@rancher/shell 2.0.1 → 2.0.2

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 (112) hide show
  1. package/assets/translations/en-us.yaml +73 -34
  2. package/assets/translations/zh-hans.yaml +1 -0
  3. package/components/AssignTo.vue +2 -0
  4. package/components/PromptRemove.vue +8 -3
  5. package/components/Questions/index.vue +2 -2
  6. package/components/ResourceDetail/Masthead.vue +1 -0
  7. package/components/auth/RoleDetailEdit.vue +5 -4
  8. package/components/fleet/FleetClusters.vue +0 -3
  9. package/components/form/Members/ClusterPermissionsEditor.vue +1 -1
  10. package/components/form/ProjectMemberEditor.vue +1 -1
  11. package/components/form/ResourceLabeledSelect.vue +11 -3
  12. package/components/form/labeled-select-utils/labeled-select.utils.ts +1 -1
  13. package/components/formatter/CloudCredExpired.vue +69 -0
  14. package/components/formatter/Date.vue +1 -1
  15. package/components/nav/Header.vue +9 -5
  16. package/components/nav/TopLevelMenu.vue +115 -51
  17. package/components/nav/__tests__/TopLevelMenu.test.ts +53 -27
  18. package/config/labels-annotations.js +2 -0
  19. package/config/pagination-table-headers.js +5 -4
  20. package/config/roles.ts +34 -19
  21. package/config/router/navigation-guards/attempt-first-login.js +1 -1
  22. package/config/router/navigation-guards/authentication.js +1 -1
  23. package/config/router/navigation-guards/i18n.js +1 -1
  24. package/config/router/navigation-guards/index.js +2 -1
  25. package/config/router/navigation-guards/load-initial-settings.js +1 -1
  26. package/config/router/navigation-guards/runtime-extension-route.js +31 -0
  27. package/config/router/routes.js +10 -1
  28. package/config/uiplugins.js +130 -61
  29. package/core/plugin.ts +5 -0
  30. package/core/plugins.js +7 -1
  31. package/detail/catalog.cattle.io.app.vue +17 -4
  32. package/detail/fleet.cattle.io.cluster.vue +11 -9
  33. package/detail/fleet.cattle.io.gitrepo.vue +1 -1
  34. package/edit/provisioning.cattle.io.cluster/__tests__/Basics.test.ts +86 -13
  35. package/edit/provisioning.cattle.io.cluster/__tests__/DirectoryConfig.test.ts +3 -134
  36. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +209 -0
  37. package/edit/provisioning.cattle.io.cluster/index.vue +8 -4
  38. package/edit/provisioning.cattle.io.cluster/rke2.vue +128 -17
  39. package/edit/provisioning.cattle.io.cluster/tabs/AddOnAdditionalManifest.vue +50 -0
  40. package/edit/provisioning.cattle.io.cluster/tabs/AddOnConfig.vue +29 -64
  41. package/edit/provisioning.cattle.io.cluster/tabs/Basics.vue +42 -3
  42. package/edit/provisioning.cattle.io.cluster/tabs/DirectoryConfig.vue +22 -86
  43. package/edit/provisioning.cattle.io.cluster/tabs/registries/RegistryConfigs.vue +8 -2
  44. package/edit/provisioning.cattle.io.cluster/tabs/registries/__tests__/RegistryConfigs.test.ts +61 -0
  45. package/initialize/entry-helpers.js +4 -21
  46. package/list/provisioning.cattle.io.cluster.vue +56 -5
  47. package/mixins/__tests__/chart.test.ts +4 -1
  48. package/mixins/chart.js +36 -16
  49. package/models/__tests__/apps.deployment.test.ts +93 -0
  50. package/models/apps.deployment.js +18 -4
  51. package/models/catalog.cattle.io.app.js +108 -21
  52. package/models/cloudcredential.js +159 -2
  53. package/models/fleet.cattle.io.gitrepo.js +4 -13
  54. package/models/management.cattle.io.cluster.js +15 -4
  55. package/models/management.cattle.io.user.js +3 -3
  56. package/models/nodedriver.js +5 -0
  57. package/models/provisioning.cattle.io.cluster.js +41 -3
  58. package/package.json +1 -1
  59. package/pages/404.vue +15 -0
  60. package/pages/auth/login.vue +4 -1
  61. package/pages/auth/setup.vue +4 -1
  62. package/pages/c/_cluster/apps/charts/install.vue +2 -1
  63. package/pages/c/_cluster/explorer/__tests__/index.test.ts +1 -1
  64. package/pages/c/_cluster/explorer/index.vue +6 -2
  65. package/pages/c/_cluster/fleet/index.vue +11 -5
  66. package/pages/c/_cluster/manager/cloudCredential/index.vue +68 -4
  67. package/pages/c/_cluster/manager/jwt.authentication/index.vue +10 -4
  68. package/pages/c/_cluster/settings/performance.vue +2 -2
  69. package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +7 -10
  70. package/pages/c/_cluster/uiplugins/index.vue +28 -18
  71. package/pages/home.vue +2 -13
  72. package/plugins/dashboard-store/actions.js +1 -1
  73. package/plugins/dashboard-store/getters.js +1 -1
  74. package/plugins/steve/__tests__/getters.test.ts +5 -5
  75. package/plugins/steve/getters.js +6 -4
  76. package/plugins/steve/hybrid-class.js +1 -5
  77. package/scripts/extension/bundle +1 -1
  78. package/scripts/extension/helm/charts/ui-plugin-server/Chart.yaml +1 -1
  79. package/scripts/publish-shell.sh +56 -59
  80. package/scripts/test-plugins-build.sh +45 -39
  81. package/scripts/typegen.sh +26 -23
  82. package/store/type-map.js +4 -2
  83. package/types/shell/index.d.ts +10 -0
  84. package/types/store/pagination.types.ts +1 -1
  85. package/utils/cluster.js +9 -0
  86. package/utils/settings.ts +3 -1
  87. package/utils/string.js +9 -0
  88. package/utils/v-sphere.ts +251 -0
  89. package/creators/app/app.package.json +0 -14
  90. package/creators/app/files/.eslintignore +0 -16
  91. package/creators/app/files/.eslintrc.js +0 -173
  92. package/creators/app/files/.gitignore +0 -70
  93. package/creators/app/files/.gitlab-ci.yml +0 -14
  94. package/creators/app/files/.vscode/settings.json +0 -21
  95. package/creators/app/files/babel.config.js +0 -1
  96. package/creators/app/files/tsconfig.json +0 -42
  97. package/creators/app/files/vue.config.js +0 -6
  98. package/creators/app/init +0 -120
  99. package/creators/app/package.json +0 -25
  100. package/creators/pkg/files/.github/workflows/build-extension-catalog.yml +0 -24
  101. package/creators/pkg/files/.github/workflows/build-extension-charts.yml +0 -22
  102. package/creators/pkg/files/babel.config.js +0 -1
  103. package/creators/pkg/files/index.ts +0 -14
  104. package/creators/pkg/files/tsconfig.json +0 -53
  105. package/creators/pkg/files/vue.config.js +0 -1
  106. package/creators/pkg/init +0 -286
  107. package/creators/pkg/package.json +0 -19
  108. package/creators/pkg/pkg.package.json +0 -21
  109. package/creators/pkg/vue-shim.ts +0 -4
  110. package/creators/update/init +0 -56
  111. package/creators/update/package.json +0 -20
  112. package/creators/update/upgrade +0 -56
@@ -9,21 +9,31 @@ import {
9
9
  ID_UNLINKED,
10
10
  NAME_UNLINKED,
11
11
  } from '@shell/config/table-headers';
12
+ import { allHash } from 'utils/promise';
13
+ import { Banner } from '@components/Banner';
12
14
 
13
15
  export default {
14
16
  components: {
15
17
  Loading,
16
18
  ResourceTable,
17
19
  Masthead,
20
+ Banner
18
21
  },
19
22
 
20
23
  async fetch() {
24
+ const promises = {};
25
+
21
26
  if (this.$store.getters['management/schemaFor'](SECRET) && !this.$store.getters[`cluster/paginationEnabled`](SECRET)) {
22
27
  // Having secrets allows showing the public portion of more types but not all users can see them.
23
- await this.$store.dispatch('management/findAll', { type: SECRET });
28
+ promises.secrets = this.$store.dispatch('management/findAll', { type: SECRET });
24
29
  }
30
+ promises.allCredentials = this.$store.dispatch('rancher/findAll', { type: NORMAN.CLOUD_CREDENTIAL });
31
+
32
+ const hash = await allHash(promises);
25
33
 
26
- this.allCredentials = await this.$store.dispatch('rancher/findAll', { type: NORMAN.CLOUD_CREDENTIAL });
34
+ this.allCredentials = hash.allCredentials;
35
+ // This can be optimized in future to to a quick fetch for those with annotation `"provisioning.cattle.io/driver": "harvester"`
36
+ this.hasHarvester = !!this.allCredentials.find((cc) => !!cc.harvestercredentialConfig);
27
37
  },
28
38
 
29
39
  data() {
@@ -40,7 +50,7 @@ export default {
40
50
  },
41
51
 
42
52
  headers() {
43
- return [
53
+ const headers = [
44
54
  ID_UNLINKED,
45
55
  NAME_UNLINKED,
46
56
  {
@@ -52,8 +62,21 @@ export default {
52
62
  formatter: 'CloudCredPublicData',
53
63
  },
54
64
  DESCRIPTION,
55
- AGE_NORMAN,
56
65
  ];
66
+
67
+ if (this.hasHarvester) {
68
+ headers.push({
69
+ name: 'expiresDate',
70
+ labelKey: 'tableHeaders.expires',
71
+ value: 'expires',
72
+ sort: 'expiresForSort',
73
+ formatter: 'CloudCredExpired',
74
+ });
75
+ }
76
+
77
+ headers.push(AGE_NORMAN);
78
+
79
+ return headers;
57
80
  },
58
81
 
59
82
  createLocation() {
@@ -65,6 +88,29 @@ export default {
65
88
  },
66
89
  };
67
90
  },
91
+
92
+ expiredData() {
93
+ const counts = this.allCredentials.reduce((res, cc) => {
94
+ const expireData = cc.expireData;
95
+
96
+ if (expireData?.expiring) {
97
+ res.expiring++;
98
+ }
99
+ if (expireData?.expired) {
100
+ res.expired++;
101
+ }
102
+
103
+ return res;
104
+ }, {
105
+ expiring: 0,
106
+ expired: 0
107
+ });
108
+
109
+ return {
110
+ expiring: counts.expiring ? this.t('manager.cloudCredentials.banners.expiring', { count: counts.expiring }) : '',
111
+ expired: counts.expired ? this.t('manager.cloudCredentials.banners.expired', { count: counts.expired }) : '',
112
+ };
113
+ }
68
114
  },
69
115
 
70
116
  };
@@ -79,6 +125,18 @@ export default {
79
125
  :create-location="createLocation"
80
126
  :type-display="t('manager.cloudCredentials.label')"
81
127
  />
128
+ <Banner
129
+ v-if="expiredData.expiring"
130
+ data-testid="cert-expiring-banner"
131
+ color="warning"
132
+ :label="expiredData.expiring"
133
+ />
134
+ <Banner
135
+ v-if="expiredData.expired"
136
+ color="error"
137
+ :label="expiredData.expired"
138
+ />
139
+
82
140
  <ResourceTable
83
141
  :schema="schema"
84
142
  :rows="rows"
@@ -92,3 +150,9 @@ export default {
92
150
  </ResourceTable>
93
151
  </div>
94
152
  </template>
153
+
154
+ <style lang="scss" scoped>
155
+ .banner {
156
+ margin: 0 0 10px 0
157
+ }
158
+ </style>
@@ -22,7 +22,7 @@ export default {
22
22
  async fetch() {
23
23
  const hash = {
24
24
  mgmtClusters: this.$fetchType(MANAGEMENT.CLUSTER),
25
- proxyConfig: this.$fetchType(MANAGEMENT.CLUSTER_PROXY_CONFIG)
25
+ proxyConfig: this.$store.dispatch('management/findAll', { type: MANAGEMENT.CLUSTER_PROXY_CONFIG, opt: { omitExcludeFields: ['metadata.managedFields'] } })
26
26
  };
27
27
 
28
28
  const res = await allHash(hash);
@@ -150,7 +150,11 @@ export default {
150
150
 
151
151
  const value = config?.enabled || '';
152
152
  const configName = config?.metadata?.name || '';
153
- const updatedOn = value ? config?.metadata?.creationTimestamp : '';
153
+ let updatedOn = '';
154
+
155
+ if (value) {
156
+ updatedOn = config?.metadata?.managedFields?.find((field) => field.operation === 'Update')?.time || '';
157
+ }
154
158
  const stateBackground = value ? colorForState(STATES_ENUM.ACTIVE).replace('text', 'bg') : colorForState(STATES_ENUM.INFO).replace('text', 'bg');
155
159
  const stateLabel = value ? this.t('jwt.state.enabled') : this.t('jwt.state.disabled');
156
160
  const creationTimestamp = cluster.metadata.creationTimestamp;
@@ -159,7 +163,7 @@ export default {
159
163
  if (!configName) {
160
164
  const clusterProxyConfig = await this.$store.dispatch('management/create', {
161
165
  enabled: true,
162
- metadata: { namespace: id, generateName: 'cluster-proxy-config-' },
166
+ metadata: { namespace: id, name: 'clusterproxyconfig' },
163
167
  });
164
168
 
165
169
  return clusterProxyConfig.save({ url: 'v1/management.cattle.io.clusterproxyconfigs', method: 'POST' });
@@ -170,7 +174,9 @@ export default {
170
174
  }
171
175
  };
172
176
  const disable = async() => {
173
- return config.remove();
177
+ config.enabled = false;
178
+
179
+ return config.save();
174
180
  };
175
181
 
176
182
  rows.push({
@@ -61,7 +61,7 @@ export default {
61
61
 
62
62
  data() {
63
63
  return {
64
- uiPerfSetting: DEFAULT_PERF_SETTING,
64
+ uiPerfSetting: null,
65
65
  authUserTTL: null,
66
66
  bannerVal: {},
67
67
  value: {},
@@ -161,7 +161,7 @@ export default {
161
161
  return;
162
162
  }
163
163
 
164
- // We're enabling a preference. Are there any incomaptible preferences?
164
+ // We're enabling a preference. Are there any incompatible preferences?
165
165
  if ((incompatible[property] || []).every((p) => !this.value[p].enabled)) {
166
166
  // No, just set and exit
167
167
  this.value[property].enabled = true;
@@ -5,6 +5,7 @@ import { Banner } from '@components/Banner';
5
5
  import LazyImage from '@shell/components/LazyImage';
6
6
  import { MANAGEMENT } from '@shell/config/types';
7
7
  import { SETTING } from '@shell/config/settings';
8
+ import { EXTENSIONS_INCOMPATIBILITY_TYPES, UI_PLUGIN_HOST_APP } from '@shell/config/uiplugins';
8
9
 
9
10
  export default {
10
11
  async fetch() {
@@ -65,10 +66,9 @@ export default {
65
66
  async loadPluginVersionInfo(version) {
66
67
  const versionName = version || this.info.displayVersion;
67
68
 
68
- const isVersionNotCompatibleWithUi = this.info.versions?.find((v) => v.version === versionName && !v.isCompatibleWithUi);
69
- const isVersionNotCompatibleWithKubeVersion = this.info.versions?.find((v) => v.version === versionName && !v.isCompatibleWithKubeVersion);
69
+ const isVersionNotCompatible = this.info.versions?.find((v) => v.version === versionName && !v.isVersionCompatible);
70
70
 
71
- if (!this.info.chart || isVersionNotCompatibleWithUi || isVersionNotCompatibleWithKubeVersion) {
71
+ if (!this.info.chart || isVersionNotCompatible) {
72
72
  return;
73
73
  }
74
74
 
@@ -107,18 +107,15 @@ export default {
107
107
  },
108
108
 
109
109
  handleVersionBtnTooltip(version) {
110
- if (version.requiredUiVersion) {
111
- return this.t('plugins.info.requiresRancherVersion', { version: version.requiredUiVersion });
112
- }
113
- if (version.requiredKubeVersion) {
114
- return this.t('plugins.info.requiresKubeVersion', { version: version.requiredKubeVersion });
110
+ if (!version.isVersionCompatible && Object.keys(version.versionIncompatibilityData).length) {
111
+ return this.t(version.versionIncompatibilityData?.tooltipKey, { required: version.versionIncompatibilityData?.type === EXTENSIONS_INCOMPATIBILITY_TYPES.HOST ? UI_PLUGIN_HOST_APP : version.versionIncompatibilityData?.required });
115
112
  }
116
113
 
117
114
  return '';
118
115
  },
119
116
 
120
117
  handleVersionBtnClass(version) {
121
- return { 'version-active': version.version === this.infoVersion, disabled: !version.isCompatibleWithUi || !version.isCompatibleWithKubeVersion };
118
+ return { 'version-active': version.version === this.infoVersion, disabled: !version.isVersionCompatible };
122
119
  }
123
120
  }
124
121
  };
@@ -219,7 +216,7 @@ export default {
219
216
  <div class="plugin-versions mb-10">
220
217
  <div
221
218
  v-for="v in info.versions"
222
- :key="v.version"
219
+ :key="`${v.name}-${v.version}`"
223
220
  >
224
221
  <a
225
222
  v-clean-tooltip="handleVersionBtnTooltip(v)"
@@ -31,12 +31,13 @@ import {
31
31
  uiPluginAnnotation,
32
32
  uiPluginHasAnnotation,
33
33
  isSupportedChartVersion,
34
- isChartVersionAvailableForInstall,
35
34
  isChartVersionHigher,
36
35
  UI_PLUGIN_NAMESPACE,
37
36
  UI_PLUGIN_CHART_ANNOTATIONS,
38
37
  UI_PLUGINS_REPO_URL,
39
- UI_PLUGINS_PARTNERS_REPO_URL
38
+ UI_PLUGINS_PARTNERS_REPO_URL,
39
+ UI_PLUGIN_HOST_APP,
40
+ EXTENSIONS_INCOMPATIBILITY_TYPES
40
41
  } from '@shell/config/uiplugins';
41
42
  import TabTitle from '@shell/components/TabTitle';
42
43
 
@@ -152,7 +153,8 @@ export default {
152
153
  },
153
154
 
154
155
  showAddReposBanner() {
155
- const hasExtensionReposBannerSetting = this.addExtensionReposBannerSetting?.value === 'true';
156
+ // because of https://github.com/rancher/rancher/pull/45894 we need to consider other start values
157
+ const hasExtensionReposBannerSetting = this.addExtensionReposBannerSetting?.value === 'true' || this.addExtensionReposBannerSetting?.value === '' || this.addExtensionReposBannerSetting?.value === undefined;
156
158
  const uiPluginsRepoNotFound = isRancherPrime() && !this.repos?.find((r) => r.urlDisplay === UI_PLUGINS_REPO_URL);
157
159
  const uiPluginsPartnersRepoNotFound = !this.repos?.find((r) => r.urlDisplay === UI_PLUGINS_PARTNERS_REPO_URL);
158
160
 
@@ -258,19 +260,20 @@ export default {
258
260
 
259
261
  item.versions = [...chart.versions];
260
262
  item.chart = chart;
263
+ item.incompatibilityMessage = '';
261
264
 
262
265
  // Filter the versions available to install (plugins-api version and current dashboard version)
263
- item.installableVersions = item.versions.filter((version) => isSupportedChartVersion({ version, kubeVersion: this.kubeVersion }) && isChartVersionAvailableForInstall({
266
+ item.installableVersions = item.versions.filter((version) => isSupportedChartVersion({
264
267
  version, rancherVersion: this.rancherVersion, kubeVersion: this.kubeVersion
265
268
  }));
266
269
 
267
270
  // add prop to version object if version is compatible with the current dashboard version
268
- item.versions = item.versions.map((version) => isChartVersionAvailableForInstall({
271
+ item.versions = item.versions.map((version) => isSupportedChartVersion({
269
272
  version, rancherVersion: this.rancherVersion, kubeVersion: this.kubeVersion
270
273
  }, true));
271
274
 
272
275
  const latestCompatible = item.installableVersions?.[0];
273
- const latestNotCompatible = item.versions.find((version) => !version.isCompatibleWithUi || !version.isCompatibleWithKubeVersion);
276
+ const latestNotCompatible = item.versions.find((version) => !version.isVersionCompatible);
274
277
 
275
278
  if (latestCompatible) {
276
279
  item.displayVersion = latestCompatible.version;
@@ -280,11 +283,20 @@ export default {
280
283
  item.icon = chart.icon || latestCompatible?.annotations?.['catalog.cattle.io/ui-icon'];
281
284
  }
282
285
 
286
+ // add message of extension card if there's a newer version of the extension, but it's not available to be installed
283
287
  if (latestNotCompatible && item.installableVersions.length && isChartVersionHigher(latestNotCompatible.version, item.installableVersions?.[0].version)) {
284
- if (!item.isCompatibleWithUi) {
285
- item.incompatibleRancherVersion = this.t('plugins.incompatibleRancherVersion', { version: latestNotCompatible.version, rancherVersion: latestNotCompatible.requiredUiVersion }, true);
286
- } else if (!item.isCompatibleWithKubeVersion) {
287
- item.incompatibleKubeVersion = this.t('plugins.incompatibleKubeVersion', { version: latestNotCompatible.version, kubeVersion: latestNotCompatible.requiredKubeVersion }, true);
288
+ switch (latestNotCompatible.versionIncompatibilityData?.type) {
289
+ case EXTENSIONS_INCOMPATIBILITY_TYPES.HOST:
290
+ item.incompatibilityMessage = this.t(latestNotCompatible.versionIncompatibilityData?.cardMessageKey, {
291
+ version: latestNotCompatible.version, required: latestNotCompatible.versionIncompatibilityData?.required, mainHost: UI_PLUGIN_HOST_APP
292
+ }, true);
293
+ break;
294
+ default:
295
+ item.incompatibilityMessage = this.t(latestNotCompatible.versionIncompatibilityData?.cardMessageKey, {
296
+ version: latestNotCompatible.version,
297
+ required: latestNotCompatible.versionIncompatibilityData?.required
298
+ }, true);
299
+ break;
288
300
  }
289
301
  }
290
302
 
@@ -398,8 +410,9 @@ export default {
398
410
 
399
411
  if (versionInstalledData) {
400
412
  const kubeVersionToCheck = versionInstalledData.annotations?.[UI_PLUGIN_CHART_ANNOTATIONS.KUBE_VERSION];
413
+ const versionSupportedData = isSupportedChartVersion({ version: versionInstalledData, kubeVersion: this.kubeVersion });
401
414
 
402
- if (this.kubeVersion && !isSupportedChartVersion({ version: versionInstalledData, kubeVersion: this.kubeVersion })) {
415
+ if (this.kubeVersion && !versionSupportedData.isVersionCompatible && versionSupportedData.versionIncompatibilityData?.type === EXTENSIONS_INCOMPATIBILITY_TYPES.KUBE) {
403
416
  plugin.installedError = this.t('plugins.currentInstalledVersionBlockedByKubeVersion', { kubeVersion: this.kubeVersion, kubeVersionToCheck }, true);
404
417
  }
405
418
  }
@@ -611,7 +624,8 @@ export default {
611
624
  },
612
625
 
613
626
  updateAddReposSetting() {
614
- if (this.addExtensionReposBannerSetting?.value === 'true') {
627
+ // because of https://github.com/rancher/rancher/pull/45894 we need to consider other start values
628
+ if (this.addExtensionReposBannerSetting?.value === 'true' || this.addExtensionReposBannerSetting?.value === '' || this.addExtensionReposBannerSetting?.value === undefined) {
615
629
  this.addExtensionReposBannerSetting.value = 'false';
616
630
  this.addExtensionReposBannerSetting.save();
617
631
  }
@@ -848,13 +862,9 @@ export default {
848
862
  <span>{{ plugin.installedError }}</span>
849
863
  </p>
850
864
  <p
851
- v-else-if="plugin.incompatibleRancherVersion"
865
+ v-else-if="plugin.incompatibilityMessage"
852
866
  class="incompatible"
853
- >{{ plugin.incompatibleRancherVersion }}</p>
854
- <p
855
- v-else-if="plugin.incompatibleKubeVersion"
856
- class="incompatible"
857
- >{{ plugin.incompatibleKubeVersion }}</p>
867
+ >{{ plugin.incompatibilityMessage }}</p>
858
868
  </span>
859
869
  </div>
860
870
  <!-- plugin badges -->
package/pages/home.vue CHANGED
@@ -91,10 +91,6 @@ export default {
91
91
  ...mapGetters(['currentCluster', 'defaultClusterId', 'releaseNotesUrl']),
92
92
  mcm: mapFeature(MULTI_CLUSTER),
93
93
 
94
- mgmtClusters() {
95
- return this.$store.getters['management/all'](MANAGEMENT.CLUSTER);
96
- },
97
-
98
94
  provClusters() {
99
95
  return this.$store.getters['management/all'](CAPI.RANCHER_CLUSTER);
100
96
  },
@@ -211,15 +207,7 @@ export default {
211
207
  },
212
208
 
213
209
  kubeClusters() {
214
- const filteredClusters = filterHiddenLocalCluster(filterOnlyKubernetesClusters(this.provClusters || [], this.$store), this.$store);
215
-
216
- return filteredClusters.map((provCluster) => {
217
- const mgmtCluster = this.mgmtClusters?.find((c) => provCluster.mgmt?.id === c.id);
218
-
219
- provCluster.description = provCluster.description || mgmtCluster?.description;
220
-
221
- return provCluster;
222
- });
210
+ return filterHiddenLocalCluster(filterOnlyKubernetesClusters(this.provClusters || [], this.$store), this.$store);
223
211
  }
224
212
  },
225
213
 
@@ -385,6 +373,7 @@ export default {
385
373
  :rows="kubeClusters"
386
374
  :headers="clusterHeaders"
387
375
  :loading="!kubeClusters"
376
+ :paging="true"
388
377
  >
389
378
  <template #header-left>
390
379
  <div class="row table-heading">
@@ -419,7 +419,7 @@ export default {
419
419
  },
420
420
  result: {
421
421
  count: out.count,
422
- pages: out.pages,
422
+ pages: out.pages || Math.ceil(out.count / (opt.pagination.pageSize || Number.MAX_SAFE_INTEGER)),
423
423
  timestamp: new Date().getTime()
424
424
  }
425
425
  } : undefined,
@@ -429,7 +429,7 @@ export default {
429
429
  };
430
430
  }
431
431
 
432
- const namespaces = _typeObj?.namespaced ? Object.keys(rootGetters.activeNamespaceCache || {}) : [];
432
+ const namespaces = _typeObj?.namespaced && !rootGetters.isAllNamespaces ? Object.keys(rootGetters.activeNamespaceCache || {}) : [];
433
433
 
434
434
  return matchingCounts(_typeObj, namespaces.length ? namespaces : null);
435
435
  },
@@ -109,13 +109,13 @@ describe('steve: getters:', () => {
109
109
  it('returns a string with a labelSelector and filter, and formatted for steve if the url starts with "/v1"', () => {
110
110
  expect(urlOptionsGetter('/v1/foo', { labelSelector: 'a=b', filter: { bar: 'baz', far: 'faz' } })).toBe('/v1/foo?labelSelector=a=b&filter=bar=baz&far=faz&exclude=metadata.managedFields');
111
111
  });
112
- it('returns a string with an exclude statement for "bar" and "metadata.managedFields" if excludeFields is a single element array with the string "bar" and the url starts with "/v1/"', () => {
113
- expect(urlOptionsGetter('/v1/foo', { excludeFields: ['bar'] })).toBe('/v1/foo?exclude=bar&exclude=metadata.managedFields');
112
+ it('returns a string with an exclude statement for "bar" if excludeFields is a single element array with the string "bar" and the url starts with "/v1/"', () => {
113
+ expect(urlOptionsGetter('/v1/foo', { excludeFields: ['bar'] })).toBe('/v1/foo?exclude=bar');
114
114
  });
115
- it('returns a string without an exclude statement if excludeFields is but the url does not start with "/v1/"', () => {
116
- expect(urlOptionsGetter('foo', { excludeFields: ['bar'] })).toBe('foo');
115
+ it('returns a string without an exclude statement for "managedFields" if omitExcludeFields includes it and the url starts with "/v1/"', () => {
116
+ expect(urlOptionsGetter('/v1/foo', { omitExcludeFields: ['metadata.managedFields'] })).toBe('/v1/foo?');
117
117
  });
118
- it('returns a string without an exclude statement if excludeFields is an array but the URL doesn\'t include the "/v1/ string"', () => {
118
+ it('returns a string without an exclude statement if excludeFields is set but the url does not start with "/v1/"', () => {
119
119
  expect(urlOptionsGetter('foo', { excludeFields: ['bar'] })).toBe('foo');
120
120
  });
121
121
  it('returns a string with a limit applied if a limit is provided', () => {
@@ -119,11 +119,13 @@ export default {
119
119
  // excludeFields should be an array of strings representing the paths of the fields to exclude
120
120
  // only works on Steve but is ignored without error by Norman
121
121
  if (isSteve) {
122
- if (Array.isArray(opt?.excludeFields)) {
123
- opt.excludeFields = [...opt.excludeFields, 'metadata.managedFields'];
124
- } else {
125
- opt.excludeFields = ['metadata.managedFields'];
122
+ if (!Array.isArray(opt?.excludeFields)) {
123
+ const excludeFields = ['metadata.managedFields'];
124
+
125
+ // for some resources, we might want to include fields, excluded by default.
126
+ opt.excludeFields = Array.isArray(opt?.omitExcludeFields) ? excludeFields.filter((f) => !f.includes(opt.omitExcludeFields)) : excludeFields;
126
127
  }
128
+
127
129
  const excludeParamsString = opt.excludeFields.map((field) => `exclude=${ field }`).join('&');
128
130
 
129
131
  url += `${ url.includes('?') ? '&' : '?' }${ excludeParamsString }`;
@@ -1,4 +1,4 @@
1
- import { ANNOTATIONS_TO_IGNORE_REGEX, LABELS_TO_IGNORE_REGEX, DESCRIPTION } from '@shell/config/labels-annotations';
1
+ import { ANNOTATIONS_TO_IGNORE_REGEX, LABELS_TO_IGNORE_REGEX } from '@shell/config/labels-annotations';
2
2
  import omitBy from 'lodash/omitBy';
3
3
  import pickBy from 'lodash/pickBy';
4
4
  import Vue from 'vue';
@@ -100,8 +100,4 @@ export default class HybridModel extends Resource {
100
100
  get state() {
101
101
  return this.stateObj?.name || 'unknown';
102
102
  }
103
-
104
- get description() {
105
- return this.metadata?.annotations?.[DESCRIPTION] || this.spec?.description || this._description;
106
- }
107
103
  }
@@ -43,7 +43,7 @@ for d in ${BASE_DIR}/dist-pkg/*; do
43
43
  mkdir plugin && mv ./${pkg}/* ./plugin
44
44
  rm -rf ./${pkg}/* && mv ./plugin ./${pkg}
45
45
 
46
- find ${pkg} -type f -printf '%P\n' | sort > ./${pkg}/files.txt
46
+ find ${pkg} -type f | sed "s|^${pkg}/||" | sort > ./${pkg}/files.txt
47
47
  popd > /dev/null
48
48
 
49
49
  cp -R ${BASE_DIR}/dist-pkg/${pkg} ${TMP}/container/plugin
@@ -1,6 +1,6 @@
1
1
  annotations:
2
2
  catalog.cattle.io/certified: rancher # Any application we are adding as a helm chart
3
- catalog.cattle.io/kube-version: '>= 1.16.0-0 < 1.29.0-0'
3
+ catalog.cattle.io/kube-version: '>= 1.16.0-0'
4
4
  catalog.cattle.io/namespace: cattle-ui-plugin-system # Must prefix with cattle- and suffix with -system=
5
5
  catalog.cattle.io/os: linux
6
6
  catalog.cattle.io/permits-os: linux, windows
@@ -1,15 +1,19 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
+ set -eo pipefail
4
+
3
5
  SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
4
- BASE_DIR="$(
5
- cd $SCRIPT_DIR && cd ../.. &
6
- pwd
7
- )"
6
+ BASE_DIR="$(cd $SCRIPT_DIR && cd ../.. && pwd)"
8
7
  SHELL_DIR=$BASE_DIR/shell/
9
- TMP_DIR=$BASE_DIR/tmp
10
- PUBLISH_ARGS="--no-git-tag-version --access public $PUBLISH_ARGS"
8
+ CREATORS_DIR=$BASE_DIR/creators/extension
11
9
  FORCE_PUBLISH_TO_NPM="false"
12
- DEFAULT_YARN_REGISTRY="https://registry.npmjs.org"
10
+ DEFAULT_NPM_REGISTRY="https://registry.npmjs.org"
11
+
12
+ # if TAG doesn't exist, we can exit as it's needed for any type of publish.
13
+ if [ -z "$TAG" ]; then
14
+ echo "You need to set the TAG variable first!"
15
+ exit 1
16
+ fi
13
17
 
14
18
  if [ ! -d "${BASE_DIR}/node_modules" ]; then
15
19
  echo "You need to run 'yarn install' first"
@@ -23,44 +27,25 @@ if [ "$1" == "--npm" ]; then
23
27
  fi
24
28
 
25
29
  if [ "$FORCE_PUBLISH_TO_NPM" == "true" ]; then
26
- export YARN_REGISTRY=$DEFAULT_YARN_REGISTRY
30
+ export NPM_REGISTRY=$DEFAULT_NPM_REGISTRY
27
31
  fi
28
32
 
29
- # We use the version from the shell package for the creator packages
30
- # Need to copy them to a temporary location, so we can patch the version number
31
- # before publishing
32
-
33
- # To set a token for NPM registry auth: `npm config set //registry.npmjs.org/:_authToken <TOKEN>``
34
-
35
- PKG_DIST=$BASE_DIR/dist-pkg/creators
36
- mkdir -p ${PKG_DIST}
37
- rm -rf ${PKG_DIST}/app
38
- rm -rf ${PKG_DIST}/pkg
39
- rm -rf ${PKG_DIST}/update
33
+ PUBLISH_ARGS="--no-git-tag-version --access public --registry $NPM_REGISTRY"
40
34
 
41
35
  pushd ${SHELL_DIR} >/dev/null
42
36
 
43
- PKG_VERSION=$(node -p "require('./package.json').version")
44
- popd >/dev/null
45
-
46
- echo "Publishing version: $PKG_VERSION"
47
-
48
- cp -R ${SHELL_DIR}/creators/app ${PKG_DIST}
49
- cp -R ${SHELL_DIR}/creators/pkg ${PKG_DIST}
50
- cp -R ${SHELL_DIR}/creators/update ${PKG_DIST}
51
-
52
- sed -i.bak -e "s/\"0.0.0/"\"$PKG_VERSION"/g" ${PKG_DIST}/app/package.json
53
- sed -i.bak -e "s/\"0.0.0/"\"$PKG_VERSION"/g" ${PKG_DIST}/pkg/package.json
54
- sed -i.bak -e "s/\"0.0.0/"\"$PKG_VERSION"/g" ${PKG_DIST}/update/package.json
55
-
56
- rm ${PKG_DIST}/app/package.json.bak
57
- rm ${PKG_DIST}/pkg/package.json.bak
58
- rm ${PKG_DIST}/update/package.json.bak
59
-
60
37
  function publish() {
61
38
  NAME=$1
62
39
  FOLDER=$2
63
40
 
41
+ # if we pass a third arg, that is the version number
42
+ # that we want to actually publish on NPM
43
+ # they should match with the package.json version stated
44
+ # because of the check in the "Check Tags Version Matching" step in the workflow
45
+ if [ -n "$3" ]; then
46
+ PKG_VERSION=$3
47
+ fi
48
+
64
49
  echo "Publishing ${NAME} from ${FOLDER}"
65
50
  pushd ${FOLDER} >/dev/null
66
51
 
@@ -71,25 +56,20 @@ function publish() {
71
56
  cp -R ${BASE_DIR}/pkg/rancher-components/src/components ./rancher-components/
72
57
  fi
73
58
 
74
- if [ "$NAME" == "Update" ]; then
75
- # Add files from the app and pkg creators to the update package
76
- mkdir -p ./app
77
- mkdir -p ./pkg
78
- cp -R ${BASE_DIR}/shell/creators/app/* ./app
79
- cp -R ${BASE_DIR}/shell/creators/pkg/* ./pkg
80
- # Remove index.ts from pkg files, as we don't want to replace that
81
- rm -f ./pkg/files/index.ts
82
-
83
- # Update the package.json for the app
84
- cd app
85
- node ${SCRIPT_DIR}/record-deps.js
86
- cd ..
59
+ # if the PKG_VERSION has a - it means it will be a pre-release of legacy-v2
60
+ if [[ $PKG_VERSION == *"-"* ]]; then
61
+ PUBLISH_ARGS="$PUBLISH_ARGS --tag legacy-v2-pre-release"
62
+ else
63
+ # If we need to release shell, we tag it as legacy-v2
64
+ PUBLISH_ARGS="$PUBLISH_ARGS --tag legacy-v2"
87
65
  fi
88
66
 
89
67
  # Make a note of dependency versions, if required
90
68
  node ${SCRIPT_DIR}/record-deps.js
91
69
 
92
- yarn publish . --new-version ${PKG_VERSION} ${PUBLISH_ARGS}
70
+ echo "Publishing to registry: $NPM_REGISTRY with args: $PUBLISH_ARGS"
71
+
72
+ npm publish ${PUBLISH_ARGS}
93
73
  RET=$?
94
74
 
95
75
  popd >/dev/null
@@ -100,15 +80,32 @@ function publish() {
100
80
  fi
101
81
  }
102
82
 
103
- # Generate the type definitions for the shell
104
- ${SCRIPT_DIR}/typegen.sh
105
-
106
- # Publish the packages - don't tag the git repo and don't auto-increment the version number
107
- publish "Shell" ${SHELL_DIR}
108
- publish "Application creator" ${PKG_DIST}/app/
109
- publish "Package creator" ${PKG_DIST}/pkg/
110
- publish "Update" ${PKG_DIST}/update/
83
+ echo "TAG ${TAG}"
84
+
85
+ # let's get the package name and version from the tag
86
+ PKG_NAME=$(sed 's/-pkg-v.*//' <<< "$TAG")
87
+ PKG_V=$(sed 's/.*-pkg-v//'<<< "$TAG")
111
88
 
112
- echo "Done"
89
+ echo "PKG_NAME ${PKG_NAME}"
90
+ echo "PKG_V ${PKG_V}"
113
91
 
92
+ # Generate the type definitions for the shell
93
+ if [ ${PKG_NAME} == "shell" ]; then
94
+ ${SCRIPT_DIR}/typegen.sh
95
+ fi
114
96
 
97
+ # version comparison checks
98
+ case $PKG_NAME in
99
+ "shell")
100
+ echo "Publishing only Shell pkg via tagged release"
101
+ publish "Shell" ${SHELL_DIR} ${PKG_V}
102
+ ;;
103
+ "creators")
104
+ echo "Publishing only Creators pkg via tagged release"
105
+ publish "Extension creator" ${CREATORS_DIR} ${PKG_V}
106
+ ;;
107
+ *)
108
+ echo "something went wrong with the tagging name => TAG: ${TAG} , PKG_NAME: ${PKG_NAME}. Admissable names are 'shell' and 'creator'"
109
+ exit 1
110
+ ;;
111
+ esac