Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored Code in public/src/admin/admin.js #582

Open
wants to merge 6 commits into
base: f24
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion install/docker/setup.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"redis": {
"host": "redis",
"port": 6379,
"port": 6380,
"database": 0
},
"postgres": {
Expand Down
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
Loading