#3591 fixes item 1

v1.18.x
barisusakli 9 years ago
parent 915a992448
commit e3ca91e325

@ -38,6 +38,8 @@ define('admin/extend/plugins', function() {
});
pluginsList.on('click', 'button[data-action="toggleInstall"]', function() {
var btn = $(this);
btn.attr('disabled', true);
pluginID = $(this).parents('li').attr('data-plugin-id');
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) {
if (confirm) {
Plugins.toggleInstall(pluginID, 'latest');
} else {
btn.removeAttr('disabled');
}
});
return;
@ -58,9 +62,15 @@ define('admin/extend/plugins', function() {
if (payload.version !== 'latest') {
Plugins.toggleInstall(pluginID, payload.version);
} else if (payload.version === 'latest') {
confirmInstall(pluginID, function() {
Plugins.toggleInstall(pluginID, 'latest');
confirmInstall(pluginID, function(confirm) {
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>' +
'<pre><code>$ ./nodebb reset plugin="' + pluginID + '"</code></pre>' +
'<p>Continue installation of latest version of this plugin?</p>', function(confirm) {
if (confirm) {
callback();
}
callback(confirm);
});
}
@ -176,15 +184,14 @@ define('admin/extend/plugins', function() {
Plugins.toggleInstall = function(pluginID, version, callback) {
var btn = $('li[data-plugin-id="' + pluginID + '"] button[data-action="toggleInstall"]');
var activateBtn = btn.siblings('[data-action="toggleActive"]');
btn.html(btn.html() + 'ing')
.attr('disabled', true)
.find('i').attr('class', 'fa fa-refresh fa-spin');
btn.find('i').attr('class', 'fa fa-refresh fa-spin');
socket.emit('admin.plugins.toggleInstall', {
id: pluginID,
version: version
}, function(err, pluginData) {
if (err) {
btn.removeAttr('disabled');
return app.alertError(err.message);
}

@ -44,8 +44,8 @@ module.exports = function(Plugins) {
if (err) {
return next(err);
}
db.sortedSetAdd('plugins:active', count, id, next);
});
db.sortedSetAdd('plugins:active', count, id, next);
});
}
},
function(next) {

Loading…
Cancel
Save