fix reload actions (#6394)

* fix reload actions

* wait until restart action is complete instead of using timeouts.

* Change Reload nominclature to Rebuild and Restart.
v1.18.x
Timothy Fike 7 years ago committed by Julian Lam
parent 0158b1aa91
commit 585d613d4b

@ -1,5 +1,5 @@
{
"alert.confirm-reload": "Are you sure you wish to rebuild and restart NodeBB?",
"alert.confirm-rebuild-and-restart": "Are you sure you wish to rebuild and restart NodeBB?",
"alert.confirm-restart": "Are you sure you wish to restart NodeBB?",
"acp-title": "%1 | NodeBB Admin Control Panel",

@ -7,5 +7,5 @@
"revert-confirm": "Are you sure you wish to restore the default NodeBB theme?",
"theme-changed": "Theme Changed",
"revert-success": "You have successfully reverted your NodeBB back to it's default theme.",
"restart-to-activate": "Please restart your NodeBB to fully activate this theme"
"restart-to-activate": "Please rebuild and restart your NodeBB to fully activate this theme."
}

@ -37,7 +37,7 @@
"alert.uninstalled": "Plugin Uninstalled",
"alert.activate-success": "Please restart your NodeBB to fully activate this plugin",
"alert.deactivate-success": "Plugin successfully deactivated",
"alert.upgrade-success": "Please reload your NodeBB to fully upgrade this plugin",
"alert.upgrade-success": "Please rebuild and restart your NodeBB to fully upgrade this plugin.",
"alert.install-success": "Plugin successfully installed, please activate the plugin.",
"alert.uninstall-success": "The plugin has been successfully deactivated and uninstalled.",
"alert.suggest-error": "<p>NodeBB could not reach the package manager, proceed with installation of latest version?</p><div class=\"alert alert-danger\"><strong>Server returned (%1)</strong>: %2</div>",

@ -37,8 +37,8 @@
"search-plugin-tooltip": "Install a search plugin from the plugin page in order to activate search functionality",
"control-panel": "System Control",
"reload": "Restart",
"restart": "Rebuild &amp; Restart",
"rebuild-and-restart": "Rebuild &amp; Restart",
"restart": "Restart",
"restart-warning": "Rebuilding or Restarting your NodeBB will drop all existing connections for a few seconds.",
"restart-disabled": "Rebuilding and Restarting your NodeBB has been disabled as you do not seem to be running it via the appropriate daemon.",
"maintenance-mode": "Maintenance Mode",

@ -63,7 +63,7 @@
"development/logger": "Logger",
"development/info": "Info",
"reload-forum": "Rebuild & Restart Forum",
"rebuild-and-restart-forum": "Rebuild & Restart Forum",
"restart-forum": "Restart Forum",
"logout": "Log out",
"view-forum": "View Forum",

@ -119,11 +119,11 @@
}
function setupRestartLinks() {
$('.reload').off('click').on('click', function () {
bootbox.confirm('[[admin/admin:alert.confirm-reload]]', function (confirm) {
$('.rebuild-and-restart').off('click').on('click', function () {
bootbox.confirm('[[admin/admin:alert.confirm-rebuild-and-restart]]', function (confirm) {
if (confirm) {
require(['admin/modules/instance'], function (instance) {
instance.reload();
instance.rebuildAndRestart();
});
}
});

@ -33,7 +33,9 @@ define('admin/appearance/themes', ['translator', 'benchpress'], function (transl
message: '[[admin/appearance/themes:restart-to-activate]]',
timeout: 5000,
clickfn: function () {
socket.emit('admin.restart');
require(['admin/modules/instance'], function (instance) {
instance.rebuildAndRestart();
});
},
});
});

@ -49,7 +49,7 @@ define('admin/extend/plugins', ['jqueryui', 'translator', 'benchpress'], functio
timeout: 5000,
clickfn: function () {
require(['admin/modules/instance'], function (instance) {
instance.restart();
instance.rebuildAndRestart();
});
},
});
@ -217,7 +217,7 @@ define('admin/extend/plugins', ['jqueryui', 'translator', 'benchpress'], functio
timeout: 5000,
clickfn: function () {
require(['admin/modules/instance'], function (instance) {
instance.reload();
instance.rebuildAndRestart();
});
},
});

@ -4,21 +4,20 @@
define('admin/modules/instance', function () {
var instance = {};
instance.reload = function (callback) {
instance.rebuildAndRestart = function (callback) {
app.alert({
alert_id: 'instance_reload',
alert_id: 'instance_rebuild_and_restart',
type: 'info',
title: 'Reloading... <i class="fa fa-spin fa-refresh"></i>',
message: 'NodeBB is reloading.',
timeout: 5000,
title: 'Rebuilding... <i class="fa fa-spin fa-refresh"></i>',
message: 'NodeBB is rebuilding front-end assets (css, javascript, etc).',
});
$(window).one('action:reconnected', function () {
app.alert({
alert_id: 'instance_reload',
alert_id: 'instance_rebuild_and_restart',
type: 'success',
title: '<i class="fa fa-check"></i> Success',
message: 'NodeBB has reloaded successfully.',
message: 'NodeBB has rebuilt and restarted successfully.',
timeout: 5000,
});
@ -27,16 +26,22 @@ define('admin/modules/instance', function () {
}
});
socket.emit('admin.reload');
socket.emit('admin.reload', function () {
app.alert({
alert_id: 'instance_rebuild_and_restart',
type: 'info',
title: 'Build Complete!... <i class="fa fa-spin fa-refresh"></i>',
message: 'NodeBB is restarting.',
});
});
};
instance.restart = function (callback) {
app.alert({
alert_id: 'instance_restart',
type: 'info',
title: 'Rebuilding... <i class="fa fa-spin fa-refresh"></i>',
message: 'NodeBB is rebuilding front-end assets (css, javascript, etc).',
timeout: 10000,
title: 'Restarting... <i class="fa fa-spin fa-refresh"></i>',
message: 'NodeBB is restarting.',
});
$(window).one('action:reconnected', function () {
@ -44,8 +49,8 @@ define('admin/modules/instance', function () {
alert_id: 'instance_restart',
type: 'success',
title: '<i class="fa fa-check"></i> Success',
message: 'NodeBB has successfully restarted.',
timeout: 10000,
message: 'NodeBB has restarted successfully.',
timeout: 5000,
});
if (typeof callback === 'function') {
@ -53,15 +58,7 @@ define('admin/modules/instance', function () {
}
});
socket.emit('admin.restart', function () {
app.alert({
alert_id: 'instance_restart',
type: 'info',
title: 'Build Complete!... <i class="fa fa-spin fa-refresh"></i>',
message: 'NodeBB is reloading.',
timeout: 10000,
});
});
socket.emit('admin.restart');
};
return instance;

@ -58,7 +58,7 @@ SocketAdmin.before = function (socket, method, data, next) {
], next);
};
SocketAdmin.reload = function (socket, data, callback) {
SocketAdmin.restart = function (socket, data, callback) {
events.log({
type: 'restart',
uid: socket.uid,
@ -68,7 +68,7 @@ SocketAdmin.reload = function (socket, data, callback) {
callback();
};
SocketAdmin.restart = function (socket, data, callback) {
SocketAdmin.reload = function (socket, data, callback) {
async.waterfall([
function (next) {
require('../meta/build').buildAll(next);

@ -120,8 +120,8 @@
<div class="panel-heading">[[admin/general/dashboard:control-panel]]</div>
<div class="panel-body text-center">
<p>
<button class="btn btn-block btn-warning reload"<!-- IF !canRestart --> disabled<!-- END -->>[[admin/general/dashboard:reload]]</button>
<button class="btn btn-block btn-danger restart"<!-- IF !canRestart --> disabled<!-- END -->>[[admin/general/dashboard:restart]]</button>
<button class="btn btn-block btn-warning restart"<!-- IF !canRestart --> disabled<!-- END -->>[[admin/general/dashboard:restart]]</button>
<button class="btn btn-block btn-danger rebuild-and-restart"<!-- IF !canRestart --> disabled<!-- END -->>[[admin/general/dashboard:rebuild-and-restart]]</button>
</p>
<p class="<!-- IF canRestart -->help-block<!-- ELSE -->alert alert-warning<!-- END -->">
<!-- IF canRestart -->

@ -9,7 +9,7 @@
</a>
</li>
<li>
<a href="#" class="reload" data-toggle="tooltip" data-placement="bottom" title="[[admin/menu:reload-forum]]">
<a href="#" class="rebuild-and-restart" data-toggle="tooltip" data-placement="bottom" title="[[admin/menu:rebuild-and-restart-forum]]">
<i class="fa fa-fw fa-refresh"></i>
</a>
</li>

Loading…
Cancel
Save