From 325b7b1a8edc09bb5ae1ae824c472b6fb69abfb4 Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Wed, 6 Sep 2023 14:11:23 -0700 Subject: [PATCH 1/2] Watch k8s state instead of Image Manager State The Image Manager state only goes through a single cycle to become active during startup. This means that the Image Manager remains in an active state whenever Rancher Desktop requires a restart, so it's more accurate to rely on the K8S state when updating the title area. Signed-off-by: Phillip Rak --- pkg/rancher-desktop/pages/Images.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/rancher-desktop/pages/Images.vue b/pkg/rancher-desktop/pages/Images.vue index 4e70d5f04a8..98f506eac3a 100644 --- a/pkg/rancher-desktop/pages/Images.vue +++ b/pkg/rancher-desktop/pages/Images.vue @@ -67,14 +67,14 @@ export default { }, watch: { - imageManagerState: { + state: { handler(state) { this.$store.dispatch( 'page/setHeader', { title: this.t('images.title') }, ); - if (!state) { + if (!state || state === 'IMAGE_MANAGER_UNREADY') { return; } From 23548370f0bcab139b9547965024b92c26ba0488 Mon Sep 17 00:00:00 2001 From: Phillip Rak Date: Wed, 6 Sep 2023 14:16:37 -0700 Subject: [PATCH 2/2] Create javascript enum for Image Manager States Signed-off-by: Phillip Rak --- pkg/rancher-desktop/pages/Images.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/rancher-desktop/pages/Images.vue b/pkg/rancher-desktop/pages/Images.vue index 98f506eac3a..363f94c8d2d 100644 --- a/pkg/rancher-desktop/pages/Images.vue +++ b/pkg/rancher-desktop/pages/Images.vue @@ -26,6 +26,11 @@ import Images from '@pkg/components/Images.vue'; import { defaultSettings } from '@pkg/config/settings'; import { ipcRenderer } from '@pkg/utils/ipcRenderer'; +const ImageMangerStates = Object.freeze({ + UNREADY: 'IMAGE_MANAGER_UNREADY', + READY: 'READY', +}); + export default { components: { Images }, data() { @@ -40,10 +45,10 @@ export default { computed: { state() { if (![K8sState.STARTED, K8sState.DISABLED].includes(this.k8sState)) { - return 'IMAGE_MANAGER_UNREADY'; + return ImageMangerStates.UNREADY; } - return this.imageManagerState ? 'READY' : 'IMAGE_MANAGER_UNREADY'; + return this.imageManagerState ? ImageMangerStates.READY : ImageMangerStates.UNREADY; }, rancherImages() { return this.images @@ -74,7 +79,7 @@ export default { { title: this.t('images.title') }, ); - if (!state || state === 'IMAGE_MANAGER_UNREADY') { + if (!state || state === ImageMangerStates.UNREADY) { return; }