@rancher/shell 0.1.3 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/assets/brand/suse/dark/rancher-logo.svg +1 -148
  2. package/assets/brand/suse/favicon.png +0 -0
  3. package/assets/brand/suse/rancher-logo.svg +1 -130
  4. package/assets/images/featured/img1.jpg +0 -0
  5. package/assets/images/featured.jpg +0 -0
  6. package/assets/images/generic-plugin.svg +1 -0
  7. package/assets/styles/themes/_dark.scss +3 -0
  8. package/assets/styles/themes/_light.scss +3 -0
  9. package/assets/styles/themes/_suse.scss +1 -1
  10. package/assets/translations/en-us.yaml +219 -47
  11. package/assets/translations/zh-hans.yaml +21 -24
  12. package/components/AsyncButton.vue +17 -2
  13. package/components/ButtonDropdown.vue +4 -0
  14. package/components/Carousel.vue +291 -0
  15. package/components/CommunityLinks.vue +64 -22
  16. package/components/CruResource.vue +11 -3
  17. package/components/Dialog.vue +102 -0
  18. package/components/ExplorerMembers.vue +2 -4
  19. package/components/ExplorerProjectsNamespaces.vue +25 -9
  20. package/components/IconMessage.vue +9 -1
  21. package/components/LazyImage.vue +21 -8
  22. package/components/LocaleSelector.vue +62 -29
  23. package/components/PromptRemove.vue +2 -2
  24. package/components/ResourceList/Masthead.vue +21 -1
  25. package/components/ResourceList/ResourceLoadingIndicator.vue +0 -8
  26. package/components/ResourceList/index.vue +9 -23
  27. package/components/ResourceTable.vue +7 -2
  28. package/components/SimpleBox.vue +6 -4
  29. package/components/SortableTable/index.vue +18 -25
  30. package/components/Tabbed/Tab.vue +5 -0
  31. package/components/Tabbed/index.vue +54 -9
  32. package/components/TypeDescription.vue +10 -1
  33. package/components/auth/Principal.vue +1 -0
  34. package/components/fleet/FleetBundles.vue +8 -3
  35. package/components/fleet/FleetClusters.vue +6 -0
  36. package/components/fleet/FleetRepos.vue +7 -1
  37. package/components/fleet/FleetSummary.vue +6 -0
  38. package/components/form/Command.vue +5 -0
  39. package/components/form/EnvVars.vue +5 -0
  40. package/components/form/KeyValue.vue +80 -58
  41. package/components/form/NameNsDescription.vue +13 -5
  42. package/components/form/NodeScheduling.vue +6 -1
  43. package/components/form/PodAffinity.vue +5 -0
  44. package/components/form/ResourceTabs/index.vue +5 -1
  45. package/components/form/ServiceNameSelect.vue +5 -0
  46. package/components/form/ValueFromResource.vue +7 -1
  47. package/components/formatter/ClusterLink.vue +3 -7
  48. package/components/nav/NamespaceFilter.vue +3 -3
  49. package/components/nav/TopLevelMenu.vue +12 -29
  50. package/config/home-links.js +155 -0
  51. package/config/labels-annotations.js +2 -1
  52. package/config/private-label.js +1 -1
  53. package/config/product/explorer.js +5 -4
  54. package/config/product/legacy.js +0 -47
  55. package/config/product/manager.js +0 -2
  56. package/config/product/multi-cluster-apps.js +0 -12
  57. package/config/product/settings.js +12 -1
  58. package/config/product/uiplugins.js +17 -0
  59. package/config/settings.js +23 -2
  60. package/config/types.js +5 -1
  61. package/config/uiplugins.js +117 -0
  62. package/config/version.js +17 -0
  63. package/content/docs/en-us/getting-started.md +1 -26
  64. package/core/plugin.ts +12 -0
  65. package/core/plugins.js +38 -2
  66. package/core/types.ts +6 -0
  67. package/creators/app/{.eslintignore → files/.eslintignore} +0 -0
  68. package/creators/app/{.eslintrc.js → files/.eslintrc.js} +0 -0
  69. package/creators/app/{.vscode → files/.vscode}/settings.json +0 -0
  70. package/creators/app/{babel.config.js → files/babel.config.js} +0 -0
  71. package/creators/app/{nuxt.config.js → files/nuxt.config.js} +0 -0
  72. package/creators/app/{tsconfig.json → files/tsconfig.json} +2 -1
  73. package/creators/app/init +16 -17
  74. package/creators/app/package.json +6 -0
  75. package/creators/pkg/{babel.config.js → files/babel.config.js} +0 -0
  76. package/creators/pkg/{index.ts → files/index.ts} +0 -0
  77. package/creators/pkg/{tsconfig.json → files/tsconfig.json} +13 -12
  78. package/creators/pkg/{vue.config.js → files/vue.config.js} +0 -0
  79. package/creators/pkg/init +1 -1
  80. package/creators/update/init +54 -0
  81. package/creators/update/package.json +20 -0
  82. package/creators/update/upgrade +56 -0
  83. package/creators/update/yarn-error.log +54 -0
  84. package/detail/provisioning.cattle.io.cluster.vue +3 -3
  85. package/detail/workload/index.vue +3 -2
  86. package/dialog/DiagnosticTimingsDialog.vue +116 -0
  87. package/dialog/RotateCertificatesDialog.vue +9 -3
  88. package/edit/auth/azuread.vue +28 -9
  89. package/edit/networking.k8s.io.ingress/index.vue +2 -2
  90. package/edit/persistentvolume/index.vue +51 -13
  91. package/edit/persistentvolumeclaim.vue +31 -13
  92. package/edit/pod.vue +27 -0
  93. package/edit/provisioning.cattle.io.cluster/rke2.vue +103 -24
  94. package/edit/service.vue +7 -5
  95. package/edit/workload/__tests__/Upgrading.test.ts +1 -0
  96. package/edit/workload/index.vue +32 -10
  97. package/edit/workload/mixins/workload.js +121 -126
  98. package/edit/workload/storage/ContainerMountPaths.vue +240 -0
  99. package/edit/workload/storage/Mount.vue +1 -0
  100. package/edit/workload/storage/awsElasticBlockStore.vue +20 -1
  101. package/edit/workload/storage/azureDisk.vue +22 -2
  102. package/edit/workload/storage/azureFile.vue +20 -2
  103. package/edit/workload/storage/csi/index.vue +23 -1
  104. package/edit/workload/storage/gcePersistentDisk.vue +20 -2
  105. package/edit/workload/storage/index.vue +33 -65
  106. package/edit/workload/storage/persistentVolumeClaim/index.vue +5 -0
  107. package/edit/workload/storage/secret.vue +6 -1
  108. package/edit/workload/storage/vsphereVolume.vue +11 -1
  109. package/layouts/default.vue +14 -8
  110. package/layouts/home.vue +9 -4
  111. package/layouts/plain.vue +10 -5
  112. package/list/catalog.cattle.io.app.vue +10 -9
  113. package/list/catalog.cattle.io.clusterrepo.vue +6 -61
  114. package/list/cis.cattle.io.clusterscan.vue +12 -12
  115. package/list/fleet.cattle.io.bundle.vue +33 -28
  116. package/list/fleet.cattle.io.cluster.vue +26 -22
  117. package/list/fleet.cattle.io.clustergroup.vue +6 -0
  118. package/list/fleet.cattle.io.clusterregistrationtoken.vue +28 -24
  119. package/list/fleet.cattle.io.gitrepo.vue +25 -14
  120. package/list/helm.cattle.io.projecthelmchart.vue +52 -33
  121. package/list/logging.banzaicloud.io.clusterflow.vue +7 -12
  122. package/list/logging.banzaicloud.io.flow.vue +7 -14
  123. package/list/management.cattle.io.cluster.vue +26 -15
  124. package/list/management.cattle.io.feature.vue +13 -8
  125. package/list/management.cattle.io.setting.vue +3 -3
  126. package/list/management.cattle.io.user.vue +38 -19
  127. package/list/monitoring.coreos.com.alertmanagerconfig.vue +8 -15
  128. package/list/namespace.vue +14 -1
  129. package/list/node.vue +13 -16
  130. package/list/persistentvolume.vue +16 -9
  131. package/list/persistentvolumeclaim.vue +5 -8
  132. package/list/provisioning.cattle.io.cluster.vue +35 -9
  133. package/list/service.vue +24 -12
  134. package/list/ui.cattle.io.navlink.vue +6 -0
  135. package/list/workload.vue +2 -2
  136. package/machine-config/harvester.vue +5 -3
  137. package/middleware/authenticated.js +6 -0
  138. package/mixins/resource-fetch.js +12 -18
  139. package/mixins/resource-manager.js +126 -0
  140. package/models/catalog.cattle.io.uiplugin.js +38 -0
  141. package/models/cluster/node.js +25 -2
  142. package/models/fleet.cattle.io.bundle.js +1 -1
  143. package/models/harvesterhci.io.management.cluster.js +11 -5
  144. package/models/pod.js +15 -5
  145. package/models/provisioning.cattle.io.cluster.js +16 -6
  146. package/models/workload.js +5 -3
  147. package/models/workload.service.js +10 -0
  148. package/nuxt.config.js +70 -25
  149. package/package.json +108 -109
  150. package/pages/auth/login.vue +11 -1
  151. package/pages/auth/verify.vue +9 -0
  152. package/pages/c/_cluster/apps/charts/index.vue +46 -1
  153. package/pages/c/_cluster/apps/charts/install.vue +10 -9
  154. package/pages/c/_cluster/explorer/index.vue +72 -9
  155. package/pages/c/_cluster/explorer/tools/index.vue +12 -5
  156. package/pages/c/_cluster/mcapps/index.vue +1 -1
  157. package/pages/c/_cluster/settings/DefaultLinksEditor.vue +108 -0
  158. package/pages/c/_cluster/settings/brand.vue +0 -40
  159. package/pages/c/_cluster/settings/links.vue +152 -0
  160. package/pages/c/_cluster/settings/performance.vue +90 -7
  161. package/pages/c/_cluster/uiplugins/DeveloperInstallDialog.vue +232 -0
  162. package/pages/c/_cluster/uiplugins/InstallDialog.vue +293 -0
  163. package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +300 -0
  164. package/pages/c/_cluster/uiplugins/RemoveUIPlugins.vue +125 -0
  165. package/pages/c/_cluster/uiplugins/SetupUIPlugins.vue +261 -0
  166. package/pages/c/_cluster/uiplugins/UninstallDialog.vue +122 -0
  167. package/pages/c/_cluster/uiplugins/index.vue +808 -0
  168. package/pages/diagnostic.vue +185 -101
  169. package/pages/docs/_doc.vue +3 -1
  170. package/pages/home.vue +21 -56
  171. package/pages/prefs.vue +108 -88
  172. package/pages/safeMode.vue +17 -0
  173. package/pages/support/index.vue +34 -137
  174. package/pkg/dynamic-importer.lib.js +4 -0
  175. package/plugins/dashboard-store/actions.js +19 -0
  176. package/plugins/dashboard-store/getters.js +20 -3
  177. package/plugins/dashboard-store/mutations.js +13 -7
  178. package/plugins/dashboard-store/resource-class.js +2 -2
  179. package/plugins/formatters.js +15 -0
  180. package/plugins/plugin.js +61 -6
  181. package/plugins/steve/getters.js +12 -0
  182. package/plugins/steve/mutations.js +1 -1
  183. package/plugins/steve/subscribe.js +94 -72
  184. package/plugins/steve/web-worker.steve-sub-worker.js +24 -15
  185. package/plugins/version.js +21 -0
  186. package/promptRemove/management.cattle.io.globalrole.vue +47 -0
  187. package/promptRemove/management.cattle.io.roletemplate.vue +47 -0
  188. package/promptRemove/mixin/roleDeletionCheck.js +97 -0
  189. package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +6 -7
  190. package/rancher-components/components/BadgeState/BadgeState.spec.ts +12 -0
  191. package/rancher-components/components/BadgeState/BadgeState.vue +107 -0
  192. package/rancher-components/components/BadgeState/index.ts +1 -0
  193. package/rancher-components/components/Banner/Banner.test.ts +13 -0
  194. package/rancher-components/components/Banner/Banner.vue +163 -0
  195. package/rancher-components/components/Banner/index.ts +1 -0
  196. package/rancher-components/components/Card/Card.vue +150 -0
  197. package/rancher-components/components/Card/index.ts +1 -0
  198. package/rancher-components/components/Form/Checkbox/Checkbox.test.ts +77 -0
  199. package/rancher-components/components/Form/Checkbox/Checkbox.vue +395 -0
  200. package/rancher-components/components/Form/Checkbox/index.ts +1 -0
  201. package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +29 -0
  202. package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +343 -0
  203. package/rancher-components/components/Form/LabeledInput/index.ts +1 -0
  204. package/rancher-components/components/Form/Radio/RadioButton.vue +270 -0
  205. package/rancher-components/components/Form/Radio/RadioGroup.vue +235 -0
  206. package/rancher-components/components/Form/Radio/index.ts +2 -0
  207. package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +168 -0
  208. package/rancher-components/components/Form/TextArea/index.ts +1 -0
  209. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.test.ts +107 -0
  210. package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +137 -0
  211. package/rancher-components/components/Form/ToggleSwitch/index.ts +1 -0
  212. package/rancher-components/components/Form/index.ts +5 -0
  213. package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +137 -0
  214. package/rancher-components/components/LabeledTooltip/index.ts +1 -0
  215. package/scripts/publish-shell.sh +40 -7
  216. package/scripts/record-deps.js +37 -0
  217. package/scripts/sync-shell-deps +37 -0
  218. package/scripts/test-plugins-build.sh +8 -5
  219. package/scripts/typegen.sh +84 -0
  220. package/store/auth.js +3 -0
  221. package/store/catalog.js +9 -8
  222. package/store/i18n.js +10 -1
  223. package/store/index.js +12 -3
  224. package/store/prefs.js +16 -0
  225. package/store/type-map.js +32 -5
  226. package/store/uiplugins.ts +15 -61
  227. package/types/shell/index.d.ts +3046 -0
  228. package/utils/__tests__/object.test.ts +0 -24
  229. package/utils/__tests__/selector.test.ts +1 -1
  230. package/utils/dynamic-importer.js +4 -0
  231. package/utils/favicon.js +8 -2
  232. package/utils/gc/gc-interval.ts +40 -0
  233. package/utils/gc/gc-root-store.js +76 -0
  234. package/utils/gc/gc-route-changed.ts +44 -0
  235. package/utils/gc/gc-types.ts +21 -0
  236. package/utils/gc/gc.ts +282 -0
  237. package/utils/grafana.js +2 -6
  238. package/utils/socket.js +41 -20
  239. package/utils/string.js +1 -7
  240. package/utils/validators/formRules/__tests__/index.test.ts +108 -0
  241. package/utils/validators/formRules/index.ts +9 -1
  242. package/config/footer.js +0 -19
  243. package/creators/pkg/nuxt.config.js +0 -6
  244. package/pages/plugins.vue +0 -387
  245. package/server/verdaccio-middleware.js +0 -56
@@ -95,7 +95,13 @@ export default Vue.extend({
95
95
  currentPhase: {
96
96
  type: String,
97
97
  default: ASYNC_BUTTON_STATES.ACTION,
98
- }
98
+ },
99
+
100
+ manual: {
101
+ type: Boolean,
102
+ default: false,
103
+ },
104
+
99
105
  },
100
106
 
101
107
  data(): { phase: string, timer?: NodeJS.Timeout} {
@@ -190,6 +196,12 @@ export default Vue.extend({
190
196
  }
191
197
  },
192
198
 
199
+ beforeDestroy() {
200
+ if (this.timer) {
201
+ clearTimeout(this.timer);
202
+ }
203
+ },
204
+
193
205
  methods: {
194
206
  clicked($event: MouseEvent) {
195
207
  if ($event) {
@@ -205,7 +217,10 @@ export default Vue.extend({
205
217
  clearTimeout(this.timer);
206
218
  }
207
219
 
208
- this.phase = ASYNC_BUTTON_STATES.WAITING;
220
+ // If manual property is set, don't automatically change the button on click
221
+ if (!this.manual) {
222
+ this.phase = ASYNC_BUTTON_STATES.WAITING;
223
+ }
209
224
 
210
225
  const cb: AsyncButtonCallback = (success) => {
211
226
  this.done(success);
@@ -194,6 +194,10 @@ export default {
194
194
  @search:focus="onFocus"
195
195
  @input="$emit('click-action', $event)"
196
196
  >
197
+ <template slot="no-options">
198
+ <slot name="no-options"></slot>
199
+ </template>
200
+
197
201
  <template #selected-option="option">
198
202
  <button
199
203
  tabindex="-1"
@@ -0,0 +1,291 @@
1
+ <script>
2
+ import { get } from '@shell/utils/object';
3
+ import { BadgeState } from '@components/BadgeState';
4
+
5
+ export default {
6
+ components: { BadgeState },
7
+ name: 'Carousel',
8
+ props: {
9
+ sliders: {
10
+ type: Array,
11
+ required: true,
12
+ },
13
+ keyField: {
14
+ type: String,
15
+ default: 'key',
16
+ },
17
+ asLink: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
21
+ linkField: {
22
+ type: String,
23
+ default: 'link'
24
+ },
25
+ targetField: {
26
+ type: String,
27
+ default: 'target',
28
+ },
29
+ rel: {
30
+ type: String,
31
+ default: 'noopener noreferrer nofollow'
32
+ },
33
+ },
34
+ data() {
35
+ return {
36
+ slider: this.sliders,
37
+ activeItemId: 0,
38
+ autoScroll: true
39
+ };
40
+ },
41
+
42
+ computed: {
43
+
44
+ trackStyle() {
45
+ const sliderItem = this.activeItemId * 100 / this.slider.length;
46
+ const width = 60 * this.slider.length;
47
+
48
+ return `transform: translateX(-${ sliderItem }%); width: ${ width }%`;
49
+ },
50
+ },
51
+
52
+ methods: {
53
+ get,
54
+
55
+ select(slide, i) {
56
+ this.$emit('clicked', slide, i);
57
+ },
58
+
59
+ scrollSlide(i) {
60
+ this.autoScroll = false;
61
+ this.activeItemId = i;
62
+ setTimeout(() => {
63
+ this.slidePosition();
64
+ }, 400);
65
+ },
66
+
67
+ nextPrev(item) {
68
+ this.autoScroll = false;
69
+ if (item === 'next' && this.activeItemId < this.slider.length - 1) {
70
+ this.activeItemId++;
71
+ }
72
+
73
+ if (item === 'prev' && this.activeItemId > 0) {
74
+ this.activeItemId--;
75
+ }
76
+
77
+ this.slidePosition();
78
+ },
79
+
80
+ timer() {
81
+ setInterval(this.autoScrollSlide, 2000);
82
+ },
83
+ autoScrollSlide() {
84
+ if (this.activeItemId < this.slider.length && this.autoScroll ) {
85
+ this.activeItemId++;
86
+ }
87
+
88
+ if (this.activeItemId > this.slider.length - 1) {
89
+ this.autoScroll = false;
90
+ this.activeItemId = 0;
91
+ }
92
+ this.slidePosition();
93
+ },
94
+
95
+ slidePosition() {
96
+ if (this.activeItemId <= 1) {
97
+ this.$refs.slide[this.slider.length - 1].style.left = '-93%';
98
+ this.$refs.slide[0].style.left = '7%';
99
+ } else {
100
+ this.$refs.slide[this.slider.length - 1].style.left = '7%';
101
+ this.$refs.slide[0].style.left = '107%';
102
+ }
103
+ }
104
+ },
105
+
106
+ mounted() {
107
+ this.timer();
108
+ }
109
+ };
110
+
111
+ </script>
112
+
113
+ <template>
114
+ <div class="slider">
115
+ <div id="slide-track" ref="slider" :style="trackStyle" class="slide-track">
116
+ <div
117
+ :is="asLink ? 'a' : 'div'"
118
+ v-for="(slide, i) in sliders"
119
+ :id="`slide` + i"
120
+ ref="slide"
121
+ :key="get(slide, keyField)"
122
+ class="slide"
123
+ :href="asLink ? get(slide, linkField) : null"
124
+ :target="get(slide, targetField)"
125
+ :rel="rel"
126
+ @click="select(slide, i)"
127
+ >
128
+ <div class="slide-content">
129
+ <div class="slide-img">
130
+ <img :src="slide.icon ? slide.icon : `/_nuxt/shell/assets/images/generic-catalog.svg`" />
131
+ </div>
132
+ <div class="slide-content-right">
133
+ <BadgeState :label="slide.repoName" color="slider-badge mb-20" />
134
+ <h1>{{ slide.chartNameDisplay }}</h1>
135
+ <p>{{ slide.chartDescription }}</p>
136
+ </div>
137
+ </div>
138
+ </div>
139
+ </div>
140
+ <div class="controls">
141
+ <div
142
+ v-for="(slide, i) in slider"
143
+ :key="i"
144
+ class="control-item"
145
+ :class="{'active': activeItemId === i}"
146
+ @click="scrollSlide(i, slider.length)"
147
+ ></div>
148
+ </div>
149
+ <div ref="prev" class="prev" :class="[activeItemId === 0 ? 'disabled' : 'prev']" @click="nextPrev('prev')">
150
+ <i class="icon icon-chevron-left icon-4x"></i>
151
+ </div>
152
+ <div ref="next" class="next" :class="[activeItemId === slider.length - 1 ? 'disabled' : 'next']" @click="nextPrev('next')">
153
+ <i class="icon icon-chevron-right icon-4x"></i>
154
+ </div>
155
+ </div>
156
+ </template>
157
+
158
+ <style lang='scss' scoped>
159
+ .slider {
160
+ margin: auto;
161
+ position: relative;
162
+ width: 100%;
163
+ place-items: center;
164
+ overflow: hidden;
165
+ margin-bottom: 30px;
166
+ min-width: 700px;
167
+
168
+ &:hover {
169
+ .prev,
170
+ .next {
171
+ display: block;
172
+ }
173
+ }
174
+ }
175
+
176
+ .slide-track {
177
+ display: flex;
178
+ animation: scrolls 10s ;
179
+ position: relative;
180
+ transition: 1s ease-in-out;
181
+ }
182
+
183
+ .slider-badge {
184
+ background: var(--app-partner-accent);
185
+ color: var(--body-bg);
186
+ }
187
+ .slide {
188
+ min-height: 210px;
189
+ width: 60%;
190
+ max-width: 60%;
191
+ margin: 0 10px;
192
+ position: relative;
193
+ border: 1px solid var(--tabbed-border);
194
+ border-radius: var(--border-radius);
195
+ left: 7%;
196
+ cursor: pointer;
197
+
198
+ &:last-child {
199
+ left: -93%;
200
+ }
201
+
202
+ .slide-header {
203
+ background: var(--default);
204
+ width: 100%;
205
+ padding: 10px 15px;
206
+ }
207
+ .slide-content {
208
+ display: flex;
209
+ padding: 30px;
210
+
211
+ .slide-img {
212
+ width: 150px;
213
+ background: var(--card-badge-text);
214
+ border-radius: calc(2 * var(--border-radius));
215
+
216
+ img {
217
+ width: 100%;
218
+ }
219
+ }
220
+
221
+ .slide-content-right {
222
+ border-left: 1px solid var(--tabbed-border);
223
+ margin-left: 30px;
224
+ padding-left: 30px;
225
+
226
+ span {
227
+ margin: 0;
228
+ }
229
+ }
230
+
231
+ }
232
+ }
233
+
234
+ .slider::before,
235
+ .slider::after {
236
+ background: linear-gradient(to right, var(--slider-light-bg) 0%, var(--slider-light-bg-right) 100%);
237
+ content: "";
238
+ height: 100%;
239
+ position: absolute;
240
+ width: 15%;
241
+ z-index: z-index('overContent');
242
+ }
243
+
244
+ .slider::before {
245
+ left: 0;
246
+ top: 0;
247
+ }
248
+ .slider::after{
249
+ right: -1px;
250
+ top: 0;
251
+ transform: rotate(180deg);
252
+ }
253
+
254
+ .controls {
255
+ width: 100%;
256
+ display: flex;
257
+ justify-content: center;
258
+ margin-top: 10px;
259
+
260
+ .control-item {
261
+ width: 10px;
262
+ height: 10px;
263
+ border-radius: 50%;
264
+ background: var(--scrollbar-thumb);
265
+ margin: 5px;
266
+ cursor: pointer;
267
+
268
+ &.active {
269
+ background:var(--body-text);
270
+ }
271
+ }
272
+ }
273
+ .prev,
274
+ .next {
275
+ position: absolute;
276
+ z-index: 20;
277
+ top: 90px;
278
+ display: none;
279
+ cursor: pointer;
280
+
281
+ &.disabled .icon {
282
+ color: var(--disabled-bg);
283
+ cursor: not-allowed;
284
+ }
285
+ }
286
+
287
+ .next {
288
+ right: 0;
289
+ }
290
+
291
+ </style>
@@ -1,12 +1,15 @@
1
1
  <script>
2
- import { options } from '@shell/config/footer';
3
2
  import SimpleBox from '@shell/components/SimpleBox';
4
3
  import Closeable from '@shell/mixins/closeable';
5
4
  import { MANAGEMENT } from '@shell/config/types';
6
5
  import { SETTING } from '@shell/config/settings';
7
6
  import { mapGetters } from 'vuex';
7
+ import { isRancherPrime } from '@shell/config/version';
8
+ import { fetchLinks } from '@shell/config/home-links';
8
9
 
9
10
  export default {
11
+ name: 'CommunityLinks',
12
+
10
13
  components: { SimpleBox },
11
14
 
12
15
  props: {
@@ -16,41 +19,63 @@ export default {
16
19
  return {};
17
20
  },
18
21
  },
22
+ isSupportPage: {
23
+ type: Boolean,
24
+ default: false,
25
+ },
19
26
  },
20
27
 
21
28
  mixins: [Closeable],
22
29
 
23
30
  async fetch() {
24
- this.uiIssuesSetting = await this.$store.dispatch('management/find', { type: MANAGEMENT.SETTING, id: SETTING.ISSUES });
25
- this.communitySetting = await this.$store.dispatch('management/find', { type: MANAGEMENT.SETTING, id: SETTING.COMMUNITY_LINKS });
31
+ this.links = await fetchLinks(this.$store, this.hasSupport, this.isSupportPage, str => this.t(str));
26
32
  },
27
33
 
28
34
  data() {
29
- return { uiIssuesSetting: null, communitySetting: null };
35
+ return { links: {} };
30
36
  },
31
37
 
32
38
  computed: {
33
-
34
39
  ...mapGetters('i18n', [
35
40
  'selectedLocaleLabel'
36
41
  ]),
37
42
 
43
+ hasOptions() {
44
+ return !!Object.keys(this.options).length || !!Object.keys(this.$slots).length;
45
+ },
46
+
47
+ hasSupport() {
48
+ return isRancherPrime() || this.$store.getters['management/byId'](MANAGEMENT.SETTING, SETTING.SUPPORTED )?.value === 'true';
49
+ },
50
+
38
51
  options() {
39
- if (Object.keys(this.linkOptions).length > 0) {
40
- return this.linkOptions;
52
+ // Use linkOptions if provided - used by Harvester
53
+ if (this.linkOptions && Object.keys(this.linkOptions).length) {
54
+ const options = [];
55
+
56
+ Object.keys(this.linkOptions).forEach((key) => {
57
+ options.push({
58
+ key,
59
+ label: this.t(key),
60
+ value: this.linkOptions[key]
61
+ });
62
+ });
63
+
64
+ return options;
41
65
  }
42
66
 
43
- if (this.communitySetting?.value === 'false') {
44
- return options(this.uiIssuesSetting?.value, true);
45
- }
67
+ // Combine the links
68
+ const all = [];
46
69
 
47
- return options(this.uiIssuesSetting?.value);
48
- },
70
+ if (this.links.custom) {
71
+ all.push(...this.links.custom);
72
+ }
49
73
 
50
- title() {
51
- const hasCustomizedFileIssueLink = this.uiIssuesSetting?.value;
74
+ if (this.links.defaults) {
75
+ all.push(...this.links.defaults.filter(link => link.enabled));
76
+ }
52
77
 
53
- return hasCustomizedFileIssueLink ? 'landing.support' : 'landing.community.title';
78
+ return all;
54
79
  }
55
80
  },
56
81
  methods: {
@@ -65,12 +90,20 @@ export default {
65
90
  </script>
66
91
 
67
92
  <template>
68
- <div>
69
- <SimpleBox :title="t(title)" :pref="pref" :pref-key="prefKey">
70
- <div v-for="(value, name) in options" :key="name" class="support-link">
71
- <a v-t="name" :href="value" target="_blank" rel="noopener noreferrer nofollow" />
93
+ <div v-if="hasOptions">
94
+ <SimpleBox :pref="pref" :pref-key="prefKey">
95
+ <template #title>
96
+ <h2>
97
+ {{ t('customLinks.displayTitle') }}
98
+ </h2>
99
+ </template>
100
+ <div v-for="link in options" :key="link.label" class="support-link">
101
+ <n-link v-if="link.value.startsWith('/') " :to="link.value">
102
+ {{ link.label }}
103
+ </n-link>
104
+ <a v-else :href="link.value" rel="noopener noreferrer nofollow" target="_blank"> {{ link.label }} </a>
72
105
  </div>
73
-
106
+ <slot />
74
107
  <div v-if="selectedLocaleLabel === t('locale.zh-hans')" class="support-link">
75
108
  <a class="link" @click="show">
76
109
  {{ t('footer.wechat.title') }}
@@ -97,8 +130,17 @@ export default {
97
130
  </template>
98
131
 
99
132
  <style lang='scss' scoped>
100
- .support-link:not(:first-child) {
101
- margin-top: 15px;
133
+ h2 {
134
+ display: flex;
135
+ align-items: center;
136
+
137
+ i {
138
+ font-size: 12px;
139
+ margin-left: 5px;
140
+ }
141
+ }
142
+ .support-link:not(:last-child) {
143
+ margin-bottom: 15px;
102
144
  }
103
145
 
104
146
  .wechat-modal {
@@ -2,7 +2,7 @@
2
2
  import isEmpty from 'lodash/isEmpty';
3
3
  import { createYaml } from '@shell/utils/create-yaml';
4
4
  import { clone, get } from '@shell/utils/object';
5
- import { SCHEMA } from '@shell/config/types';
5
+ import { SCHEMA, NAMESPACE } from '@shell/config/types';
6
6
  import ResourceYaml from '@shell/components/ResourceYaml';
7
7
  import { Banner } from '@components/Banner';
8
8
  import AsyncButton from '@shell/components/AsyncButton';
@@ -329,10 +329,18 @@ export default {
329
329
 
330
330
  async createNamespaceIfNeeded() {
331
331
  const inStore = this.$store.getters['currentStore'](this.resource);
332
+ const newNamespaceName = get(this.resource, this.namespaceKey);
333
+ let namespaceAlreadyExists = false;
332
334
 
333
- if (this.createNamespace) {
335
+ try {
336
+ // This is in a try-catch block because the call to fetch
337
+ // a namespace throws an error if the namespace is not found.
338
+ namespaceAlreadyExists = !!(await this.$store.dispatch(`${ inStore }/find`, { type: NAMESPACE, id: newNamespaceName }));
339
+ } catch {}
340
+
341
+ if (this.createNamespace && !namespaceAlreadyExists) {
334
342
  try {
335
- const newNamespace = await this.$store.dispatch(`${ inStore }/createNamespace`, { name: get(this.resource, this.namespaceKey) }, { root: true });
343
+ const newNamespace = await this.$store.dispatch(`${ inStore }/createNamespace`, { name: newNamespaceName }, { root: true });
336
344
 
337
345
  newNamespace.applyDefaults();
338
346
  await newNamespace.save();
@@ -0,0 +1,102 @@
1
+ <script>
2
+ import AsyncButton from '@shell/components/AsyncButton';
3
+
4
+ export default {
5
+ components: { AsyncButton },
6
+
7
+ props: {
8
+ name: {
9
+ type: String,
10
+ required: true,
11
+ },
12
+
13
+ title: {
14
+ type: String,
15
+ required: true,
16
+ },
17
+
18
+ mode: {
19
+ type: String,
20
+ default: '',
21
+ }
22
+ },
23
+
24
+ data() {
25
+ return { closed: false };
26
+ },
27
+
28
+ methods: {
29
+ beforeOpen() {
30
+ this.closed = false;
31
+ },
32
+
33
+ ok(btnCb) {
34
+ const callback = (ok) => {
35
+ btnCb(ok);
36
+ if (ok) {
37
+ this.closeDialog(true);
38
+ }
39
+ };
40
+
41
+ this.$emit('okay', callback);
42
+ },
43
+
44
+ closeDialog(result) {
45
+ if (!this.closed) {
46
+ this.$modal.hide(this.name);
47
+ this.$emit('closed', result);
48
+ this.closed = true;
49
+ }
50
+ },
51
+ }
52
+ };
53
+ </script>
54
+
55
+ <template>
56
+ <modal
57
+ :name="name"
58
+ height="auto"
59
+ :scrollable="true"
60
+ @closed="closeDialog(false)"
61
+ @before-open="beforeOpen"
62
+ >
63
+ <div class="modal-dialog">
64
+ <h4>
65
+ {{ title }}
66
+ </h4>
67
+ <slot></slot>
68
+ <div class="dialog-buttons mt-20">
69
+ <slot name="buttons"></slot>
70
+ <div v-if="!$slots.buttons">
71
+ <button class="btn role-secondary" @click="closeDialog(false)">
72
+ {{ t('generic.cancel') }}
73
+ </button>
74
+ <button v-if="!mode" class="btn role-primary ml-10" @click="closeDialog(true)">
75
+ {{ t('generic.ok') }}
76
+ </button>
77
+ <AsyncButton v-else :mode="mode" class="ml-10" @click="ok" />
78
+ </div>
79
+ </div>
80
+ </div>
81
+ </modal>
82
+ </template>
83
+
84
+ <style lang="scss" scoped>
85
+ .modal-dialog {
86
+ padding: 10px;
87
+
88
+ h4 {
89
+ font-weight: bold;
90
+ }
91
+
92
+ .dialog-buttons {
93
+ display: flex;
94
+ justify-content: flex-end;
95
+ margin-top: 10px;
96
+
97
+ > *:not(:last-child) {
98
+ margin-right: 10px;
99
+ }
100
+ }
101
+ }
102
+ </style>
@@ -1,7 +1,6 @@
1
1
  <script>
2
2
  import { MANAGEMENT, NORMAN, VIRTUAL_TYPES } from '@shell/config/types';
3
3
  import ResourceTable from '@shell/components/ResourceTable';
4
- import Loading from '@shell/components/Loading';
5
4
  import Masthead from '@shell/components/ResourceList/Masthead';
6
5
  import { AGE, ROLE, STATE, PRINCIPAL } from '@shell/config/table-headers';
7
6
  import { canViewClusterPermissionsEditor } from '@shell/components/form/Members/ClusterPermissionsEditor.vue';
@@ -17,7 +16,6 @@ export default {
17
16
 
18
17
  components: {
19
18
  Banner,
20
- Loading,
21
19
  Masthead,
22
20
  ResourceTable
23
21
  },
@@ -96,8 +94,7 @@ export default {
96
94
  </script>
97
95
 
98
96
  <template>
99
- <Loading v-if="$fetchState.pending || !currentCluster" />
100
- <div v-else>
97
+ <div>
101
98
  <Masthead
102
99
  :schema="schema"
103
100
  :resource="resource"
@@ -116,6 +113,7 @@ export default {
116
113
  :rows="filteredClusterRoleTemplateBindings"
117
114
  :groupable="false"
118
115
  :namespaced="false"
116
+ :loading="$fetchState.pending || !currentCluster"
119
117
  sub-search="subSearch"
120
118
  :sub-fields="['nameDisplay']"
121
119
  />