From 23d6dd4595943abf0b064a5ea771b811b7d14303 Mon Sep 17 00:00:00 2001 From: Volker Theile Date: Tue, 7 Mar 2023 23:17:05 +0100 Subject: [PATCH] =?UTF-8?q?Add=20the=20ability=20to=20specify=20the=20metr?= =?UTF-8?q?ic=20(relative=20priority)=20=E2=80=A6=20(#1507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deb/openmediavault/debian/changelog | 3 + .../omv/deploy/systemd-networkd/files/bond.j2 | 15 +++- .../deploy/systemd-networkd/files/bridge.j2 | 15 +++- .../deploy/systemd-networkd/files/ethernet.j2 | 15 +++- .../omv/deploy/systemd-networkd/files/vlan.j2 | 15 +++- .../omv/deploy/systemd-networkd/files/wifi.j2 | 15 +++- .../confdb/migrations.d/conf_6.3.3.sh | 29 +++++++ .../confdb/populate.d/40interfaces.sh | 4 +- .../conf.system.network.interface.json | 12 +++ .../datamodels/rpc.network.json | 60 +++++++++++++ .../firstaid/modules.d/10configure_network.py | 5 +- .../share/openmediavault/templates/config.xml | 2 + .../interface-bond-form-page.component.ts | 86 ++++++++++++++----- .../interface-bridge-form-page.component.ts | 86 ++++++++++++++----- .../interface-ethernet-form-page.component.ts | 86 ++++++++++++++----- .../interface-vlan-form-page.component.ts | 86 ++++++++++++++----- .../interface-wifi-form-page.component.ts | 86 ++++++++++++++----- 17 files changed, 507 insertions(+), 113 deletions(-) create mode 100755 deb/openmediavault/usr/share/openmediavault/confdb/migrations.d/conf_6.3.3.sh diff --git a/deb/openmediavault/debian/changelog b/deb/openmediavault/debian/changelog index fed0e0126..c487338f0 100644 --- a/deb/openmediavault/debian/changelog +++ b/deb/openmediavault/debian/changelog @@ -8,6 +8,9 @@ openmediavault (6.3.3-1) stable; urgency=low via scheduled tasks, e.g. `images@daily_20230228T095758`. Please delete your existing scheduled tasks and recreate them to take advantage of the new naming scheme. + * Add the ability to specify the metric (relative priority) + of the default route set via the `Gateway` option in the + network interface page. -- Volker Theile Tue, 28 Feb 2023 00:08:49 +0100 diff --git a/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/bond.j2 b/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/bond.j2 index 84dd2ef78..baa015fcc 100644 --- a/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/bond.j2 +++ b/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/bond.j2 @@ -28,11 +28,22 @@ network: - {{ interface.address6 }}/{{ interface.netmask6 }} {%- endif %} {%- endif %} +{%- if (interface.method == "static" and interface.gateway | is_ipv4) or (interface.method6 == "static" and interface.gateway6 | is_ipv6) %} + routes: {%- if interface.method == "static" and interface.gateway | is_ipv4 %} - gateway4: {{ interface.gateway }} + - to: 0.0.0.0/0 + via: {{ interface.gateway }} +{%- if interface.routemetric > 0 %} + metric: {{ interface.routemetric }} +{%- endif %} {%- endif %} {%- if interface.method6 == "static" and interface.gateway6 | is_ipv6 %} - gateway6: {{ interface.gateway6 }} + - to: ::/0 + via: {{ interface.gateway6 }} +{%- if interface.routemetric6 != 1 %} + metric: {{ interface.routemetric6 }} +{%- endif %} +{%- endif %} {%- endif %} {%- if interface.method6 in ["auto", "dhcp"] %} accept-ra: true diff --git a/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/bridge.j2 b/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/bridge.j2 index 530c3cf96..c932525b0 100644 --- a/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/bridge.j2 +++ b/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/bridge.j2 @@ -28,11 +28,22 @@ network: - {{ interface.address6 }}/{{ interface.netmask6 }} {%- endif %} {%- endif %} +{%- if (interface.method == "static" and interface.gateway | is_ipv4) or (interface.method6 == "static" and interface.gateway6 | is_ipv6) %} + routes: {%- if interface.method == "static" and interface.gateway | is_ipv4 %} - gateway4: {{ interface.gateway }} + - to: 0.0.0.0/0 + via: {{ interface.gateway }} +{%- if interface.routemetric > 0 %} + metric: {{ interface.routemetric }} +{%- endif %} {%- endif %} {%- if interface.method6 == "static" and interface.gateway6 | is_ipv6 %} - gateway6: {{ interface.gateway6 }} + - to: ::/0 + via: {{ interface.gateway6 }} +{%- if interface.routemetric6 != 1 %} + metric: {{ interface.routemetric6 }} +{%- endif %} +{%- endif %} {%- endif %} {%- if interface.method6 in ["auto", "dhcp"] %} accept-ra: true diff --git a/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/ethernet.j2 b/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/ethernet.j2 index 9f95a2bc8..89073665b 100644 --- a/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/ethernet.j2 +++ b/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/ethernet.j2 @@ -14,11 +14,22 @@ network: - {{ interface.address6 }}/{{ interface.netmask6 }} {%- endif %} {%- endif %} +{%- if (interface.method == "static" and interface.gateway | is_ipv4) or (interface.method6 == "static" and interface.gateway6 | is_ipv6) %} + routes: {%- if interface.method == "static" and interface.gateway | is_ipv4 %} - gateway4: {{ interface.gateway }} + - to: 0.0.0.0/0 + via: {{ interface.gateway }} +{%- if interface.routemetric > 0 %} + metric: {{ interface.routemetric }} +{%- endif %} {%- endif %} {%- if interface.method6 == "static" and interface.gateway6 | is_ipv6 %} - gateway6: {{ interface.gateway6 }} + - to: ::/0 + via: {{ interface.gateway6 }} +{%- if interface.routemetric6 != 1 %} + metric: {{ interface.routemetric6 }} +{%- endif %} +{%- endif %} {%- endif %} {%- if interface.method6 in ["auto", "dhcp"] %} accept-ra: true diff --git a/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/vlan.j2 b/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/vlan.j2 index a145cf602..faa905639 100644 --- a/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/vlan.j2 +++ b/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/vlan.j2 @@ -11,11 +11,22 @@ network: - {{ interface.address6 }}/{{ interface.netmask6 }} {%- endif %} {%- endif %} +{%- if (interface.method == "static" and interface.gateway | is_ipv4) or (interface.method6 == "static" and interface.gateway6 | is_ipv6) %} + routes: {%- if interface.method == "static" and interface.gateway | is_ipv4 %} - gateway4: {{ interface.gateway }} + - to: 0.0.0.0/0 + via: {{ interface.gateway }} +{%- if interface.routemetric > 0 %} + metric: {{ interface.routemetric }} +{%- endif %} {%- endif %} {%- if interface.method6 == "static" and interface.gateway6 | is_ipv6 %} - gateway6: {{ interface.gateway6 }} + - to: ::/0 + via: {{ interface.gateway6 }} +{%- if interface.routemetric6 != 1 %} + metric: {{ interface.routemetric6 }} +{%- endif %} +{%- endif %} {%- endif %} {%- if interface.method6 in ["auto", "dhcp"] %} accept-ra: true diff --git a/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/wifi.j2 b/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/wifi.j2 index b80db1982..eddfca81b 100644 --- a/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/wifi.j2 +++ b/deb/openmediavault/srv/salt/omv/deploy/systemd-networkd/files/wifi.j2 @@ -11,11 +11,22 @@ network: - {{ interface.address6 }}/{{ interface.netmask6 }} {%- endif %} {%- endif %} +{%- if (interface.method == "static" and interface.gateway | is_ipv4) or (interface.method6 == "static" and interface.gateway6 | is_ipv6) %} + routes: {%- if interface.method == "static" and interface.gateway | is_ipv4 %} - gateway4: {{ interface.gateway }} + - to: 0.0.0.0/0 + via: {{ interface.gateway }} +{%- if interface.routemetric > 0 %} + metric: {{ interface.routemetric }} +{%- endif %} {%- endif %} {%- if interface.method6 == "static" and interface.gateway6 | is_ipv6 %} - gateway6: {{ interface.gateway6 }} + - to: ::/0 + via: {{ interface.gateway6 }} +{%- if interface.routemetric6 != 1 %} + metric: {{ interface.routemetric6 }} +{%- endif %} +{%- endif %} {%- endif %} {%- if interface.method6 in ["auto", "dhcp"] %} accept-ra: true diff --git a/deb/openmediavault/usr/share/openmediavault/confdb/migrations.d/conf_6.3.3.sh b/deb/openmediavault/usr/share/openmediavault/confdb/migrations.d/conf_6.3.3.sh new file mode 100755 index 000000000..22559faf4 --- /dev/null +++ b/deb/openmediavault/usr/share/openmediavault/confdb/migrations.d/conf_6.3.3.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# +# This file is part of OpenMediaVault. +# +# @license http://www.gnu.org/licenses/gpl.html GPL Version 3 +# @author Volker Theile +# @copyright Copyright (c) 2009-2023 Volker Theile +# +# OpenMediaVault is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# OpenMediaVault is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenMediaVault. If not, see . + +set -e + +. /usr/share/openmediavault/scripts/helper-functions + +omv_config_add_key "/config/system/network/interfaces/interface" "routemetric" "0" +omv_config_add_key "/config/system/network/interfaces/interface" "routemetric6" "1" + +exit 0 diff --git a/deb/openmediavault/usr/share/openmediavault/confdb/populate.d/40interfaces.sh b/deb/openmediavault/usr/share/openmediavault/confdb/populate.d/40interfaces.sh index 1bfe2b3bd..4c232f1e7 100755 --- a/deb/openmediavault/usr/share/openmediavault/confdb/populate.d/40interfaces.sh +++ b/deb/openmediavault/usr/share/openmediavault/confdb/populate.d/40interfaces.sh @@ -66,12 +66,12 @@ grep -iP "^\s*iface\s+(eth[0-9]+|en[a-z0-9]+)\s+(inet|inet6)\s+(static|dhcp)" ${ fi jq --null-input --compact-output "{uuid: \"${OMV_CONFIGOBJECT_NEW_UUID}\", \ devicename: \"${devname}\", type: \"ethernet\", method6: \"manual\", \ - address6: \"\", netmask6: 64, gateway6: \"\", \ + address6: \"\", netmask6: 64, gateway6: \"\", routemetric6: 1, \ dnsnameservers: \"${dnsnameservers}\", dnssearch: \"\", \ wol: false, mtu: 0, \ comment: \"\", method: \"${method}\", \ address: \"${address}\", netmask: \"${netmask}\", \ - gateway: \"${gateway}\"}" | + gateway: \"${gateway}\", routemetric: 0}" | omv-confdbadm update "conf.system.network.interface" - fi done diff --git a/deb/openmediavault/usr/share/openmediavault/datamodels/conf.system.network.interface.json b/deb/openmediavault/usr/share/openmediavault/datamodels/conf.system.network.interface.json index 00976cea5..4dff648db 100644 --- a/deb/openmediavault/usr/share/openmediavault/datamodels/conf.system.network.interface.json +++ b/deb/openmediavault/usr/share/openmediavault/datamodels/conf.system.network.interface.json @@ -35,6 +35,12 @@ "gateway": { "type": "string" }, + "routemetric": { + "type": "integer", + "minimum": 0, + "maximum": 65535, + "default": 0 + }, "method6": { "type": "string", "enum": [ "auto", "dhcp", "static", "manual" ], @@ -52,6 +58,12 @@ "gateway6": { "type": "string" }, + "routemetric6": { + "type": "integer", + "minimum": 0, + "maximum": 65535, + "default": 1 + }, "dnsnameservers": { "type": "string", "pattern": "^((\\S+\\s+)*\\S+)?$" diff --git a/deb/openmediavault/usr/share/openmediavault/datamodels/rpc.network.json b/deb/openmediavault/usr/share/openmediavault/datamodels/rpc.network.json index 2bd55ac70..511de7247 100644 --- a/deb/openmediavault/usr/share/openmediavault/datamodels/rpc.network.json +++ b/deb/openmediavault/usr/share/openmediavault/datamodels/rpc.network.json @@ -30,6 +30,12 @@ "type": "string", "required": true }, + "routemetric": { + "type": "integer", + "minimum": 0, + "maximum": 65535, + "required": true + }, "method6": { "type": "string", "enum": [ "auto", "static", "manual", "dhcp" ], @@ -49,6 +55,12 @@ "type": "string", "required": true }, + "routemetric6": { + "type": "integer", + "minimum": 0, + "maximum": 65535, + "required": true + }, "dnsnameservers": { "type": "string", "pattern": "^((\\S+[,;])*\\S+)?$", @@ -107,6 +119,12 @@ "type": "string", "required": true }, + "routemetric": { + "type": "integer", + "minimum": 0, + "maximum": 65535, + "required": true + }, "method6": { "type": "string", "enum": [ "auto", "static", "manual", "dhcp" ], @@ -126,6 +144,12 @@ "type": "string", "required": true }, + "routemetric6": { + "type": "integer", + "minimum": 0, + "maximum": 65535, + "required": true + }, "dnsnameservers": { "type": "string", "pattern": "^((\\S+[,;])*\\S+)?$", @@ -216,6 +240,12 @@ "type": "string", "required": true }, + "routemetric": { + "type": "integer", + "minimum": 0, + "maximum": 65535, + "required": true + }, "method6": { "type": "string", "enum": [ "auto", "static", "manual", "dhcp" ], @@ -235,6 +265,12 @@ "type": "string", "required": true }, + "routemetric6": { + "type": "integer", + "minimum": 0, + "maximum": 65535, + "required": true + }, "dnsnameservers": { "type": "string", "pattern": "^((\\S+[,;])*\\S+)?$", @@ -303,6 +339,12 @@ "type": "string", "required": true }, + "routemetric": { + "type": "integer", + "minimum": 0, + "maximum": 65535, + "required": true + }, "method6": { "type": "string", "enum": [ "auto", "static", "manual", "dhcp" ], @@ -322,6 +364,12 @@ "type": "string", "required": true }, + "routemetric6": { + "type": "integer", + "minimum": 0, + "maximum": 65535, + "required": true + }, "dnsnameservers": { "type": "string", "pattern": "^((\\S+[,;])*\\S+)?$", @@ -393,6 +441,12 @@ "type": "string", "required": true }, + "routemetric": { + "type": "integer", + "minimum": 0, + "maximum": 65535, + "required": true + }, "method6": { "type": "string", "enum": ["auto", "static", "manual", "dhcp"], @@ -412,6 +466,12 @@ "type": "string", "required": true }, + "routemetric6": { + "type": "integer", + "minimum": 0, + "maximum": 65535, + "required": true + }, "dnsnameservers": { "type": "string", "pattern": "^((\\S+[,;])*\\S+)?$", diff --git a/deb/openmediavault/usr/share/openmediavault/firstaid/modules.d/10configure_network.py b/deb/openmediavault/usr/share/openmediavault/firstaid/modules.d/10configure_network.py index b31aa5cd0..0cec8d2c4 100755 --- a/deb/openmediavault/usr/share/openmediavault/firstaid/modules.d/10configure_network.py +++ b/deb/openmediavault/usr/share/openmediavault/firstaid/modules.d/10configure_network.py @@ -19,7 +19,6 @@ # You should have received a copy of the GNU General Public License # along with OpenMediaVault. If not, see . import ipaddress -import re import sys import dialog @@ -43,11 +42,13 @@ class Module(openmediavault.firstaid.IModule): address = "" netmask = "" gateway = "" + routemetric = 0 method = "manual" address6 = "" method6 = "manual" netmask6 = 64 gateway6 = "" + routemetric6 = 1 wol = False dns_nameservers = "" wpa_ssid = None @@ -385,10 +386,12 @@ class Module(openmediavault.firstaid.IModule): "address": address, "netmask": netmask, "gateway": gateway, + "routemetric": routemetric, "method6": method6, "address6": address6, "netmask6": netmask6, "gateway6": gateway6, + "routemetric6": routemetric6, "dnsnameservers": dns_nameservers, "dnssearch": "", "mtu": 0, diff --git a/deb/openmediavault/usr/share/openmediavault/templates/config.xml b/deb/openmediavault/usr/share/openmediavault/templates/config.xml index 7b243e129..a84637c50 100644 --- a/deb/openmediavault/usr/share/openmediavault/templates/config.xml +++ b/deb/openmediavault/usr/share/openmediavault/templates/config.xml @@ -143,10 +143,12 @@
xxx.xxx.xxx.xxx
xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx + 0-65535 auto|dhcp|static|manual xxxx:xxxx:...:xxxx 0-128 xxxx:xxxx:...:xxxx + 0-65535 xxx yyy zzz 0...n diff --git a/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-bond-form-page.component.ts b/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-bond-form-page.component.ts index 32ce03c58..ed7f769a0 100644 --- a/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-bond-form-page.component.ts +++ b/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-bond-form-page.component.ts @@ -340,17 +340,40 @@ export class InterfaceBondFormPageComponent extends BaseFormPageComponent { ] }, { - type: 'textInput', - name: 'gateway', - label: gettext('Gateway'), - value: '', - validators: { - patternType: 'ipv4' - }, - modifiers: [ + type: 'container', + fields: [ { - type: 'disabled', - constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + type: 'textInput', + name: 'gateway', + label: gettext('Gateway'), + value: '', + validators: { + patternType: 'ipv4' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + } + ], + flex: 75 + }, + { + type: 'numberInput', + name: 'routemetric', + label: gettext('Metric'), + value: 0, + validators: { + min: 0, + max: 65535, + patternType: 'integer' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + } + ] } ] }, @@ -410,17 +433,40 @@ export class InterfaceBondFormPageComponent extends BaseFormPageComponent { ] }, { - type: 'textInput', - name: 'gateway6', - label: gettext('Gateway'), - value: '', - validators: { - patternType: 'ipv6' - }, - modifiers: [ + type: 'container', + fields: [ { - type: 'disabled', - constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + type: 'textInput', + name: 'gateway6', + label: gettext('Gateway'), + value: '', + validators: { + patternType: 'ipv6' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + } + ], + flex: 75 + }, + { + type: 'numberInput', + name: 'routemetric6', + label: gettext('Metric'), + value: 1, + validators: { + min: 0, + max: 65535, + patternType: 'integer' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + } + ] } ] }, diff --git a/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-bridge-form-page.component.ts b/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-bridge-form-page.component.ts index d4e0a81fb..b0e491714 100644 --- a/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-bridge-form-page.component.ts +++ b/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-bridge-form-page.component.ts @@ -157,17 +157,40 @@ export class InterfaceBridgeFormPageComponent extends BaseFormPageComponent { ] }, { - type: 'textInput', - name: 'gateway', - label: gettext('Gateway'), - value: '', - validators: { - patternType: 'ipv4' - }, - modifiers: [ + type: 'container', + fields: [ { - type: 'disabled', - constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + type: 'textInput', + name: 'gateway', + label: gettext('Gateway'), + value: '', + validators: { + patternType: 'ipv4' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + } + ], + flex: 75 + }, + { + type: 'numberInput', + name: 'routemetric', + label: gettext('Metric'), + value: 0, + validators: { + min: 0, + max: 65535, + patternType: 'integer' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + } + ] } ] }, @@ -227,17 +250,40 @@ export class InterfaceBridgeFormPageComponent extends BaseFormPageComponent { ] }, { - type: 'textInput', - name: 'gateway6', - label: gettext('Gateway'), - value: '', - validators: { - patternType: 'ipv6' - }, - modifiers: [ + type: 'container', + fields: [ { - type: 'disabled', - constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + type: 'textInput', + name: 'gateway6', + label: gettext('Gateway'), + value: '', + validators: { + patternType: 'ipv6' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + } + ], + flex: 75 + }, + { + type: 'numberInput', + name: 'routemetric6', + label: gettext('Metric'), + value: 1, + validators: { + min: 0, + max: 65535, + patternType: 'integer' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + } + ] } ] }, diff --git a/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-ethernet-form-page.component.ts b/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-ethernet-form-page.component.ts index 4e0da8399..7b2c64a6f 100644 --- a/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-ethernet-form-page.component.ts +++ b/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-ethernet-form-page.component.ts @@ -146,17 +146,40 @@ export class InterfaceEthernetFormPageComponent extends BaseFormPageComponent { ] }, { - type: 'textInput', - name: 'gateway', - label: gettext('Gateway'), - value: '', - validators: { - patternType: 'ipv4' - }, - modifiers: [ + type: 'container', + fields: [ { - type: 'disabled', - constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + type: 'textInput', + name: 'gateway', + label: gettext('Gateway'), + value: '', + validators: { + patternType: 'ipv4' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + } + ], + flex: 75 + }, + { + type: 'numberInput', + name: 'routemetric', + label: gettext('Metric'), + value: 0, + validators: { + min: 0, + max: 65535, + patternType: 'integer' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + } + ] } ] }, @@ -216,17 +239,40 @@ export class InterfaceEthernetFormPageComponent extends BaseFormPageComponent { ] }, { - type: 'textInput', - name: 'gateway6', - label: gettext('Gateway'), - value: '', - validators: { - patternType: 'ipv6' - }, - modifiers: [ + type: 'container', + fields: [ { - type: 'disabled', - constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + type: 'textInput', + name: 'gateway6', + label: gettext('Gateway'), + value: '', + validators: { + patternType: 'ipv6' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + } + ], + flex: 75 + }, + { + type: 'numberInput', + name: 'routemetric6', + label: gettext('Metric'), + value: 1, + validators: { + min: 0, + max: 65535, + patternType: 'integer' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + } + ] } ] }, diff --git a/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-vlan-form-page.component.ts b/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-vlan-form-page.component.ts index 11d36e7f3..a3bfd1090 100644 --- a/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-vlan-form-page.component.ts +++ b/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-vlan-form-page.component.ts @@ -168,17 +168,40 @@ export class InterfaceVlanFormPageComponent extends BaseFormPageComponent { ] }, { - type: 'textInput', - name: 'gateway', - label: gettext('Gateway'), - value: '', - validators: { - patternType: 'ipv4' - }, - modifiers: [ + type: 'container', + fields: [ { - type: 'disabled', - constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + type: 'textInput', + name: 'gateway', + label: gettext('Gateway'), + value: '', + validators: { + patternType: 'ipv4' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + } + ], + flex: 75 + }, + { + type: 'numberInput', + name: 'routemetric', + label: gettext('Metric'), + value: 0, + validators: { + min: 0, + max: 65535, + patternType: 'integer' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + } + ] } ] }, @@ -238,17 +261,40 @@ export class InterfaceVlanFormPageComponent extends BaseFormPageComponent { ] }, { - type: 'textInput', - name: 'gateway6', - label: gettext('Gateway'), - value: '', - validators: { - patternType: 'ipv6' - }, - modifiers: [ + type: 'container', + fields: [ { - type: 'disabled', - constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + type: 'textInput', + name: 'gateway6', + label: gettext('Gateway'), + value: '', + validators: { + patternType: 'ipv6' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + } + ], + flex: 75 + }, + { + type: 'numberInput', + name: 'routemetric6', + label: gettext('Metric'), + value: 1, + validators: { + min: 0, + max: 65535, + patternType: 'integer' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + } + ] } ] }, diff --git a/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-wifi-form-page.component.ts b/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-wifi-form-page.component.ts index 0cd10f730..00b216e5c 100644 --- a/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-wifi-form-page.component.ts +++ b/deb/openmediavault/workbench/src/app/pages/network/interfaces/interface-wifi-form-page.component.ts @@ -172,17 +172,40 @@ export class InterfaceWifiFormPageComponent extends BaseFormPageComponent { ] }, { - type: 'textInput', - name: 'gateway', - label: gettext('Gateway'), - value: '', - validators: { - patternType: 'ipv4' - }, - modifiers: [ + type: 'container', + fields: [ { - type: 'disabled', - constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + type: 'textInput', + name: 'gateway', + label: gettext('Gateway'), + value: '', + validators: { + patternType: 'ipv6' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + } + ], + flex: 75 + }, + { + type: 'numberInput', + name: 'routemetric', + label: gettext('Metric'), + value: 0, + validators: { + min: 0, + max: 65535, + patternType: 'integer' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method' }, arg1: 'static' } + } + ] } ] }, @@ -242,17 +265,40 @@ export class InterfaceWifiFormPageComponent extends BaseFormPageComponent { ] }, { - type: 'textInput', - name: 'gateway6', - label: gettext('Gateway'), - value: '', - validators: { - patternType: 'ipv6' - }, - modifiers: [ + type: 'container', + fields: [ { - type: 'disabled', - constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + type: 'textInput', + name: 'gateway6', + label: gettext('Gateway'), + value: '', + validators: { + patternType: 'ipv4' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + } + ], + flex: 75 + }, + { + type: 'numberInput', + name: 'routemetric6', + label: gettext('Metric'), + value: 1, + validators: { + min: 0, + max: 65535, + patternType: 'integer' + }, + modifiers: [ + { + type: 'disabled', + constraint: { operator: 'ne', arg0: { prop: 'method6' }, arg1: 'static' } + } + ] } ] },