Opened 5 years ago

Closed 5 years ago

#2125 closed bug (Fixed)

Plugin method calls are missing when first enabling plugins in webui

Reported by: Lilltiger Owned by: damoxc
Priority: minor Milestone: 1.3.6
Component: Plugin Version: 1.3-stable (git)
Keywords: label, webui Cc:

Description

In Deluge 1.3.3, 1.3.5 and the current git (1 Jul 2012)
one is unable to add labels using the Label plugin in the WebUI
unless you first open the gtk-ui and add a label.
The gtk-ui can be started as any user, it does not have to be the same user as the webui runs as, and the webui daemon does not even have to be restarted. I have managed to reproduce this several times by unmerging (using gentoo/sabayon) and reinstalling deluge.

Change History (8)

comment:1 Changed 5 years ago by johnnyg

  • Milestone changed from Future to 1.3.6
  • Owner set to damoxc
  • Status changed from new to assigned
  • Version changed from 1.3.5 to git 1.3-stable

It fails due to deluge.client.label being undefined on line 79 of label.js Restarting deluge-web after enabling the plugin also fixes it. For some reason deluge.client.label isn't being created after enabling the plugin. Not sure if this is also due to the extjs upgrade...

comment:2 Changed 5 years ago by Cas

Because it happens on 1.3.3 that means that its not related to extjs 3.4 upgrade and when quickly testing the issue I found that restarting just deluged works so I think maybe a plugin core issue.

comment:3 Changed 5 years ago by Cas

More testing has revealed that it affects other plugins (scheduler) as well and found another workaround is to reconnect to the daemon using Connection manager.

The main problem here is that remote methods stored in json_api _remote_methods are only updated upon connecting to the daemon client.daemon.get_method_list so therefore not updated when enabling the plugin after the webui has connected.

Not sure the best way to solve this issue.

comment:4 Changed 5 years ago by Cas

  • Summary changed from Issues with creating labels in WebUI to Plugin method calls are missing when first enabling plugins in webui

comment:5 Changed 5 years ago by gazpachoking

This seems to be working well for me. Also cleaned up a little bit of deferred weirdness which was unrelated.

Ninja edit: decided event registration should be on component start instead of init, moved the patch to github.

https://github.com/gazpachoking/deluge/compare/1.3-stable...1.3-stable-2125

comment:6 Changed 5 years ago by Cas

The fix for #2046 means that need to refresh the browser is no longer required however this bug will resurface because the js code does not contain the updated list of methods. The quick and dirty fix is to do the following:

  • deluge/ui/web/js/deluge-all/Plugin.js

    a b Deluge.Plugin = Ext.extend(Ext.util.Observable, { 
    7777        */ 
    7878       enable: function() { 
    7979               this.fireEvent("enable", this); 
    80                if (this.onEnable) this.onEnable(); 
     80               if (this.onEnable) { 
     81                       deluge.client.reloadMethods(); 
     82                       this.onEnable(); 
     83               } 
    8184       }, 
    8285 
    8386       registerTorrentStatus: function(key, header, options) { 

The problem with this change is that by using reloadMethods from Client.js it deletes all the methods in list before updating. This results in undefined errors when attempting to call deluge methods while webui is running until the list is repopulated.

I think this requires adding a new function to Client.js that simply adds newly found methods to the list.

comment:7 Changed 5 years ago by gazpachoking

Fixed the issue Cas mentioned in this branch. Label plugin works fully right after enabling with no refreshes. There are some errors after plugins (at least label) are disabled, unsure if it's related.

comment:8 Changed 5 years ago by gazpachoking

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in 1.3-stable: 782b39c90db, e865180e832

Note: See TracTickets for help on using tickets.