Skip to content

Commit fa8ba17

Browse files
authored
Dedicated route for Extensions Catalog (#16021)
* working on dedicated route and view for extensions catalog page * minor fix
1 parent b32e5c5 commit fa8ba17

File tree

4 files changed

+264
-185
lines changed

4 files changed

+264
-185
lines changed

shell/assets/translations/en-us.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5328,7 +5328,7 @@ plugins:
53285328
warnNoAuth: This version of the extension will be loaded before authentication and will have access to the login process.
53295329
manageCatalog:
53305330
label: Manage Extension Catalogs
5331-
title: Extension
5331+
title: Extensions
53325332
subtitle: Catalogs
53335333
imageLoad:
53345334
load: Import Extension Catalog

shell/config/router/routes.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,13 @@ export default [
8181
{
8282
path: '/c/:cluster/uiplugins',
8383
name: 'c-cluster-uiplugins',
84-
component: () => interopDefault(import('@shell/pages/c/_cluster/uiplugins/index.vue')),
84+
component: () => interopDefault(import('@shell/pages/c/_cluster/uiplugins/index.vue'))
85+
},
86+
{
87+
path: '/c/:cluster/uiplugins/catalogs',
88+
component: () => interopDefault(import('@shell/pages/c/_cluster/uiplugins/catalogs.vue')),
89+
name: 'c-cluster-uiplugins-catalogs'
8590
},
86-
8791
{
8892
path: '/diagnostic',
8993
component: () => interopDefault(import('@shell/pages/diagnostic.vue')),
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
2+
<script>
3+
import CatalogList from './CatalogList/index.vue';
4+
5+
export default {
6+
name: 'ExtensionsAirgappedView',
7+
components: { CatalogList },
8+
data() {
9+
return {
10+
extensionsPageLink: {
11+
name: 'c-cluster-uiplugins',
12+
params: { cluster: this.$route.params.cluster }
13+
},
14+
reloadRequired: false
15+
};
16+
},
17+
methods: {
18+
returnToExtensionsPage() {
19+
this.$router.push(this.extensionsPageLink);
20+
},
21+
reload() {
22+
this.$router.go();
23+
},
24+
showCatalogLoadDialog() {
25+
this.$store.dispatch('management/promptModal', {
26+
component: 'ExtensionCatalogInstallDialog',
27+
returnFocusSelector: '[data-testid="extensions-catalog-load-dialog"]',
28+
componentProps: {
29+
refresh: () => {
30+
this.reloadRequired = true;
31+
}
32+
}
33+
});
34+
},
35+
showCatalogUninstallDialog(ev) {
36+
this.$store.dispatch('management/promptModal', {
37+
component: 'ExtensionCatalogUninstallDialog',
38+
returnFocusSelector: '[data-testid="extensions-catalog-load-dialog"]',
39+
componentProps: {
40+
catalog: ev,
41+
refresh: () => {
42+
this.reloadRequired = true;
43+
}
44+
}
45+
});
46+
},
47+
}
48+
};
49+
</script>
50+
51+
<template>
52+
<div id="extensions-airgapped-main-page">
53+
<div class="plugin-header">
54+
<!-- catalog/airgapped header -->
55+
<div class="catalog-title">
56+
<h2
57+
class="mb-0 mr-10"
58+
data-testid="extensions-catalog-title"
59+
>
60+
<a
61+
class="link"
62+
role="link"
63+
tabindex="0"
64+
:aria-label="t('plugins.manageCatalog.title')"
65+
@click="returnToExtensionsPage()"
66+
>
67+
{{ t('plugins.manageCatalog.title') }}:
68+
</a>
69+
<t k="plugins.manageCatalog.subtitle" />
70+
</h2>
71+
</div>
72+
<div class="actions-container">
73+
<!-- extensions reload toast/notification -->
74+
<div
75+
v-if="reloadRequired"
76+
class="plugin-reload-banner mmr-6"
77+
data-testid="extension-reload-banner"
78+
>
79+
<i class="icon icon-checkmark mr-10" />
80+
<span>
81+
{{ t('plugins.reload') }}
82+
</span>
83+
<button
84+
class="ml-10 btn btn-sm role-primary"
85+
data-testid="extension-reload-banner-reload-btn"
86+
role="button"
87+
:aria-label="t('plugins.labels.reloadRancher')"
88+
@click="reload()"
89+
>
90+
{{ t('generic.reload') }}
91+
</button>
92+
</div>
93+
</div>
94+
</div>
95+
<div>
96+
<!-- Catalog list view -->
97+
<CatalogList
98+
@showCatalogLoadDialog="showCatalogLoadDialog"
99+
@showCatalogUninstallDialog="showCatalogUninstallDialog($event)"
100+
/>
101+
</div>
102+
</div>
103+
</template>
104+
105+
<style lang="scss" scoped>
106+
.plugin-header {
107+
display: flex;
108+
align-items: center;
109+
justify-content: space-between;
110+
margin-bottom: 10px;
111+
112+
.catalog-title {
113+
display: flex;
114+
flex-direction: row;
115+
align-items: center;
116+
}
117+
118+
> h2 {
119+
flex: 1;
120+
margin-bottom: 0;
121+
}
122+
123+
.link {
124+
cursor: pointer;
125+
}
126+
}
127+
128+
.plugin-reload-banner {
129+
align-items: center;
130+
background-color: var(--success-banner-bg);
131+
display: flex;
132+
padding: 4px 4px 4px 12px;
133+
border-radius: 5px;
134+
min-height: 36px;
135+
136+
> i {
137+
color: var(--success);
138+
font-size: 14px;
139+
font-weight: bold;
140+
}
141+
142+
> button {
143+
line-height: 30px;
144+
min-height: 30px;
145+
}
146+
}
147+
</style>

0 commit comments

Comments
 (0)