mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 15:35:47 +01:00
closes #3212
This commit is contained in:
@@ -63,8 +63,9 @@
|
|||||||
|
|
||||||
function setupKeybindings() {
|
function setupKeybindings() {
|
||||||
Mousetrap.bind('ctrl+shift+a r', function() {
|
Mousetrap.bind('ctrl+shift+a r', function() {
|
||||||
console.log('[admin] Reloading NodeBB...');
|
require(['admin/modules/instance'], function(instance) {
|
||||||
socket.emit('admin.reload');
|
instance.reload();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Mousetrap.bind('ctrl+shift+a R', function() {
|
Mousetrap.bind('ctrl+shift+a R', function() {
|
||||||
@@ -185,31 +186,8 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('.reload').off('click').on('click', function() {
|
$('.reload').off('click').on('click', function() {
|
||||||
app.alert({
|
require(['admin/modules/instance'], function(instance) {
|
||||||
alert_id: 'instance_reload',
|
instance.reload();
|
||||||
type: 'info',
|
|
||||||
title: 'Reloading... <i class="fa fa-spin fa-refresh"></i>',
|
|
||||||
message: 'NodeBB is reloading.',
|
|
||||||
timeout: 5000
|
|
||||||
});
|
|
||||||
|
|
||||||
socket.emit('admin.reload', function(err) {
|
|
||||||
if (!err) {
|
|
||||||
app.alert({
|
|
||||||
alert_id: 'instance_reload',
|
|
||||||
type: 'success',
|
|
||||||
title: '<i class="fa fa-check"></i> Success',
|
|
||||||
message: 'NodeBB has successfully reloaded.',
|
|
||||||
timeout: 5000
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
app.alert({
|
|
||||||
alert_id: 'instance_reload',
|
|
||||||
type: 'danger',
|
|
||||||
title: '[[global:alert.error]]',
|
|
||||||
message: '[[error:reload-failed, ' + err.message + ']]'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ define('admin/extend/plugins', function() {
|
|||||||
type: status.active ? 'warning' : 'success',
|
type: status.active ? 'warning' : 'success',
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
clickfn: function() {
|
clickfn: function() {
|
||||||
socket.emit('admin.reload');
|
require(['admin/modules/instance'], function(instance) {
|
||||||
|
instance.reload();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -160,7 +162,9 @@ define('admin/extend/plugins', function() {
|
|||||||
type: 'warning',
|
type: 'warning',
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
clickfn: function() {
|
clickfn: function() {
|
||||||
socket.emit('admin.reload');
|
require(['admin/modules/instance'], function(instance) {
|
||||||
|
instance.reload();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
42
public/src/admin/modules/instance.js
Normal file
42
public/src/admin/modules/instance.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
/*globals define*/
|
||||||
|
|
||||||
|
define('admin/modules/instance', function() {
|
||||||
|
var instance = {};
|
||||||
|
|
||||||
|
instance.reload = function(callback) {
|
||||||
|
app.alert({
|
||||||
|
alert_id: 'instance_reload',
|
||||||
|
type: 'info',
|
||||||
|
title: 'Reloading... <i class="fa fa-spin fa-refresh"></i>',
|
||||||
|
message: 'NodeBB is reloading.',
|
||||||
|
timeout: 5000
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.emit('admin.reload', function(err) {
|
||||||
|
if (!err) {
|
||||||
|
app.alert({
|
||||||
|
alert_id: 'instance_reload',
|
||||||
|
type: 'success',
|
||||||
|
title: '<i class="fa fa-check"></i> Success',
|
||||||
|
message: 'NodeBB has successfully reloaded.',
|
||||||
|
timeout: 5000
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
app.alert({
|
||||||
|
alert_id: 'instance_reload',
|
||||||
|
type: 'danger',
|
||||||
|
title: '[[global:alert.error]]',
|
||||||
|
message: '[[error:reload-failed, ' + err.message + ']]'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof callback === 'function') {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user