@rancher/shell 0.3.5 → 0.3.7

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 (120) hide show
  1. package/assets/images/providers/outscale.svg +19 -0
  2. package/assets/styles/base/_basic.scss +18 -0
  3. package/assets/styles/base/_mixins.scss +0 -11
  4. package/assets/styles/base/_variables.scss +2 -4
  5. package/assets/styles/global/_button.scss +12 -2
  6. package/assets/translations/en-us.yaml +35 -1
  7. package/assets/translations/zh-hans.yaml +30 -10
  8. package/chart/gatekeeper.vue +3 -2
  9. package/chart/istio.vue +29 -3
  10. package/components/BrandImage.vue +1 -4
  11. package/components/Carousel.vue +85 -37
  12. package/components/EtcdInfoBanner.vue +7 -3
  13. package/components/ExplorerMembers.vue +100 -5
  14. package/components/ExplorerProjectsNamespaces.vue +32 -2
  15. package/components/GrafanaDashboard.vue +9 -2
  16. package/components/SortableTable/index.vue +23 -11
  17. package/components/SortableTable/selection.js +58 -50
  18. package/components/Wizard.vue +4 -2
  19. package/components/auth/AuthBanner.vue +6 -0
  20. package/components/auth/RoleDetailEdit.vue +2 -2
  21. package/components/form/HookOption.vue +14 -10
  22. package/components/form/Labels.vue +32 -27
  23. package/components/form/MatchExpressions.vue +2 -2
  24. package/components/form/Members/ClusterPermissionsEditor.vue +32 -7
  25. package/components/form/NameNsDescription.vue +1 -1
  26. package/components/form/ProjectMemberEditor.vue +46 -21
  27. package/components/form/Tolerations.vue +4 -1
  28. package/components/form/ValueFromResource.vue +14 -9
  29. package/components/form/WorkloadPorts.vue +2 -2
  30. package/components/form/__tests__/NameNsDescription.ts +27 -0
  31. package/components/formatter/WorkloadHealthScale.vue +8 -2
  32. package/components/nav/NamespaceFilter.vue +8 -0
  33. package/{nuxt/components → components/nuxt}/nuxt.js +1 -1
  34. package/{nuxt → config}/middleware.js +8 -8
  35. package/config/product/explorer.js +24 -3
  36. package/config/query-params.js +1 -0
  37. package/config/router.js +1 -1
  38. package/{nuxt → config}/store.js +82 -79
  39. package/config/table-headers.js +46 -12
  40. package/config/types.js +7 -0
  41. package/core/plugin.ts +4 -2
  42. package/core/types.ts +258 -1
  43. package/creators/app/files/tsconfig.json +0 -1
  44. package/creators/app/files/vue.config.js +0 -1
  45. package/creators/pkg/files/.github/workflows/build-extension.yml +3 -4
  46. package/creators/pkg/files/tsconfig.json +0 -1
  47. package/creators/pkg/pkg.package.json +3 -3
  48. package/detail/constraints.gatekeeper.sh.constraint.vue +14 -7
  49. package/detail/fleet.cattle.io.clustergroup.vue +7 -1
  50. package/edit/auth/ldap/config.vue +21 -1
  51. package/edit/auth/saml.vue +132 -37
  52. package/edit/fleet.cattle.io.gitrepo.vue +16 -1
  53. package/edit/logging.banzaicloud.io.output/index.vue +18 -5
  54. package/edit/logging.banzaicloud.io.output/providers/loki.vue +1 -0
  55. package/edit/namespace.vue +12 -8
  56. package/edit/provisioning.cattle.io.cluster/MachinePool.vue +11 -4
  57. package/edit/provisioning.cattle.io.cluster/import.vue +23 -25
  58. package/edit/provisioning.cattle.io.cluster/rke2.vue +96 -18
  59. package/edit/workload/mixins/workload.js +6 -7
  60. package/edit/workload/storage/Mount.vue +3 -3
  61. package/initialize/App.js +206 -0
  62. package/{nuxt → initialize}/client.js +406 -360
  63. package/{nuxt → initialize}/index.js +21 -22
  64. package/layouts/standalone.vue +13 -0
  65. package/list/catalog.cattle.io.clusterrepo.vue +1 -0
  66. package/list/rbac.authorization.k8s.io.clusterrolebinding.vue +48 -0
  67. package/list/workload.vue +6 -4
  68. package/mixins/chart.js +29 -1
  69. package/mixins/fetch.client.js +95 -0
  70. package/{nuxt/mixins → mixins}/fetch.server.js +30 -26
  71. package/mixins/labeled-form-element.ts +2 -2
  72. package/models/constraints.gatekeeper.sh.constraint.js +37 -0
  73. package/models/pod.js +4 -0
  74. package/models/rbac.authorization.k8s.io.clusterrolebinding.js +16 -0
  75. package/models/rbac.authorization.k8s.io.rolebinding.js +16 -0
  76. package/package.json +9 -13
  77. package/pages/c/_cluster/apps/charts/install.vue +61 -39
  78. package/pages/diagnostic.vue +32 -25
  79. package/pages/rio/mesh.vue +1 -2
  80. package/pkg/tsconfig.json +0 -1
  81. package/plugins/clean-html-directive.js +3 -0
  82. package/plugins/dashboard-store/index.js +1 -1
  83. package/plugins/plugin.js +0 -14
  84. package/plugins/portal-vue.js +4 -0
  85. package/rancher-components/components/Banner/Banner.test.ts +3 -5
  86. package/rancher-components/components/Banner/Banner.vue +1 -0
  87. package/rancher-components/components/Form/Radio/RadioButton.test.ts +31 -0
  88. package/rancher-components/components/Form/Radio/RadioButton.vue +14 -3
  89. package/scripts/extension/publish +42 -23
  90. package/scripts/serve-pkgs +6 -2
  91. package/store/type-map.js +1 -1
  92. package/tsconfig.json +0 -1
  93. package/types/rancher/index.d.ts +2 -0
  94. package/types/shell/index.d.ts +353 -284
  95. package/utils/__tests__/grafana.test.ts +44 -0
  96. package/utils/axios.js +190 -0
  97. package/{nuxt → utils}/cookie-universal-nuxt.js +7 -6
  98. package/utils/dom.js +15 -0
  99. package/utils/gc/gc.ts +1 -1
  100. package/utils/grafana.js +35 -16
  101. package/{nuxt/utils.js → utils/nuxt.js} +265 -236
  102. package/utils/router.scrollBehavior.js +1 -1
  103. package/vue.config.js +30 -19
  104. package/nuxt/App.js +0 -210
  105. package/nuxt/axios.js +0 -186
  106. package/nuxt/empty.js +0 -1
  107. package/nuxt/jsonp.js +0 -82
  108. package/nuxt/loading.html +0 -39
  109. package/nuxt/mixins/fetch.client.js +0 -90
  110. package/nuxt/portal-vue.js +0 -4
  111. package/nuxt/server.js +0 -312
  112. package/nuxt/views/app.template.html +0 -9
  113. package/nuxt/views/error.html +0 -23
  114. package/plugins/dashboard-store/extensions.js +0 -22
  115. /package/{nuxt/components → components/nuxt}/nuxt-build-indicator.vue +0 -0
  116. /package/{nuxt/components → components/nuxt}/nuxt-child.js +0 -0
  117. /package/{nuxt/components → components/nuxt}/nuxt-error.vue +0 -0
  118. /package/{nuxt/components → components/nuxt}/nuxt-link.client.js +0 -0
  119. /package/{nuxt/components → components/nuxt}/nuxt-link.server.js +0 -0
  120. /package/{nuxt/components → components/nuxt}/nuxt-loading.vue +0 -0
@@ -1,4 +0,0 @@
1
- import Vue from 'vue'
2
- import PortalVue from 'portal-vue'
3
-
4
- Vue.use(PortalVue)
package/nuxt/server.js DELETED
@@ -1,312 +0,0 @@
1
- import Vue from 'vue'
2
- import { joinURL, normalizeURL, withQuery } from 'ufo'
3
- import fetch from 'node-fetch'
4
- import middleware from './middleware.js'
5
- import {
6
- applyAsyncData,
7
- middlewareSeries,
8
- sanitizeComponent,
9
- getMatchedComponents,
10
- promisify
11
- } from './utils.js'
12
- import fetchMixin from './mixins/fetch.server'
13
- import { createApp, NuxtError } from './index.js'
14
- import NuxtLink from './components/nuxt-link.server.js' // should be included after ./index.js
15
-
16
- // Update serverPrefetch strategy
17
- Vue.config.optionMergeStrategies.serverPrefetch = Vue.config.optionMergeStrategies.created
18
-
19
- // Fetch mixin
20
- if (!Vue.__nuxt__fetch__mixin__) {
21
- Vue.mixin(fetchMixin)
22
- Vue.__nuxt__fetch__mixin__ = true
23
- }
24
-
25
- if (!Vue.__original_use__) {
26
- Vue.__original_use__ = Vue.use
27
- Vue.__install_times__ = 0
28
- Vue.use = function (plugin, ...args) {
29
- plugin.__nuxt_external_installed__ = Vue._installedPlugins.includes(plugin)
30
- return Vue.__original_use__(plugin, ...args)
31
- }
32
- }
33
- if (Vue.__install_times__ === 2) {
34
- Vue.__install_times__ = 0
35
- Vue._installedPlugins = Vue._installedPlugins.filter(plugin => {
36
- return plugin.__nuxt_external_installed__ === true
37
- })
38
- }
39
- Vue.__install_times__++
40
-
41
- // Component: <NuxtLink>
42
- Vue.component(NuxtLink.name, NuxtLink)
43
- Vue.component('NLink', NuxtLink)
44
-
45
- if (!global.fetch) { global.fetch = fetch }
46
-
47
- const noopApp = () => new Vue({ render: h => h('div', { domProps: { id: '__nuxt' } }) })
48
-
49
- const createNext = ssrContext => (opts) => {
50
- // If static target, render on client-side
51
- ssrContext.redirected = opts
52
- if (ssrContext.target === 'static' || !ssrContext.res) {
53
- ssrContext.nuxt.serverRendered = false
54
- return
55
- }
56
- let fullPath = withQuery(opts.path, opts.query)
57
- const $config = ssrContext.runtimeConfig || {}
58
- const routerBase = ($config._app && $config._app.basePath) || '/'
59
- if (!fullPath.startsWith('http') && (routerBase !== '/' && !fullPath.startsWith(routerBase))) {
60
- fullPath = joinURL(routerBase, fullPath)
61
- }
62
- // Avoid loop redirect
63
- if (decodeURI(fullPath) === decodeURI(ssrContext.url)) {
64
- ssrContext.redirected = false
65
- return
66
- }
67
- ssrContext.res.writeHead(opts.status, {
68
- Location: normalizeURL(fullPath)
69
- })
70
- ssrContext.res.end()
71
- }
72
-
73
- // This exported function will be called by `bundleRenderer`.
74
- // This is where we perform data-prefetching to determine the
75
- // state of our application before actually rendering it.
76
- // Since data fetching is async, this function is expected to
77
- // return a Promise that resolves to the app instance.
78
- export default async (ssrContext) => {
79
- // Create ssrContext.next for simulate next() of beforeEach() when wanted to redirect
80
- ssrContext.redirected = false
81
- ssrContext.next = createNext(ssrContext)
82
- // Used for beforeNuxtRender({ Components, nuxtState })
83
- ssrContext.beforeRenderFns = []
84
- // Nuxt object (window.{{globals.context}}, defaults to window.__NUXT__)
85
- ssrContext.nuxt = { layout: 'default', data: [], fetch: {}, error: null, state: null, serverRendered: true, routePath: '' }
86
-
87
- ssrContext.fetchCounters = {}
88
-
89
- // Remove query from url is static target
90
-
91
- // Public runtime config
92
- ssrContext.nuxt.config = ssrContext.runtimeConfig.public
93
- if (ssrContext.nuxt.config._app) {
94
- __webpack_public_path__ = joinURL(ssrContext.nuxt.config._app.cdnURL, ssrContext.nuxt.config._app.assetsPath)
95
- }
96
- // Create the app definition and the instance (created for each request)
97
- const { app, router, store } = await createApp(ssrContext, ssrContext.runtimeConfig.private)
98
- const _app = new Vue(app)
99
- // Add ssr route path to nuxt context so we can account for page navigation between ssr and csr
100
- ssrContext.nuxt.routePath = app.context.route.path
101
-
102
- // Add meta infos (used in renderer.js)
103
- ssrContext.meta = _app.$meta()
104
-
105
- // Keep asyncData for each matched component in ssrContext (used in app/utils.js via this.$ssrContext)
106
- ssrContext.asyncData = {}
107
-
108
- const beforeRender = async () => {
109
- // Call beforeNuxtRender() methods
110
- await Promise.all(ssrContext.beforeRenderFns.map(fn => promisify(fn, { Components, nuxtState: ssrContext.nuxt })))
111
-
112
- ssrContext.rendered = () => {
113
- // Add the state from the vuex store
114
- ssrContext.nuxt.state = store.state
115
- }
116
- }
117
-
118
- const renderErrorPage = async () => {
119
- // Don't server-render the page in static target
120
- if (ssrContext.target === 'static') {
121
- ssrContext.nuxt.serverRendered = false
122
- }
123
-
124
- // Load layout for error page
125
- const layout = (NuxtError.options || NuxtError).layout
126
- const errLayout = typeof layout === 'function' ? layout.call(NuxtError, app.context) : layout
127
- ssrContext.nuxt.layout = errLayout || 'default'
128
- await _app.loadLayout(errLayout)
129
- _app.setLayout(errLayout)
130
-
131
- await beforeRender()
132
- return _app
133
- }
134
- const render404Page = () => {
135
- app.context.error({ statusCode: 404, path: ssrContext.url, message: 'This page could not be found' })
136
- return renderErrorPage()
137
- }
138
-
139
- const s = Date.now()
140
-
141
- // Components are already resolved by setContext -> getRouteData (app/utils.js)
142
- const Components = getMatchedComponents(app.context.route)
143
-
144
- /*
145
- ** Dispatch store nuxtServerInit
146
- */
147
- if (store._actions && store._actions.nuxtServerInit) {
148
- try {
149
- await store.dispatch('nuxtServerInit', app.context)
150
- } catch (err) {
151
- console.debug('Error occurred when calling nuxtServerInit: ', err.message)
152
- throw err
153
- }
154
- }
155
- // ...If there is a redirect or an error, stop the process
156
- if (ssrContext.redirected) {
157
- return noopApp()
158
- }
159
- if (ssrContext.nuxt.error) {
160
- return renderErrorPage()
161
- }
162
-
163
- /*
164
- ** Call global middleware (nuxt.config.js)
165
- */
166
- let midd = ["i18n"]
167
- midd = midd.map((name) => {
168
- if (typeof name === 'function') {
169
- return name
170
- }
171
- if (typeof middleware[name] !== 'function') {
172
- app.context.error({ statusCode: 500, message: 'Unknown middleware ' + name })
173
- }
174
- return middleware[name]
175
- })
176
- await middlewareSeries(midd, app.context)
177
- // ...If there is a redirect or an error, stop the process
178
- if (ssrContext.redirected) {
179
- return noopApp()
180
- }
181
- if (ssrContext.nuxt.error) {
182
- return renderErrorPage()
183
- }
184
-
185
- /*
186
- ** Set layout
187
- */
188
- let layout = Components.length ? Components[0].options.layout : NuxtError.layout
189
- if (typeof layout === 'function') {
190
- layout = layout(app.context)
191
- }
192
- await _app.loadLayout(layout)
193
- if (ssrContext.nuxt.error) {
194
- return renderErrorPage()
195
- }
196
- layout = _app.setLayout(layout)
197
- ssrContext.nuxt.layout = _app.layoutName
198
-
199
- /*
200
- ** Call middleware (layout + pages)
201
- */
202
- midd = []
203
-
204
- layout = sanitizeComponent(layout)
205
- if (layout.options.middleware) {
206
- midd = midd.concat(layout.options.middleware)
207
- }
208
-
209
- Components.forEach((Component) => {
210
- if (Component.options.middleware) {
211
- midd = midd.concat(Component.options.middleware)
212
- }
213
- })
214
- midd = midd.map((name) => {
215
- if (typeof name === 'function') {
216
- return name
217
- }
218
- if (typeof middleware[name] !== 'function') {
219
- app.context.error({ statusCode: 500, message: 'Unknown middleware ' + name })
220
- }
221
- return middleware[name]
222
- })
223
- await middlewareSeries(midd, app.context)
224
- // ...If there is a redirect or an error, stop the process
225
- if (ssrContext.redirected) {
226
- return noopApp()
227
- }
228
- if (ssrContext.nuxt.error) {
229
- return renderErrorPage()
230
- }
231
-
232
- /*
233
- ** Call .validate()
234
- */
235
- let isValid = true
236
- try {
237
- for (const Component of Components) {
238
- if (typeof Component.options.validate !== 'function') {
239
- continue
240
- }
241
-
242
- isValid = await Component.options.validate(app.context)
243
-
244
- if (!isValid) {
245
- break
246
- }
247
- }
248
- } catch (validationError) {
249
- // ...If .validate() threw an error
250
- app.context.error({
251
- statusCode: validationError.statusCode || '500',
252
- message: validationError.message
253
- })
254
- return renderErrorPage()
255
- }
256
-
257
- // ...If .validate() returned false
258
- if (!isValid) {
259
- // Render a 404 error page
260
- return render404Page()
261
- }
262
-
263
- // If no Components found, returns 404
264
- if (!Components.length) {
265
- return render404Page()
266
- }
267
-
268
- // Call asyncData & fetch hooks on components matched by the route.
269
- const asyncDatas = await Promise.all(Components.map((Component) => {
270
- const promises = []
271
-
272
- // Call asyncData(context)
273
- if (Component.options.asyncData && typeof Component.options.asyncData === 'function') {
274
- const promise = promisify(Component.options.asyncData, app.context)
275
- promise.then((asyncDataResult) => {
276
- ssrContext.asyncData[Component.cid] = asyncDataResult
277
- applyAsyncData(Component)
278
- return asyncDataResult
279
- })
280
- promises.push(promise)
281
- } else {
282
- promises.push(null)
283
- }
284
-
285
- // Call fetch(context)
286
- if (Component.options.fetch && Component.options.fetch.length) {
287
- promises.push(Component.options.fetch(app.context))
288
- } else {
289
- promises.push(null)
290
- }
291
-
292
- return Promise.all(promises)
293
- }))
294
-
295
- if (process.env.DEBUG && asyncDatas.length) console.debug('Data fetching ' + ssrContext.url + ': ' + (Date.now() - s) + 'ms')
296
-
297
- // datas are the first row of each
298
- ssrContext.nuxt.data = asyncDatas.map(r => r[0] || {})
299
-
300
- // ...If there is a redirect or an error, stop the process
301
- if (ssrContext.redirected) {
302
- return noopApp()
303
- }
304
- if (ssrContext.nuxt.error) {
305
- return renderErrorPage()
306
- }
307
-
308
- // Call beforeNuxtRender methods & add store state
309
- await beforeRender()
310
-
311
- return _app
312
- }
@@ -1,9 +0,0 @@
1
- <!DOCTYPE html>
2
- <html {{ HTML_ATTRS }}>
3
- <head {{ HEAD_ATTRS }}>
4
- {{ HEAD }}
5
- </head>
6
- <body {{ BODY_ATTRS }}>
7
- {{ APP }}
8
- </body>
9
- </html>
@@ -1,23 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Server error</title>
5
- <meta charset="utf-8">
6
- <meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" name=viewport>
7
- <style>
8
- .__nuxt-error-page{padding: 1rem;background:#f7f8fb;color:#47494e;text-align:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;font-family:sans-serif;font-weight:100!important;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;position:absolute;top:0;left:0;right:0;bottom:0}.__nuxt-error-page .error{max-width:450px}.__nuxt-error-page .title{font-size:24px;font-size:1.5rem;margin-top:15px;color:#47494e;margin-bottom:8px}.__nuxt-error-page .description{color:#7f828b;line-height:21px;margin-bottom:10px}.__nuxt-error-page a{color:#7f828b!important;text-decoration:none}.__nuxt-error-page .logo{position:fixed;left:12px;bottom:12px}
9
- </style>
10
- </head>
11
- <body>
12
- <div class="__nuxt-error-page">
13
- <div class="error">
14
- <svg xmlns="http://www.w3.org/2000/svg" width="90" height="90" fill="#DBE1EC" viewBox="0 0 48 48"><path d="M22 30h4v4h-4zm0-16h4v12h-4zm1.99-10C12.94 4 4 12.95 4 24s8.94 20 19.99 20S44 35.05 44 24 35.04 4 23.99 4zM24 40c-8.84 0-16-7.16-16-16S15.16 8 24 8s16 7.16 16 16-7.16 16-16 16z"/></svg>
15
- <div class="title">Server error</div>
16
- <div class="description">{{ message }}</div>
17
- </div>
18
- <div class="logo">
19
- <a href="https://nuxtjs.org" target="_blank" rel="noopener">Nuxt</a>
20
- </div>
21
- </div>
22
- </body>
23
- </html>
@@ -1,22 +0,0 @@
1
- // This plugin loads any plugins at app load time
2
-
3
- import { allHash } from '@shell/utils/promise';
4
-
5
- const META_NAME_PREFIX = 'app-autoload-';
6
-
7
- export default async(context) => {
8
- const meta = context.app?.head?.meta || [];
9
- const hash = {};
10
-
11
- meta.forEach((m) => {
12
- const metaName = m.name || '';
13
-
14
- if (metaName.indexOf(META_NAME_PREFIX) === 0) {
15
- const name = metaName.substr(META_NAME_PREFIX.length);
16
-
17
- hash[name] = context.$plugin.loadAsync(name, m.content);
18
- }
19
- });
20
-
21
- await allHash(hash);
22
- };