mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-20 12:42:54 +00:00
config_tools: apply pattern check to interface name
This patch applies pattern check to network interface name. Report error if regex doesn't match. Tracked-On: #6690 Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
This commit is contained in:
parent
c88860250e
commit
df0c683c6c
@ -17,7 +17,10 @@
|
|||||||
<label>Network interface name: </label>
|
<label>Network interface name: </label>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col md="4">
|
<b-col md="4">
|
||||||
<b-form-input v-model="network.interface_name"/>
|
<b-form-input :state="validateInterfaceName(network.interface_name)" v-model="network.interface_name" placeholder="An arbitrary-long string with letters, digits, underscores or dashes."/>
|
||||||
|
<b-form-invalid-feedback>
|
||||||
|
An arbitrary-long string with letters, digits, underscores or dashes.
|
||||||
|
</b-form-invalid-feedback>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
</div>
|
</div>
|
||||||
@ -67,6 +70,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
NetworkConfiguration: this.rootSchema.definitions['VirtioNetworkConfiguration'],
|
||||||
NetworkFrameworkType: this.rootSchema.definitions['VirtioNetworkFrameworkType']['enum'],
|
NetworkFrameworkType: this.rootSchema.definitions['VirtioNetworkFrameworkType']['enum'],
|
||||||
NetworkFrameworkDefault: this.rootSchema.definitions['VirtioNetworkConfiguration']['properties']['virtio_framework']['default'],
|
NetworkFrameworkDefault: this.rootSchema.definitions['VirtioNetworkConfiguration']['properties']['virtio_framework']['default'],
|
||||||
defaultVal: vueUtils.getPathVal(this.rootFormData, this.curNodePath)
|
defaultVal: vueUtils.getPathVal(this.rootFormData, this.curNodePath)
|
||||||
@ -90,6 +94,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
validateInterfaceName(value) {
|
||||||
|
var regexp = new RegExp(this.NetworkConfiguration.properties.interface_name.pattern);
|
||||||
|
return (value != null) && regexp.test(value);
|
||||||
|
},
|
||||||
removeVirtioNetwork(index) {
|
removeVirtioNetwork(index) {
|
||||||
this.defaultVal.splice(index, 1);
|
this.defaultVal.splice(index, 1);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user