@rancher/shell 3.0.12-rc.5 → 3.0.12-rc.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/apis/intf/resources-api/resource-base.ts +42 -2
  2. package/apis/intf/resources-api/resource-instance.ts +101 -0
  3. package/apis/intf/resources-api/resources-api.ts +177 -23
  4. package/apis/intf/resources.ts +8 -6
  5. package/apis/intf/shell-api/slide-in.ts +46 -17
  6. package/apis/resources/__tests__/resources-api-class.test.ts +309 -28
  7. package/apis/resources/resources-api-class.ts +232 -43
  8. package/apis/shell/__tests__/slide-in.test.ts +83 -2
  9. package/apis/shell/slide-in.ts +20 -0
  10. package/assets/images/providers/traefik.png +0 -0
  11. package/assets/translations/en-us.yaml +10 -4
  12. package/chart/__tests__/rancher-monitoring-dashboards-index.test.ts +269 -0
  13. package/chart/rancher-monitoring-dashboards/index.vue +155 -0
  14. package/cloud-credential/__tests__/generic.test.ts +132 -0
  15. package/cloud-credential/generic.vue +33 -3
  16. package/components/EtcdInfoBanner.vue +2 -12
  17. package/components/ExplorerProjectsNamespaces.vue +2 -2
  18. package/components/GrafanaDashboard.vue +2 -8
  19. package/components/Resource/Detail/Masthead/__tests__/index.test.ts +68 -14
  20. package/components/Resource/Detail/Masthead/index.vue +8 -3
  21. package/components/Resource/Detail/Metadata/IdentifyingInformation/__tests__/identifying-fields.test.ts +9 -0
  22. package/components/Resource/Detail/Metadata/IdentifyingInformation/identifying-fields.ts +5 -1
  23. package/components/SlideInPanelManager.vue +103 -25
  24. package/components/__tests__/SlideInPanelManager.spec.ts +153 -10
  25. package/components/auth/AuthBanner.vue +1 -1
  26. package/components/form/Security.vue +1 -1
  27. package/components/formatter/Translate.vue +22 -1
  28. package/components/nav/Group.vue +5 -10
  29. package/components/nav/TopLevelMenu.vue +1 -30
  30. package/components/nav/__tests__/Group.test.ts +61 -0
  31. package/config/labels-annotations.js +1 -0
  32. package/config/table-headers.js +5 -2
  33. package/core/__tests__/plugin-products-apply.test.ts +787 -0
  34. package/core/__tests__/plugin-products-extend.test.ts +189 -0
  35. package/core/__tests__/plugin-products-helpers.test.ts +81 -78
  36. package/core/__tests__/plugin-products-new.test.ts +389 -0
  37. package/core/__tests__/plugin-products-scenarios.test.ts +980 -0
  38. package/core/__tests__/plugin-products-side-menu.test.ts +1935 -0
  39. package/core/plugin-products-base.ts +201 -93
  40. package/core/plugin-products-extending.ts +1 -1
  41. package/core/plugin-products-external.ts +380 -0
  42. package/core/plugin-products-helpers.ts +28 -24
  43. package/core/plugin-products-internal.ts +207 -0
  44. package/core/plugin-products-top-level.ts +10 -5
  45. package/core/plugin-products-type-guards.ts +17 -6
  46. package/core/plugin-products.ts +5 -7
  47. package/core/plugin-types.ts +1 -389
  48. package/core/plugin.ts +10 -11
  49. package/core/plugins-loader.js +2 -0
  50. package/core/types.ts +6 -202
  51. package/detail/__tests__/provisioning.cattle.io.cluster.test.ts +52 -0
  52. package/detail/pod.vue +1 -1
  53. package/detail/provisioning.cattle.io.cluster.vue +0 -2
  54. package/edit/auth/AuthProviderWarningBanners.vue +12 -0
  55. package/edit/auth/__tests__/AuthProviderWarningBanners.test.ts +10 -1
  56. package/edit/auth/__tests__/azuread.test.ts +1 -0
  57. package/edit/auth/__tests__/github.test.ts +1 -0
  58. package/edit/auth/__tests__/oidc.test.ts +1 -0
  59. package/edit/auth/__tests__/saml.test.ts +1 -0
  60. package/edit/auth/ldap/__tests__/index.test.ts +1 -0
  61. package/edit/provisioning.cattle.io.cluster/index.vue +1 -1
  62. package/edit/provisioning.cattle.io.cluster/rke2.vue +1 -1
  63. package/edit/provisioning.cattle.io.cluster/tabs/networking/index.vue +2 -2
  64. package/list/management.cattle.io.user.vue +24 -5
  65. package/list/utils/management.cattle.io.cluster.utils.ts +1 -1
  66. package/machine-config/__tests__/generic.test.ts +163 -0
  67. package/machine-config/components/EC2Networking.vue +31 -7
  68. package/machine-config/components/__tests__/EC2Networking.test.ts +38 -15
  69. package/machine-config/generic.vue +32 -5
  70. package/mixins/resource-fetch.js +1 -1
  71. package/models/__tests__/namespace.test.ts +133 -8
  72. package/models/__tests__/provisioning.cattle.io.cluster.test.ts +57 -1
  73. package/models/__tests__/rke-machine.cattle.io.vmwarevspheremachinetemplate.test.ts +22 -0
  74. package/models/namespace.js +34 -2
  75. package/models/pod.js +12 -10
  76. package/models/provisioning.cattle.io.cluster.js +20 -13
  77. package/models/rke-machine.cattle.io.vmwarevspheremachinetemplate.js +9 -0
  78. package/package.json +1 -1
  79. package/pages/auth/login.vue +1 -1
  80. package/pages/c/_cluster/apps/charts/__tests__/install.test.ts +110 -0
  81. package/pages/c/_cluster/apps/charts/install.vue +29 -0
  82. package/pages/c/_cluster/auth/config/index.vue +11 -4
  83. package/pages/c/_cluster/explorer/workload-dashboard/__tests__/composable.test.ts +136 -1
  84. package/pages/c/_cluster/explorer/workload-dashboard/composable.ts +69 -1
  85. package/pages/c/_cluster/fleet/index.vue +5 -9
  86. package/pages/c/_cluster/monitoring/index.vue +6 -1
  87. package/pkg/vue.config.js +4 -3
  88. package/plugins/codemirror.js +2 -0
  89. package/plugins/dashboard-store/resource-class.js +13 -9
  90. package/plugins/steve/__tests__/steve-class-resource-api.test.ts +147 -0
  91. package/plugins/steve/steve-class.js +43 -0
  92. package/plugins/steve/subscribe.js +11 -0
  93. package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +115 -0
  94. package/rancher-components/Form/LabeledInput/LabeledInput.vue +83 -3
  95. package/store/__tests__/action-menu.test.ts +622 -0
  96. package/store/__tests__/auth.test.ts +18 -0
  97. package/store/__tests__/notifications.test.ts +466 -1
  98. package/store/__tests__/slideInPanel.test.ts +143 -43
  99. package/store/__tests__/ui-context.test.ts +255 -0
  100. package/store/__tests__/wm.test.ts +503 -0
  101. package/store/auth.js +11 -1
  102. package/store/aws.js +19 -4
  103. package/store/features.js +1 -0
  104. package/store/plugins.js +6 -0
  105. package/store/slideInPanel.ts +15 -3
  106. package/types/rancher/steve.api.ts +2 -2
  107. package/types/shell/index.d.ts +84 -2
  108. package/types/store/dashboard-store.types.ts +2 -2
  109. package/types/store/type-map.ts +262 -1
  110. package/utils/__tests__/fleet-appco.test.ts +23 -0
  111. package/utils/async.ts +2 -0
  112. package/utils/fleet-appco.ts +6 -1
  113. package/utils/grafana.js +2 -17
  114. package/utils/monitoring.js +38 -1
  115. package/utils/sort.js +1 -1
  116. package/core/__tests__/plugin-products.test.ts +0 -4694
@@ -29,7 +29,11 @@ export default defineComponent({
29
29
  ...labeledFormElementProps,
30
30
  /**
31
31
  * The type of the Labeled Input.
32
- * @values text, cron, multiline, multiline-password
32
+ *
33
+ * Any native HTML input type is passed through to the underlying input
34
+ * (e.g. text, password, number, email). A few custom values change the
35
+ * rendering or behaviour:
36
+ * @values cron (renders as text), multiline, multiline-password, integer (renders as text with inputmode="numeric", blocks non-integer input)
33
37
  */
34
38
  type: {
35
39
  type: String,
@@ -150,6 +154,23 @@ export default defineComponent({
150
154
  });
151
155
 
152
156
  const effectiveStatus = computed(() => props.status);
157
+ const isInteger = computed(() => props.type === 'integer');
158
+ const nativeType = computed(() => {
159
+ if (props.type === 'cron') {
160
+ return 'text';
161
+ }
162
+
163
+ if (props.type === 'integer') {
164
+ return 'text';
165
+ }
166
+
167
+ return props.type;
168
+ });
169
+
170
+ // Hints the mobile keyboard to show a numeric layout, since the
171
+ // integer type renders as type="text" to avoid browser number
172
+ // formatting quirks (e.g. scientific notation for large values).
173
+ const inputMode = computed(() => (isInteger.value ? 'numeric' : undefined));
153
174
 
154
175
  return {
155
176
  focused,
@@ -163,6 +184,9 @@ export default defineComponent({
163
184
  veeHandleBlur,
164
185
  veeValidate,
165
186
  effectiveStatus,
187
+ isInteger,
188
+ nativeType,
189
+ inputMode,
166
190
  };
167
191
  },
168
192
 
@@ -325,6 +349,59 @@ export default defineComponent({
325
349
  }
326
350
  },
327
351
 
352
+ isValidIntegerInput(inputValue: string): boolean {
353
+ const integer = /^-?[0-9]*$/;
354
+ const nonNegativeInteger = /^[0-9]*$/;
355
+ const pattern = Number(this.$attrs.min) >= 0 ? nonNegativeInteger : integer;
356
+
357
+ if (!pattern.test(inputValue)) {
358
+ return false;
359
+ }
360
+
361
+ const numeric = Number(inputValue);
362
+
363
+ // Safe integer is primarily here to validate that the number fits in the datatype
364
+ // used for numbers in the browser, if we exceed this safe number the browser automatically converts the number to scientific notation.
365
+ if (inputValue !== '' && inputValue !== '-' && !Number.isSafeInteger(numeric)) {
366
+ return false;
367
+ }
368
+
369
+ return true;
370
+ },
371
+
372
+ prospectiveValue(input: HTMLInputElement, inserted: string): string {
373
+ const start = input.selectionStart ?? 0;
374
+ const end = input.selectionEnd ?? 0;
375
+
376
+ return input.value.slice(0, start) + inserted + input.value.slice(end);
377
+ },
378
+
379
+ onKeydown(event: KeyboardEvent): void {
380
+ // Skip named keys (Backspace, Arrow, etc.) and modifier shortcuts (Ctrl+A, Cmd+C).
381
+ if (!this.isInteger || event.key.length !== 1 || event.ctrlKey || event.metaKey) {
382
+ return;
383
+ }
384
+
385
+ const next = this.prospectiveValue(event.target as HTMLInputElement, event.key);
386
+
387
+ if (!this.isValidIntegerInput(next)) {
388
+ event.preventDefault();
389
+ }
390
+ },
391
+
392
+ onPaste(event: ClipboardEvent): void {
393
+ if (!this.isInteger) {
394
+ return;
395
+ }
396
+
397
+ const paste = event.clipboardData?.getData('text/plain') ?? '';
398
+ const next = this.prospectiveValue(event.target as HTMLInputElement, paste);
399
+
400
+ if (!this.isValidIntegerInput(next)) {
401
+ event.preventDefault();
402
+ }
403
+ },
404
+
328
405
  /**
329
406
  * Emit on input change
330
407
  */
@@ -435,14 +512,15 @@ export default defineComponent({
435
512
  :id="inputId"
436
513
  ref="value"
437
514
  v-stripped-aria-label="!hasLabel && ariaLabel ? ariaLabel : undefined"
438
- :role="type === 'number' ? undefined : 'textbox'"
515
+ :role="nativeType === 'number' ? undefined : 'textbox'"
439
516
  :class="{ 'no-label': !hasLabel }"
440
517
  v-bind="$attrs"
441
518
  :name="name || undefined"
442
519
  :maxlength="_maxlength"
443
520
  :disabled="isDisabled"
444
521
  :aria-disabled="isDisabled"
445
- :type="type === 'cron' ? 'text' : type"
522
+ :type="nativeType"
523
+ :inputmode="inputMode"
446
524
  :value="value"
447
525
  :placeholder="_placeholder"
448
526
  autocomplete="off"
@@ -451,6 +529,8 @@ export default defineComponent({
451
529
  :aria-describedby="ariaDescribedBy"
452
530
  :aria-required="requiredField"
453
531
  @input="onInput"
532
+ @keydown="onKeydown"
533
+ @paste="onPaste"
454
534
  @focus="onFocus"
455
535
  @blur="onBlur"
456
536
  @change="onChange"