@rancher/shell 0.3.4 → 0.3.5

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 (246) hide show
  1. package/assets/styles/app.scss +1 -1
  2. package/assets/styles/fonts/_fontstack.scss +11 -11
  3. package/assets/styles/vendor/vue-js-modal.scss +3 -3
  4. package/assets/translations/en-us.yaml +92 -22
  5. package/assets/translations/zh-hans.yaml +84 -15
  6. package/babel.config.js +13 -0
  7. package/chart/gatekeeper.vue +77 -0
  8. package/chart/istio.vue +108 -111
  9. package/chart/logging/index.vue +13 -4
  10. package/chart/monitoring/index.vue +15 -5
  11. package/chart/monitoring/steps/uninstall-v1.vue +2 -2
  12. package/chart/rancher-backup/index.vue +10 -3
  13. package/cloud-credential/aws.vue +1 -1
  14. package/cloud-credential/digitalocean.vue +1 -1
  15. package/cloud-credential/gcp.vue +1 -1
  16. package/cloud-credential/generic.vue +2 -2
  17. package/cloud-credential/linode.vue +1 -1
  18. package/cloud-credential/pnap.vue +1 -1
  19. package/components/ActionMenu.vue +3 -4
  20. package/components/AssignTo.vue +1 -1
  21. package/components/AsyncButton.vue +1 -1
  22. package/components/BannerGraphic.vue +1 -1
  23. package/components/ButtonDropdown.vue +2 -3
  24. package/components/ChartPsp.vue +76 -0
  25. package/components/CruResource.vue +6 -2
  26. package/components/DashboardMetrics.vue +12 -10
  27. package/components/DetailText.vue +1 -1
  28. package/components/DisableAuthProviderModal.vue +1 -1
  29. package/components/EmberPage.vue +1 -1
  30. package/components/EtcdInfoBanner.vue +5 -4
  31. package/components/ExplorerMembers.vue +1 -1
  32. package/components/ExplorerProjectsNamespaces.vue +14 -1
  33. package/components/FileDiff.vue +6 -7
  34. package/components/GrafanaDashboard.vue +18 -21
  35. package/components/LazyImage.vue +10 -12
  36. package/components/LogItem.vue +1 -1
  37. package/components/Markdown.vue +1 -1
  38. package/components/PromptRemove.vue +2 -2
  39. package/components/PromptRestore.vue +1 -1
  40. package/components/ResourceDetail/Masthead.vue +16 -0
  41. package/components/ResourceDetail/index.vue +21 -4
  42. package/components/ResourceList/index.vue +1 -1
  43. package/components/ResourceTable.vue +4 -1
  44. package/components/SingleClusterInfo.vue +2 -2
  45. package/components/SortableTable/THead.vue +1 -1
  46. package/components/SortableTable/index.vue +5 -2
  47. package/components/__tests__/AsyncButton.test.ts +3 -1
  48. package/components/__tests__/ChartPsp.test.ts +75 -0
  49. package/components/__tests__/CruResource.test.ts +3 -1
  50. package/components/auth/Principal.vue +1 -1
  51. package/components/fleet/FleetBundles.vue +3 -1
  52. package/components/fleet/FleetClusters.vue +1 -2
  53. package/components/fleet/FleetIntro.vue +9 -1
  54. package/components/fleet/FleetNoWorkspaces.vue +62 -0
  55. package/components/fleet/FleetSummary.vue +7 -1
  56. package/components/form/LabeledSelect.vue +14 -11
  57. package/components/form/MatchExpressions.vue +17 -2
  58. package/components/form/NameNsDescription.vue +31 -45
  59. package/components/form/ResourceSelector.vue +1 -1
  60. package/components/form/SecretSelector.vue +5 -1
  61. package/components/form/ServiceNameSelect.vue +1 -1
  62. package/components/form/SimpleSecretSelector.vue +9 -9
  63. package/components/form/__tests__/LabeledSelect.test.ts +138 -0
  64. package/components/form/__tests__/NameNsDescription.ts +32 -0
  65. package/components/formatter/InternalExternalIP.vue +6 -0
  66. package/components/formatter/InvolvedObjectLink.vue +54 -0
  67. package/components/formatter/Link.vue +20 -4
  68. package/components/formatter/LinkName.vue +6 -1
  69. package/components/formatter/ServiceTargets.vue +1 -1
  70. package/components/nav/Group.vue +2 -2
  71. package/components/nav/NamespaceFilter.vue +15 -11
  72. package/components/nav/TopLevelMenu.vue +2 -4
  73. package/components/nav/Type.vue +1 -1
  74. package/components/nav/WorkspaceSwitcher.vue +46 -5
  75. package/config/labels-annotations.js +17 -0
  76. package/config/product/auth.js +3 -2
  77. package/config/product/explorer.js +11 -4
  78. package/config/product/fleet.js +2 -0
  79. package/config/router.js +414 -0
  80. package/config/table-headers.js +10 -2
  81. package/config/types.js +11 -8
  82. package/config/uiplugins.js +30 -0
  83. package/content/docs/en-us/whats-new.md +10 -0
  84. package/content/docs/zh-hans/whats-new.md +11 -1
  85. package/core/plugin-routes.ts +23 -0
  86. package/creators/app/app.package.json +2 -1
  87. package/creators/app/files/.eslintrc.js +1 -1
  88. package/creators/app/files/babel.config.js +1 -18
  89. package/creators/app/files/vue.config.js +7 -0
  90. package/creators/app/init +5 -5
  91. package/creators/pkg/files/.github/workflows/build-extension.yml +111 -0
  92. package/creators/pkg/init +35 -4
  93. package/creators/update/init +1 -1
  94. package/detail/constraints.gatekeeper.sh.constraint.vue +20 -10
  95. package/detail/fleet.cattle.io.gitrepo.vue +19 -11
  96. package/detail/harvesterhci.io.management.cluster.vue +3 -3
  97. package/detail/provisioning.cattle.io.cluster.vue +54 -12
  98. package/detail/workload/index.vue +3 -3
  99. package/dialog/AddClusterMemberDialog.vue +1 -1
  100. package/dialog/AddProjectMemberDialog.vue +2 -2
  101. package/dialog/AddonConfigConfirmationDialog.vue +27 -15
  102. package/dialog/DiagnosticTimingsDialog.vue +1 -1
  103. package/dialog/ForceMachineRemoveDialog.vue +1 -1
  104. package/dialog/GenericPrompt.vue +18 -6
  105. package/dialog/RotateEncryptionKeyDialog.vue +1 -1
  106. package/dialog/SaveAsRKETemplateDialog.vue +1 -1
  107. package/dialog/ScaleMachineDownDialog.vue +1 -1
  108. package/edit/auth/github.vue +8 -8
  109. package/edit/auth/googleoauth.vue +5 -5
  110. package/edit/auth/ldap/index.vue +1 -1
  111. package/edit/auth/oidc.vue +1 -1
  112. package/edit/auth/saml.vue +1 -1
  113. package/edit/cis.cattle.io.clusterscan.vue +1 -1
  114. package/edit/fleet.cattle.io.clustergroup.vue +6 -4
  115. package/edit/fleet.cattle.io.gitrepo.vue +16 -3
  116. package/edit/helm.cattle.io.projecthelmchart.vue +5 -1
  117. package/edit/management.cattle.io.fleetworkspace.vue +141 -6
  118. package/edit/management.cattle.io.podsecurityadmissionconfigurationtemplate.vue +4 -1
  119. package/edit/management.cattle.io.setting.vue +1 -1
  120. package/edit/monitoring.coreos.com.alertmanagerconfig/types/webhook.vue +2 -2
  121. package/edit/monitoring.coreos.com.receiver/tls.vue +18 -18
  122. package/edit/monitoring.coreos.com.receiver/types/webhook.banner.vue +4 -4
  123. package/edit/monitoring.coreos.com.receiver/types/webhook.vue +1 -1
  124. package/edit/namespace.vue +2 -2
  125. package/edit/networking.k8s.io.networkpolicy/PolicyRuleTarget.vue +126 -45
  126. package/edit/networking.k8s.io.networkpolicy/index.vue +1 -1
  127. package/edit/provisioning.cattle.io.cluster/MachinePool.vue +10 -0
  128. package/edit/provisioning.cattle.io.cluster/RegistryConfigs.vue +1 -0
  129. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +202 -2
  130. package/edit/provisioning.cattle.io.cluster/rke2.vue +248 -84
  131. package/edit/resources.cattle.io.backup.vue +1 -1
  132. package/edit/service.vue +1 -1
  133. package/edit/storage.k8s.io.storageclass/provisioners/driver.harvesterhci.io.vue +2 -2
  134. package/edit/workload/__tests__/Job.test.ts +3 -1
  135. package/edit/workload/index.vue +8 -3
  136. package/edit/workload/mixins/workload.js +16 -0
  137. package/layouts/default.vue +7 -3
  138. package/list/fleet.cattle.io.bundle.vue +6 -3
  139. package/list/fleet.cattle.io.clusterregistrationtoken.vue +3 -1
  140. package/list/fleet.cattle.io.gitrepo.vue +44 -5
  141. package/list/management.cattle.io.fleetworkspace.vue +45 -0
  142. package/list/node.vue +69 -16
  143. package/list/provisioning.cattle.io.cluster.vue +30 -1
  144. package/machine-config/azure.vue +97 -38
  145. package/middleware/authenticated.js +34 -0
  146. package/mixins/chart.js +73 -2
  147. package/mixins/resource-fetch.js +2 -2
  148. package/models/apps.statefulset.js +28 -0
  149. package/models/cluster/node.js +23 -2
  150. package/models/cluster.x-k8s.io.machine.js +4 -2
  151. package/models/clusterroletemplatebinding.js +7 -0
  152. package/models/constraints.gatekeeper.sh.constraint.js +9 -0
  153. package/models/fleet.cattle.io.cluster.js +19 -10
  154. package/models/fleet.cattle.io.gitrepo.js +7 -2
  155. package/models/management.cattle.io.cluster.js +1 -1
  156. package/models/management.cattle.io.fleetworkspace.js +12 -0
  157. package/models/management.cattle.io.gitreporestriction.js +5 -0
  158. package/models/management.cattle.io.podsecurityadmissionconfigurationtemplate.js +3 -0
  159. package/models/provisioning.cattle.io.cluster.js +7 -5
  160. package/nuxt/App.js +210 -0
  161. package/nuxt/axios.js +186 -0
  162. package/nuxt/client.js +817 -0
  163. package/nuxt/components/nuxt-build-indicator.vue +143 -0
  164. package/nuxt/components/nuxt-child.js +122 -0
  165. package/nuxt/components/nuxt-error.vue +98 -0
  166. package/nuxt/components/nuxt-link.client.js +98 -0
  167. package/nuxt/components/nuxt-link.server.js +16 -0
  168. package/nuxt/components/nuxt-loading.vue +154 -0
  169. package/nuxt/components/nuxt.js +101 -0
  170. package/nuxt/cookie-universal-nuxt.js +9 -0
  171. package/nuxt/empty.js +1 -0
  172. package/nuxt/index.js +365 -0
  173. package/nuxt/jsonp.js +82 -0
  174. package/nuxt/loading.html +39 -0
  175. package/nuxt/middleware.js +12 -0
  176. package/nuxt/mixins/fetch.client.js +90 -0
  177. package/nuxt/mixins/fetch.server.js +69 -0
  178. package/nuxt/portal-vue.js +4 -0
  179. package/nuxt/server.js +312 -0
  180. package/nuxt/store.js +178 -0
  181. package/nuxt/utils.js +630 -0
  182. package/nuxt/views/app.template.html +9 -0
  183. package/nuxt/views/error.html +23 -0
  184. package/package.json +5 -9
  185. package/pages/auth/setup.vue +2 -2
  186. package/pages/c/_cluster/apps/charts/__tests__/install.helper.test.ts +33 -0
  187. package/pages/c/_cluster/apps/charts/chart.vue +4 -4
  188. package/pages/c/_cluster/apps/charts/install.helpers.js +26 -0
  189. package/pages/c/_cluster/apps/charts/install.vue +40 -66
  190. package/pages/c/_cluster/explorer/EventsTable.vue +5 -19
  191. package/pages/c/_cluster/explorer/index.vue +29 -25
  192. package/pages/c/_cluster/explorer/tools/index.vue +8 -8
  193. package/pages/c/_cluster/fleet/index.vue +95 -34
  194. package/pages/c/_cluster/gatekeeper/index.vue +1 -1
  195. package/pages/c/_cluster/istio/index.vue +5 -5
  196. package/pages/c/_cluster/manager/cloudCredential/index.vue +1 -1
  197. package/pages/c/_cluster/monitoring/index.vue +7 -0
  198. package/pages/c/_cluster/uiplugins/InstallDialog.vue +8 -8
  199. package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +20 -7
  200. package/pages/c/_cluster/uiplugins/index.vue +49 -17
  201. package/pages/home.vue +9 -4
  202. package/pages/index.vue +10 -1
  203. package/plugins/clean-html-directive.js +31 -0
  204. package/plugins/dashboard-store/actions.js +32 -9
  205. package/plugins/dashboard-store/mutations.js +5 -2
  206. package/plugins/dashboard-store/resource-class.js +8 -1
  207. package/plugins/steve/mutations.js +3 -2
  208. package/plugins/steve/steve-description-class.js +5 -1
  209. package/plugins/steve/subscribe.js +63 -54
  210. package/plugins/steve-create-worker.js +14 -0
  211. package/promptRemove/management.cattle.io.globalrole.vue +2 -2
  212. package/promptRemove/management.cattle.io.project.vue +2 -2
  213. package/promptRemove/management.cattle.io.roletemplate.vue +2 -2
  214. package/promptRemove/pod.vue +1 -1
  215. package/public/index.html +65 -0
  216. package/rancher-components/components/Banner/Banner.test.ts +9 -1
  217. package/rancher-components/components/Banner/Banner.vue +1 -1
  218. package/rancher-components/components/Form/Checkbox/Checkbox.vue +2 -0
  219. package/rancher-components/components/Form/Radio/RadioButton.vue +1 -1
  220. package/scripts/build-pkg.sh +1 -0
  221. package/scripts/clean +6 -0
  222. package/scripts/extension/bundle +58 -0
  223. package/scripts/extension/helmpatch +89 -0
  224. package/scripts/extension/publish +314 -0
  225. package/scripts/test-plugins-build.sh +4 -0
  226. package/store/__tests__/index.test.ts +110 -0
  227. package/store/index.js +145 -58
  228. package/store/type-map.js +5 -1
  229. package/tsconfig.default.json +36 -0
  230. package/tsconfig.json +24 -0
  231. package/types/shell/index.d.ts +420 -343
  232. package/utils/__tests__/string.test.ts +12 -0
  233. package/utils/auth.js +65 -0
  234. package/utils/monitoring.js +2 -1
  235. package/utils/position.js +5 -8
  236. package/utils/router.scrollBehavior.js +80 -0
  237. package/utils/select.js +1 -3
  238. package/utils/socket.js +1 -0
  239. package/utils/string.js +13 -0
  240. package/utils/time.js +9 -0
  241. package/vue.config.js +679 -0
  242. package/chart/rancher-alerting-drivers.vue +0 -53
  243. package/chart/rancher-gatekeeper.vue +0 -37
  244. package/creators/app/files/nuxt.config.js +0 -6
  245. package/models/management.cattle.io.podsecurityadmissionconfigurationtemplate.ts +0 -4
  246. package/nuxt.config.js +0 -798
package/nuxt/utils.js ADDED
@@ -0,0 +1,630 @@
1
+ import Vue from 'vue'
2
+ import { isSamePath as _isSamePath, joinURL, normalizeURL, withQuery, withoutTrailingSlash } from 'ufo'
3
+
4
+ // window.{{globals.loadedCallback}} hook
5
+ // Useful for jsdom testing or plugins (https://github.com/tmpvar/jsdom#dealing-with-asynchronous-script-loading)
6
+ if (process.client) {
7
+ window.onNuxtReadyCbs = []
8
+ window.onNuxtReady = (cb) => {
9
+ window.onNuxtReadyCbs.push(cb)
10
+ }
11
+ }
12
+
13
+ export function createGetCounter (counterObject, defaultKey = '') {
14
+ return function getCounter (id = defaultKey) {
15
+ if (counterObject[id] === undefined) {
16
+ counterObject[id] = 0
17
+ }
18
+ return counterObject[id]++
19
+ }
20
+ }
21
+
22
+ export function empty () {}
23
+
24
+ export function globalHandleError (error) {
25
+ if (Vue.config.errorHandler) {
26
+ Vue.config.errorHandler(error)
27
+ }
28
+ }
29
+
30
+ export function interopDefault (promise) {
31
+ return promise.then(m => m.default || m)
32
+ }
33
+
34
+ export function hasFetch(vm) {
35
+ return vm.$options && typeof vm.$options.fetch === 'function' && !vm.$options.fetch.length
36
+ }
37
+ export function purifyData(data) {
38
+ if (process.env.NODE_ENV === 'production') {
39
+ return data
40
+ }
41
+
42
+ return Object.entries(data).filter(
43
+ ([key, value]) => {
44
+ const valid = !(value instanceof Function) && !(value instanceof Promise)
45
+ if (!valid) {
46
+ console.warn(`${key} is not able to be stringified. This will break in a production environment.`)
47
+ }
48
+ return valid
49
+ }
50
+ ).reduce((obj, [key, value]) => {
51
+ obj[key] = value
52
+ return obj
53
+ }, {})
54
+ }
55
+ export function getChildrenComponentInstancesUsingFetch(vm, instances = []) {
56
+ const children = vm.$children || []
57
+ for (const child of children) {
58
+ if (child.$fetch) {
59
+ instances.push(child)
60
+ continue; // Don't get the children since it will reload the template
61
+ }
62
+ if (child.$children) {
63
+ getChildrenComponentInstancesUsingFetch(child, instances)
64
+ }
65
+ }
66
+ return instances
67
+ }
68
+
69
+ export function applyAsyncData (Component, asyncData) {
70
+ if (
71
+ // For SSR, we once all this function without second param to just apply asyncData
72
+ // Prevent doing this for each SSR request
73
+ !asyncData && Component.options.__hasNuxtData
74
+ ) {
75
+ return
76
+ }
77
+
78
+ const ComponentData = Component.options._originDataFn || Component.options.data || function () { return {} }
79
+ Component.options._originDataFn = ComponentData
80
+
81
+ Component.options.data = function () {
82
+ const data = ComponentData.call(this, this)
83
+ if (this.$ssrContext) {
84
+ asyncData = this.$ssrContext.asyncData[Component.cid]
85
+ }
86
+ return { ...data, ...asyncData }
87
+ }
88
+
89
+ Component.options.__hasNuxtData = true
90
+
91
+ if (Component._Ctor && Component._Ctor.options) {
92
+ Component._Ctor.options.data = Component.options.data
93
+ }
94
+ }
95
+
96
+ export function sanitizeComponent (Component) {
97
+ // If Component already sanitized
98
+ if (Component.options && Component._Ctor === Component) {
99
+ return Component
100
+ }
101
+ if (!Component.options) {
102
+ Component = Vue.extend(Component) // fix issue #6
103
+ Component._Ctor = Component
104
+ } else {
105
+ Component._Ctor = Component
106
+ Component.extendOptions = Component.options
107
+ }
108
+ // If no component name defined, set file path as name, (also fixes #5703)
109
+ if (!Component.options.name && Component.options.__file) {
110
+ Component.options.name = Component.options.__file
111
+ }
112
+ return Component
113
+ }
114
+
115
+ export function getMatchedComponents (route, matches = false, prop = 'components') {
116
+ return Array.prototype.concat.apply([], route.matched.map((m, index) => {
117
+ return Object.keys(m[prop]).map((key) => {
118
+ matches && matches.push(index)
119
+ return m[prop][key]
120
+ })
121
+ }))
122
+ }
123
+
124
+ export function getMatchedComponentsInstances (route, matches = false) {
125
+ return getMatchedComponents(route, matches, 'instances')
126
+ }
127
+
128
+ export function flatMapComponents (route, fn) {
129
+ return Array.prototype.concat.apply([], route.matched.map((m, index) => {
130
+ return Object.keys(m.components).reduce((promises, key) => {
131
+ if (m.components[key]) {
132
+ promises.push(fn(m.components[key], m.instances[key], m, key, index))
133
+ } else {
134
+ delete m.components[key]
135
+ }
136
+ return promises
137
+ }, [])
138
+ }))
139
+ }
140
+
141
+ export function resolveRouteComponents (route, fn) {
142
+ return Promise.all(
143
+ flatMapComponents(route, async (Component, instance, match, key) => {
144
+ // If component is a function, resolve it
145
+ if (typeof Component === 'function' && !Component.options) {
146
+ try {
147
+ Component = await Component()
148
+ } catch (error) {
149
+ // Handle webpack chunk loading errors
150
+ // This may be due to a new deployment or a network problem
151
+ if (
152
+ error &&
153
+ error.name === 'ChunkLoadError' &&
154
+ typeof window !== 'undefined' &&
155
+ window.sessionStorage
156
+ ) {
157
+ const timeNow = Date.now()
158
+ const previousReloadTime = parseInt(window.sessionStorage.getItem('nuxt-reload'))
159
+
160
+ // check for previous reload time not to reload infinitely
161
+ if (!previousReloadTime || previousReloadTime + 60000 < timeNow) {
162
+ window.sessionStorage.setItem('nuxt-reload', timeNow)
163
+ window.location.reload(true /* skip cache */)
164
+ }
165
+ }
166
+
167
+ throw error
168
+ }
169
+ }
170
+ match.components[key] = Component = sanitizeComponent(Component)
171
+ return typeof fn === 'function' ? fn(Component, instance, match, key) : Component
172
+ })
173
+ )
174
+ }
175
+
176
+ export async function getRouteData (route) {
177
+ if (!route) {
178
+ return
179
+ }
180
+ // Make sure the components are resolved (code-splitting)
181
+ await resolveRouteComponents(route)
182
+ // Send back a copy of route with meta based on Component definition
183
+ return {
184
+ ...route,
185
+ meta: getMatchedComponents(route).map((Component, index) => {
186
+ return { ...Component.options.meta, ...(route.matched[index] || {}).meta }
187
+ })
188
+ }
189
+ }
190
+
191
+ export async function setContext (app, context) {
192
+ // If context not defined, create it
193
+ if (!app.context) {
194
+ app.context = {
195
+ isStatic: process.static,
196
+ isDev: true,
197
+ isHMR: false,
198
+ app,
199
+ store: app.store,
200
+ payload: context.payload,
201
+ error: context.error,
202
+ base: app.router.options.base,
203
+ env: {"commit":"head","version":"0.1.2","dev":true,"pl":1,"perfTest":false,"rancherEnv":"web","api":"http://localhost:8989"}
204
+ }
205
+ // Only set once
206
+
207
+ if (context.req) {
208
+ app.context.req = context.req
209
+ }
210
+ if (context.res) {
211
+ app.context.res = context.res
212
+ }
213
+
214
+ if (context.ssrContext) {
215
+ app.context.ssrContext = context.ssrContext
216
+ }
217
+ app.context.redirect = (status, path, query) => {
218
+ if (!status) {
219
+ return
220
+ }
221
+ app.context._redirected = true
222
+ // if only 1 or 2 arguments: redirect('/') or redirect('/', { foo: 'bar' })
223
+ let pathType = typeof path
224
+ if (typeof status !== 'number' && (pathType === 'undefined' || pathType === 'object')) {
225
+ query = path || {}
226
+ path = status
227
+ pathType = typeof path
228
+ status = 302
229
+ }
230
+ if (pathType === 'object') {
231
+ path = app.router.resolve(path).route.fullPath
232
+ }
233
+ // "/absolute/route", "./relative/route" or "../relative/route"
234
+ if (/(^[.]{1,2}\/)|(^\/(?!\/))/.test(path)) {
235
+ app.context.next({
236
+ path,
237
+ query,
238
+ status
239
+ })
240
+ } else {
241
+ path = withQuery(path, query)
242
+ if (process.server) {
243
+ app.context.next({
244
+ path,
245
+ status
246
+ })
247
+ }
248
+ if (process.client) {
249
+ // https://developer.mozilla.org/en-US/docs/Web/API/Location/replace
250
+ window.location.replace(path)
251
+
252
+ // Throw a redirect error
253
+ throw new Error('ERR_REDIRECT')
254
+ }
255
+ }
256
+ }
257
+ if (process.server) {
258
+ app.context.beforeNuxtRender = fn => context.beforeRenderFns.push(fn)
259
+ }
260
+ if (process.client) {
261
+ app.context.nuxtState = window.__NUXT__
262
+ }
263
+ }
264
+
265
+ // Dynamic keys
266
+ const [currentRouteData, fromRouteData] = await Promise.all([
267
+ getRouteData(context.route),
268
+ getRouteData(context.from)
269
+ ])
270
+
271
+ if (context.route) {
272
+ app.context.route = currentRouteData
273
+ }
274
+
275
+ if (context.from) {
276
+ app.context.from = fromRouteData
277
+ }
278
+
279
+ app.context.next = context.next
280
+ app.context._redirected = false
281
+ app.context._errored = false
282
+ app.context.isHMR = Boolean(context.isHMR)
283
+ app.context.params = app.context.route.params || {}
284
+ app.context.query = app.context.route.query || {}
285
+ }
286
+
287
+ export function middlewareSeries (promises, appContext) {
288
+ if (!promises.length || appContext._redirected || appContext._errored) {
289
+ return Promise.resolve()
290
+ }
291
+ return promisify(promises[0], appContext)
292
+ .then(() => {
293
+ return middlewareSeries(promises.slice(1), appContext)
294
+ })
295
+ }
296
+
297
+ export function promisify (fn, context) {
298
+ let promise
299
+ if (fn.length === 2) {
300
+ console.warn('Callback-based asyncData, fetch or middleware calls are deprecated. ' +
301
+ 'Please switch to promises or async/await syntax')
302
+
303
+ // fn(context, callback)
304
+ promise = new Promise((resolve) => {
305
+ fn(context, function (err, data) {
306
+ if (err) {
307
+ context.error(err)
308
+ }
309
+ data = data || {}
310
+ resolve(data)
311
+ })
312
+ })
313
+ } else {
314
+ promise = fn(context)
315
+ }
316
+
317
+ if (promise && promise instanceof Promise && typeof promise.then === 'function') {
318
+ return promise
319
+ }
320
+ return Promise.resolve(promise)
321
+ }
322
+
323
+ // Imported from vue-router
324
+ export function getLocation (base, mode) {
325
+ if (mode === 'hash') {
326
+ return window.location.hash.replace(/^#\//, '')
327
+ }
328
+
329
+ base = decodeURI(base).slice(0, -1) // consideration is base is normalized with trailing slash
330
+ let path = decodeURI(window.location.pathname)
331
+
332
+ if (base && path.startsWith(base)) {
333
+ path = path.slice(base.length)
334
+ }
335
+
336
+ const fullPath = (path || '/') + window.location.search + window.location.hash
337
+
338
+ return normalizeURL(fullPath)
339
+ }
340
+
341
+ // Imported from path-to-regexp
342
+
343
+ /**
344
+ * Compile a string to a template function for the path.
345
+ *
346
+ * @param {string} str
347
+ * @param {Object=} options
348
+ * @return {!function(Object=, Object=)}
349
+ */
350
+ export function compile (str, options) {
351
+ return tokensToFunction(parse(str, options), options)
352
+ }
353
+
354
+ export function getQueryDiff (toQuery, fromQuery) {
355
+ const diff = {}
356
+ const queries = { ...toQuery, ...fromQuery }
357
+ for (const k in queries) {
358
+ if (String(toQuery[k]) !== String(fromQuery[k])) {
359
+ diff[k] = true
360
+ }
361
+ }
362
+ return diff
363
+ }
364
+
365
+ export function normalizeError (err) {
366
+ let message
367
+ if (!(err.message || typeof err === 'string')) {
368
+ try {
369
+ message = JSON.stringify(err, null, 2)
370
+ } catch (e) {
371
+ message = `[${err.constructor.name}]`
372
+ }
373
+ } else {
374
+ message = err.message || err
375
+ }
376
+ return {
377
+ ...err,
378
+ message,
379
+ statusCode: (err.statusCode || err.status || (err.response && err.response.status) || 500)
380
+ }
381
+ }
382
+
383
+ /**
384
+ * The main path matching regexp utility.
385
+ *
386
+ * @type {RegExp}
387
+ */
388
+ const PATH_REGEXP = new RegExp([
389
+ // Match escaped characters that would otherwise appear in future matches.
390
+ // This allows the user to escape special characters that won't transform.
391
+ '(\\\\.)',
392
+ // Match Express-style parameters and un-named parameters with a prefix
393
+ // and optional suffixes. Matches appear as:
394
+ //
395
+ // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
396
+ // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
397
+ // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
398
+ '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
399
+ ].join('|'), 'g')
400
+
401
+ /**
402
+ * Parse a string for the raw tokens.
403
+ *
404
+ * @param {string} str
405
+ * @param {Object=} options
406
+ * @return {!Array}
407
+ */
408
+ function parse (str, options) {
409
+ const tokens = []
410
+ let key = 0
411
+ let index = 0
412
+ let path = ''
413
+ const defaultDelimiter = (options && options.delimiter) || '/'
414
+ let res
415
+
416
+ while ((res = PATH_REGEXP.exec(str)) != null) {
417
+ const m = res[0]
418
+ const escaped = res[1]
419
+ const offset = res.index
420
+ path += str.slice(index, offset)
421
+ index = offset + m.length
422
+
423
+ // Ignore already escaped sequences.
424
+ if (escaped) {
425
+ path += escaped[1]
426
+ continue
427
+ }
428
+
429
+ const next = str[index]
430
+ const prefix = res[2]
431
+ const name = res[3]
432
+ const capture = res[4]
433
+ const group = res[5]
434
+ const modifier = res[6]
435
+ const asterisk = res[7]
436
+
437
+ // Push the current path onto the tokens.
438
+ if (path) {
439
+ tokens.push(path)
440
+ path = ''
441
+ }
442
+
443
+ const partial = prefix != null && next != null && next !== prefix
444
+ const repeat = modifier === '+' || modifier === '*'
445
+ const optional = modifier === '?' || modifier === '*'
446
+ const delimiter = res[2] || defaultDelimiter
447
+ const pattern = capture || group
448
+
449
+ tokens.push({
450
+ name: name || key++,
451
+ prefix: prefix || '',
452
+ delimiter,
453
+ optional,
454
+ repeat,
455
+ partial,
456
+ asterisk: Boolean(asterisk),
457
+ pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
458
+ })
459
+ }
460
+
461
+ // Match any characters still remaining.
462
+ if (index < str.length) {
463
+ path += str.substr(index)
464
+ }
465
+
466
+ // If the path exists, push it onto the end.
467
+ if (path) {
468
+ tokens.push(path)
469
+ }
470
+
471
+ return tokens
472
+ }
473
+
474
+ /**
475
+ * Prettier encoding of URI path segments.
476
+ *
477
+ * @param {string}
478
+ * @return {string}
479
+ */
480
+ function encodeURIComponentPretty (str, slashAllowed) {
481
+ const re = slashAllowed ? /[?#]/g : /[/?#]/g
482
+ return encodeURI(str).replace(re, (c) => {
483
+ return '%' + c.charCodeAt(0).toString(16).toUpperCase()
484
+ })
485
+ }
486
+
487
+ /**
488
+ * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
489
+ *
490
+ * @param {string}
491
+ * @return {string}
492
+ */
493
+ function encodeAsterisk (str) {
494
+ return encodeURIComponentPretty(str, true)
495
+ }
496
+
497
+ /**
498
+ * Escape a regular expression string.
499
+ *
500
+ * @param {string} str
501
+ * @return {string}
502
+ */
503
+ function escapeString (str) {
504
+ return str.replace(/([.+*?=^!:${}()[\]|/\\])/g, '\\$1')
505
+ }
506
+
507
+ /**
508
+ * Escape the capturing group by escaping special characters and meaning.
509
+ *
510
+ * @param {string} group
511
+ * @return {string}
512
+ */
513
+ function escapeGroup (group) {
514
+ return group.replace(/([=!:$/()])/g, '\\$1')
515
+ }
516
+
517
+ /**
518
+ * Expose a method for transforming tokens into the path function.
519
+ */
520
+ function tokensToFunction (tokens, options) {
521
+ // Compile all the tokens into regexps.
522
+ const matches = new Array(tokens.length)
523
+
524
+ // Compile all the patterns before compilation.
525
+ for (let i = 0; i < tokens.length; i++) {
526
+ if (typeof tokens[i] === 'object') {
527
+ matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options))
528
+ }
529
+ }
530
+
531
+ return function (obj, opts) {
532
+ let path = ''
533
+ const data = obj || {}
534
+ const options = opts || {}
535
+ const encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent
536
+
537
+ for (let i = 0; i < tokens.length; i++) {
538
+ const token = tokens[i]
539
+
540
+ if (typeof token === 'string') {
541
+ path += token
542
+
543
+ continue
544
+ }
545
+
546
+ const value = data[token.name || 'pathMatch']
547
+ let segment
548
+
549
+ if (value == null) {
550
+ if (token.optional) {
551
+ // Prepend partial segment prefixes.
552
+ if (token.partial) {
553
+ path += token.prefix
554
+ }
555
+
556
+ continue
557
+ } else {
558
+ throw new TypeError('Expected "' + token.name + '" to be defined')
559
+ }
560
+ }
561
+
562
+ if (Array.isArray(value)) {
563
+ if (!token.repeat) {
564
+ throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
565
+ }
566
+
567
+ if (value.length === 0) {
568
+ if (token.optional) {
569
+ continue
570
+ } else {
571
+ throw new TypeError('Expected "' + token.name + '" to not be empty')
572
+ }
573
+ }
574
+
575
+ for (let j = 0; j < value.length; j++) {
576
+ segment = encode(value[j])
577
+
578
+ if (!matches[i].test(segment)) {
579
+ throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
580
+ }
581
+
582
+ path += (j === 0 ? token.prefix : token.delimiter) + segment
583
+ }
584
+
585
+ continue
586
+ }
587
+
588
+ segment = token.asterisk ? encodeAsterisk(value) : encode(value)
589
+
590
+ if (!matches[i].test(segment)) {
591
+ throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
592
+ }
593
+
594
+ path += token.prefix + segment
595
+ }
596
+
597
+ return path
598
+ }
599
+ }
600
+
601
+ /**
602
+ * Get the flags for a regexp from the options.
603
+ *
604
+ * @param {Object} options
605
+ * @return {string}
606
+ */
607
+ function flags (options) {
608
+ return options && options.sensitive ? '' : 'i'
609
+ }
610
+
611
+ export function addLifecycleHook(vm, hook, fn) {
612
+ if (!vm.$options[hook]) {
613
+ vm.$options[hook] = []
614
+ }
615
+ if (!vm.$options[hook].includes(fn)) {
616
+ vm.$options[hook].push(fn)
617
+ }
618
+ }
619
+
620
+ export const urlJoin = joinURL
621
+
622
+ export const stripTrailingSlash = withoutTrailingSlash
623
+
624
+ export const isSamePath = _isSamePath
625
+
626
+ export function setScrollRestoration (newVal) {
627
+ try {
628
+ window.history.scrollRestoration = newVal;
629
+ } catch(e) {}
630
+ }
@@ -0,0 +1,9 @@
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>
@@ -0,0 +1,23 @@
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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rancher/shell",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Rancher Dashboard Shell",
5
5
  "repository": "https://github.com/rancherlabs/dashboard",
6
6
  "license": "Apache-2.0",
@@ -16,15 +16,11 @@
16
16
  "clean": "./scripts/clean",
17
17
  "lint": "./node_modules/.bin/eslint --max-warnings 0 --ext .ts,.js,.vue .",
18
18
  "test": "./node_modules/.bin/nyc ava --serial --verbose",
19
- "nuxt": "./node_modules/.bin/nuxt",
20
- "dev": "./node_modules/.bin/nuxt dev",
21
- "mem-dev": "node --max-old-space-size=8192 ./node_modules/.bin/nuxt dev",
19
+ "dev": "./node_modules/.bin/vue-cli-service dev",
22
20
  "docker-dev": "docker run --rm --name dashboard-dev -p 8005:8005 -e API=$API -v $(pwd):/src -v dashboard_node:/src/node_modules rancher/dashboard:dev",
23
- "build": "./node_modules/.bin/nuxt build --devtools",
24
- "analyze": "./node_modules/.bin/nuxt build --analyze",
25
- "start": "./node_modules/.bin/nuxt start",
26
- "generate": "./node_modules/.bin/nuxt generate",
27
- "dev-debug": "node --inspect ./node_modules/.bin/nuxt",
21
+ "build": "./node_modules/.bin/vue-cli-service build",
22
+ "analyze": "./node_modules/.bin/vue-cli-service build --report",
23
+ "start": "./node_modules/.bin/vue-cli-service start",
28
24
  "cy:run": "cypress run",
29
25
  "cy:open": "cypress open",
30
26
  "e2e:pre": "NODE_ENV=dev yarn build",
@@ -281,8 +281,8 @@ export default {
281
281
 
282
282
  <template v-if="mustChangePassword">
283
283
  <p
284
+ v-clean-html="t(isFirstLogin ? 'setup.setPassword' : 'setup.newUserSetPassword', { username }, true)"
284
285
  class="text-center mb-20 mt-20 setup-title"
285
- v-html="t(isFirstLogin ? 'setup.setPassword' : 'setup.newUserSetPassword', { username }, true)"
286
286
  />
287
287
 
288
288
  <Password
@@ -495,7 +495,7 @@ export default {
495
495
  }
496
496
 
497
497
  .landscape {
498
- background-image: url('~shell/assets/images/pl/login-landscape.svg');
498
+ background-image: url('~@shell/assets/images/pl/login-landscape.svg');
499
499
  background-repeat: no-repeat;
500
500
  background-size: cover;
501
501
  background-position: center center;