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/components/pipeline/CameraAndPipelineSelect.vue b/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue index 66c7404ec8..4621f5953d 100644 --- a/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue +++ b/photon-client/src/components/pipeline/CameraAndPipelineSelect.vue @@ -20,54 +20,12 @@ 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: "", @@ -278,6 +232,9 @@ export default { showPipeTypeDialog: false, proposedPipelineType : 0, pipeIndexToDuplicate: undefined, + showPipeImportDialog: false, + pipelineImportData: undefined, + importedPipelineName: "", snack: false, snackbar: { color: "success", @@ -286,25 +243,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]) { @@ -435,6 +377,11 @@ export default { this.newPipelineName = ""; }, } - } + + diff --git a/photon-client/src/views/CamerasView.vue b/photon-client/src/views/CamerasView.vue index 765832218f..222d5a9e6c 100644 --- a/photon-client/src/views/CamerasView.vue +++ b/photon-client/src/views/CamerasView.vue @@ -16,25 +16,71 @@ > Camera Settings
- + + + + + + + + + + + + +
@@ -419,10 +465,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, @@ -432,7 +482,8 @@ export default { }, data() { return { - calibrationDialog: false, + cameraNicknameEditInProgress : false, + cameraTempNameValue: "", calibrationInProgress: false, calibrationFailed: false, filteredVideomodeIndex: 0, @@ -603,8 +654,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]); 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("_", " ") }}