Files
NodeBB/public/src/admin/modules/instance.js

70 lines
1.7 KiB
JavaScript
Raw Normal View History

2017-02-18 01:56:23 -07:00
'use strict';
2015-06-08 15:50:33 -04:00
define('admin/modules/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
config.relative_path + '/assets/templates/alert.js',
], function () {
2015-06-08 15:50:33 -04:00
var instance = {};
instance.rebuildAndRestart = function (callback) {
2015-06-08 15:50:33 -04:00
app.alert({
alert_id: 'instance_rebuild_and_restart',
2015-06-08 15:50:33 -04:00
type: 'info',
title: 'Rebuilding... <i class="fa fa-spin fa-refresh"></i>',
message: 'NodeBB is rebuilding front-end assets (css, javascript, etc).',
2015-06-08 15:50:33 -04:00
});
$(window).one('action:reconnected', function () {
app.alert({
alert_id: 'instance_rebuild_and_restart',
type: 'success',
title: '<i class="fa fa-check"></i> Success',
message: 'NodeBB has rebuilt and restarted successfully.',
2017-02-17 19:31:21 -07:00
timeout: 5000,
});
2015-06-08 15:50:33 -04:00
if (typeof callback === 'function') {
callback();
}
});
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.',
});
});
2015-06-08 15:53:07 -04:00
};
2015-06-08 15:52:39 -04:00
instance.restart = function (callback) {
2015-06-08 15:52:39 -04:00
app.alert({
alert_id: 'instance_restart',
type: 'info',
title: 'Restarting... <i class="fa fa-spin fa-refresh"></i>',
message: 'NodeBB is restarting.',
2015-06-08 15:52:39 -04:00
});
$(window).one('action:reconnected', function () {
2015-06-08 15:52:39 -04:00
app.alert({
alert_id: 'instance_restart',
type: 'success',
title: '<i class="fa fa-check"></i> Success',
message: 'NodeBB has restarted successfully.',
timeout: 5000,
2015-06-08 15:52:39 -04:00
});
if (typeof callback === 'function') {
callback();
}
});
socket.emit('admin.restart');
2015-06-08 15:53:07 -04:00
};
2016-12-15 13:03:14 +03:00
2015-06-08 15:50:33 -04:00
return instance;
});