luci-mod-network: use createHanleFn for handleJoin function
authorAnsuel Smith <ansuelsmth@gmail.com>
Sun, 1 Nov 2020 00:45:41 +0000 (01:45 +0100)
committerAnsuel Smith <ansuelsmth@gmail.com>
Sun, 1 Nov 2020 00:45:41 +0000 (01:45 +0100)
handleJoin can be slow to parse all the data and show the new modal, this can result in the disappear of the scan modal and the showing of the wifi config page while the data are generating. This is wrong since a user can think that he did something wrong. Fix this by using the createHandleFn and by removing the scan pool function instead of calling ScanAbort function that with the other thing wrongly removes the Scan modal. (the modal is replaced with the add one when all the data are ready)

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js

index dc75c9509fdc1b23eff545086388770df2caec21..26ddbaa19bab3f51a1f17dea0db6f98e3f4b240a 100644 (file)
@@ -1742,7 +1742,7 @@ return view.extend({
                                                E('span', { 'style': s }, '%h'.format(network.formatWifiEncryption(res.encryption))),
                                                E('div', { 'class': 'right' }, E('button', {
                                                        'class': 'cbi-button cbi-button-action important',
-                                                       'click': L.bind(this.handleJoin, this, radioDev, res)
+                                                       'click': ui.createHandlerFn(this, 'handleJoin', radioDev, res)
                                                }, _('Join Network')))
                                        ]);
 
@@ -1886,7 +1886,7 @@ return view.extend({
                };
 
                s.handleJoin = function(radioDev, bss, ev) {
-                       this.handleScanAbort(ev);
+                       poll.remove(this.pollFn);
 
                        var m2 = new form.Map('wireless'),
                            s2 = m2.section(form.NamedSection, '_new_'),