Skip to content

Commit 27404f0

Browse files
committed
add confirmation dialog
1 parent 89b68c8 commit 27404f0

File tree

1 file changed

+35
-4
lines changed

1 file changed

+35
-4
lines changed

photon-client/src/components/cameras/CameraCalibrationInfoCard.vue

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ const props = defineProps<{
1212
videoFormat: VideoFormat;
1313
}>();
1414
15-
const removeCalibration = () => {
15+
const confirmRemoveDialog = ref({ show: false, vf: {} as VideoFormat });
16+
17+
const removeCalibration = (vf: VideoFormat) => {
1618
axiosPost("/calibration/remove", "delete a camera calibration", {
1719
cameraUniqueName: useCameraSettingsStore().currentCameraSettings.uniqueName,
18-
width: props.videoFormat.resolution.width,
19-
height: props.videoFormat.resolution.height
20+
width: vf.resolution.width,
21+
height: vf.resolution.height
2022
});
23+
24+
confirmRemoveDialog.value.show = false;
2125
};
2226
2327
const exportCalibration = ref();
@@ -112,7 +116,7 @@ const calibrationImageURL = (index: number) =>
112116
class="mr-2"
113117
style="flex: 1"
114118
:variant="theme.global.name.value === 'LightTheme' ? 'elevated' : 'outlined'"
115-
@click="removeCalibration"
119+
@click="() => (confirmRemoveDialog = { show: true, vf: props.videoFormat })"
116120
>
117121
<v-icon start size="large">mdi-delete</v-icon>
118122
<span>Delete</span>
@@ -307,6 +311,33 @@ const calibrationImageURL = (index: number) =>
307311
</v-data-table>
308312
</v-card-text>
309313
</v-card>
314+
315+
<v-dialog v-model="confirmRemoveDialog.show" width="600">
316+
<v-card color="surface" dark>
317+
<v-card-title>Delete Calibration</v-card-title>
318+
<v-card-text class="pt-0">
319+
Are you sure you want to delete the calibration for {{ confirmRemoveDialog.vf.resolution.width }}x{{
320+
confirmRemoveDialog.vf.resolution.height
321+
}}?
322+
<v-card-actions class="pt-5 pb-0 pr-0" style="justify-content: flex-end">
323+
<v-btn
324+
:variant="theme.global.name.value === 'LightTheme' ? 'elevated' : 'outlined'"
325+
color="buttonPassive"
326+
@click="confirmRemoveDialog.show = false"
327+
>
328+
Cancel
329+
</v-btn>
330+
<v-btn
331+
:variant="theme.global.name.value === 'LightTheme' ? 'elevated' : 'outlined'"
332+
color="error"
333+
@click="removeCalibration(confirmRemoveDialog.vf)"
334+
>
335+
Delete
336+
</v-btn>
337+
</v-card-actions>
338+
</v-card-text>
339+
</v-card>
340+
</v-dialog>
310341
</template>
311342

312343
<style scoped>

0 commit comments

Comments
 (0)