2015-06-08 15:50:33 -04:00
|
|
|
"use strict";
|
|
|
|
|
|
2017-02-17 21:55:19 -07:00
|
|
|
|
2016-10-13 11:43:39 +02:00
|
|
|
define('admin/modules/instance', function () {
|
2015-06-08 15:50:33 -04:00
|
|
|
var instance = {};
|
|
|
|
|
|
2016-10-13 11:43:39 +02:00
|
|
|
instance.reload = function (callback) {
|
2015-06-08 15:50:33 -04:00
|
|
|
app.alert({
|
|
|
|
|
alert_id: 'instance_reload',
|
|
|
|
|
type: 'info',
|
|
|
|
|
title: 'Reloading... <i class="fa fa-spin fa-refresh"></i>',
|
|
|
|
|
message: 'NodeBB is reloading.',
|
2017-02-17 19:31:21 -07:00
|
|
|
timeout: 5000,
|
2015-06-08 15:50:33 -04:00
|
|
|
});
|
|
|
|
|
|
2016-11-18 12:53:26 -05:00
|
|
|
$(window).one('action:reconnected', function () {
|
|
|
|
|
app.alert({
|
|
|
|
|
alert_id: 'instance_reload',
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: '<i class="fa fa-check"></i> Success',
|
|
|
|
|
message: 'NodeBB has reloaded successfully.',
|
2017-02-17 19:31:21 -07:00
|
|
|
timeout: 5000,
|
2016-11-18 12:53:26 -05:00
|
|
|
});
|
2015-06-08 15:50:33 -04:00
|
|
|
|
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
});
|
2016-11-18 12:53:26 -05:00
|
|
|
|
|
|
|
|
socket.emit('admin.reload');
|
2015-06-08 15:53:07 -04:00
|
|
|
};
|
2015-06-08 15:52:39 -04:00
|
|
|
|
2016-10-13 11:43:39 +02:00
|
|
|
instance.restart = function (callback) {
|
2015-06-08 15:52:39 -04:00
|
|
|
app.alert({
|
|
|
|
|
alert_id: 'instance_restart',
|
|
|
|
|
type: 'info',
|
2016-11-18 12:53:26 -05:00
|
|
|
title: 'Rebuilding... <i class="fa fa-spin fa-refresh"></i>',
|
2016-12-15 13:03:14 +03:00
|
|
|
message: 'NodeBB is rebuilding front-end assets (css, javascript, etc).',
|
2017-02-17 19:31:21 -07:00
|
|
|
timeout: 10000,
|
2015-06-08 15:52:39 -04:00
|
|
|
});
|
|
|
|
|
|
2016-10-13 11:43:39 +02: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 successfully restarted.',
|
2017-02-17 19:31:21 -07:00
|
|
|
timeout: 10000,
|
2015-06-08 15:52:39 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2016-11-18 12:53:26 -05:00
|
|
|
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.',
|
2017-02-17 19:31:21 -07:00
|
|
|
timeout: 10000,
|
2016-11-18 12:53:26 -05:00
|
|
|
});
|
|
|
|
|
});
|
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;
|
|
|
|
|
});
|