luci-app-firewall: make a dropdown list for flow offloading options
Either software or hardware offloading can be used at a time. Make a dropdown list for them to reflect this on the firewall section of LuCI.
I wanted to import the cbiRichListValue variable from interfaces.js like this:
import { cbiRichListValue } from '../network/interfaces.js';
cbiRichListValue.prototype.renderWidget = function(section_id, option_index, cfgvalue) {
var choices = this.transformChoices();
var widget = new ui.Dropdown((cfgvalue != null) ? cfgvalue : this.default, choices, {
id: this.cbid(section_id),
sort: this.keylist,
optional: false,
select_placeholder: this.select_placeholder || this.placeholder,
custom_placeholder: this.custom_placeholder || this.placeholder,
validate: L.bind(this.validate, this, section_id),
disabled: (this.readonly != null) ? this.readonly : this.map.readonly
});
return widget.render();
};
But I kept getting the "import declarations may only appear at top level of a module" error. So I currently define the variable again on zones.js but change "optional: true" to "optional: false".
@jow- looking forward to your review.
@jow- another ping regarding this
I don't see any inherent problems in doing so. But does it need to be redefined just to change the boolean? Won't it inherit and override?
@systemcrash I don't know JS at all and am not interested in learning it. I'd had crafted this with ChatGPT back in the day to resolve a logical mistake that's still there. It's been more than a year which this patch has been waiting for a proper review. I would really appreciate it if you'd apply whatever you're suggesting and resubmit so that this fix can finally find its way to LuCI.
So I tested it on v22. Works fine, but for the missing 'require ui';.
It does the same thing in the same amount of clicks. Is there any reason this must go in?
Because the current representation of the flow offloading options is wrong. As I described on the commit log, only one flow offloading option can be used at a time.