From d27b3d0775cb341b4e4afa4b3152b336fe8ab50d Mon Sep 17 00:00:00 2001 From: Sam Freund Date: Tue, 18 Nov 2025 02:41:20 -0600 Subject: [PATCH] Modal template for deletion confirmation (#2190) ## Description This adds a template modal that can be used for confirming that the user wants to delete something. The main goal is to reduce complication and duplicated code, and standardize the way we handle deletion. closes #2175 ## Meta Merge checklist: - [x] Pull Request title is [short, imperative summary](https://cbea.ms/git-commit/) of proposed changes - [x] The description documents the _what_ and _why_ - [x] This PR has been [linted](https://docs.photonvision.org/en/latest/docs/contributing/linting.html). - [ ] If this PR changes behavior or adds a feature, user documentation is updated - [ ] If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly - [ ] If this PR touches configuration, this is backwards compatible with settings back to v2025.3.2 - [ ] If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated - [ ] If this PR addresses a bug, a regression test for it is added --------- Co-authored-by: Devolian --- .../cameras/CameraCalibrationInfoCard.vue | 60 +++------ .../components/cameras/CameraSettingsCard.vue | 60 ++------- .../src/components/common/pv-delete-modal.vue | 85 +++++++++++++ .../dashboard/CameraAndPipelineSelectCard.vue | 35 ++---- .../components/settings/DeviceControlCard.vue | 72 ++--------- .../settings/ObjectDetectionCard.vue | 117 ++++-------------- .../src/views/CameraMatchingView.vue | 96 +++++--------- 7 files changed, 188 insertions(+), 337 deletions(-) create mode 100644 photon-client/src/components/common/pv-delete-modal.vue diff --git a/photon-client/src/components/cameras/CameraCalibrationInfoCard.vue b/photon-client/src/components/cameras/CameraCalibrationInfoCard.vue index b92734fde..cb5b02b27 100644 --- a/photon-client/src/components/cameras/CameraCalibrationInfoCard.vue +++ b/photon-client/src/components/cameras/CameraCalibrationInfoCard.vue @@ -5,6 +5,7 @@ import { useStateStore } from "@/stores/StateStore"; import { computed, inject, ref } from "vue"; import { axiosPost, getResolutionString, parseJsonFile } from "@/lib/PhotonUtils"; import { useTheme } from "vuetify"; +import PvDeleteModal from "@/components/common/pv-delete-modal.vue"; const theme = useTheme(); @@ -12,7 +13,7 @@ const props = defineProps<{ videoFormat: VideoFormat; }>(); -const confirmRemoveDialog = ref({ show: false, vf: {} as VideoFormat }); +const confirmRemoveDialog = ref({ show: false, vf: props.videoFormat as VideoFormat }); const removeCalibration = (vf: VideoFormat) => { axiosPost("/calibration/remove", "delete a camera calibration", { @@ -20,8 +21,6 @@ const removeCalibration = (vf: VideoFormat) => { width: vf.resolution.width, height: vf.resolution.height }); - - confirmRemoveDialog.value.show = false; }; const exportCalibration = ref(); @@ -110,17 +109,6 @@ const calibrationImageURL = (index: number) => Calibration Details - - mdi-delete - Delete - /> :href="exportCalibrationURL" target="_blank" /> + + mdi-delete + Delete + - - - Delete Calibration - - Are you sure you want to delete the calibration for {{ confirmRemoveDialog.vf.resolution.width }}x{{ - confirmRemoveDialog.vf.resolution.height - }}? This cannot be undone. - - - Cancel - - - Delete - - - - - +