Skip to content

Commit

Permalink
Merge pull request #356 from ottogroup/GBICSGO-2204
Browse files Browse the repository at this point in the history
adds watch and removes click event
  • Loading branch information
mrahbar authored Jun 14, 2024
2 parents 02f8a14 + fb1695a commit 781e159
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
16 changes: 10 additions & 6 deletions frontend/src/components/BackupEditDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,14 @@ const integerRequiredRule = (fieldName: string) => {
return (v: number) => (!!v && v > 0) || `${fieldName} is required and must be bigger than 0`;
};
const closeDialog = () => {
viewDialog.value = false;
emits('close');
};
watch(
() => viewDialog.value,
(value) => {
if (!value) {
emits('close');
}
},
);
watch(
() => props.id,
Expand All @@ -108,7 +112,7 @@ watch(
</script>

<template>
<v-dialog v-model="viewDialog" width="800" @click="closeDialog">
<v-dialog v-model="viewDialog" width="800">
<v-card title="Update backup" :loading="isLoading">
<v-card-text>
<v-form :disabled="isLoading || backupStatusIsDeleted" v-model="isValid" fast-fail @submit.prevent>
Expand Down Expand Up @@ -205,7 +209,7 @@ watch(
</v-card-text>
<template v-slot:actions>
<v-btn-group class="ms-auto">
<v-btn text="Cancel" @click="closeDialog"></v-btn>
<v-btn text="Cancel" @click="viewDialog = false"></v-btn>
<v-btn text="Update" :disabled="isLoading || !isValid" @click="saveBackup()"></v-btn>
</v-btn-group>
</template>
Expand Down
16 changes: 10 additions & 6 deletions frontend/src/components/BackupViewDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,14 @@ const projectLink = (project: string) => {
return `https://console.cloud.google.com/welcome?project=${project}`;
};
const closeDialog = () => {
viewDialog.value = false;
emits('close');
};
watch(
() => viewDialog.value,
(value) => {
if (!value) {
emits('close');
}
},
);
watch(
() => props.id,
Expand All @@ -138,7 +142,7 @@ watch(
</script>

<template>
<v-dialog v-model="viewDialog" width="800" @click="closeDialog">
<v-dialog v-model="viewDialog" width="800">
<v-card title="Backup">
<v-card-text v-if="isLoading">
<v-progress-linear indeterminate/>
Expand Down Expand Up @@ -395,7 +399,7 @@ watch(
</v-window>
</v-card-text>
<template v-slot:actions>
<v-btn class="ms-auto" text="Close" @click="closeDialog"></v-btn>
<v-btn class="ms-auto" text="Close" @click="viewDialog = false"></v-btn>
</template>
</v-card>
</v-dialog>
Expand Down

0 comments on commit 781e159

Please sign in to comment.