From e3f51d2a9272e810244fcdfdc74f57f1d4b4a38b Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Sun, 18 Jun 2023 01:50:36 -0400 Subject: [PATCH 1/8] fix --- photon-client/src/views/SettingsView.vue | 2 +- photon-client/src/views/SettingsViews/DeviceControl.vue | 2 +- photon-client/src/views/SettingsViews/Lighting.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/photon-client/src/views/SettingsView.vue b/photon-client/src/views/SettingsView.vue index 266fe91829..a0b9e41711 100644 --- a/photon-client/src/views/SettingsView.vue +++ b/photon-client/src/views/SettingsView.vue @@ -15,7 +15,7 @@ class="mb-3 pr-6 pb-3" style="background-color: #006492;" > - {{ item.name }} + {{ item.name.replaceAll("_", " ") }} export default { // eslint-disable-next-line - name: "DeviceControl", + name: "Device_Control", data() { return { snack: false, diff --git a/photon-client/src/views/SettingsViews/Lighting.vue b/photon-client/src/views/SettingsViews/Lighting.vue index 355127e651..7c148f960a 100644 --- a/photon-client/src/views/SettingsViews/Lighting.vue +++ b/photon-client/src/views/SettingsViews/Lighting.vue @@ -17,7 +17,7 @@ export default { // eslint-disable-next-line - name: 'LEDControl', + name: 'LED_Control', components: { CVslider, }, From c62f1f4125ca16fabf151aeb7141f323f8e76121 Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Sun, 18 Jun 2023 13:15:38 -0400 Subject: [PATCH 2/8] Move camera edit to Camera Settings --- .../src/components/common/cv-icon.vue | 3 +- photon-client/src/views/CamerasView.vue | 109 ++++++++++++++++-- 2 files changed, 103 insertions(+), 9 deletions(-) diff --git a/photon-client/src/components/common/cv-icon.vue b/photon-client/src/components/common/cv-icon.vue index bff41be366..9c32f7e71f 100644 --- a/photon-client/src/components/common/cv-icon.vue +++ b/photon-client/src/components/common/cv-icon.vue @@ -9,6 +9,7 @@ @@ -24,7 +25,7 @@ export default { name: 'Icon', // eslint-disable-next-line vue/require-prop-types - props: ['color', 'tooltip', 'text', 'right', 'hover'], + props: ['color', 'tooltip', 'text', 'right', 'hover', 'disabled'], data() { return {} }, diff --git a/photon-client/src/views/CamerasView.vue b/photon-client/src/views/CamerasView.vue index c695cdb07d..2a9c41c089 100644 --- a/photon-client/src/views/CamerasView.vue +++ b/photon-client/src/views/CamerasView.vue @@ -16,25 +16,70 @@ > Camera Settings
- + + + + + + + + + + + + +
@@ -418,10 +463,14 @@ import CVimage from "../components/common/cv-image"; import TooltippedLabel from "../components/common/cv-tooltipped-label"; import jsPDF from "jspdf"; import "../jsPDFFonts/Prompt-Regular-normal.js"; +import CVicon from "@/components/common/cv-icon.vue"; +import CVinput from "@/components/common/cv-input.vue"; export default { name: 'Cameras', components: { + CVinput, + CVicon, TooltippedLabel, CVselect, CVnumberinput, @@ -431,6 +480,8 @@ export default { }, data() { return { + cameraNicknameEditInProgress : false, + cameraTempNameValue: "", snack: false, calibrationInProgress: false, calibrationFailed: false, @@ -602,8 +653,50 @@ export default { this.$store.commit('mutateCalibrationState', {['videoModeIndex']: this.filteredResolutionList[i].index}); } }, + cameraNicknameChangeDisabled() { + if(this.checkCameraName !== '') return true; + if(this.cameraTempNameValue === this.$store.getters.cameraList[this.currentCameraIndex]) return true; + return false; + }, + checkCameraName() { + if (this.cameraTempNameValue !== this.$store.getters.cameraList[this.currentCameraIndex]) { + const cameraNameRegex = RegExp("^[A-Za-z0-9_ \\-)(]*[A-Za-z0-9][A-Za-z0-9_ \\-)(.]*$") + if (cameraNameRegex.test(this.cameraTempNameValue)) { + for (let cam in this.cameraList) { + if (this.cameraList.hasOwnProperty(cam)) { + if (this.cameraTempNameValue === this.cameraList[cam]) { + return "A camera by that name already exists" + } + } + } + } else { + return "Please enter a valid camera name. It should only contain letters, numbers, underscores, hyphens, parentheses, and periods." + } + } + return ""; + } }, methods: { + changeCameraName() { + this.cameraTempNameValue = this.$store.getters.cameraList[this.currentCameraIndex]; + this.cameraNicknameEditInProgress = true + }, + saveCameraNicknameChange() { + // This should already be handled but just to be safe + if(this.checkCameraName !== "") return; + + this.axios.post('http://' + this.$address + '/api/setCameraNickname', + {name: this.cameraTempNameValue, cameraIndex: this.$store.getters.currentCameraIndex}) + .then(() => { + this.$emit('camera-name-changed') + }) + .catch(e => { + console.log("HTTP error while changing camera name " + e); + this.$emit('camera-name-changed') + }) + + this.cameraNicknameEditInProgress = false; + }, readImportedCalibration(event) { // let formData = new FormData(); // formData.append("zipData", event.target.files[0]); From fee1079cdc6c53e9ec9e7733bebc276bcf8f0045 Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Sun, 18 Jun 2023 13:21:38 -0400 Subject: [PATCH 3/8] Remove option from PipelineView --- .../pipeline/CameraAndPipelineSelect.vue | 91 +------------------ 1 file changed, 3 insertions(+), 88 deletions(-) diff --git a/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue b/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue index 7fd3a1ccd9..01ca0f6f1e 100644 --- a/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue +++ b/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue @@ -12,53 +12,11 @@ class="pa-0" > - - - - -
- - -
{ return { - re: RegExp("^[A-Za-z0-9_ \\-)(]*[A-Za-z0-9][A-Za-z0-9_ \\-)(.]*$"), - isCameraNameEdit: false, - newCameraName: "", - cameraNameError: "", isPipelineNameEdit: false, namingDialog: false, newPipelineName: "", @@ -273,25 +227,10 @@ export default { } }, computed: { - checkCameraName() { - if (this.newCameraName !== this.$store.getters.cameraList[this.currentCameraIndex]) { - if (this.re.test(this.newCameraName)) { - for (let cam in this.cameraList) { - if (this.cameraList.hasOwnProperty(cam)) { - if (this.newCameraName === this.cameraList[cam]) { - return "A camera by that name already exists" - } - } - } - } else { - return "A camera name can only contain letters, numbers, and spaces" - } - } - return ""; - }, checkPipelineName() { if (this.newPipelineName !== this.$store.getters.pipelineList[this.currentPipelineIndex - 1] || !this.isPipelineNameEdit) { - if (this.re.test(this.newPipelineName)) { + const pipelineNameChangeRegex = RegExp("^[A-Za-z0-9_ \\-)(]*[A-Za-z0-9][A-Za-z0-9_ \\-)(.]*$") + if (pipelineNameChangeRegex.test(this.newPipelineName)) { for (let pipe in this.$store.getters.pipelineList) { if (this.$store.getters.pipelineList.hasOwnProperty(pipe)) { if (this.newPipelineName === this.$store.getters.pipelineList[pipe]) { @@ -341,30 +280,6 @@ export default { this.handleInputWithIndex('pipelineType', newIdx); this.showPipeTypeDialog = false; }, - changeCameraName() { - this.newCameraName = this.$store.getters.cameraList[this.currentCameraIndex]; - this.isCameraNameEdit = true; - }, - saveCameraNameChange() { - if (this.checkCameraName === "") { - // this.handleInputWithIndex("changeCameraName", this.newCameraName); - this.axios.post('http://' + this.$address + '/api/setCameraNickname', - {name: this.newCameraName, cameraIndex: this.$store.getters.currentCameraIndex}) - // eslint-disable-next-line - .then(r => { - this.$emit('camera-name-changed') - }) - .catch(e => { - console.log("HTTP error while changing camera name " + e); - this.$emit('camera-name-changed') - }) - this.discardCameraNameChange(); - } - }, - discardCameraNameChange() { - this.isCameraNameEdit = false; - this.newCameraName = ""; - }, toPipelineNameChange() { this.newPipelineName = this.$store.getters.pipelineList[this.currentPipelineIndex - 1]; this.isPipelineNameEdit = true; From 911bac80f39a97eb6ae757be276f01d3fd7ee6ba Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Sun, 18 Jun 2023 13:22:34 -0400 Subject: [PATCH 4/8] Update CamerasView.vue --- photon-client/src/views/CamerasView.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/photon-client/src/views/CamerasView.vue b/photon-client/src/views/CamerasView.vue index 2a9c41c089..ff1150ea3a 100644 --- a/photon-client/src/views/CamerasView.vue +++ b/photon-client/src/views/CamerasView.vue @@ -42,6 +42,7 @@ Date: Sun, 18 Jun 2023 20:19:19 -0400 Subject: [PATCH 5/8] [WIP] Add UI framework for JSON import and export --- .../pipeline/CameraAndPipelineSelect.vue | 147 +++++++++++++++++- 1 file changed, 146 insertions(+), 1 deletion(-) diff --git a/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue b/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue index 01ca0f6f1e..13bc33e42c 100644 --- a/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue +++ b/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue @@ -98,6 +98,26 @@ /> + + + + + + + + + + @@ -200,6 +220,85 @@ + + + Import Pipeline Settings + + Import a previously exported PhotonVision pipeline to this device. + + + + Select File + + + + + mdi-close + + + mdi-check-bold + + + +
+
+ + + + + + Import Pipeline + + + No, take me back + + +
+
+
+
@@ -223,7 +322,11 @@ export default { duplicateDialog: false, showPipeTypeDialog: false, proposedPipelineType : 0, - pipeIndexToDuplicate: undefined + pipeIndexToDuplicate: undefined, + + showPipeImportDialog: false, + pipelineImportData: undefined, + importedPipelineName: "" } }, computed: { @@ -267,6 +370,15 @@ export default { set(value) { value; // nop, since we have the dialog for this } + }, + checkImportedPipelineFile() { + if(this.pipelineImportData === undefined) { + return "No File Uploaded" + } else if(this.pipelineImportData === null) { + return "Corrupt or Malformed JSON File" + } else { + return "" + } } }, methods: { @@ -307,6 +419,26 @@ export default { this.discardPipelineNameChange(); } }, + handlePipelineImportFile(event) { + // TODO, parse required info. null if malformed, else data + event; + this.pipelineImportData = {} + }, + _checkPipelineName(name) { + const pipelineNameChangeRegex = RegExp("^[A-Za-z0-9_ \\-)(]*[A-Za-z0-9][A-Za-z0-9_ \\-)(.]*$") + if (pipelineNameChangeRegex.test(name)) { + for (let pipe in this.$store.getters.pipelineList) { + if (this.$store.getters.pipelineList.hasOwnProperty(pipe)) { + if (name === this.$store.getters.pipelineList[pipe]) { + return "A pipeline with this name already exists" + } + } + } + } else { + return "A pipeline name can only contain letters, numbers, and spaces" + } + return "" + }, duplicatePipeline() { this.handleInputWithIndex("duplicatePipeline", this.currentPipelineIndex); }, @@ -315,6 +447,19 @@ export default { this.isPipelineNameEdit = false; this.newPipelineName = ""; }, + exportPipelineToJson() { + // TODO determine what data needs to be exported, and export it to JSON + }, + createPipelineFromImportedFile() { + // this.pipelineImportData + // this.importedPipelineName + // TODO, create a new pipeline using the data, rename it using the name, then select it or whatever order the backend wants + }, + cancelPipelineImport() { + this.showPipeImportDialog = false; + this.pipelineImportData = undefined; + this.importedPipelineName = "" + } } } From 83b5231a0ae2937cf8cff0cc24999bc6c87f31e7 Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Mon, 26 Jun 2023 00:30:25 -0400 Subject: [PATCH 6/8] Update CamerasView.vue --- photon-client/src/views/CamerasView.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/photon-client/src/views/CamerasView.vue b/photon-client/src/views/CamerasView.vue index 8362ca864d..222d5a9e6c 100644 --- a/photon-client/src/views/CamerasView.vue +++ b/photon-client/src/views/CamerasView.vue @@ -484,7 +484,6 @@ export default { return { cameraNicknameEditInProgress : false, cameraTempNameValue: "", - snack: false, calibrationInProgress: false, calibrationFailed: false, filteredVideomodeIndex: 0, From 96501e7828dbb0ae92448dbe850e9154b6e1e98d Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Mon, 26 Jun 2023 01:52:29 -0400 Subject: [PATCH 7/8] Update CameraAndPipelineSelect.vue --- .../pipeline/CameraAndPipelineSelect.vue | 141 ------------------ 1 file changed, 141 deletions(-) diff --git a/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue b/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue index bc20c5218f..9a0306e0d9 100644 --- a/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue +++ b/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue @@ -106,26 +106,6 @@ /> - - - - - - - - - - @@ -228,85 +208,6 @@ - - - Import Pipeline Settings - - Import a previously exported PhotonVision pipeline to this device. - - - - Select File - - - - - mdi-close - - - mdi-check-bold - - - -
-
- - - - - - Import Pipeline - - - No, take me back - - -
-
-
-
@@ -382,15 +283,6 @@ export default { set(value) { value; // nop, since we have the dialog for this } - }, - checkImportedPipelineFile() { - if(this.pipelineImportData === undefined) { - return "No File Uploaded" - } else if(this.pipelineImportData === null) { - return "Corrupt or Malformed JSON File" - } else { - return "" - } } }, methods: { @@ -476,26 +368,6 @@ export default { this.discardPipelineNameChange(); } }, - handlePipelineImportFile(event) { - // TODO, parse required info. null if malformed, else data - event; - this.pipelineImportData = {} - }, - _checkPipelineName(name) { - const pipelineNameChangeRegex = RegExp("^[A-Za-z0-9_ \\-)(]*[A-Za-z0-9][A-Za-z0-9_ \\-)(.]*$") - if (pipelineNameChangeRegex.test(name)) { - for (let pipe in this.$store.getters.pipelineList) { - if (this.$store.getters.pipelineList.hasOwnProperty(pipe)) { - if (name === this.$store.getters.pipelineList[pipe]) { - return "A pipeline with this name already exists" - } - } - } - } else { - return "A pipeline name can only contain letters, numbers, and spaces" - } - return "" - }, duplicatePipeline() { this.handleInputWithIndex("duplicatePipeline", this.currentPipelineIndex); }, @@ -504,19 +376,6 @@ export default { this.isPipelineNameEdit = false; this.newPipelineName = ""; }, - exportPipelineToJson() { - // TODO determine what data needs to be exported, and export it to JSON - }, - createPipelineFromImportedFile() { - // this.pipelineImportData - // this.importedPipelineName - // TODO, create a new pipeline using the data, rename it using the name, then select it or whatever order the backend wants - }, - cancelPipelineImport() { - this.showPipeImportDialog = false; - this.pipelineImportData = undefined; - this.importedPipelineName = "" - } } } From f3ff5f0189e6260f034146d395f42a005350e725 Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Mon, 26 Jun 2023 02:02:59 -0400 Subject: [PATCH 8/8] Fix a bug where default Roboto font was used --- .../src/components/pipeline/CameraAndPipelineSelect.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue b/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue index 9a0306e0d9..4621f5953d 100644 --- a/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue +++ b/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue @@ -379,3 +379,9 @@ export default { } } + +