From 9b03c7845bff7c4615467bc4f5bb35310972e9d7 Mon Sep 17 00:00:00 2001 From: Daan Hoogland Date: Sun, 9 Mar 2025 20:34:49 +0100 Subject: [PATCH 1/5] remove double listUsers call --- ui/src/store/modules/user.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js index bd0afaa17bf7..be5b4667121c 100644 --- a/ui/src/store/modules/user.js +++ b/ui/src/store/modules/user.js @@ -311,17 +311,6 @@ const user = { commit('SET_TIMEZONE_OFFSET', cachedTimezoneOffset) commit('SET_USE_BROWSER_TIMEZONE', cachedUseBrowserTimezone) commit('SET_CUSTOM_COLUMNS', cachedCustomColumns) - - // Ensuring we get the user info so that store.getters.user is never empty when the page is freshly loaded - api('listUsers', { username: Cookies.get('username'), listall: true }).then(response => { - const result = response.listusersresponse.user[0] - commit('SET_INFO', result) - commit('SET_NAME', result.firstname + ' ' + result.lastname) - store.dispatch('SetCsLatestVersion', result.rolename) - resolve(cachedApis) - }).catch(error => { - reject(error) - }) } else if (store.getters.loginFlag) { const hide = message.loading(i18n.global.t('message.discovering.feature'), 0) api('listZones').then(json => { From 9c4fb52e3c57ef8823ceb35eb1a2674525f4697a Mon Sep 17 00:00:00 2001 From: Daan Hoogland Date: Mon, 10 Mar 2025 09:03:46 +0100 Subject: [PATCH 2/5] Revert "remove double listUsers call" This reverts commit 9b03c7845bff7c4615467bc4f5bb35310972e9d7. --- ui/src/store/modules/user.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js index be5b4667121c..bd0afaa17bf7 100644 --- a/ui/src/store/modules/user.js +++ b/ui/src/store/modules/user.js @@ -311,6 +311,17 @@ const user = { commit('SET_TIMEZONE_OFFSET', cachedTimezoneOffset) commit('SET_USE_BROWSER_TIMEZONE', cachedUseBrowserTimezone) commit('SET_CUSTOM_COLUMNS', cachedCustomColumns) + + // Ensuring we get the user info so that store.getters.user is never empty when the page is freshly loaded + api('listUsers', { username: Cookies.get('username'), listall: true }).then(response => { + const result = response.listusersresponse.user[0] + commit('SET_INFO', result) + commit('SET_NAME', result.firstname + ' ' + result.lastname) + store.dispatch('SetCsLatestVersion', result.rolename) + resolve(cachedApis) + }).catch(error => { + reject(error) + }) } else if (store.getters.loginFlag) { const hide = message.loading(i18n.global.t('message.discovering.feature'), 0) api('listZones').then(json => { From 7c041f92a380849596154b615be1c664d6cf1dc3 Mon Sep 17 00:00:00 2001 From: Daan Hoogland Date: Mon, 10 Mar 2025 09:05:01 +0100 Subject: [PATCH 3/5] remove second cross check to github --- ui/src/store/modules/user.js | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js index bd0afaa17bf7..c864561fa0d9 100644 --- a/ui/src/store/modules/user.js +++ b/ui/src/store/modules/user.js @@ -390,7 +390,6 @@ const user = { const result = response.listusersresponse.user[0] commit('SET_INFO', result) commit('SET_NAME', result.firstname + ' ' + result.lastname) - store.dispatch('SetCsLatestVersion', result.rolename) }).catch(error => { reject(error) }) From 232df43b54f59294796224c3e637774b8d951376 Mon Sep 17 00:00:00 2001 From: Daan Hoogland Date: Mon, 10 Mar 2025 10:30:01 +0100 Subject: [PATCH 4/5] add option to cross check versions --- ui/public/config.json | 3 ++- ui/src/store/modules/user.js | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/public/config.json b/ui/public/config.json index 38d1fd9bbe71..64d102841862 100644 --- a/ui/public/config.json +++ b/ui/public/config.json @@ -97,5 +97,6 @@ "basicZoneEnabled": true, "multipleServer": false, "allowSettingTheme": true, - "docHelpMappings": {} + "docHelpMappings": {}, + "notifyLatestCSVersion": true } diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js index c864561fa0d9..50777eb1c109 100644 --- a/ui/src/store/modules/user.js +++ b/ui/src/store/modules/user.js @@ -317,7 +317,6 @@ const user = { const result = response.listusersresponse.user[0] commit('SET_INFO', result) commit('SET_NAME', result.firstname + ' ' + result.lastname) - store.dispatch('SetCsLatestVersion', result.rolename) resolve(cachedApis) }).catch(error => { reject(error) @@ -390,6 +389,7 @@ const user = { const result = response.listusersresponse.user[0] commit('SET_INFO', result) commit('SET_NAME', result.firstname + ' ' + result.lastname) + store.dispatch('SetCsLatestVersion', result.rolename) }).catch(error => { reject(error) }) @@ -555,6 +555,9 @@ const user = { commit('SET_DOMAIN_STORE', domainStore) }, SetCsLatestVersion ({ commit }, rolename) { + if (!config.notifyLatestCSVersion) { + return + } const lastFetchTs = store.getters.latestVersion?.fetchedTs ? store.getters.latestVersion.fetchedTs : 0 if (rolename === 'Root Admin' && (+new Date() - lastFetchTs) > 24 * 60 * 60 * 1000) { axios.get( From 8aae38e4ae984ffe0943985ee593fd3b18037465 Mon Sep 17 00:00:00 2001 From: dahn Date: Mon, 10 Mar 2025 10:46:54 +0100 Subject: [PATCH 5/5] Update ui/src/store/modules/user.js Co-authored-by: Vishesh --- ui/src/store/modules/user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js index 50777eb1c109..78c0612bd4aa 100644 --- a/ui/src/store/modules/user.js +++ b/ui/src/store/modules/user.js @@ -555,7 +555,7 @@ const user = { commit('SET_DOMAIN_STORE', domainStore) }, SetCsLatestVersion ({ commit }, rolename) { - if (!config.notifyLatestCSVersion) { + if (!vueProps.$config.notifyLatestCSVersion) { return } const lastFetchTs = store.getters.latestVersion?.fetchedTs ? store.getters.latestVersion.fetchedTs : 0