From 8f4b6bb45dda9fd0872b85acc682d65b2748b059 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Mon, 5 May 2025 09:33:47 -0400 Subject: [PATCH 01/14] show save button in ide when dirtyflag is sent to parent --- src/api/renderer_api.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/api/renderer_api.js b/src/api/renderer_api.js index 646f18db3a..6574f134ad 100644 --- a/src/api/renderer_api.js +++ b/src/api/renderer_api.js @@ -176,6 +176,8 @@ export function renderer_api_notify(key, value) { sentValue = { isDirty: value } + // Dispatch to Vuex store with a boolean value + this.$store.dispatch('zap/setSaveButtonVisible', value) } window?.parent?.postMessage( { From 466abca429075e2a7d20ca0426d271cdff6013fc Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Mon, 5 May 2025 18:02:59 -0400 Subject: [PATCH 02/14] remove redundant logic --- src/api/renderer_api.js | 2 -- src/components/ZCLToolbar.vue | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/api/renderer_api.js b/src/api/renderer_api.js index 6574f134ad..646f18db3a 100644 --- a/src/api/renderer_api.js +++ b/src/api/renderer_api.js @@ -176,8 +176,6 @@ export function renderer_api_notify(key, value) { sentValue = { isDirty: value } - // Dispatch to Vuex store with a boolean value - this.$store.dispatch('zap/setSaveButtonVisible', value) } window?.parent?.postMessage( { diff --git a/src/components/ZCLToolbar.vue b/src/components/ZCLToolbar.vue index aee551bbff..ce13c44c4b 100644 --- a/src/components/ZCLToolbar.vue +++ b/src/components/ZCLToolbar.vue @@ -61,9 +61,7 @@ flat no-caps @click="saveChanges" - v-if=" - this.$store.state.zap.saveButtonVisible && this.$store.state.zap.isDirty - " + v-if="this.$store.state.zap.isDirty" >
From bc444e6b65115dacf029f40f35bba8b87b0d2f23 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Tue, 6 May 2025 13:45:43 -0400 Subject: [PATCH 03/14] no point in having the button disapear the way the current logic works --- src/components/ZCLToolbar.vue | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/components/ZCLToolbar.vue b/src/components/ZCLToolbar.vue index ce13c44c4b..91023f6c27 100644 --- a/src/components/ZCLToolbar.vue +++ b/src/components/ZCLToolbar.vue @@ -55,14 +55,7 @@
Generate
- +
Save
From d8fa40c42e2ec3d9eba2a808a655c04aac63e15c Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Tue, 6 May 2025 14:28:11 -0400 Subject: [PATCH 04/14] only show if stsApplication --- src/components/ZCLToolbar.vue | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/components/ZCLToolbar.vue b/src/components/ZCLToolbar.vue index 91023f6c27..010474e1a8 100644 --- a/src/components/ZCLToolbar.vue +++ b/src/components/ZCLToolbar.vue @@ -55,7 +55,14 @@
Generate
- +
Save
@@ -231,11 +238,25 @@ import * as dbEnum from '../../src-shared/db-enum.js' const rendApi = require(`../../src-shared/rend-api.js`) const restApi = require(`../../src-shared/rest-api.js`) const observable = require('../util/observable.js') +const querystring = require('querystring') import CommonMixin from '../util/common-mixin' export default { name: 'ZCLToolbar', mixins: [CommonMixin], computed: { + showSaveButton() { + let search = window.location.search + + if (search[0] === '?') { + search = search.substring(1) + } + query = querystring.parse(search) + if (this.query['stsApplication']) { + return true + } else { + return false + } + }, isCoreDocumentationAvailable() { return ( this.$store.state.zap.genericOptions[ @@ -290,7 +311,8 @@ export default { isExpanded: false, globalOptionsDialog: false, notification: '', - generationDirectory: '' + generationDirectory: '', + query: {} } }, methods: { From b27a311747842a1c1274f0c6299447188281a0ac Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Tue, 6 May 2025 14:45:06 -0400 Subject: [PATCH 05/14] cleanup --- src/App.vue | 27 +++++++++------------------ src/components/ZCLToolbar.vue | 15 +++++++++------ 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/src/App.vue b/src/App.vue index 7798897820..05991ca384 100644 --- a/src/App.vue +++ b/src/App.vue @@ -263,37 +263,28 @@ export default defineComponent({ ) }) } - - // Parse the query string into the front end. - let search = window.location.search - - if (search[0] === '?') { - search = search.substring(1) - } - - let query = querystring.parse(search) - if (query[`uiMode`]) { - this.$store.dispatch('zap/setDefaultUiMode', query[`uiMode`]) + if (this.query[`uiMode`]) { + this.$store.dispatch('zap/setDefaultUiMode', this.query[`uiMode`]) } - if (`debugNavBar` in query) { + if (`debugNavBar` in this.query) { this.$store.dispatch( 'zap/setDebugNavBar', - query[`debugNavBar`] === 'true' + this.query[`debugNavBar`] === 'true' ) } else { // If we don't specify it, default is on. this.$store.dispatch('zap/setDebugNavBar', true) } - if ('standalone' in query) { - this.$store.dispatch('zap/setStandalone', query['standalone']) + if ('standalone' in this.query) { + this.$store.dispatch('zap/setStandalone', this.query['standalone']) } - if (`setSaveButtonVisible` in query) { + if (`setSaveButtonVisible` in this.query) { this.$store.dispatch( 'zap/setSaveButtonVisible', - query[`setSaveButtonVisible`] === 'true' + this.query[`setSaveButtonVisible`] === 'true' ) } else { // If we don't specify it, default is off. @@ -318,7 +309,7 @@ export default defineComponent({ // load initial UC component state this.$store.dispatch(`zap/loadUcComponentState`) - if (query[`newConfig`]) { + if (this.query[`newConfig`]) { this.loadInitialEndpoints() } diff --git a/src/components/ZCLToolbar.vue b/src/components/ZCLToolbar.vue index 010474e1a8..5e01f1063b 100644 --- a/src/components/ZCLToolbar.vue +++ b/src/components/ZCLToolbar.vue @@ -245,12 +245,6 @@ export default { mixins: [CommonMixin], computed: { showSaveButton() { - let search = window.location.search - - if (search[0] === '?') { - search = search.substring(1) - } - query = querystring.parse(search) if (this.query['stsApplication']) { return true } else { @@ -374,6 +368,14 @@ export default { regenerateIntoDirectory(currentPath) { this.doGeneration(currentPath) }, + parseQueryString() { + let search = window.location.search + + if (search[0] === '?') { + search = search.substring(1) + } + this.query = querystring.parse(search) + }, getNotifications() { this.$serverGet(restApi.uri.unseenNotificationCount) .then((resp) => { @@ -385,6 +387,7 @@ export default { } }, mounted() { + this.parseQueryString() if (this.$onWebSocket) { this.$onWebSocket( dbEnum.wsCategory.notificationCount, From f7a3fff28a59b8f9f2edff135481ac3b477c30f7 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Tue, 6 May 2025 14:47:52 -0400 Subject: [PATCH 06/14] further cleanup --- src/App.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/App.vue b/src/App.vue index 05991ca384..bc184fbf4d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -138,6 +138,11 @@ export default defineComponent({ ZclTour }, mixins: [CommonMixin, uiOptions], + data() { + return { + query: {} // Initialize query as an empty object + } + }, computed: { endpointType: { get() { From 8cab06185ade15b97a491371cd551ce37efa169f Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Tue, 6 May 2025 14:55:22 -0400 Subject: [PATCH 07/14] further cleanup, adding query to state so do not have redundant logic --- src/App.vue | 9 +++------ src/components/ZCLToolbar.vue | 9 --------- src/store/zap/mutations.js | 4 ++++ src/store/zap/state.js | 1 + 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/App.vue b/src/App.vue index bc184fbf4d..39b5b1dbd9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -176,12 +176,9 @@ export default defineComponent({ }, methods: { parseQueryString() { - let search = window.location.search - - if (search[0] === '?') { - search = search.substring(1) - } - this.query = querystring.parse(search) + const searchParams = new URLSearchParams(window.location.search) + const query = Object.fromEntries(searchParams.entries()) // Parse query string into an object + this.$store.commit('zap/setQuery', query) // Store it in Vuex }, setTheme() { diff --git a/src/components/ZCLToolbar.vue b/src/components/ZCLToolbar.vue index 5e01f1063b..6384e7cfec 100644 --- a/src/components/ZCLToolbar.vue +++ b/src/components/ZCLToolbar.vue @@ -368,14 +368,6 @@ export default { regenerateIntoDirectory(currentPath) { this.doGeneration(currentPath) }, - parseQueryString() { - let search = window.location.search - - if (search[0] === '?') { - search = search.substring(1) - } - this.query = querystring.parse(search) - }, getNotifications() { this.$serverGet(restApi.uri.unseenNotificationCount) .then((resp) => { @@ -387,7 +379,6 @@ export default { } }, mounted() { - this.parseQueryString() if (this.$onWebSocket) { this.$onWebSocket( dbEnum.wsCategory.notificationCount, diff --git a/src/store/zap/mutations.js b/src/store/zap/mutations.js index 96a53b595c..675c905e00 100644 --- a/src/store/zap/mutations.js +++ b/src/store/zap/mutations.js @@ -49,6 +49,10 @@ export const updateShowDevTools = (state) => { state.showDevTools = !state.showDevTools } +export const setQuery = (state, query) => { + state.query = query +} + /** * Set the information text in the state * @param {*} state diff --git a/src/store/zap/state.js b/src/store/zap/state.js index 1c39e0460a..e888548c89 100644 --- a/src/store/zap/state.js +++ b/src/store/zap/state.js @@ -52,6 +52,7 @@ export default function () { featureMapValue: 0, zclDeviceTypes: {}, endpoints: [], + query: {}, genericOptions: {}, selectedGenericOptions: {}, projectPackages: [], From b00797b3075a8a77f9e550931a23d5c4f8204072 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Tue, 6 May 2025 14:58:10 -0400 Subject: [PATCH 08/14] more cleanup --- src/components/ZCLToolbar.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/ZCLToolbar.vue b/src/components/ZCLToolbar.vue index 6384e7cfec..c4e7f804b0 100644 --- a/src/components/ZCLToolbar.vue +++ b/src/components/ZCLToolbar.vue @@ -244,6 +244,9 @@ export default { name: 'ZCLToolbar', mixins: [CommonMixin], computed: { + query() { + return this.$store.state.zap.query // Access the query string from Vuex + }, showSaveButton() { if (this.query['stsApplication']) { return true @@ -305,8 +308,7 @@ export default { isExpanded: false, globalOptionsDialog: false, notification: '', - generationDirectory: '', - query: {} + generationDirectory: '' } }, methods: { From 9ba1f3fb5a7bb601b8894eeb6af078f92344e3ed Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Tue, 6 May 2025 15:03:35 -0400 Subject: [PATCH 09/14] even more cleanup --- src/App.vue | 8 +++----- src/components/ZCLToolbar.vue | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/App.vue b/src/App.vue index 39b5b1dbd9..8b05882b91 100644 --- a/src/App.vue +++ b/src/App.vue @@ -138,11 +138,6 @@ export default defineComponent({ ZclTour }, mixins: [CommonMixin, uiOptions], - data() { - return { - query: {} // Initialize query as an empty object - } - }, computed: { endpointType: { get() { @@ -157,6 +152,9 @@ export default defineComponent({ showExceptionIcon() { return this.$store.state.zap.showExceptionIcon }, + query() { + return this.$store.state.zap.query // Access the query string from Vuex + }, uiThemeCategory: { get() { if (this.$store.state.zap.isMultiConfig) { diff --git a/src/components/ZCLToolbar.vue b/src/components/ZCLToolbar.vue index c4e7f804b0..eeb8841d19 100644 --- a/src/components/ZCLToolbar.vue +++ b/src/components/ZCLToolbar.vue @@ -248,6 +248,7 @@ export default { return this.$store.state.zap.query // Access the query string from Vuex }, showSaveButton() { + console.log(this.query) if (this.query['stsApplication']) { return true } else { From 2952ac72b9c854676323b51777f868f3796c011b Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Tue, 6 May 2025 15:05:45 -0400 Subject: [PATCH 10/14] more cleanup --- src/components/ZCLToolbar.vue | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/components/ZCLToolbar.vue b/src/components/ZCLToolbar.vue index eeb8841d19..b13f017445 100644 --- a/src/components/ZCLToolbar.vue +++ b/src/components/ZCLToolbar.vue @@ -248,12 +248,7 @@ export default { return this.$store.state.zap.query // Access the query string from Vuex }, showSaveButton() { - console.log(this.query) - if (this.query['stsApplication']) { - return true - } else { - return false - } + return !!this.query?.stsApplication // Use optional chaining and double negation for clarity }, isCoreDocumentationAvailable() { return ( From f1b3e2db29ebd63cc6a3c5cc1c28bf0717548152 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Tue, 6 May 2025 15:08:03 -0400 Subject: [PATCH 11/14] cleanup --- src/components/ZCLToolbar.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/ZCLToolbar.vue b/src/components/ZCLToolbar.vue index b13f017445..3370356ab3 100644 --- a/src/components/ZCLToolbar.vue +++ b/src/components/ZCLToolbar.vue @@ -238,7 +238,6 @@ import * as dbEnum from '../../src-shared/db-enum.js' const rendApi = require(`../../src-shared/rend-api.js`) const restApi = require(`../../src-shared/rest-api.js`) const observable = require('../util/observable.js') -const querystring = require('querystring') import CommonMixin from '../util/common-mixin' export default { name: 'ZCLToolbar', From 21f3dc608b49f847013915f7d0def9e1a01b5168 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Wed, 21 May 2025 11:21:20 -0400 Subject: [PATCH 12/14] remove unused code --- src/store/zap/actions.js | 9 --------- src/store/zap/mutations.js | 9 --------- src/store/zap/state.js | 2 -- 3 files changed, 20 deletions(-) diff --git a/src/store/zap/actions.js b/src/store/zap/actions.js index 4eba9f4410..44284d530f 100644 --- a/src/store/zap/actions.js +++ b/src/store/zap/actions.js @@ -1171,15 +1171,6 @@ export function setDebugNavBar(context, debugNavBar) { context.commit('setDebugNavBar', debugNavBar) } -/** - * Show or hide the Save button in ZAP UI. - * @param {*} context - * @param {*} saveButtonVisible - */ -export function setSaveButtonVisible(context, saveButtonVisible) { - context.commit('setSaveButtonVisible', saveButtonVisible) -} - /** * Set the mode of ZAP UI. * @param {*} context diff --git a/src/store/zap/mutations.js b/src/store/zap/mutations.js index 675c905e00..6d27f93bf2 100644 --- a/src/store/zap/mutations.js +++ b/src/store/zap/mutations.js @@ -789,15 +789,6 @@ export function setDebugNavBar(state, debugNavBar) { state.debugNavBar = debugNavBar } -/** - * Show save button in the UI using the state. - * @param {*} state - * @param {*} saveButtonVisible - */ -export function setSaveButtonVisible(state, saveButtonVisible) { - state.saveButtonVisible = saveButtonVisible -} - /** * Set standalone mode for ZAP using the state. * @param {*} state diff --git a/src/store/zap/state.js b/src/store/zap/state.js index e888548c89..9e82c17ded 100644 --- a/src/store/zap/state.js +++ b/src/store/zap/state.js @@ -57,8 +57,6 @@ export default function () { selectedGenericOptions: {}, projectPackages: [], allPackages: [], - isDirty: false, - saveButtonVisible: false, clusterManager: { openDomains: {}, lastSelectedDomain: null, From 3798ab285fc299d4f25ffcc00cddaf841ebd6af4 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Wed, 21 May 2025 14:49:48 -0400 Subject: [PATCH 13/14] bug fix --- src/components/ZCLToolbar.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ZCLToolbar.vue b/src/components/ZCLToolbar.vue index 3370356ab3..1f9ca229cf 100644 --- a/src/components/ZCLToolbar.vue +++ b/src/components/ZCLToolbar.vue @@ -247,7 +247,7 @@ export default { return this.$store.state.zap.query // Access the query string from Vuex }, showSaveButton() { - return !!this.query?.stsApplication // Use optional chaining and double negation for clarity + return !!this.query['stsApplication'] // Use optional chaining and double negation for clarity }, isCoreDocumentationAvailable() { return ( From 43a94ccbea9caf8b2f0e7118a4ded5698afa0e07 Mon Sep 17 00:00:00 2001 From: Paul Regan Date: Wed, 21 May 2025 15:39:48 -0400 Subject: [PATCH 14/14] bug fix --- src/components/ZCLToolbar.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ZCLToolbar.vue b/src/components/ZCLToolbar.vue index 1f9ca229cf..161d652b59 100644 --- a/src/components/ZCLToolbar.vue +++ b/src/components/ZCLToolbar.vue @@ -247,7 +247,7 @@ export default { return this.$store.state.zap.query // Access the query string from Vuex }, showSaveButton() { - return !!this.query['stsApplication'] // Use optional chaining and double negation for clarity + return !!this.query['stsApplicationId'] // Use optional chaining and double negation for clarity }, isCoreDocumentationAvailable() { return (