From 8446c9450812df148c6aeb8daf69edafcf8ee85e Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Sat, 21 Oct 2023 10:46:53 -0400 Subject: [PATCH] [photon-client] Fix camera and pipeline name editing (#969) closes #965 Had to disable the eslint rule that was causing the bug. Disallows disabling driver mode when there are no other pipelines to swap to Also adds icons for saving and canceling name edits Adds the option to create a new pipeline in driver mode if there are no other pipelines Adds disable prop to the driver mode switch on the camera settings page --- photon-client/.eslintrc.json | 3 +- .../src/components/cameras/CamerasView.vue | 2 +- .../src/components/common/pv-icon.vue | 11 +++- .../src/components/common/pv-input.vue | 7 ++- .../dashboard/CameraAndPipelineSelectCard.vue | 59 ++++++++++++++----- .../src/components/dashboard/CamerasCard.vue | 9 ++- 6 files changed, 70 insertions(+), 21 deletions(-) diff --git a/photon-client/.eslintrc.json b/photon-client/.eslintrc.json index a257cd186a..ca944a24c4 100644 --- a/photon-client/.eslintrc.json +++ b/photon-client/.eslintrc.json @@ -15,6 +15,7 @@ "object-curly-spacing": ["error", "always"], "quote-props": ["error", "as-needed"], "no-case-declarations": "off", - "vue/require-default-prop": "off" + "vue/require-default-prop": "off", + "vue/v-on-event-hyphenation": "off" } } diff --git a/photon-client/src/components/cameras/CamerasView.vue b/photon-client/src/components/cameras/CamerasView.vue index 4448dcde1e..a0c1968d1e 100644 --- a/photon-client/src/components/cameras/CamerasView.vue +++ b/photon-client/src/components/cameras/CamerasView.vue @@ -68,7 +68,7 @@ const fpsTooLow = computed(() => {
(), { right: false, + disabled: false, hover: false } ); @@ -24,7 +26,14 @@ const hoverClass = props.hover ? "hover" : "";
diff --git a/photon-client/src/components/common/pv-input.vue b/photon-client/src/components/common/pv-input.vue index ff3434132c..282e95e367 100644 --- a/photon-client/src/components/common/pv-input.vue +++ b/photon-client/src/components/common/pv-input.vue @@ -35,9 +35,10 @@ const localValue = computed({ const handleKeydown = ({ key }) => { switch (key) { case "Enter": - if (!(props.rules || []).some((v) => v(localValue.value) === false || typeof v(localValue.value) === "string")) { - emit("onEnter", localValue.value); - } + // Explicitly check that all rule props return true + if (!props.rules?.every((rule) => rule(localValue.value) === true)) return; + + emit("onEnter", localValue.value); break; case "Escape": emit("onEscape"); diff --git a/photon-client/src/components/dashboard/CameraAndPipelineSelectCard.vue b/photon-client/src/components/dashboard/CameraAndPipelineSelectCard.vue index b01b4a4dd8..c7b6d3724b 100644 --- a/photon-client/src/components/dashboard/CameraAndPipelineSelectCard.vue +++ b/photon-client/src/components/dashboard/CameraAndPipelineSelectCard.vue @@ -138,7 +138,7 @@ const cancelPipelineCreation = () => { newPipelineType.value = useCameraSettingsStore().currentWebsocketPipelineType; }; -// Pipeline Creation +// Pipeline Deletion const showPipelineDeletionConfirmationDialog = ref(false); const confirmDeleteCurrentPipeline = () => { useCameraSettingsStore().deleteCurrentPipeline(); @@ -186,6 +186,11 @@ const cancelChangePipelineType = () => { showPipelineTypeChangeDialog.value = false; }; +// Pipeline duplication' +const duplicateCurrentPipeline = () => { + useCameraSettingsStore().duplicatePipeline(useCameraSettingsStore().currentCameraSettings.currentPipelineIndex); +}; + // Change Props whenever the pipeline settings are changed useCameraSettingsStore().$subscribe((mutation, state) => { const currentCameraSettings = state.cameras[useStateStore().currentCameraIndex]; @@ -225,12 +230,27 @@ useCameraSettingsStore().$subscribe((mutation, state) => { :input-cols="12 - 3" :rules="[(v) => checkCameraName(v)]" label="Camera" - @on-enter="saveCameraNameEdit" - @on-escape="cancelCameraNameEdit" + @onEnter="saveCameraNameEdit" + @onEscape="cancelCameraNameEdit" /> - +
+ + +
+
@@ -250,12 +270,21 @@ useCameraSettingsStore().$subscribe((mutation, state) => { :input-cols="12 - 3" :rules="[(v) => checkPipelineName(v)]" label="Pipeline" - @on-enter="(v) => savePipelineNameEdit(v)" - @on-escape="cancelPipelineNameEdit" + @onEnter="(v) => savePipelineNameEdit(v)" + @onEscape="cancelPipelineNameEdit" /> - +
+ + +
+ @@ -275,19 +304,21 @@ useCameraSettingsStore().$subscribe((mutation, state) => { - + +
diff --git a/photon-client/src/components/dashboard/CamerasCard.vue b/photon-client/src/components/dashboard/CamerasCard.vue index 5670106df3..21fb77ada2 100644 --- a/photon-client/src/components/dashboard/CamerasCard.vue +++ b/photon-client/src/components/dashboard/CamerasCard.vue @@ -66,7 +66,14 @@ const fpsTooLow = computed(() => {
- +