mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
#3591 fixes item 1
This commit is contained in:
@@ -38,6 +38,8 @@ define('admin/extend/plugins', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
pluginsList.on('click', 'button[data-action="toggleInstall"]', function() {
|
pluginsList.on('click', 'button[data-action="toggleInstall"]', function() {
|
||||||
|
var btn = $(this);
|
||||||
|
btn.attr('disabled', true);
|
||||||
pluginID = $(this).parents('li').attr('data-plugin-id');
|
pluginID = $(this).parents('li').attr('data-plugin-id');
|
||||||
|
|
||||||
if ($(this).attr('data-installed') === '1') {
|
if ($(this).attr('data-installed') === '1') {
|
||||||
@@ -49,6 +51,8 @@ define('admin/extend/plugins', function() {
|
|||||||
bootbox.confirm('<p>NodeBB could not reach the package manager, proceed with installation of latest version?</p><div class="alert alert-danger"><strong>Server returned (' + err.status + ')</strong>: ' + err.responseText + '</div>', function(confirm) {
|
bootbox.confirm('<p>NodeBB could not reach the package manager, proceed with installation of latest version?</p><div class="alert alert-danger"><strong>Server returned (' + err.status + ')</strong>: ' + err.responseText + '</div>', function(confirm) {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
Plugins.toggleInstall(pluginID, 'latest');
|
Plugins.toggleInstall(pluginID, 'latest');
|
||||||
|
} else {
|
||||||
|
btn.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@@ -58,9 +62,15 @@ define('admin/extend/plugins', function() {
|
|||||||
if (payload.version !== 'latest') {
|
if (payload.version !== 'latest') {
|
||||||
Plugins.toggleInstall(pluginID, payload.version);
|
Plugins.toggleInstall(pluginID, payload.version);
|
||||||
} else if (payload.version === 'latest') {
|
} else if (payload.version === 'latest') {
|
||||||
confirmInstall(pluginID, function() {
|
confirmInstall(pluginID, function(confirm) {
|
||||||
Plugins.toggleInstall(pluginID, 'latest');
|
if (confirm) {
|
||||||
|
Plugins.toggleInstall(pluginID, 'latest');
|
||||||
|
} else {
|
||||||
|
btn.removeAttr('disabled');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
btn.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -137,9 +147,7 @@ define('admin/extend/plugins', function() {
|
|||||||
'<p>In the event that NodeBB cannot boot properly:</p>' +
|
'<p>In the event that NodeBB cannot boot properly:</p>' +
|
||||||
'<pre><code>$ ./nodebb reset plugin="' + pluginID + '"</code></pre>' +
|
'<pre><code>$ ./nodebb reset plugin="' + pluginID + '"</code></pre>' +
|
||||||
'<p>Continue installation of latest version of this plugin?</p>', function(confirm) {
|
'<p>Continue installation of latest version of this plugin?</p>', function(confirm) {
|
||||||
if (confirm) {
|
callback(confirm);
|
||||||
callback();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,15 +184,14 @@ define('admin/extend/plugins', function() {
|
|||||||
Plugins.toggleInstall = function(pluginID, version, callback) {
|
Plugins.toggleInstall = function(pluginID, version, callback) {
|
||||||
var btn = $('li[data-plugin-id="' + pluginID + '"] button[data-action="toggleInstall"]');
|
var btn = $('li[data-plugin-id="' + pluginID + '"] button[data-action="toggleInstall"]');
|
||||||
var activateBtn = btn.siblings('[data-action="toggleActive"]');
|
var activateBtn = btn.siblings('[data-action="toggleActive"]');
|
||||||
btn.html(btn.html() + 'ing')
|
btn.find('i').attr('class', 'fa fa-refresh fa-spin');
|
||||||
.attr('disabled', true)
|
|
||||||
.find('i').attr('class', 'fa fa-refresh fa-spin');
|
|
||||||
|
|
||||||
socket.emit('admin.plugins.toggleInstall', {
|
socket.emit('admin.plugins.toggleInstall', {
|
||||||
id: pluginID,
|
id: pluginID,
|
||||||
version: version
|
version: version
|
||||||
}, function(err, pluginData) {
|
}, function(err, pluginData) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
btn.removeAttr('disabled');
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ module.exports = function(Plugins) {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
}
|
}
|
||||||
db.sortedSetAdd('plugins:active', count, id, next);
|
db.sortedSetAdd('plugins:active', count, id, next);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
|
|||||||
Reference in New Issue
Block a user