[WebUI] Fix prefs plugins page not listing enabled plugins correctly

This fixes the display of which plugins are currently running. The old
code was returned a list of enabled plugins containing WebUI code so
switched to calling the entire list of a plugins from core.

Also updated the docstring in json api to reflect actual usage.
This commit is contained in:
Calum Lind 2016-05-15 21:03:07 +01:00
parent 0278e782e0
commit 46b726a4e0
2 changed files with 26 additions and 5 deletions

View File

@ -146,8 +146,21 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
},
updatePlugins: function() {
deluge.client.web.get_plugins({
success: this.onGotPlugins,
var onGotAvailablePlugins = function(plugins) {
this.availablePlugins = plugins;
deluge.client.core.get_enabled_plugins({
success: onGotEnabledPlugins,
scope: this
});
}
var onGotEnabledPlugins = function(plugins) {
this.enabledPlugins = plugins;
this.onGotPlugins()
}
deluge.client.core.get_available_plugins({
success: onGotAvailablePlugins,
scope: this
});
},
@ -182,9 +195,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
window.open('http://dev.deluge-torrent.org/wiki/Plugins');
},
onGotPlugins: function(plugins) {
this.enabledPlugins = plugins.enabled_plugins;
this.availablePlugins = plugins.available_plugins;
onGotPlugins: function() {
this.setInfo();
this.updatePluginsGrid();
},

View File

@ -899,6 +899,16 @@ class WebApi(JSONComponent):
@export
def get_plugins(self):
"""All available and enabled plugins within WebUI.
Note:
This does not represent all plugins from deluge.client.core.
Returns:
dict: A dict containing 'available_plugins' and 'enabled_plugins' lists.
"""
return {
"enabled_plugins": component.get("Web.PluginManager").plugins.keys(),
"available_plugins": component.get("Web.PluginManager").available_plugins