config_tools: show confirm message when user deselecting checkbox in cat widget

show confirm message when user deselecting checkbox in cat widget

Tracked-On: #6691
Signed-off-by: Weiyi Feng <weiyix.feng@intel.com>
This commit is contained in:
Weiyi Feng 2022-06-05 22:08:52 +08:00 committed by acrnsi-robot
parent 21240fd84e
commit 8ac076a540
1 changed files with 16 additions and 8 deletions

View File

@ -135,6 +135,8 @@ function count(source, target) {
return (source.match(new RegExp(target, 'g')) || []).length;
}
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
// noinspection JSUnresolvedVariable
export default {
@ -209,13 +211,21 @@ export default {
},
methods: {
checkboxController(name, event) {
// prevent default event
event.preventDefault()
event.stopPropagation()
let oldValue = this.formDataProxy(name);
let newValue = oldValue === 'y' ? 'n' : 'y';
let message = newValue === 'y' ? "Selecting Cache Allocation Technology, Code and Data Prioritization, " +
"or Virtual Cache Allocation Technology will remove any prior configurations. " +
"To see your current configuration, go to the Hypervisors Advanced tab, " +
"Memory Isolation for Performance section.\n\n" +
"Are you sure you want to continue?" : "Deselecting Cache Allocation Technology, " +
if (newValue === 'y') {
wait(50).then(() => {
this.formDataProxy(name, newValue, true);
})
return
}
// newValue === 'n'
// show confirm dialog to confirm disable CAT feature
let message = "Deselecting Cache Allocation Technology, " +
"Code and Data Prioritization, or Virtual Cache Allocation Technology will remove any prior configurations. " +
"To see your current configuration, go to the Hypervisors Advanced tab, " +
"Memory Isolation for Performance section.\n\n" +
@ -225,8 +235,6 @@ export default {
.then((confirmed) => {
this.formDataProxy(name, confirmed ? newValue : oldValue, true)
})
event.preventDefault()
event.stopPropagation()
},
formDataProxy(name, data = null, update = false) {
let path = {