Skip to content

Commit 8967700

Browse files
authored
Merge pull request #17475 from rancher/gha-portpr-25312186428-1
[backport v2.14.2] Fix window manager
2 parents 5734574 + ce2da96 commit 8967700

5 files changed

Lines changed: 68 additions & 58 deletions

File tree

shell/components/nav/WindowManager/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const props = defineProps({
3636
3737
const { loadComponent } = useComponentsMount();
3838
39-
const { isPanelEnabled } = usePanelsHandler({ layout: props.layout, positions: props.positions });
39+
const { isPanelEnabled } = usePanelsHandler(props);
4040
const { tabs } = useTabsHandler();
4141
</script>
4242

@@ -66,6 +66,7 @@ const { tabs } = useTabsHandler();
6666
:active="true"
6767
:height="tab.containerHeight"
6868
:width="tab.containerWidth"
69+
:layout="layout"
6970
v-bind="tab.attrs"
7071
/>
7172
</keep-alive>

shell/components/templates/default.vue

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import ActionMenu from '@shell/components/ActionMenu';
99
import GrowlManager from '@shell/components/GrowlManager';
1010
import ModalManager from '@shell/components/ModalManager';
1111
import SlideInPanelManager from '@shell/components/SlideInPanelManager';
12-
import WindowManager from '@shell/components/nav/WindowManager';
1312
import PromptRemove from '@shell/components/PromptRemove';
1413
import PromptRestore from '@shell/components/PromptRestore';
1514
import PromptModal from '@shell/components/PromptModal';
@@ -39,7 +38,6 @@ export default {
3938
GrowlManager,
4039
ModalManager,
4140
SlideInPanelManager,
42-
WindowManager,
4341
FixedBanner,
4442
AwsComplianceBanner,
4543
Inactivity,
@@ -48,10 +46,11 @@ export default {
4846
4947
mixins: [PageHeaderActions, Brand, BrowserTabVisibility],
5048
49+
inject: ['notifyWmContainerReady'],
50+
5151
// Note - This will not run on route change
5252
data() {
5353
return {
54-
layout: Layout.default,
5554
noLocaleShortcut: process.env.dev || false,
5655
wantNavSync: false,
5756
};
@@ -104,6 +103,10 @@ export default {
104103
},
105104
},
106105
106+
mounted() {
107+
this.notifyWmContainerReady(Layout.default);
108+
},
109+
107110
methods: {
108111
109112
handlePageAction(action) {
@@ -219,7 +222,12 @@ export default {
219222
class="outlet"
220223
/>
221224
</main>
222-
<WindowManager :layout="layout" />
225+
<!-- Teleport target for WindowManager (unique per layout) -->
226+
<!-- display: contents makes child panels become grid items of the parent grid -->
227+
<div
228+
id="wm-container-default"
229+
style="display: contents;"
230+
/>
223231
</div>
224232
<FixedBanner :footer="true" />
225233
<GrowlManager />

shell/components/templates/home.vue

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import BrowserTabVisibility from '@shell/mixins/browser-tab-visibility';
1111
import Inactivity from '@shell/components/Inactivity';
1212
import { mapState, mapGetters } from 'vuex';
1313
import PromptModal from '@shell/components/PromptModal';
14-
import WindowManager from '@shell/components/nav/WindowManager';
1514
import { Layout } from '@shell/types/window-manager';
1615
1716
export default {
@@ -25,14 +24,14 @@ export default {
2524
AwsComplianceBanner,
2625
Inactivity,
2726
PromptModal,
28-
WindowManager
2927
},
3028
3129
mixins: [Brand, BrowserTabVisibility],
3230
31+
inject: ['notifyWmContainerReady'],
32+
3333
data() {
3434
return {
35-
layout: Layout.home,
3635
// Assume home pages have routes where the name is the key to use for string lookup
3736
name: this.$route.name,
3837
noLocaleShortcut: process.env.dev || false,
@@ -45,6 +44,10 @@ export default {
4544
...mapGetters(['showTopLevelMenu']),
4645
},
4746
47+
mounted() {
48+
this.notifyWmContainerReady(Layout.home);
49+
},
50+
4851
methods: {
4952
toggleTheme() {
5053
this.$store.dispatch('prefs/toggleTheme');
@@ -82,7 +85,12 @@ export default {
8285
class="outlet"
8386
/>
8487
</main>
85-
<WindowManager :layout="layout" />
88+
<!-- Teleport target for WindowManager (unique per layout) -->
89+
<!-- display: contents makes child panels become grid items of the parent grid -->
90+
<div
91+
id="wm-container-home"
92+
style="display: contents;"
93+
/>
8694
</div>
8795
<FixedBanner :footer="true" />
8896
<GrowlManager />
@@ -125,27 +133,6 @@ export default {
125133
}
126134
}
127135
128-
.wm {
129-
grid-area: wm;
130-
overflow-y: hidden;
131-
z-index: z-index('windowsManager');
132-
position: relative;
133-
}
134-
135-
.wm-vr {
136-
grid-area: wm-vr;
137-
overflow-y: hidden;
138-
z-index: z-index('windowsManager');
139-
position: relative;
140-
}
141-
142-
.wm-vl {
143-
grid-area: wm-vl;
144-
overflow-y: hidden;
145-
z-index: z-index('windowsManager');
146-
position: relative;
147-
}
148-
149136
MAIN {
150137
grid-area: main;
151138
overflow: auto;

shell/components/templates/plain.vue

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import BrowserTabVisibility from '@shell/mixins/browser-tab-visibility';
1414
import Inactivity from '@shell/components/Inactivity';
1515
import { mapGetters } from 'vuex';
1616
import PromptModal from '@shell/components/PromptModal';
17-
import WindowManager from '@shell/components/nav/WindowManager';
1817
import { Layout } from '@shell/types/window-manager';
1918
2019
export default {
@@ -31,17 +30,17 @@ export default {
3130
SlideInPanelManager,
3231
AwsComplianceBanner,
3332
Inactivity,
34-
WindowManager
3533
},
3634
3735
mixins: [Brand, BrowserTabVisibility],
3836
37+
inject: ['notifyWmContainerReady'],
38+
3939
data() {
4040
return {
4141
// Assume home pages have routes where the name is the key to use for string lookup
4242
name: this.$route.name,
43-
noLocaleShortcut: process.env.dev || false,
44-
layout: Layout.plain,
43+
noLocaleShortcut: process.env.dev || false
4544
};
4645
},
4746
@@ -50,6 +49,10 @@ export default {
5049
...mapGetters(['showTopLevelMenu']),
5150
},
5251
52+
mounted() {
53+
this.notifyWmContainerReady(Layout.plain);
54+
},
55+
5356
methods: {
5457
toggleTheme() {
5558
this.$store.dispatch('prefs/toggleTheme');
@@ -98,7 +101,12 @@ export default {
98101
@shortkey="toggleNoneLocale()"
99102
/>
100103
</main>
101-
<WindowManager :layout="layout" />
104+
<!-- Teleport target for WindowManager (unique per layout) -->
105+
<!-- display: contents makes child panels become grid items of the parent grid -->
106+
<div
107+
id="wm-container-plain"
108+
style="display: contents;"
109+
/>
102110
</div>
103111

104112
<FixedBanner :footer="true" />
@@ -130,27 +138,6 @@ export default {
130138
}
131139
}
132140
133-
.wm {
134-
grid-area: wm;
135-
overflow-y: hidden;
136-
z-index: z-index('windowsManager');
137-
position: relative;
138-
}
139-
140-
.wm-vr {
141-
grid-area: wm-vr;
142-
overflow-y: hidden;
143-
z-index: z-index('windowsManager');
144-
position: relative;
145-
}
146-
147-
.wm-vl {
148-
grid-area: wm-vl;
149-
overflow-y: hidden;
150-
z-index: z-index('windowsManager');
151-
position: relative;
152-
}
153-
154141
MAIN {
155142
grid-area: main;
156143
overflow: auto;

shell/initialize/App.vue

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
<script>
22
import GlobalLoading from '@shell/components/nav/GlobalLoading.vue';
3+
import WindowManager from '@shell/components/nav/WindowManager';
34
45
import '@shell/assets/styles/app.scss';
56
67
export default {
7-
data: () => ({ isOnline: true }),
8+
data() {
9+
return {
10+
isOnline: true,
11+
currentLayout: null,
12+
};
13+
},
814
915
created() {
1016
// add to window so we can listen when ready
@@ -36,6 +42,14 @@ export default {
3642
this.$loading = this.$refs.loading;
3743
},
3844
45+
provide() {
46+
return {
47+
notifyWmContainerReady: (layout) => {
48+
this.currentLayout = layout;
49+
}
50+
};
51+
},
52+
3953
computed: {
4054
isOffline() {
4155
return !this.isOnline;
@@ -55,7 +69,10 @@ export default {
5569
},
5670
},
5771
58-
components: { GlobalLoading }
72+
components: {
73+
GlobalLoading,
74+
WindowManager,
75+
}
5976
};
6077
</script>
6178
<template>
@@ -65,6 +82,16 @@ export default {
6582
id="__layout"
6683
>
6784
<router-view />
85+
<!--
86+
WindowManager is teleported into each template's wm-container
87+
This keeps a single instance that never re-mounts while appearing in each template
88+
-->
89+
<Teleport
90+
v-if="currentLayout"
91+
:to="`#wm-container-${currentLayout}`"
92+
>
93+
<WindowManager :layout="currentLayout" />
94+
</Teleport>
6895
</div>
6996
</div>
7097
</template>

0 commit comments

Comments
 (0)