mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-20 04:33:55 +00:00
config_tools: apply pattern check to virtio input id
this patch applies pattern check to virtio input id. 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
df0c683c6c
commit
39626609d0
@ -17,7 +17,10 @@
|
|||||||
Guest virtio input device unique identifier:
|
Guest virtio input device unique identifier:
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col md="4">
|
<b-col md="4">
|
||||||
<b-form-input v-model="input.id"/>
|
<b-form-input :state="validateId(input.id)" v-model="input.id" 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 {
|
||||||
|
InputConfiguration: this.rootSchema.definitions['VirtioInputConfiguration'],
|
||||||
BackendDeviceFileType: this.rootSchema.definitions['VirtioInputConfiguration']['properties']['backend_device_file']['enum'],
|
BackendDeviceFileType: this.rootSchema.definitions['VirtioInputConfiguration']['properties']['backend_device_file']['enum'],
|
||||||
defaultVal: vueUtils.getPathVal(this.rootFormData, this.curNodePath)
|
defaultVal: vueUtils.getPathVal(this.rootFormData, this.curNodePath)
|
||||||
};
|
};
|
||||||
@ -89,6 +93,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
validateId(value) {
|
||||||
|
var regexp = new RegExp(this.InputConfiguration.properties.id.pattern);
|
||||||
|
return (value != null) && regexp.test(value);
|
||||||
|
},
|
||||||
removeVirtioInput(index) {
|
removeVirtioInput(index) {
|
||||||
this.defaultVal.splice(index, 1);
|
this.defaultVal.splice(index, 1);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user