mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-26 07:21:37 +00:00
show warning message when users attempt to create a new scenario
fix warning message when users attempt to create a new scenario, or import an existing scenario, for an existing configuration Tracked-On: #7898 Signed-off-by: Chuang-Ke chuangx.ke@intel.com Reviewed-by: Junjie Mao junjie.mao@intel.com
This commit is contained in:
parent
715a597e37
commit
e5a9c36095
@ -3,7 +3,7 @@
|
|||||||
<div class="border-end-sm py-1 col-sm">
|
<div class="border-end-sm py-1 col-sm">
|
||||||
<div class="py-4 text-center">
|
<div class="py-4 text-center">
|
||||||
<NewScenario v-model:show-modal="showCreateScenario" @newScenario="newScenario"/>
|
<NewScenario v-model:show-modal="showCreateScenario" @newScenario="newScenario"/>
|
||||||
<button type="button" class="btn btn-primary btn-lg" @click="showCreateScenario=true">
|
<button type="button" class="btn btn-primary btn-lg" @click="CreateScenario">
|
||||||
Create Scenario…
|
Create Scenario…
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div class="py-4 text-right">
|
<div class="py-4 text-right">
|
||||||
<button type="button" class="wel-btn btn btn-primary btn-lg" @click="loadScenario(false)">
|
<button type="button" class="wel-btn btn btn-primary btn-lg" @click="checkAndLoadScenario(false)">
|
||||||
Import Scenario
|
Import Scenario
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -44,6 +44,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import configurator from "../../lib/acrn";
|
import configurator from "../../lib/acrn";
|
||||||
import NewScenario from "./Scenario/NewScenario.vue";
|
import NewScenario from "./Scenario/NewScenario.vue";
|
||||||
|
import _ from "lodash";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Scenario",
|
name: "Scenario",
|
||||||
@ -83,11 +84,39 @@ export default {
|
|||||||
this.getScenarioHistory()
|
this.getScenarioHistory()
|
||||||
// Todo: auto load scenario
|
// Todo: auto load scenario
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
CreateScenario() {
|
||||||
|
if (!_.isEmpty(this.scenario)) {
|
||||||
|
confirm(`Warning: Overwrite the existing scenario file?`)
|
||||||
|
.then((r) => {
|
||||||
|
// user cancel the operation
|
||||||
|
if (!r) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// user confirm the operation
|
||||||
|
this.showCreateScenario = true
|
||||||
|
})
|
||||||
|
} else this.showCreateScenario = true
|
||||||
|
},
|
||||||
newScenario(data) {
|
newScenario(data) {
|
||||||
|
|
||||||
this.$emit('scenarioUpdate', data)
|
this.$emit('scenarioUpdate', data)
|
||||||
},
|
},
|
||||||
loadScenario(auto = false) {
|
checkAndLoadScenario(auto = false) {
|
||||||
|
if (!_.isEmpty(this.scenario)) {
|
||||||
|
confirm(`Warning: Overwrite the existing scenario file?`)
|
||||||
|
.then((r) => {
|
||||||
|
// user cancel the operation
|
||||||
|
if (!r) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// user confirm the operation
|
||||||
|
this.loadScenario(auto)
|
||||||
|
})
|
||||||
|
} else this.loadScenario(auto)
|
||||||
|
},
|
||||||
|
loadScenario(auto) {
|
||||||
if (this.currentSelectedScenario.length > 0) {
|
if (this.currentSelectedScenario.length > 0) {
|
||||||
configurator.loadScenario(this.currentSelectedScenario)
|
configurator.loadScenario(this.currentSelectedScenario)
|
||||||
.then((scenarioConfig) => {
|
.then((scenarioConfig) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user