/admin/plugins: Don't list installed plugins as available

pull/1672/head
Marcel Klehr 2013-03-26 11:58:31 +01:00
parent 511407241a
commit aca5d150e4
2 changed files with 18 additions and 4 deletions

View File

@ -72,6 +72,9 @@ exports.socketio = function (hook_name, args, cb) {
var res = Object.keys(results)
.map(function(pluginName) {
return results[pluginName]
})
.filter(function(plugin) {
return !plugins.plugins[plugin.name]
});
res = sortPluginList(res, query.sortBy, query.sortDir)
.slice(query.offset, query.offset+query.limit);

View File

@ -80,16 +80,17 @@ $(document).ready(function () {
// update & install
$(".do-install, .do-update").unbind('click').click(function (e) {
var row = $(e.target).closest("tr")
, plugin = row.find(".name").text();
var $row = $(e.target).closest("tr")
, plugin = $row.find(".name").text();
socket.emit("install", plugin);
progress.show('Installing plugin '+plugin+'...')
});
// uninstall
$(".do-uninstall").unbind('click').click(function (e) {
var row = $(e.target).closest("tr")
, plugin = row.find(".name").text();
var $row = $(e.target).closest("tr")
, plugin = $row.find(".name").text();
$row.remove()
socket.emit("uninstall", plugin);
progress.show('Uninstalling plugin '+plugin+'...')
});
@ -172,11 +173,21 @@ $(document).ready(function () {
socket.on('finished:install', function(data) {
if(data.error) alert('An error occured while installing the plugin. \n'+data.error)
socket.emit("getInstalled");
// update search results
search.offset = 0;
search(search.searchTerm, search.results.length);
search.results = [];
})
socket.on('finished:uninstall', function(data) {
if(data.error) alert('An error occured while uninstalling the plugin. \n'+data.error)
socket.emit("getInstalled");
// update search results
search.offset = 0;
search(search.searchTerm, search.results.length);
search.results = [];
})
// init