config-tools: add validation to IVSHMEM widget

Add validation to IVSHMEM widget, displaying error msg below the
input line. Currently only check for empty line.

Tracked-On: #7481

Signed-off-by: Zhou, Wu <wu.zhou@intel.com>
This commit is contained in:
Wu Zhou 2022-05-16 14:34:05 +08:00 committed by acrnsi-robot
parent 0adfe7a439
commit 39490c72b1
1 changed files with 18 additions and 6 deletions

View File

@ -9,7 +9,10 @@
<label>Region name: </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="validation(IVSHMEM_VMO.NAME)" v-model="IVSHMEM_VMO.NAME" placeholder="Any string with no white spaces."/>
<b-form-invalid-feedback>
must have value
</b-form-invalid-feedback>
</b-col>
</b-row>
@ -45,10 +48,16 @@
<label>VM name:</label>
</b-col>
<b-col sm="3">
<b-form-select v-model="IVSHMEM_VM.VM_NAME" :options="vmNames"></b-form-select>
<b-form-select :state="validation(IVSHMEM_VM.VM_NAME)" v-model="IVSHMEM_VM.VM_NAME" :options="vmNames"></b-form-select>
<b-form-invalid-feedback>
must have value
</b-form-invalid-feedback>
</b-col>
<b-col sm="3">
<b-form-input v-model="IVSHMEM_VM.VBDF" placeholder="00:[device].[function], e.g. 00:0c.0. All fields are in hexadecimal."/>
<b-form-input :state="validation(IVSHMEM_VM.VBDF)" v-model="IVSHMEM_VM.VBDF" placeholder="00:[device].[function], e.g. 00:0c.0. All fields are in hexadecimal./>
<b-form-invalid-feedback>
must have value
</b-form-invalid-feedback>
</b-col>
<b-col sm="3">
<div class="ToolSet">
@ -148,6 +157,9 @@ export default {
}
},
methods: {
validation(value) {
return value.length != 0;
},
addSharedVM(vms, index) {
// add new item after current item
vms.splice(index + 1, 0, {
@ -175,11 +187,11 @@ export default {
"IVSHMEM_VMS": {
"IVSHMEM_VM": [
{
"VM_NAME": "PRE_RT_VM0",
"VM_NAME": "",
"VBDF": ""
},
{
"VM_NAME": "POST_STD_VM1",
"VM_NAME": "",
"VBDF": ""
}
]
@ -237,4 +249,4 @@ label:before {
background: #f9f9f9;
padding: 5px 5px 3px;
}
</style>
</style>