Skip to content

Commit

Permalink
luke changes from project 1
Browse files Browse the repository at this point in the history
  • Loading branch information
lukenalewajk committed Sep 21, 2024
1 parent bfba324 commit 222a10b
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions public/src/admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,25 +179,29 @@ app.onDomReady();

function setupRestartLinks() {
require(['benchpress', 'bootbox', 'admin/modules/instance'], function (benchpress, bootbox, instance) {
// need to preload the compiled alert template
// otherwise it can be unloaded when rebuild & restart is run
// the client can't fetch the template file, resulting in an error
benchpress.render('partials/toast', {}).then(function () {
$('[component="rebuild-and-restart"]').off('click').on('click', function () {
bootbox.confirm('[[admin/admin:alert.confirm-rebuild-and-restart]]', function (confirm) {
if (confirm) {
instance.rebuildAndRestart();
}
});
});
setupRebuildAndRestartLink(instance, bootbox);
setupRestartLink(instance, bootbox);
});
});
}

$('[component="restart"]').off('click').on('click', function () {
bootbox.confirm('[[admin/admin:alert.confirm-restart]]', function (confirm) {
if (confirm) {
instance.restart();
}
});
});
function setupRebuildAndRestartLink(instance, bootbox) {
$('[component="rebuild-and-restart"]').off('click').on('click', function () {
bootbox.confirm('[[admin/admin:alert.confirm-rebuild-and-restart]]', function (confirm) {
if (confirm) {
instance.rebuildAndRestart();
}
});
});
}

function setupRestartLink(instance, bootbox) {
$('[component="restart"]').off('click').on('click', function () {
bootbox.confirm('[[admin/admin:alert.confirm-restart]]', function (confirm) {
if (confirm) {
instance.restart();
}
});
});
}
Expand Down

0 comments on commit 222a10b

Please sign in to comment.