@rancher/shell 1.2.2 → 1.2.5-rc.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 (49) hide show
  1. package/assets/translations/en-us.yaml +8 -0
  2. package/assets/translations/zh-hans.yaml +1 -0
  3. package/cloud-credential/__tests__/harvester.test.ts +18 -0
  4. package/cloud-credential/harvester.vue +9 -1
  5. package/components/AlertTable.vue +17 -7
  6. package/components/GrafanaDashboard.vue +6 -4
  7. package/components/nav/TopLevelMenu.vue +1 -4
  8. package/config/product/explorer.js +11 -4
  9. package/config/settings.ts +9 -2
  10. package/config/types.js +1 -1
  11. package/config/uiplugins.js +2 -2
  12. package/edit/management.cattle.io.setting.vue +15 -2
  13. package/edit/provisioning.cattle.io.cluster/RegistryConfigs.vue +8 -2
  14. package/edit/provisioning.cattle.io.cluster/__tests__/RegistryConfigs.test.ts +61 -0
  15. package/edit/provisioning.cattle.io.cluster/__tests__/utils/cluster.ts +386 -0
  16. package/package.json +1 -1
  17. package/plugins/dashboard-store/actions.js +3 -2
  18. package/scripts/publish-shell.sh +59 -51
  19. package/scripts/test-plugins-build.sh +111 -29
  20. package/shell/types/shell/index.d.ts +2 -0
  21. package/store/catalog.js +1 -1
  22. package/store/type-map.utils.ts +44 -0
  23. package/types/store/dashboard-store.types.ts +23 -0
  24. package/types/store/vuex.d.ts +9 -0
  25. package/.DS_Store +0 -0
  26. package/creators/app/app.package.json +0 -13
  27. package/creators/app/files/.eslintignore +0 -18
  28. package/creators/app/files/.eslintrc.js +0 -173
  29. package/creators/app/files/.gitignore +0 -70
  30. package/creators/app/files/.vscode/settings.json +0 -22
  31. package/creators/app/files/babel.config.js +0 -1
  32. package/creators/app/files/tsconfig.json +0 -42
  33. package/creators/app/files/vue.config.js +0 -6
  34. package/creators/app/init +0 -101
  35. package/creators/app/package.json +0 -25
  36. package/creators/pkg/files/.github/workflows/build-extension-catalog.yml +0 -28
  37. package/creators/pkg/files/.github/workflows/build-extension-charts.yml +0 -26
  38. package/creators/pkg/files/babel.config.js +0 -1
  39. package/creators/pkg/files/index.ts +0 -14
  40. package/creators/pkg/files/tsconfig.json +0 -53
  41. package/creators/pkg/files/vue.config.js +0 -1
  42. package/creators/pkg/init +0 -254
  43. package/creators/pkg/package.json +0 -19
  44. package/creators/pkg/pkg.package.json +0 -21
  45. package/creators/pkg/vue-shim.ts +0 -4
  46. package/creators/update/init +0 -56
  47. package/creators/update/package.json +0 -20
  48. package/creators/update/upgrade +0 -56
  49. package/types/shell/index.d.ts +0 -4310
@@ -0,0 +1,386 @@
1
+ export const PROV_CLUSTER = {
2
+ id: 'fleet-default/test-args',
3
+ type: 'provisioning.cattle.io.cluster',
4
+ apiVersion: 'provisioning.cattle.io/v1',
5
+ kind: 'Cluster',
6
+ metadata: {
7
+ annotations: { 'field.cattle.io/creatorId': 'user' },
8
+ creationTimestamp: '2024-01-14T10:03:39Z',
9
+ generation: 3,
10
+ name: 'test-args',
11
+ namespace: 'fleet-default',
12
+ state: {
13
+ error: false,
14
+ message: 'Resource is Ready',
15
+ name: 'active',
16
+ transitioning: false
17
+ },
18
+ uid: 'eab4ed52-c339-4d61-8dc2-804d09f36425',
19
+ labels: {}
20
+ },
21
+ spec: {
22
+ kubernetesVersion: 'v1.27.8+rke2r1',
23
+ localClusterAuthEndpoint: {
24
+ enabled: false,
25
+ caCerts: '',
26
+ fqdn: ''
27
+ },
28
+ rkeConfig: {
29
+ chartValues: { 'rke2-calico': {} },
30
+ etcd: {
31
+ snapshotRetention: 5,
32
+ snapshotScheduleCron: '0 */5 * * *',
33
+ disableSnapshots: false
34
+ },
35
+ machineGlobalConfig: {
36
+ cni: 'calico',
37
+ 'disable-kube-proxy': false,
38
+ 'etcd-expose-metrics': false
39
+ },
40
+ machinePoolDefaults: {},
41
+ machinePools: [
42
+ {
43
+ controlPlaneRole: true,
44
+ drainBeforeDelete: true,
45
+ etcdRole: true,
46
+ machineConfigRef: {
47
+ kind: 'DigitaloceanConfig',
48
+ name: 'nc-test-args-pool1-dfvbh'
49
+ },
50
+ name: 'pool1',
51
+ quantity: 1,
52
+ unhealthyNodeTimeout: '0s',
53
+ workerRole: true
54
+ }
55
+ ],
56
+ machineSelectorConfig: [
57
+ { config: { 'protect-kernel-defaults': false } }
58
+ ],
59
+ registries: {
60
+ configs: {},
61
+ mirrors: {}
62
+ },
63
+ },
64
+ defaultPodSecurityAdmissionConfigurationTemplateName: '',
65
+ },
66
+ status: {
67
+ agentDeployed: true,
68
+ clientSecretName: 'test-args-kubeconfig',
69
+ clusterName: 'c-m-qk7hvstl',
70
+ fleetWorkspaceName: 'fleet-default',
71
+ observedGeneration: 3,
72
+ ready: true
73
+ }
74
+ };
75
+
76
+ export const VERSION_CLUSTER = {
77
+ label: 'v1.27.8+rke2r1',
78
+ value: 'v1.27.8+rke2r1',
79
+ sort: '0000000001.0000000027.0000000008.rke0000000002r0000000001',
80
+ serverArgs: {
81
+ 'audit-policy-file': {
82
+ type: 'string',
83
+ create: false,
84
+ update: false
85
+ },
86
+ 'cluster-cidr': {
87
+ type: 'string',
88
+ create: false,
89
+ update: false
90
+ },
91
+ 'cluster-dns': {
92
+ type: 'string',
93
+ create: false,
94
+ update: false
95
+ },
96
+ 'cluster-domain': {
97
+ type: 'string',
98
+ create: false,
99
+ update: false
100
+ },
101
+ cni: {
102
+ type: 'array',
103
+ default: 'calico',
104
+ create: false,
105
+ update: false,
106
+ options: [
107
+ 'canal',
108
+ 'cilium',
109
+ 'calico',
110
+ 'multus,canal',
111
+ 'multus,cilium',
112
+ 'multus,calico'
113
+ ]
114
+ },
115
+ 'container-runtime-endpoint': {
116
+ type: 'string',
117
+ create: false,
118
+ update: false
119
+ },
120
+ disable: {
121
+ type: 'array',
122
+ create: false,
123
+ update: false,
124
+ options: [
125
+ 'rke2-coredns',
126
+ 'rke2-ingress-nginx',
127
+ 'rke2-metrics-server'
128
+ ]
129
+ },
130
+ 'disable-cloud-controller': {
131
+ type: 'bool',
132
+ create: false,
133
+ update: false
134
+ },
135
+ 'disable-kube-proxy': {
136
+ type: 'boolean',
137
+ default: false,
138
+ create: false,
139
+ update: false
140
+ },
141
+ 'disable-scheduler': {
142
+ type: 'bool',
143
+ create: false,
144
+ update: false
145
+ },
146
+ 'egress-selector-mode': {
147
+ type: 'string',
148
+ create: false,
149
+ update: false
150
+ },
151
+ 'etcd-arg': {
152
+ type: 'array',
153
+ create: false,
154
+ update: false
155
+ },
156
+ 'etcd-expose-metrics': {
157
+ type: 'boolean',
158
+ default: false,
159
+ create: false,
160
+ update: false
161
+ },
162
+ 'etcd-image': {
163
+ type: 'string',
164
+ create: false,
165
+ update: false
166
+ },
167
+ 'kube-apiserver-arg': {
168
+ type: 'array',
169
+ create: false,
170
+ update: false
171
+ },
172
+ 'kube-apiserver-image': {
173
+ type: 'string',
174
+ create: false,
175
+ update: false
176
+ },
177
+ 'kube-cloud-controller-manager-arg': {
178
+ type: 'array',
179
+ create: false,
180
+ update: false
181
+ },
182
+ 'kube-controller-manager-arg': {
183
+ type: 'array',
184
+ create: false,
185
+ update: false
186
+ },
187
+ 'kube-controller-manager-image': {
188
+ type: 'string',
189
+ create: false,
190
+ update: false
191
+ },
192
+ 'kube-proxy-arg': {
193
+ type: 'array',
194
+ create: false,
195
+ update: false
196
+ },
197
+ 'kube-scheduler-arg': {
198
+ type: 'array',
199
+ create: false,
200
+ update: false
201
+ },
202
+ 'kube-scheduler-image': {
203
+ type: 'string',
204
+ create: false,
205
+ update: false
206
+ },
207
+ 'kubelet-path': {
208
+ type: 'string',
209
+ create: false,
210
+ update: false
211
+ },
212
+ 'pause-image': {
213
+ type: 'string',
214
+ create: false,
215
+ update: false
216
+ },
217
+ 'runtime-image': {
218
+ type: 'string',
219
+ create: false,
220
+ update: false
221
+ },
222
+ 'service-cidr': {
223
+ type: 'string',
224
+ create: false,
225
+ update: false
226
+ },
227
+ 'service-node-port-range': {
228
+ type: 'string',
229
+ create: false,
230
+ update: false
231
+ },
232
+ snapshotter: {
233
+ type: 'string',
234
+ create: false,
235
+ update: false
236
+ },
237
+ 'tls-san': {
238
+ type: 'array',
239
+ create: false,
240
+ update: false
241
+ },
242
+ 'tls-san-security': {
243
+ type: 'boolean',
244
+ create: false,
245
+ update: false
246
+ }
247
+ },
248
+ agentArgs: {
249
+ 'audit-policy-file': {
250
+ type: 'string',
251
+ create: false,
252
+ update: false
253
+ },
254
+ 'cloud-controller-manager-extra-env': {
255
+ type: 'array',
256
+ create: false,
257
+ update: false
258
+ },
259
+ 'cloud-controller-manager-extra-mount': {
260
+ type: 'array',
261
+ create: false,
262
+ update: false
263
+ },
264
+ 'cloud-provider-config': {
265
+ type: 'string',
266
+ create: false,
267
+ update: false
268
+ },
269
+ 'cloud-provider-name': {
270
+ type: 'enum',
271
+ nullable: true,
272
+ create: false,
273
+ update: false,
274
+ options: [
275
+ 'aws',
276
+ 'azure',
277
+ 'gcp',
278
+ 'rancher-vsphere',
279
+ 'harvester',
280
+ 'external'
281
+ ]
282
+ },
283
+ 'control-plane-resource-limits': {
284
+ type: 'string',
285
+ create: false,
286
+ update: false
287
+ },
288
+ 'control-plane-resource-requests': {
289
+ type: 'string',
290
+ create: false,
291
+ update: false
292
+ },
293
+ 'etcd-extra-env': {
294
+ type: 'array',
295
+ create: false,
296
+ update: false
297
+ },
298
+ 'etcd-extra-mount': {
299
+ type: 'array',
300
+ create: false,
301
+ update: false
302
+ },
303
+ 'kube-apiserver-extra-env': {
304
+ type: 'array',
305
+ create: false,
306
+ update: false
307
+ },
308
+ 'kube-apiserver-extra-mount': {
309
+ type: 'array',
310
+ create: false,
311
+ update: false
312
+ },
313
+ 'kube-controller-manager-extra-env': {
314
+ type: 'array',
315
+ create: false,
316
+ update: false
317
+ },
318
+ 'kube-controller-manager-extra-mount': {
319
+ type: 'array',
320
+ create: false,
321
+ update: false
322
+ },
323
+ 'kube-proxy-arg': {
324
+ type: 'array',
325
+ create: false,
326
+ update: false
327
+ },
328
+ 'kube-proxy-extra-env': {
329
+ type: 'array',
330
+ create: false,
331
+ update: false
332
+ },
333
+ 'kube-proxy-extra-mount': {
334
+ type: 'array',
335
+ create: false,
336
+ update: false
337
+ },
338
+ 'kube-scheduler-extra-env': {
339
+ type: 'array',
340
+ create: false,
341
+ update: false
342
+ },
343
+ 'kube-scheduler-extra-mount': {
344
+ type: 'array',
345
+ create: false,
346
+ update: false
347
+ },
348
+ 'kubelet-arg': {
349
+ type: 'array',
350
+ create: false,
351
+ update: false
352
+ },
353
+ profile: {
354
+ type: 'enum',
355
+ nullable: true,
356
+ create: false,
357
+ update: false,
358
+ options: [
359
+ 'cis',
360
+ 'cis-1.23'
361
+ ]
362
+ },
363
+ 'protect-kernel-defaults': {
364
+ type: 'boolean',
365
+ default: false,
366
+ create: false,
367
+ update: false
368
+ },
369
+ 'resolv-conf': {
370
+ type: 'string',
371
+ create: false,
372
+ update: false
373
+ },
374
+ selinux: {
375
+ type: 'bool',
376
+ create: false,
377
+ update: false
378
+ },
379
+ 'system-default-registry': {
380
+ type: 'string',
381
+ create: false,
382
+ update: false
383
+ }
384
+ },
385
+ disabled: false
386
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rancher/shell",
3
- "version": "1.2.2",
3
+ "version": "1.2.5-rc.1",
4
4
  "description": "Rancher Dashboard Shell",
5
5
  "repository": "https://github.com/rancherlabs/dashboard",
6
6
  "license": "Apache-2.0",
@@ -8,6 +8,7 @@ import { normalizeType } from './normalize';
8
8
  import garbageCollect from '@shell/utils/gc/gc';
9
9
  import { addSchemaIndexFields } from '@shell/plugins/steve/schema.utils';
10
10
  import { addParam } from '@shell/utils/url';
11
+ import { conditionalDepaginate } from '@shell/store/type-map.utils';
11
12
 
12
13
  export const _ALL = 'all';
13
14
  export const _MERGE = 'merge';
@@ -188,7 +189,7 @@ export default {
188
189
  opt = opt || {};
189
190
  opt.url = getters.urlFor(type, null, opt);
190
191
  opt.stream = opt.stream !== false && load !== _NONE;
191
- opt.depaginate = typeOptions?.depaginate;
192
+ opt.depaginate = conditionalDepaginate(typeOptions?.depaginate, { ctx, args: { type, opt } });
192
193
 
193
194
  let skipHaveAll = false;
194
195
 
@@ -367,7 +368,7 @@ export default {
367
368
  opt = opt || {};
368
369
  opt.labelSelector = selector;
369
370
  opt.url = getters.urlFor(type, null, opt);
370
- opt.depaginate = typeOptions?.depaginate;
371
+ opt.depaginate = conditionalDepaginate(typeOptions?.depaginate, { ctx, args: { type, opt } });
371
372
 
372
373
  const res = await dispatch('request', { opt, type });
373
374
 
@@ -6,8 +6,15 @@ BASE_DIR="$(
6
6
  pwd
7
7
  )"
8
8
  SHELL_DIR=$BASE_DIR/shell/
9
- TMP_DIR=$BASE_DIR/tmp
10
- PUBLISH_ARGS="--no-git-tag-version --access public $PUBLISH_ARGS"
9
+ CREATORS_DIR=$BASE_DIR/creators/extension
10
+ FORCE_PUBLISH_TO_NPM="false"
11
+ DEFAULT_NPM_REGISTRY="https://registry.npmjs.org"
12
+
13
+ # if TAG doesn't exist, we can exit as it's needed for any type of publish.
14
+ if [ -z "$TAG" ]; then
15
+ echo "You need to set the TAG variable first!"
16
+ exit 1
17
+ fi
11
18
 
12
19
  if [ ! -d "${BASE_DIR}/node_modules" ]; then
13
20
  echo "You need to run 'yarn install' first"
@@ -16,41 +23,30 @@ fi
16
23
 
17
24
  echo "Publishing Shell Packages"
18
25
 
19
- # We use the version from the shell package for the creator packages
20
- # Need to copy them to a temporary location, so we can patch the version number
21
- # before publishing
26
+ if [ "$1" == "--npm" ]; then
27
+ FORCE_PUBLISH_TO_NPM="true"
28
+ fi
22
29
 
23
- # To set a token for NPM registry auth: `npm config set //registry.npmjs.org/:_authToken <TOKEN>``
30
+ if [ "$FORCE_PUBLISH_TO_NPM" == "true" ]; then
31
+ export NPM_REGISTRY=$DEFAULT_NPM_REGISTRY
32
+ fi
24
33
 
25
- PKG_DIST=$BASE_DIR/dist-pkg/creators
26
- mkdir -p ${PKG_DIST}
27
- rm -rf ${PKG_DIST}/app
28
- rm -rf ${PKG_DIST}/pkg
29
- rm -rf ${PKG_DIST}/update
34
+ PUBLISH_ARGS="--no-git-tag-version --access public --registry $NPM_REGISTRY"
30
35
 
31
36
  pushd ${SHELL_DIR} >/dev/null
32
37
 
33
- PKG_VERSION=$(node -p "require('./package.json').version")
34
- popd >/dev/null
35
-
36
- echo "Publishing version: $PKG_VERSION"
37
-
38
- cp -R ${SHELL_DIR}/creators/app ${PKG_DIST}
39
- cp -R ${SHELL_DIR}/creators/pkg ${PKG_DIST}
40
- cp -R ${SHELL_DIR}/creators/update ${PKG_DIST}
41
-
42
- sed -i.bak -e "s/\"0.0.0/"\"$PKG_VERSION"/g" ${PKG_DIST}/app/package.json
43
- sed -i.bak -e "s/\"0.0.0/"\"$PKG_VERSION"/g" ${PKG_DIST}/pkg/package.json
44
- sed -i.bak -e "s/\"0.0.0/"\"$PKG_VERSION"/g" ${PKG_DIST}/update/package.json
45
-
46
- rm ${PKG_DIST}/app/package.json.bak
47
- rm ${PKG_DIST}/pkg/package.json.bak
48
- rm ${PKG_DIST}/update/package.json.bak
49
-
50
38
  function publish() {
51
39
  NAME=$1
52
40
  FOLDER=$2
53
41
 
42
+ # if we pass a third arg, that is the version number
43
+ # that we want to actually publish on NPM
44
+ # they should match with the package.json version stated
45
+ # because of the check in the "Check Tags Version Matching" step in the workflow
46
+ if [ -n "$3" ]; then
47
+ PKG_VERSION=$3
48
+ fi
49
+
54
50
  echo "Publishing ${NAME} from ${FOLDER}"
55
51
  pushd ${FOLDER} >/dev/null
56
52
 
@@ -61,25 +57,20 @@ function publish() {
61
57
  cp -R ${BASE_DIR}/pkg/rancher-components/src/components ./rancher-components/
62
58
  fi
63
59
 
64
- if [ "$NAME" == "Update" ]; then
65
- # Add files from the app and pkg creators to the update package
66
- mkdir -p ./app
67
- mkdir -p ./pkg
68
- cp -R ${BASE_DIR}/shell/creators/app/* ./app
69
- cp -R ${BASE_DIR}/shell/creators/pkg/* ./pkg
70
- # Remove index.ts from pkg files, as we don't want to replace that
71
- rm -f ./pkg/files/index.ts
72
-
73
- # Update the package.json for the app
74
- cd app
75
- node ${SCRIPT_DIR}/record-deps.js
76
- cd ..
60
+ # if the PKG_VERSION has a - it means it will be a pre-release of legacy-v1
61
+ if [[ $PKG_VERSION == *"-"* ]]; then
62
+ PUBLISH_ARGS="$PUBLISH_ARGS --tag legacy-v1-pre-release"
63
+ else
64
+ # If we need to release shell, we tag it as legacy-v1
65
+ PUBLISH_ARGS="$PUBLISH_ARGS --tag legacy-v1"
77
66
  fi
78
67
 
79
68
  # Make a note of dependency versions, if required
80
69
  node ${SCRIPT_DIR}/record-deps.js
81
70
 
82
- yarn publish . --new-version ${PKG_VERSION} ${PUBLISH_ARGS} --tag v1.2
71
+ echo "Publishing to registry: $NPM_REGISTRY with args: $PUBLISH_ARGS"
72
+
73
+ npm publish ${PUBLISH_ARGS}
83
74
  RET=$?
84
75
 
85
76
  popd >/dev/null
@@ -90,15 +81,32 @@ function publish() {
90
81
  fi
91
82
  }
92
83
 
93
- # Generate the type definitions for the shell
94
- ${SCRIPT_DIR}/typegen.sh
95
-
96
- # Publish the packages - don't tag the git repo and don't auto-increment the version number
97
- publish "Shell" ${SHELL_DIR}
98
- publish "Application creator" ${PKG_DIST}/app/
99
- publish "Package creator" ${PKG_DIST}/pkg/
100
- publish "Update" ${PKG_DIST}/update/
84
+ echo "TAG ${TAG}"
85
+
86
+ # let's get the package name and version from the tag
87
+ PKG_NAME=$(sed 's/-pkg-v.*//' <<< "$TAG")
88
+ PKG_V=$(sed 's/.*-pkg-v//'<<< "$TAG")
101
89
 
102
- echo "Done"
90
+ echo "PKG_NAME ${PKG_NAME}"
91
+ echo "PKG_V ${PKG_V}"
103
92
 
93
+ # Generate the type definitions for the shell
94
+ if [ ${PKG_NAME} == "shell" ]; then
95
+ ${SCRIPT_DIR}/typegen.sh
96
+ fi
104
97
 
98
+ # version comparison checks
99
+ case $PKG_NAME in
100
+ "shell")
101
+ echo "Publishing only Shell pkg via tagged release"
102
+ publish "Shell" ${SHELL_DIR} ${PKG_V}
103
+ ;;
104
+ "creators")
105
+ echo "Publishing only Creators pkg via tagged release"
106
+ publish "Extension creator" ${CREATORS_DIR} ${PKG_V}
107
+ ;;
108
+ *)
109
+ echo "something went wrong with the tagging name => TAG: ${TAG} , PKG_NAME: ${PKG_NAME}. Admissable names are 'shell' and 'creator'"
110
+ exit 1
111
+ ;;
112
+ esac