misc: configurator: Apply pattern check to IVSHMEM name

This patch applies pattern check to IVSHMEM name. Report error if regex
does not match.

Tracked-On: #7707
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
This commit is contained in:
Yifan Liu 2022-06-07 09:45:59 +08:00 committed by acrnsi-robot
parent 1f4ac22bb1
commit e549f73f8e
1 changed files with 8 additions and 1 deletions

View File

@ -16,7 +16,10 @@
</label>
</b-col>
<b-col md="4">
<b-form-input v-model="IVSHMEM_VMO.NAME" placeholder="Any string with no white spaces."/>
<b-form-input :state="validateIvshrgName(IVSHMEM_VMO.NAME)" v-model="IVSHMEM_VMO.NAME" placeholder="Must be 1-27 characters and only letters, digits and '_'."/>
<b-form-invalid-feedback>
Name must be between 1-27 characters and contain only letters, digits and "_".
</b-form-invalid-feedback>
</b-col>
</b-row>
@ -189,6 +192,10 @@ export default {
}
},
methods: {
validateIvshrgName(value) {
var regexp = new RegExp(this.IVSHMEMRegionType.properties.NAME.pattern);
return regexp.test(value);
},
validation(value) {
return (value != null) && (value.length != 0);
},