From 71c03940b2a3e8c08150fa6c356b0009d438838a Mon Sep 17 00:00:00 2001 From: Giuseppe Leo Date: Fri, 9 Aug 2024 15:45:29 +0200 Subject: [PATCH] Restore Harvester nuxt global vars in app init (#11618) --- shell/initialize/App.vue | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/shell/initialize/App.vue b/shell/initialize/App.vue index f473fe1d0ac..2d2797f68c5 100644 --- a/shell/initialize/App.vue +++ b/shell/initialize/App.vue @@ -15,6 +15,19 @@ export default { // add to window so we can listen when ready window.$globalApp = this; + // This is needed for Harvester https://github.com/rancher/dashboard/issues/10681 + const isHarvester = this.$globalApp?.$store.getters['currentCluster']?.isHarvester; + + if (!isHarvester) { + Object.defineProperty(window, '$nuxt', { + get() { + console.warn('window.$nuxt is deprecated. It would be best to stop using globalState all together. For an alternative you can use window.$globalApp.'); // eslint-disable-line no-console + + return window.$globalApp; + } + }); + } + this.refreshOnlineStatus(); // Setup the listeners window.addEventListener('online', this.refreshOnlineStatus);