mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-01 16:44:23 +08:00
🔥 Sync 2026-10-24 23:19:23
This commit is contained in:
1 parent
9886197604
commit
37e1475e87
59 files changed
+5167
-1483
No files matched your search
@@ -17,6 +17,17 @@ var callSystemBoard = rpc.declare({
|
||||
});
|
||||
|
||||
|
||||
// 040-multipath-weight's reading of network.<iface>.multipath_weight:
|
||||
// not a number is unset (100), 0 is 1, over 256 is 256
|
||||
function normalizeWeightValue(value) {
|
||||
if (value == null || value === '')
|
||||
return value;
|
||||
if (!/^[0-9]+$/.test(value))
|
||||
return null;
|
||||
value = +value;
|
||||
return String(value < 1 ? 1 : (value > 256 ? 256 : value));
|
||||
}
|
||||
|
||||
return L.view.extend({
|
||||
load: function() {
|
||||
return Promise.all([
|
||||
@@ -400,6 +411,13 @@ return L.view.extend({
|
||||
// none. Unset means 100 for every reader (omr-weight-sync, mqvpn).
|
||||
o.placeholder = "100";
|
||||
o.rmempty = true;
|
||||
// A weight stored out of range (0, 300) failed the datatype and
|
||||
// blocked every save of this page: shown as 040-multipath-weight reads
|
||||
// it. A save that doesn't change the field leaves a number unwritten
|
||||
// and drops what is not one
|
||||
o.cfgvalue = function(section_id) {
|
||||
return normalizeWeightValue(uci.get('network', section_id, 'multipath_weight'));
|
||||
};
|
||||
|
||||
return m.render();
|
||||
}
|
||||
|
||||
@@ -185,6 +185,19 @@ return L.view.extend({
|
||||
// multipath_weight='100' on each WAN that had none (unset is 100)
|
||||
o.placeholder = '100';
|
||||
o.rmempty = true;
|
||||
// A weight stored out of range (0, 300) failed the datatype
|
||||
// and blocked every save: shown as 040-multipath-weight reads
|
||||
// it (not a number: unset, 0: 1, over 256: 256). A save that
|
||||
// doesn't change the field leaves a number unwritten
|
||||
o.cfgvalue = function(section_id) {
|
||||
var value = uci.get('network', section_id, 'multipath_weight');
|
||||
if (value == null || value === '')
|
||||
return value;
|
||||
if (!/^[0-9]+$/.test(value))
|
||||
return null;
|
||||
value = +value;
|
||||
return String(value < 1 ? 1 : (value > 256 ? 256 : value));
|
||||
};
|
||||
}
|
||||
|
||||
return m.render();
|
||||
|
||||
Reference in new issue
Block a user