@rancher/shell 0.4.0 → 0.5.1

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 (243) hide show
  1. package/assets/images/providers/ovhcloudmks.svg +122 -0
  2. package/assets/images/providers/ovhcloudpubliccloud.svg +122 -0
  3. package/assets/styles/global/_layout.scss +99 -0
  4. package/assets/translations/en-us.yaml +30 -5
  5. package/assets/translations/zh-hans.yaml +1 -1
  6. package/babel.config.js +7 -1
  7. package/chart/monitoring/alerting/index.vue +7 -21
  8. package/chart/monitoring/grafana/index.vue +55 -0
  9. package/chart/monitoring/index.vue +51 -17
  10. package/chart/monitoring/prometheus/index.vue +37 -43
  11. package/chart/rancher-backup/index.vue +2 -1
  12. package/cloud-credential/azure.vue +4 -17
  13. package/components/Certificates.vue +164 -0
  14. package/components/CodeMirror.vue +19 -21
  15. package/components/CruResource.vue +1 -0
  16. package/components/EtcdInfoBanner.vue +1 -1
  17. package/components/ExplorerProjectsNamespaces.vue +25 -1
  18. package/components/IconOrSvg.vue +1 -1
  19. package/components/LandingPagePreference.vue +1 -4
  20. package/components/Questions/index.vue +1 -1
  21. package/components/ResourceDetail/Masthead.vue +16 -3
  22. package/components/ResourceTable.vue +14 -2
  23. package/components/ResourceYaml.vue +5 -0
  24. package/components/SideNav.vue +1 -1
  25. package/components/SingleClusterInfo.vue +1 -4
  26. package/components/Tabbed/index.vue +12 -0
  27. package/components/fleet/FleetRepos.vue +62 -27
  28. package/components/fleet/FleetResources.vue +6 -1
  29. package/components/form/ArrayListSelect.vue +10 -0
  30. package/components/form/KeyValue.vue +4 -0
  31. package/components/form/LabeledSelect.vue +4 -0
  32. package/components/formatter/Checked.vue +11 -3
  33. package/components/formatter/FleetClusterSummaryGraph.vue +27 -0
  34. package/components/formatter/FleetSummaryGraph.vue +23 -11
  35. package/components/formatter/LiveDuration.vue +1 -1
  36. package/components/formatter/PercentageBar.vue +1 -1
  37. package/components/formatter/__tests__/Checked.test.ts +19 -0
  38. package/components/nav/Group.vue +2 -2
  39. package/components/nav/Header.vue +0 -1
  40. package/components/nav/TopLevelMenu.vue +36 -6
  41. package/components/nav/Type.vue +1 -3
  42. package/components/nav/WindowManager/ContainerLogs.vue +101 -3
  43. package/components/nav/WindowManager/ContainerShell.vue +6 -1
  44. package/components/nav/WindowManager/__tests__/ContainerLogs.test.ts +186 -0
  45. package/components/nav/WindowManager/index.vue +11 -10
  46. package/components/nav/__tests__/TopLevelMenu.test.ts +33 -0
  47. package/components/nav/__tests__/Type.test.ts +1 -1
  48. package/components/nuxt/nuxt-child.js +14 -78
  49. package/components/nuxt/nuxt.js +1 -1
  50. package/{layouts → components/templates}/blank.vue +1 -1
  51. package/{layouts → components/templates}/default.vue +8 -98
  52. package/{layouts → components/templates}/error.vue +10 -19
  53. package/{layouts → components/templates}/home.vue +4 -1
  54. package/{layouts → components/templates}/plain.vue +4 -1
  55. package/{layouts → components/templates}/standalone.vue +1 -1
  56. package/{layouts → components/templates}/unauthenticated.vue +1 -1
  57. package/composables/useCompactInput.ts +20 -0
  58. package/composables/useLabeledFormElement.ts +138 -0
  59. package/config/harvester-manager-types.js +2 -0
  60. package/config/private-label.js +22 -0
  61. package/config/product/explorer.js +3 -0
  62. package/config/product/fleet.js +6 -1
  63. package/config/product/manager.js +8 -2
  64. package/config/query-params.js +1 -0
  65. package/config/router.js +385 -364
  66. package/config/settings.ts +1 -0
  67. package/config/store.js +1 -1
  68. package/config/system-namespaces.js +3 -0
  69. package/config/table-headers.js +47 -0
  70. package/core/plugin-routes.ts +56 -114
  71. package/core/plugin.ts +16 -10
  72. package/core/plugins-loader.js +7 -9
  73. package/core/plugins.js +0 -3
  74. package/creators/app/files/.gitlab-ci.yml +1 -1
  75. package/detail/fleet.cattle.io.cluster.vue +11 -1
  76. package/detail/provisioning.cattle.io.cluster.vue +4 -3
  77. package/dialog/ScaleMachineDownDialog.vue +34 -17
  78. package/edit/__tests__/service.test.ts +89 -0
  79. package/edit/auth/googleoauth.vue +1 -5
  80. package/edit/catalog.cattle.io.clusterrepo.vue +18 -0
  81. package/edit/cloudcredential.vue +2 -0
  82. package/edit/configmap.vue +2 -1
  83. package/edit/networking.k8s.io.networkpolicy/__tests__/PolicyRuleTarget.spec.ts +1 -1
  84. package/edit/provisioning.cattle.io.cluster/SelectCredential.vue +15 -7
  85. package/edit/provisioning.cattle.io.cluster/__tests__/Advanced.test.ts +112 -0
  86. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.test.ts +473 -0
  87. package/edit/provisioning.cattle.io.cluster/__tests__/{CustomCommand.tests.ts → CustomCommand.test.ts} +4 -0
  88. package/edit/provisioning.cattle.io.cluster/__tests__/DrainOptions.test.ts +1 -1
  89. package/edit/provisioning.cattle.io.cluster/__tests__/index.test.ts +73 -0
  90. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +7 -1
  91. package/edit/provisioning.cattle.io.cluster/__tests__/utils/cluster.ts +386 -0
  92. package/edit/provisioning.cattle.io.cluster/import.vue +2 -2
  93. package/edit/provisioning.cattle.io.cluster/index.vue +92 -36
  94. package/edit/provisioning.cattle.io.cluster/rke2.vue +171 -583
  95. package/edit/provisioning.cattle.io.cluster/tabs/AddOnConfig.vue +137 -0
  96. package/edit/provisioning.cattle.io.cluster/tabs/Advanced.vue +157 -0
  97. package/edit/provisioning.cattle.io.cluster/{Basics.vue → tabs/Basics.vue} +94 -19
  98. package/edit/provisioning.cattle.io.cluster/{MachinePool.vue → tabs/MachinePool.vue} +1 -0
  99. package/edit/provisioning.cattle.io.cluster/tabs/etcd/index.vue +135 -0
  100. package/edit/provisioning.cattle.io.cluster/tabs/networking/index.vue +189 -0
  101. package/edit/provisioning.cattle.io.cluster/tabs/registries/index.vue +144 -0
  102. package/edit/provisioning.cattle.io.cluster/tabs/upgrade/index.vue +76 -0
  103. package/edit/service.vue +12 -0
  104. package/edit/workload/mixins/workload.js +1 -1
  105. package/initialize/App.js +25 -71
  106. package/initialize/client.js +21 -162
  107. package/initialize/index.js +27 -123
  108. package/list/management.cattle.io.feature.vue +1 -7
  109. package/list/node.vue +1 -0
  110. package/machine-config/__tests__/vmwarevsphere.test.ts +100 -21
  111. package/machine-config/vmwarevsphere.vue +73 -51
  112. package/middleware/authenticated.js +10 -17
  113. package/mixins/auth-config.js +2 -7
  114. package/mixins/brand.js +29 -41
  115. package/mixins/labeled-form-element.ts +6 -1
  116. package/models/__tests__/management.cattle.io.node.ts +85 -0
  117. package/models/__tests__/management.cattle.io.nodepool.ts +83 -0
  118. package/models/__tests__/namespace.test.ts +49 -9
  119. package/models/__tests__/workload.test.ts +91 -0
  120. package/models/cluster/node.js +4 -4
  121. package/models/cluster.x-k8s.io.machinedeployment.js +14 -0
  122. package/models/fleet.cattle.io.cluster.js +4 -0
  123. package/models/fleet.cattle.io.gitrepo.js +56 -13
  124. package/models/management.cattle.io.kontainerdriver.js +1 -1
  125. package/models/management.cattle.io.node.js +18 -14
  126. package/models/management.cattle.io.nodepool.js +17 -0
  127. package/models/namespace.js +1 -1
  128. package/models/pod.js +20 -0
  129. package/models/provisioning.cattle.io.cluster.js +20 -3
  130. package/models/secret.js +117 -18
  131. package/models/workload.js +16 -0
  132. package/models/workload.service.js +18 -0
  133. package/package.json +10 -9
  134. package/pages/about.vue +0 -1
  135. package/pages/account/create-key.vue +0 -1
  136. package/pages/account/index.vue +0 -1
  137. package/pages/auth/login.vue +0 -1
  138. package/pages/auth/logout.vue +0 -2
  139. package/pages/auth/setup.vue +0 -4
  140. package/pages/auth/verify.vue +14 -8
  141. package/pages/c/_cluster/apps/charts/install.vue +4 -4
  142. package/pages/c/_cluster/apps/index.vue +0 -2
  143. package/pages/c/_cluster/auth/index.vue +0 -2
  144. package/pages/c/_cluster/ecm/index.vue +0 -2
  145. package/pages/c/_cluster/explorer/index.vue +28 -2
  146. package/pages/c/_cluster/fleet/index.vue +1 -1
  147. package/pages/c/_cluster/index.vue +0 -2
  148. package/pages/c/_cluster/settings/banners.vue +0 -2
  149. package/pages/c/_cluster/settings/brand.vue +0 -2
  150. package/pages/c/_cluster/settings/index.vue +0 -2
  151. package/pages/c/_cluster/settings/links.vue +0 -1
  152. package/pages/c/_cluster/settings/performance.vue +0 -1
  153. package/pages/c/_cluster/uiplugins/CatalogList/CatalogLoadDialog.vue +2 -1
  154. package/pages/c/_cluster/uiplugins/CatalogList/index.vue +10 -46
  155. package/pages/c/_cluster/uiplugins/index.vue +0 -2
  156. package/pages/diagnostic.vue +1 -2
  157. package/pages/fail-whale.vue +0 -1
  158. package/pages/prefs.vue +0 -1
  159. package/pages/support/index.vue +2 -8
  160. package/pkg/auto-import.js +1 -1
  161. package/plugins/axios.js +0 -36
  162. package/plugins/back-button.js +3 -5
  163. package/plugins/codemirror-loader.js +1 -1
  164. package/plugins/codemirror.js +41 -0
  165. package/plugins/dashboard-store/__tests__/{mutations.spec.ts → mutations.test.ts} +1 -1
  166. package/plugins/dashboard-store/__tests__/resource-class.test.ts +49 -0
  167. package/plugins/dashboard-store/__tests__/utils/store-mocks.ts +7 -0
  168. package/plugins/dashboard-store/actions.js +30 -4
  169. package/plugins/dashboard-store/classify.js +1 -18
  170. package/plugins/dashboard-store/getters.js +10 -5
  171. package/plugins/dashboard-store/index.js +0 -12
  172. package/plugins/dashboard-store/mutations.js +0 -4
  173. package/plugins/dashboard-store/resource-class.js +59 -18
  174. package/plugins/steve/__tests__/steve-class.spec.ts +59 -0
  175. package/plugins/steve/__tests__/utils/steve-mocks.ts +31 -0
  176. package/plugins/steve/getters.js +4 -1
  177. package/plugins/steve/norman-class.js +19 -0
  178. package/plugins/steve/steve-class.js +22 -0
  179. package/plugins/steve/subscribe.js +4 -10
  180. package/rancher-components/Accordion/Accordion.test.ts +45 -0
  181. package/rancher-components/Accordion/Accordion.vue +85 -0
  182. package/rancher-components/Accordion/index.ts +1 -0
  183. package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +19 -2
  184. package/rancher-components/Form/LabeledInput/LabeledInput.vue +12 -1
  185. package/rancher-components/Form/Radio/RadioButton.test.ts +7 -3
  186. package/rancher-components/Form/Radio/RadioGroup.test.ts +30 -0
  187. package/rancher-components/Form/Radio/RadioGroup.vue +4 -0
  188. package/rancher-components/StringList/StringList.test.ts +270 -0
  189. package/rancher-components/StringList/StringList.vue +57 -18
  190. package/rancher-components/components/Accordion/Accordion.test.ts +45 -0
  191. package/rancher-components/components/Accordion/Accordion.vue +85 -0
  192. package/rancher-components/components/Accordion/index.ts +1 -0
  193. package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +19 -2
  194. package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +4 -1
  195. package/scripts/.gitlab/workflows/build-extension-catalog.gitlab-ci.yml +50 -0
  196. package/scripts/extension/parse-tag-name +2 -2
  197. package/scripts/publish-shell.sh +10 -0
  198. package/scripts/test-plugins-build.sh +85 -9
  199. package/server/har-file.js +183 -0
  200. package/store/catalog.js +1 -1
  201. package/store/features.js +1 -0
  202. package/store/i18n.js +11 -0
  203. package/store/index.js +10 -11
  204. package/store/prefs.js +33 -35
  205. package/store/type-map.js +8 -7
  206. package/tsconfig.json +35 -9
  207. package/tsconfig.paths.json +18 -0
  208. package/types/shell/index.d.ts +345 -214
  209. package/utils/__tests__/create-yaml.test.ts +60 -0
  210. package/utils/axios.js +0 -19
  211. package/utils/azure.js +24 -0
  212. package/utils/create-yaml.js +17 -10
  213. package/utils/monitoring.js +1 -1
  214. package/utils/nuxt.js +18 -39
  215. package/utils/object.js +14 -0
  216. package/utils/router.scrollBehavior.js +12 -14
  217. package/utils/time.js +1 -1
  218. package/utils/url.ts +1 -1
  219. package/vue.config.js +23 -2
  220. package/.DS_Store +0 -0
  221. package/assets/images/providers/aks-black.svg +0 -28
  222. package/assets/images/providers/aks.svg +0 -31
  223. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.tests.ts +0 -234
  224. package/initialize/layouts.ts +0 -26
  225. package/mixins/fetch.server.js +0 -73
  226. package/pages/c/index.vue +0 -9
  227. package/pages/rio/mesh.vue +0 -508
  228. package/plugins/transitions.js +0 -4
  229. package/scripts/.DS_Store +0 -0
  230. package/scripts/verdaccio.log +0 -205
  231. package/tsconfig.default.json +0 -46
  232. package/yarn-error.log +0 -200
  233. /package/components/form/__tests__/{NameNsDescription.ts → NameNsDescription.test.ts} +0 -0
  234. /package/edit/networking.k8s.io.networkpolicy/__tests__/utils/{selectors.ts → selectors.test.ts} +0 -0
  235. /package/edit/provisioning.cattle.io.cluster/{AgentConfiguration.vue → tabs/AgentConfiguration.vue} +0 -0
  236. /package/edit/provisioning.cattle.io.cluster/{MemberRoles.vue → tabs/MemberRoles.vue} +0 -0
  237. /package/edit/provisioning.cattle.io.cluster/{S3Config.vue → tabs/etcd/S3Config.vue} +0 -0
  238. /package/edit/provisioning.cattle.io.cluster/{ACE.vue → tabs/networking/ACE.vue} +0 -0
  239. /package/edit/provisioning.cattle.io.cluster/{RegistryConfigs.vue → tabs/registries/RegistryConfigs.vue} +0 -0
  240. /package/edit/provisioning.cattle.io.cluster/{RegistryMirrors.vue → tabs/registries/RegistryMirrors.vue} +0 -0
  241. /package/edit/provisioning.cattle.io.cluster/{DrainOptions.vue → tabs/upgrade/DrainOptions.vue} +0 -0
  242. /package/plugins/dashboard-store/__tests__/{actions.spec.ts → actions.test.ts} +0 -0
  243. /package/plugins/dashboard-store/__tests__/{getters.spec.ts → getters.test.ts} +0 -0
@@ -60,4 +60,64 @@ describe('fx: dumpBlock', () => {
60
60
  });
61
61
  });
62
62
  });
63
+
64
+ it('should retain line breaks when a line longer than 80 characters exists', () => {
65
+ const data = {
66
+ 'managerApiConfiguration.properties': `# Sample XPlanManagerAPI Configuration (if this comment is longer than 80 characters, the output should remain the same)
67
+
68
+ apiUrl=https://example.com/xplan-api-manager
69
+ contactEmailAddress=contact@example.com
70
+ termsOfServiceUrl=https://example.com/terms
71
+ documentationUrl=https://example.com/docs
72
+ wmsUrl=https://example.com/xplan-wms/services
73
+ skipSemantic=false
74
+ skipGeometric=true`
75
+ };
76
+
77
+ const expectedResult = `managerApiConfiguration.properties: >+
78
+ # Sample XPlanManagerAPI Configuration (if this comment is longer than 80 characters, the output should remain the same)
79
+
80
+ apiUrl=https://example.com/xplan-api-manager
81
+ contactEmailAddress=contact@example.com
82
+ termsOfServiceUrl=https://example.com/terms
83
+ documentationUrl=https://example.com/docs
84
+ wmsUrl=https://example.com/xplan-wms/services
85
+ skipSemantic=false
86
+ skipGeometric=true
87
+ `;
88
+
89
+ const yamlModifiers = {
90
+ lineWidth: -1,
91
+ 'managerApiConfiguration.properties': {
92
+ chomping: '+',
93
+ scalarStyle: '>',
94
+ }
95
+ };
96
+
97
+ const result = dumpBlock(data, yamlModifiers);
98
+
99
+ expect(result).toStrictEqual(expectedResult);
100
+ });
101
+
102
+ it('should not attempt to replace indicators when a header cannot be found', () => {
103
+ const data = {
104
+ a: 'a\nb\tc',
105
+ b: 'a\nb\tc',
106
+ c: `a
107
+ b c`
108
+ };
109
+
110
+ const expectedResult = `a: "a\\nb\\tc"\nb: "a\\nb\\tc"\nc: |+\n a\n b c\n`;
111
+
112
+ const yamlModifiers = {
113
+ lineWidth: -1,
114
+ a: { chomping: '+' },
115
+ b: { chomping: '+' },
116
+ c: { chomping: '+' },
117
+ };
118
+
119
+ const result = dumpBlock(data, yamlModifiers);
120
+
121
+ expect(result).toStrictEqual(expectedResult);
122
+ });
63
123
  });
package/utils/axios.js CHANGED
@@ -75,10 +75,6 @@ const createAxiosInstance = (axiosOptions) => {
75
75
  };
76
76
 
77
77
  const setupProgress = (axios) => {
78
- if (process.server) {
79
- return;
80
- }
81
-
82
78
  // A noop loading inteterface for when $nuxt is not yet ready
83
79
  const noopLoading = {
84
80
  finish: () => { },
@@ -167,21 +163,6 @@ export default (ctx, inject) => {
167
163
  headers
168
164
  };
169
165
 
170
- // Proxy SSR request headers headers
171
- if (process.server && ctx.req && ctx.req.headers) {
172
- const reqHeaders = { ...ctx.req.headers };
173
-
174
- for (const h of ['accept', 'host', 'cf-ray', 'cf-connecting-ip', 'content-length', 'content-md5', 'content-type']) {
175
- delete reqHeaders[h];
176
- }
177
- axiosOptions.headers.common = { ...reqHeaders, ...axiosOptions.headers.common };
178
- }
179
-
180
- if (process.server) {
181
- // Don't accept brotli encoding because Node can't parse it
182
- axiosOptions.headers.common['accept-encoding'] = 'gzip, deflate';
183
- }
184
-
185
166
  const axios = createAxiosInstance(axiosOptions);
186
167
 
187
168
  // Inject axios to the context as $axios
package/utils/azure.js ADDED
@@ -0,0 +1,24 @@
1
+ const AZURE_ERROR_MSG_REGEX = /^.*Message=\"(.*)\"$/;
2
+ const AZURE_ERROR_JSON_REGEX = /^.*Response body: ({.*})/;
3
+
4
+ export const parseAzureError = (err) => {
5
+ // Try and parse the response from Azure a couple of ways
6
+ const msgMatch = err.match(AZURE_ERROR_MSG_REGEX);
7
+
8
+ if (msgMatch?.length === 2) {
9
+ return msgMatch[1];
10
+ } else {
11
+ const jsonMatch = err.match(AZURE_ERROR_JSON_REGEX);
12
+
13
+ if (jsonMatch?.length === 2) {
14
+ try {
15
+ const errorObj = JSON.parse(jsonMatch[1]);
16
+
17
+ return errorObj.error_description;
18
+ } catch (e) {}
19
+ }
20
+ }
21
+
22
+ // Can't parse error
23
+ return false;
24
+ };
@@ -32,7 +32,6 @@ const ALWAYS_ADD = [
32
32
  ];
33
33
 
34
34
  export const NEVER_ADD = [
35
- 'metadata.clusterName',
36
35
  'metadata.clusterName',
37
36
  'metadata.creationTimestamp',
38
37
  'metadata.deletionGracePeriodSeconds',
@@ -46,11 +45,16 @@ export const NEVER_ADD = [
46
45
  'metadata.resourceVersion',
47
46
  'metadata.relationships',
48
47
  'metadata.selfLink',
48
+ 'metadata.state',
49
49
  'metadata.uid',
50
50
  // CRD -> Schema describes the schema used for validation, pruning, and defaulting of this version of the custom resource. If we allow processing we fall into inf loop on openAPIV3Schema.allOf which contains a cyclical ref of allOf props.
51
51
  'spec.versions.schema',
52
52
  'status',
53
53
  'stringData',
54
+ 'links',
55
+ '_name',
56
+ '_labels',
57
+ '_annotations',
54
58
  ];
55
59
 
56
60
  export const ACTIVELY_REMOVE = [
@@ -443,20 +447,21 @@ export function saferDump(obj) {
443
447
  *
444
448
  * this is required since jsyaml.dump doesn't support chomping and scalar style at the moment.
445
449
  * see: https://github.com/nodeca/js-yaml/issues/171
450
+
451
+ * @typedef {Object} DumpBlockOptions
452
+ * @property {('>' | '|')} [scalarStyle] - The scalar style.
453
+ * @property {('-' | '+' | '' | null)} [chomping] - The chomping style.
446
454
  *
447
455
  * @param {*} data the multiline block
448
- * @param {*} options blocks indicators, see: https://yaml-multiline.info
456
+ * @param {Object} options - Serialization options for jsyaml.dump.
457
+ * @param {number} options.lineWidth - Set max line width. Set -1 for unlimited width.
458
+ * @param {DumpBlockOptions} [options.dynamicProperties] - Options for dynamic properties.
459
+ * Developers can provide their own property names under `options`.
449
460
  *
450
- * - scalarStyle:
451
- * one of '|', '>'
452
- * default '|'
453
- * - chomping:
454
- * one of: null, '', '-', '+'
455
- * default: null
456
461
  * @returns the result of jsyaml.dump with the addition of multiline indicators
457
462
  */
458
463
  export function dumpBlock(data, options = {}) {
459
- const parsed = jsyaml.dump(data);
464
+ const parsed = jsyaml.dump(data, options);
460
465
 
461
466
  let out = parsed;
462
467
 
@@ -472,7 +477,9 @@ export function dumpBlock(data, options = {}) {
472
477
  /**
473
478
  * Replace the original block indicators with the ones provided in the options param
474
479
  */
475
- out = out.replace(header, `${ key }: ${ scalarStyle }${ chomping }${ indentation }`);
480
+ if (header) {
481
+ out = out.replace(header, `${ key }: ${ scalarStyle }${ chomping }${ indentation }`);
482
+ }
476
483
  }
477
484
  }
478
485
 
@@ -42,7 +42,7 @@ export function haveV1Monitoring(getters) {
42
42
  return !!cluster?.status?.monitoringStatus;
43
43
  }
44
44
 
45
- const CATTLE_MONITORING_NAMESPACE = 'cattle-monitoring-system';
45
+ export const CATTLE_MONITORING_NAMESPACE = 'cattle-monitoring-system';
46
46
 
47
47
  export async function haveV1MonitoringWorkloads(store) {
48
48
  const workloadsByType = await Promise.all(
package/utils/nuxt.js CHANGED
@@ -5,12 +5,10 @@ import {
5
5
 
6
6
  // window.{{globals.loadedCallback}} hook
7
7
  // Useful for jsdom testing or plugins (https://github.com/tmpvar/jsdom#dealing-with-asynchronous-script-loading)
8
- if (process.client) {
9
- window.onNuxtReadyCbs = [];
10
- window.onNuxtReady = (cb) => {
11
- window.onNuxtReadyCbs.push(cb);
12
- };
13
- }
8
+ window.onNuxtReadyCbs = [];
9
+ window.onNuxtReady = (cb) => {
10
+ window.onNuxtReadyCbs.push(cb);
11
+ };
14
12
 
15
13
  export function createGetCounter(counterObject, defaultKey = '') {
16
14
  return function getCounter(id = defaultKey) {
@@ -92,10 +90,6 @@ export function applyAsyncData(Component, asyncData) {
92
90
  Component.options.data = function() {
93
91
  const data = ComponentData.call(this, this);
94
92
 
95
- if (this.$ssrContext) {
96
- asyncData = this.$ssrContext.asyncData[Component.cid];
97
- }
98
-
99
93
  return { ...data, ...asyncData };
100
94
  };
101
95
 
@@ -210,15 +204,14 @@ export async function setContext(app, context) {
210
204
  // If context not defined, create it
211
205
  if (!app.context) {
212
206
  app.context = {
213
- isStatic: process.static,
214
- isDev: true,
215
- isHMR: false,
207
+ isDev: true,
208
+ isHMR: false,
216
209
  app,
217
- store: app.store,
218
- payload: context.payload,
219
- error: context.error,
220
- base: app.router.options.base,
221
- env: {
210
+ store: app.store,
211
+ payload: context.payload,
212
+ error: context.error,
213
+ base: app.router.options.base,
214
+ env: {
222
215
  commit: 'head', version: '0.1.2', dev: true, pl: 1, perfTest: false, rancherEnv: 'web', api: 'http://localhost:8989'
223
216
  }
224
217
  };
@@ -231,9 +224,6 @@ export async function setContext(app, context) {
231
224
  app.context.res = context.res;
232
225
  }
233
226
 
234
- if (context.ssrContext) {
235
- app.context.ssrContext = context.ssrContext;
236
- }
237
227
  app.context.redirect = (status, path, query) => {
238
228
  if (!status) {
239
229
  return;
@@ -260,27 +250,16 @@ export async function setContext(app, context) {
260
250
  });
261
251
  } else {
262
252
  path = withQuery(path, query);
263
- if (process.server) {
264
- app.context.next({
265
- path,
266
- status
267
- });
268
- }
269
- if (process.client) {
270
- // https://developer.mozilla.org/en-US/docs/Web/API/Location/replace
271
- window.location.replace(path);
272
253
 
273
- // Throw a redirect error
274
- throw new Error('ERR_REDIRECT');
275
- }
254
+ // https://developer.mozilla.org/en-US/docs/Web/API/Location/replace
255
+ window.location.replace(path);
256
+
257
+ // Throw a redirect error
258
+ throw new Error('ERR_REDIRECT');
276
259
  }
277
260
  };
278
- if (process.server) {
279
- app.context.beforeNuxtRender = (fn) => context.beforeRenderFns.push(fn);
280
- }
281
- if (process.client) {
282
- app.context.nuxtState = window.__NUXT__;
283
- }
261
+
262
+ app.context.nuxtState = window.__NUXT__;
284
263
  }
285
264
 
286
265
  // Dynamic keys
package/utils/object.js CHANGED
@@ -110,6 +110,20 @@ export function remove(obj, path) {
110
110
  return obj;
111
111
  }
112
112
 
113
+ /**
114
+ * `delete` a property at the given path.
115
+ *
116
+ * This is similar to `remove` but doesn't need any fancy kube obj path splitting
117
+ * and doesn't use `Vue.set` (avoids reactivity)
118
+ */
119
+ export function deleteProperty(obj, path) {
120
+ const pathAr = path.split('.');
121
+ const propToDelete = pathAr.pop();
122
+
123
+ // Walk down path until final prop, then delete final prop
124
+ delete pathAr.reduce((o, k) => o[k] || {}, obj)[propToDelete];
125
+ }
126
+
113
127
  export function getter(path) {
114
128
  return function(obj) {
115
129
  return get(obj, path);
@@ -1,21 +1,19 @@
1
1
  import { getMatchedComponents, setScrollRestoration } from './nuxt';
2
2
 
3
- if (process.client) {
4
- if ('scrollRestoration' in window.history) {
5
- setScrollRestoration('manual');
3
+ if ('scrollRestoration' in window.history) {
4
+ setScrollRestoration('manual');
6
5
 
7
- // reset scrollRestoration to auto when leaving page, allowing page reload
8
- // and back-navigation from other pages to use the browser to restore the
9
- // scrolling position.
10
- window.addEventListener('beforeunload', () => {
11
- setScrollRestoration('auto');
12
- });
6
+ // reset scrollRestoration to auto when leaving page, allowing page reload
7
+ // and back-navigation from other pages to use the browser to restore the
8
+ // scrolling position.
9
+ window.addEventListener('beforeunload', () => {
10
+ setScrollRestoration('auto');
11
+ });
13
12
 
14
- // Setting scrollRestoration to manual again when returning to this page.
15
- window.addEventListener('load', () => {
16
- setScrollRestoration('manual');
17
- });
18
- }
13
+ // Setting scrollRestoration to manual again when returning to this page.
14
+ window.addEventListener('load', () => {
15
+ setScrollRestoration('manual');
16
+ });
19
17
  }
20
18
 
21
19
  function shouldScrollToTop(route) {
package/utils/time.js CHANGED
@@ -10,7 +10,7 @@ export function diffFrom(value, from, t) {
10
10
  const now = day();
11
11
 
12
12
  from = from || now;
13
- const diff = value.diff(now, 'seconds');
13
+ const diff = value.diff(from, 'seconds');
14
14
 
15
15
  let absDiff = Math.abs(diff);
16
16
 
package/utils/url.ts CHANGED
@@ -2,7 +2,7 @@ type UriField = 'source' | 'protocol' | 'authority' | 'userInfo' | 'user' | 'pas
2
2
  type UriFields = {
3
3
  [key in UriField]: string; // eslint-disable-line no-unused-vars
4
4
  }
5
- type QueryParams = {
5
+ export type QueryParams = {
6
6
  [key: string]: string
7
7
  }
8
8
 
package/vue.config.js CHANGED
@@ -6,6 +6,7 @@ const { generateDynamicTypeImport } = require('./pkg/auto-import');
6
6
  const CopyWebpackPlugin = require('copy-webpack-plugin');
7
7
  const serverMiddlewares = require('./server/server-middleware.js');
8
8
  const configHelper = require('./vue-config-helper.js');
9
+ const har = require('./server/har-file');
9
10
 
10
11
  // Suppress info level logging messages from http-proxy-middleware
11
12
  // This hides all of the "[HPM Proxy created] ..." messages
@@ -291,6 +292,14 @@ module.exports = function(dir, _appConfig) {
291
292
  '/engines-dist': configHelper.proxyOpts('https://127.0.0.1:8000'),
292
293
  };
293
294
 
295
+ // HAR File support - load network responses from the specified .har file and use those rather than communicating to the Rancher server
296
+ const harFile = process.env.HAR_FILE;
297
+ let harData;
298
+
299
+ if (harFile) {
300
+ harData = har.loadFile(harFile, devPorts ? 8005 : 80, ''); // eslint-disable-line no-console
301
+ }
302
+
294
303
  const config = {
295
304
  // Vue server
296
305
  devServer: {
@@ -313,6 +322,19 @@ module.exports = function(dir, _appConfig) {
313
322
 
314
323
  app.use(serverMiddlewares);
315
324
 
325
+ if (harData) {
326
+ console.log('Installing HAR file middleware'); // eslint-disable-line no-console
327
+ app.use(har.harProxy(harData, process.env.HAR_DIR));
328
+
329
+ server.websocketProxies.push({
330
+ upgrade(req, socket, head) {
331
+ const responseHeaders = ['HTTP/1.1 101 Web Socket Protocol Handshake', 'Upgrade: WebSocket', 'Connection: Upgrade'];
332
+
333
+ socket.write(`${ responseHeaders.join('\r\n') }\r\n\r\n`);
334
+ }
335
+ });
336
+ }
337
+
316
338
  Object.keys(proxy).forEach((p) => {
317
339
  const px = createProxyMiddleware({
318
340
  ...proxy[p],
@@ -387,7 +409,6 @@ module.exports = function(dir, _appConfig) {
387
409
  // DefinePlugin does string replacement within our code. We may want to consider replacing it with something else. In code we'll see something like
388
410
  // process.env.commit even though process and env aren't even defined objects. This could cause people to be mislead.
389
411
  config.plugins.push(new webpack.DefinePlugin({
390
- 'process.client': JSON.stringify(true),
391
412
  'process.env.commit': JSON.stringify(commit),
392
413
  'process.env.version': JSON.stringify(dashboardVersion),
393
414
  'process.env.dev': JSON.stringify(dev),
@@ -544,7 +565,7 @@ module.exports = function(dir, _appConfig) {
544
565
  options: { mode: ['body'] }
545
566
  }
546
567
  ]
547
- }
568
+ },
548
569
  ];
549
570
 
550
571
  config.module.rules.push(...loaders);
package/.DS_Store DELETED
Binary file
@@ -1,28 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
5
- <g>
6
- <polygon points="49.9,37.8 49.9,62.2 64.6,56.3 64.6,43.2 "/>
7
- <path d="M35.4,41.3V58l11.5,4.1V37.8L35.4,41.3z M38.1,57.2l-1.8-0.7V43.2l1.8-0.5V57.2z M41.4,58.4l-2.5-0.9V42.4l2.5-0.8V58.4z
8
- M45.5,59.7l-3.3-1V41.3l3.3-1V59.7z"/>
9
- <polygon points="14.5,37.8 14.5,62.2 29.2,56.3 29.2,43.2 "/>
10
- <path d="M0,41.3V58l11.5,4.1V37.8L0,41.3z M2.8,57.2L1,56.5V43.2l1.8-0.5V57.2z M6,58.4l-2.5-0.9V42.4L6,41.6V58.4z M10.1,59.7
11
- l-3.3-1V41.3l3.3-1V59.7z"/>
12
- <polygon points="85.3,37.8 85.3,62.2 100,56.3 100,43.2 "/>
13
- <path d="M70.8,41.3V58l11.5,4.1V37.8L70.8,41.3z M73.4,57.2l-1.8-0.7V43.2l1.8-0.5V57.2z M76.8,58.4l-2.5-0.9V42.4l2.5-0.8V58.4z
14
- M80.9,59.7l-3.3-1V41.3l3.3-1V59.7z"/>
15
- <polygon points="31.1,62.6 31.1,87 45.7,81.1 45.7,68 "/>
16
- <path d="M16.5,66.3v16.6L28,87V62.6L16.5,66.3z M19.1,82l-1.8-0.7V68.1l1.8-0.5V82z M22.5,83.2L20,82.3V67.2l2.5-0.8V83.2z
17
- M26.6,84.6l-3.3-1V66.1l3.3-1V84.6z"/>
18
- <polygon points="67.1,62.6 67.1,87 81.8,81.1 81.8,68 "/>
19
- <path d="M52.4,66.3v16.6L64,87V62.6L52.4,66.3z M55.2,82l-1.8-0.7V68.1l1.8-0.5V82z M58.5,83.2l-2.5-1v-15l2.5-0.8V83.2z
20
- M62.6,84.6l-3.3-1V66.1l3.3-1V84.6z"/>
21
- <polygon points="31.1,13 31.1,37.3 45.7,31.5 45.7,18.4 "/>
22
- <path d="M16.5,16.6v16.6L28,37.3V13L16.5,16.6z M19.1,32.3l-1.8-0.7V18.4l1.8-0.5V32.3z M22.5,33.5L20,32.7V17.6l2.5-0.8V33.5z
23
- M26.6,34.9l-3.3-1V16.6l3.3-1V34.9z"/>
24
- <polygon points="67.1,13 67.1,37.3 81.8,31.5 81.8,18.4 "/>
25
- <path d="M52.4,16.6v16.6L64,37.3V13L52.4,16.6z M55.2,32.3l-1.8-0.7V18.4l1.8-0.5V32.3z M58.5,33.5L56,32.7V17.6l2.5-0.8
26
- C58.5,16.8,58.5,33.5,58.5,33.5z M62.6,34.9l-3.3-1V16.6l3.3-1V34.9z"/>
27
- </g>
28
- </svg>
@@ -1,31 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 25.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
5
- <style type="text/css">
6
- .st0{fill:#0079D6;}
7
- </style>
8
- <g>
9
- <polygon class="st0" points="49.9,37.8 49.9,62.2 64.6,56.3 64.6,43.2 "/>
10
- <path class="st0" d="M35.4,41.3V58l11.5,4.1V37.8L35.4,41.3z M38.1,57.2l-1.8-0.7V43.2l1.8-0.5V57.2z M41.4,58.4l-2.5-0.9V42.4
11
- l2.5-0.8V58.4z M45.5,59.7l-3.3-1V41.3l3.3-1V59.7z"/>
12
- <polygon class="st0" points="14.5,37.8 14.5,62.2 29.2,56.3 29.2,43.2 "/>
13
- <path class="st0" d="M0,41.3V58l11.5,4.1V37.8L0,41.3z M2.8,57.2l-1.8-0.7V43.2l1.8-0.5V57.2z M6,58.4l-2.5-0.9V42.4L6,41.6V58.4z
14
- M10.1,59.7l-3.3-1V41.3l3.3-1V59.7z"/>
15
- <polygon class="st0" points="85.3,37.8 85.3,62.2 100,56.3 100,43.2 "/>
16
- <path class="st0" d="M70.8,41.3V58l11.5,4.1V37.8L70.8,41.3z M73.4,57.2l-1.8-0.7V43.2l1.8-0.5V57.2z M76.8,58.4l-2.5-0.9V42.4
17
- l2.5-0.8V58.4z M80.9,59.7l-3.3-1V41.3l3.3-1V59.7z"/>
18
- <polygon class="st0" points="31.1,62.6 31.1,87 45.7,81.1 45.7,68 "/>
19
- <path class="st0" d="M16.5,66.3v16.6L28,87V62.6L16.5,66.3z M19.1,82l-1.8-0.7V68.1l1.8-0.5V82z M22.5,83.2l-2.5-0.9V67.2l2.5-0.8
20
- V83.2z M26.6,84.6l-3.3-1V66.1l3.3-1V84.6z"/>
21
- <polygon class="st0" points="67.1,62.6 67.1,87 81.8,81.1 81.8,68 "/>
22
- <path class="st0" d="M52.4,66.3v16.6L64,87V62.6L52.4,66.3z M55.2,82l-1.8-0.7V68.1l1.8-0.5V82z M58.5,83.2L56,82.2V67.2l2.5-0.8
23
- V83.2z M62.6,84.6l-3.3-1V66.1l3.3-1V84.6z"/>
24
- <polygon class="st0" points="31.1,13 31.1,37.3 45.7,31.5 45.7,18.4 "/>
25
- <path class="st0" d="M16.5,16.6v16.6L28,37.3V13L16.5,16.6z M19.1,32.3l-1.8-0.7V18.4l1.8-0.5V32.3z M22.5,33.5l-2.5-0.8V17.6
26
- l2.5-0.8V33.5z M26.6,34.9l-3.3-1V16.6l3.3-1V34.9z"/>
27
- <polygon class="st0" points="67.1,13 67.1,37.3 81.8,31.5 81.8,18.4 "/>
28
- <path class="st0" d="M52.4,16.6v16.6L64,37.3V13L52.4,16.6z M55.2,32.3l-1.8-0.7V18.4l1.8-0.5V32.3z M58.5,33.5L56,32.7V17.6
29
- l2.5-0.8C58.5,16.8,58.5,33.5,58.5,33.5z M62.6,34.9l-3.3-1V16.6l3.3-1V34.9z"/>
30
- </g>
31
- </svg>