Skip to content

Commit

Permalink
add a dialog to confirm the run
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiSakuma committed Jun 29, 2023
1 parent e2185d9 commit e463560
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
2 changes: 2 additions & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ declare module '@vue/runtime-core' {
VBreadcrumbs: typeof import('vuetify/lib')['VBreadcrumbs']
VBtn: typeof import('vuetify/lib')['VBtn']
VCard: typeof import('vuetify/lib')['VCard']
VCardAction: typeof import('vuetify/lib')['VCardAction']
VCardActions: typeof import('vuetify/lib')['VCardActions']
VCardSubtitle: typeof import('vuetify/lib')['VCardSubtitle']
VCardText: typeof import('vuetify/lib')['VCardText']
Expand All @@ -38,6 +39,7 @@ declare module '@vue/runtime-core' {
VCol: typeof import('vuetify/lib')['VCol']
VContainer: typeof import('vuetify/lib')['VContainer']
VDataTable: typeof import('vuetify/lib')['VDataTable']
VDialog: typeof import('vuetify/lib')['VDialog']
VDivider: typeof import('vuetify/lib')['VDivider']
VIcon: typeof import('vuetify/lib')['VIcon']
VList: typeof import('vuetify/lib')['VList']
Expand Down
34 changes: 32 additions & 2 deletions src/components/RunCtrl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,24 @@
</v-list-item>
</v-list>
</v-menu>
<v-dialog v-model="dialog" max-width="290">
<v-card>
<v-card-title> Start running the script? </v-card-title>
<v-card-text> Are you sure to start? </v-card-text>
<v-card-actions>
<v-btn text color="grey darken-2" @click="dialog = false">
Cancel
</v-btn>
<v-spacer></v-spacer>
<v-btn text color="primary" @click="onStartConfirmed"> Start </v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-card-actions>
</template>

<script setup lang="ts">
import { ref, computed } from "vue";
import { watch, ref, computed } from "vue";
import { useStore } from "@/stores/main";
Expand Down Expand Up @@ -173,7 +186,7 @@ const chip = computed(
async function onClick(method: Method) {
if (method === "run") {
await executeExec({});
showConfirmationDialog();
} else if (method === "reset") {
await executeReset({});
} else if (method === "interrupt") {
Expand All @@ -190,4 +203,21 @@ const { executeMutation: executeReset } = useResetMutation();
const { executeMutation: executeInterrupt } = useInterruptMutation();
const { executeMutation: executeTerminate } = useTerminateMutation();
const { executeMutation: executeKill } = useKillMutation();
function showConfirmationDialog() {
dialog.value = true;
}
async function onStartConfirmed() {
dialog.value = false;
await executeExec({});
}
watch(nextlineState, () => {
if (nextlineState.value !== "initialized") {
dialog.value = false;
}
});
const dialog = ref(false);
</script>

0 comments on commit e463560

Please sign in to comment.