/admin/plugins: Don't list installed plugins as available
This commit is contained in:
parent
511407241a
commit
aca5d150e4
|
@ -72,6 +72,9 @@ exports.socketio = function (hook_name, args, cb) {
|
||||||
var res = Object.keys(results)
|
var res = Object.keys(results)
|
||||||
.map(function(pluginName) {
|
.map(function(pluginName) {
|
||||||
return results[pluginName]
|
return results[pluginName]
|
||||||
|
})
|
||||||
|
.filter(function(plugin) {
|
||||||
|
return !plugins.plugins[plugin.name]
|
||||||
});
|
});
|
||||||
res = sortPluginList(res, query.sortBy, query.sortDir)
|
res = sortPluginList(res, query.sortBy, query.sortDir)
|
||||||
.slice(query.offset, query.offset+query.limit);
|
.slice(query.offset, query.offset+query.limit);
|
||||||
|
|
|
@ -80,16 +80,17 @@ $(document).ready(function () {
|
||||||
|
|
||||||
// update & install
|
// update & install
|
||||||
$(".do-install, .do-update").unbind('click').click(function (e) {
|
$(".do-install, .do-update").unbind('click').click(function (e) {
|
||||||
var row = $(e.target).closest("tr")
|
var $row = $(e.target).closest("tr")
|
||||||
, plugin = row.find(".name").text();
|
, plugin = $row.find(".name").text();
|
||||||
socket.emit("install", plugin);
|
socket.emit("install", plugin);
|
||||||
progress.show('Installing plugin '+plugin+'...')
|
progress.show('Installing plugin '+plugin+'...')
|
||||||
});
|
});
|
||||||
|
|
||||||
// uninstall
|
// uninstall
|
||||||
$(".do-uninstall").unbind('click').click(function (e) {
|
$(".do-uninstall").unbind('click').click(function (e) {
|
||||||
var row = $(e.target).closest("tr")
|
var $row = $(e.target).closest("tr")
|
||||||
, plugin = row.find(".name").text();
|
, plugin = $row.find(".name").text();
|
||||||
|
$row.remove()
|
||||||
socket.emit("uninstall", plugin);
|
socket.emit("uninstall", plugin);
|
||||||
progress.show('Uninstalling plugin '+plugin+'...')
|
progress.show('Uninstalling plugin '+plugin+'...')
|
||||||
});
|
});
|
||||||
|
@ -172,11 +173,21 @@ $(document).ready(function () {
|
||||||
socket.on('finished:install', function(data) {
|
socket.on('finished:install', function(data) {
|
||||||
if(data.error) alert('An error occured while installing the plugin. \n'+data.error)
|
if(data.error) alert('An error occured while installing the plugin. \n'+data.error)
|
||||||
socket.emit("getInstalled");
|
socket.emit("getInstalled");
|
||||||
|
|
||||||
|
// update search results
|
||||||
|
search.offset = 0;
|
||||||
|
search(search.searchTerm, search.results.length);
|
||||||
|
search.results = [];
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.on('finished:uninstall', function(data) {
|
socket.on('finished:uninstall', function(data) {
|
||||||
if(data.error) alert('An error occured while uninstalling the plugin. \n'+data.error)
|
if(data.error) alert('An error occured while uninstalling the plugin. \n'+data.error)
|
||||||
socket.emit("getInstalled");
|
socket.emit("getInstalled");
|
||||||
|
|
||||||
|
// update search results
|
||||||
|
search.offset = 0;
|
||||||
|
search(search.searchTerm, search.results.length);
|
||||||
|
search.results = [];
|
||||||
})
|
})
|
||||||
|
|
||||||
// init
|
// init
|
||||||
|
|
Loading…
Reference in New Issue