@rancher/shell 3.0.12-rc.4 → 3.0.12-rc.6

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 (159) 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/resources/__tests__/resources-api-class.test.ts +309 -28
  6. package/apis/resources/resources-api-class.ts +232 -43
  7. package/assets/images/providers/traefik.png +0 -0
  8. package/assets/styles/global/_button.scss +1 -1
  9. package/assets/translations/en-us.yaml +49 -14
  10. package/chart/__tests__/rancher-monitoring-dashboards-index.test.ts +269 -0
  11. package/chart/rancher-monitoring-dashboards/index.vue +155 -0
  12. package/cloud-credential/__tests__/generic.test.ts +132 -0
  13. package/cloud-credential/generic.vue +33 -3
  14. package/components/ActionDropdownShell.vue +5 -3
  15. package/components/ButtonGroup.vue +26 -1
  16. package/components/CruResource.vue +51 -2
  17. package/components/EtcdInfoBanner.vue +2 -12
  18. package/components/GrafanaDashboard.vue +2 -8
  19. package/components/PromptRestore.vue +93 -32
  20. package/components/Questions/index.vue +1 -0
  21. package/components/Resource/Detail/Masthead/__tests__/index.test.ts +68 -14
  22. package/components/Resource/Detail/Masthead/index.vue +8 -3
  23. package/components/ResourceTable.vue +1 -0
  24. package/components/SortableTable/index.vue +4 -3
  25. package/components/Wizard.vue +14 -1
  26. package/components/__tests__/ButtonGroup.test.ts +56 -0
  27. package/components/__tests__/PromptRestore.test.ts +169 -19
  28. package/components/fleet/GitRepoAdvancedTab.vue +1 -0
  29. package/components/fleet/GitRepoMetadataTab.vue +5 -0
  30. package/components/fleet/HelmOpAppCoConfigTab.vue +4 -0
  31. package/components/fleet/HelmOpMetadataTab.vue +5 -0
  32. package/components/form/FileSelector.vue +39 -1
  33. package/components/form/PrivateRegistry.constants.ts +7 -0
  34. package/components/form/PrivateRegistry.vue +253 -18
  35. package/components/form/Security.vue +1 -1
  36. package/components/form/SelectOrCreateAuthSecret.vue +140 -17
  37. package/components/form/__tests__/FileSelector.test.ts +23 -0
  38. package/components/form/__tests__/PrivateRegistry.test.ts +463 -73
  39. package/components/form/__tests__/SelectOrCreateAuthSecret.test.ts +122 -0
  40. package/components/formatter/EtcdSnapshotName.vue +73 -0
  41. package/components/formatter/Translate.vue +22 -1
  42. package/components/nav/Group.vue +5 -10
  43. package/components/nav/Header.vue +8 -1
  44. package/components/nav/TopLevelMenu.vue +1 -30
  45. package/components/nav/__tests__/Group.test.ts +61 -0
  46. package/components/templates/default.vue +7 -0
  47. package/config/features.js +1 -0
  48. package/config/labels-annotations.js +3 -0
  49. package/config/product/manager.js +6 -0
  50. package/config/secret.ts +10 -0
  51. package/config/settings.ts +6 -2
  52. package/config/table-headers.js +5 -2
  53. package/config/types.js +7 -0
  54. package/core/__tests__/plugin-products-apply.test.ts +787 -0
  55. package/core/__tests__/plugin-products-extend.test.ts +189 -0
  56. package/core/__tests__/plugin-products-helpers.test.ts +81 -78
  57. package/core/__tests__/plugin-products-new.test.ts +389 -0
  58. package/core/__tests__/plugin-products-scenarios.test.ts +980 -0
  59. package/core/__tests__/plugin-products-side-menu.test.ts +1935 -0
  60. package/core/plugin-products-base.ts +201 -93
  61. package/core/plugin-products-extending.ts +1 -1
  62. package/core/plugin-products-external.ts +380 -0
  63. package/core/plugin-products-helpers.ts +28 -24
  64. package/core/plugin-products-internal.ts +207 -0
  65. package/core/plugin-products-top-level.ts +10 -5
  66. package/core/plugin-products-type-guards.ts +17 -6
  67. package/core/plugin-products.ts +5 -7
  68. package/core/plugin-types.ts +1 -389
  69. package/core/plugin.ts +10 -11
  70. package/core/types.ts +6 -202
  71. package/detail/__tests__/provisioning.cattle.io.cluster.test.ts +52 -0
  72. package/detail/pod.vue +1 -1
  73. package/detail/provisioning.cattle.io.cluster.vue +79 -5
  74. package/dialog/RotateEncryptionKeyDialog.vue +33 -9
  75. package/dialog/__tests__/RotateEncryptionKeyDialog.test.ts +78 -0
  76. package/edit/__tests__/fleet.cattle.io.gitrepo.test.ts +92 -0
  77. package/edit/__tests__/fleet.cattle.io.helmop.test.ts +101 -0
  78. package/edit/__tests__/management.cattle.io.setting.test.ts +2 -1
  79. package/edit/auth/AuthProviderWarningBanners.vue +12 -0
  80. package/edit/auth/__tests__/AuthProviderWarningBanners.test.ts +10 -1
  81. package/edit/auth/__tests__/azuread.test.ts +1 -0
  82. package/edit/auth/__tests__/github.test.ts +1 -0
  83. package/edit/auth/__tests__/oidc.test.ts +1 -0
  84. package/edit/auth/__tests__/saml.test.ts +1 -0
  85. package/edit/auth/ldap/__tests__/index.test.ts +1 -0
  86. package/edit/compliance.cattle.io.clusterscanprofile.vue +39 -41
  87. package/edit/fleet.cattle.io.gitrepo.vue +70 -16
  88. package/edit/fleet.cattle.io.helmop.vue +51 -5
  89. package/edit/helm.cattle.io.projecthelmchart.vue +1 -0
  90. package/edit/{management.cattle.io.setting.vue → management.cattle.io.setting/index.vue} +32 -9
  91. package/edit/management.cattle.io.setting/system-default-registry-pull-secrets.vue +81 -0
  92. package/edit/provisioning.cattle.io.cluster/SelectCredential.vue +3 -12
  93. package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +18 -0
  94. package/edit/provisioning.cattle.io.cluster/index.vue +1 -1
  95. package/edit/provisioning.cattle.io.cluster/rke2.vue +6 -2
  96. package/edit/provisioning.cattle.io.cluster/tabs/etcd/index.vue +0 -1
  97. package/edit/provisioning.cattle.io.cluster/tabs/networking/index.vue +2 -2
  98. package/edit/provisioning.cattle.io.cluster/tabs/registries/index.vue +14 -55
  99. package/list/management.cattle.io.user.vue +24 -5
  100. package/list/utils/management.cattle.io.cluster.utils.ts +1 -1
  101. package/machine-config/__tests__/generic.test.ts +163 -0
  102. package/machine-config/components/EC2Networking.vue +31 -7
  103. package/machine-config/components/__tests__/EC2Networking.test.ts +38 -15
  104. package/machine-config/generic.vue +32 -5
  105. package/mixins/resource-fetch.js +1 -1
  106. package/models/__tests__/provisioning.cattle.io.cluster.test.ts +156 -0
  107. package/models/__tests__/rke-machine.cattle.io.vmwarevspheremachinetemplate.test.ts +22 -0
  108. package/models/__tests__/secret.test.ts +68 -1
  109. package/models/management.cattle.io.cluster.js +21 -3
  110. package/models/pod.js +25 -12
  111. package/models/provisioning.cattle.io.cluster.js +59 -9
  112. package/models/rke-machine.cattle.io.vmwarevspheremachinetemplate.js +9 -0
  113. package/models/rke.cattle.io.etcdsnapshot.js +17 -9
  114. package/models/secret.js +19 -0
  115. package/models/workload.js +12 -7
  116. package/package.json +1 -1
  117. package/pages/auth/login.vue +1 -1
  118. package/pages/c/_cluster/apps/charts/__tests__/install.test.ts +569 -81
  119. package/pages/c/_cluster/apps/charts/install.vue +143 -28
  120. package/pages/c/_cluster/auth/config/index.vue +11 -4
  121. package/pages/c/_cluster/monitoring/index.vue +6 -1
  122. package/pkg/require-asset.lib.js +25 -0
  123. package/pkg/vue.config.js +7 -0
  124. package/plugins/dashboard-store/__tests__/resource-class.test.ts +84 -0
  125. package/plugins/dashboard-store/getters.js +0 -1
  126. package/plugins/dashboard-store/resource-class.js +62 -15
  127. package/plugins/steve/__tests__/steve-class-resource-api.test.ts +147 -0
  128. package/plugins/steve/steve-class.js +43 -0
  129. package/plugins/steve/subscribe.js +11 -0
  130. package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +115 -0
  131. package/rancher-components/Form/LabeledInput/LabeledInput.vue +83 -3
  132. package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +30 -0
  133. package/rancher-components/Form/TextArea/__tests__/TextAreaAutoGrow.test.ts +95 -0
  134. package/rancher-components/RcButton/index.ts +1 -1
  135. package/rancher-components/RcDropdown/RcDropdownTrigger.vue +6 -1
  136. package/store/__tests__/auth.test.ts +18 -0
  137. package/store/__tests__/features.test.ts +131 -0
  138. package/store/__tests__/growl.test.ts +374 -0
  139. package/store/__tests__/modal.test.ts +131 -0
  140. package/store/__tests__/notifications.test.ts +466 -1
  141. package/store/__tests__/slideInPanel.test.ts +88 -0
  142. package/store/__tests__/type-map.utils.test.ts +433 -0
  143. package/store/__tests__/ui-context.test.ts +255 -0
  144. package/store/auth.js +11 -1
  145. package/store/features.js +5 -0
  146. package/store/plugins.js +6 -0
  147. package/types/rancher/steve.api.ts +2 -2
  148. package/types/shell/index.d.ts +120 -0
  149. package/types/store/dashboard-store.types.ts +2 -2
  150. package/types/store/type-map.ts +262 -1
  151. package/utils/__tests__/operation-cr.test.ts +34 -0
  152. package/utils/async.ts +2 -0
  153. package/utils/grafana.js +2 -17
  154. package/utils/monitoring.js +38 -1
  155. package/utils/operation-cr.js +19 -0
  156. package/utils/require-asset.ts +7 -0
  157. package/utils/validators/__tests__/private-registry.test.ts +27 -15
  158. package/utils/validators/private-registry.ts +15 -4
  159. package/core/__tests__/plugin-products.test.ts +0 -4694
package/store/auth.js CHANGED
@@ -76,7 +76,7 @@ export const getters = {
76
76
 
77
77
  selfUser(state) {
78
78
  return state.selfUser;
79
- }
79
+ },
80
80
  };
81
81
 
82
82
  export const mutations = {
@@ -208,6 +208,16 @@ export const actions = {
208
208
  return findBy(authConfigs, 'id', id);
209
209
  },
210
210
 
211
+ /**
212
+ * Is the local auth provider enabled?
213
+ */
214
+ async getLocalProviderEnabled({ dispatch }) {
215
+ // If it exists as an option to log in --> enabled
216
+ const localProvider = await dispatch('getAuthProvider', 'local');
217
+
218
+ return !!localProvider;
219
+ },
220
+
211
221
  /**
212
222
  * Create the basic json object used for the nonce (this includes the random nonce/state)
213
223
  */
package/store/features.js CHANGED
@@ -39,6 +39,11 @@ export const PROVISIONING_PRE_BOOTSTRAP = create('provisioningprebootstrap', fal
39
39
  export const SCHEDULING_CUSTOMIZATION = create(SCHEDULING_CUSTOMIZATION_FEATURE, false);
40
40
  export const SCC = create('rancher-scc-registration-extension', true);
41
41
  export const AUTOSCALER = create('cluster-autoscaling', false);
42
+ // Feature flags for disabling shell access to clusters, nodes, pods
43
+ export const CLUSTER_SHELL = create('cluster-shell', true);
44
+ export const NODE_SHELL = create('node-shell', true);
45
+ export const POD_SHELL = create('pod-shell', true);
46
+ export const HIDE_LOCAL_AUTH_PROVIDER = create('hide-local-auth-provider', false);
42
47
 
43
48
  // Not currently used.. no point defining ones we don't use
44
49
  // export const EMBEDDED_CLUSTER_API = create('embedded-cluster-api', true);
package/store/plugins.js CHANGED
@@ -129,6 +129,12 @@ export const state = function() {
129
129
  return {};
130
130
  };
131
131
 
132
+ export const actions = {
133
+ mapDriver(ctx, { name, to }) {
134
+ mapDriver(name, to);
135
+ },
136
+ };
137
+
132
138
  export const getters = {
133
139
  credentialOptions() {
134
140
  return (name) => {
@@ -13,13 +13,13 @@ export const STEVE_RESPONSE_CODE = {
13
13
  /**
14
14
  * Steve API JSON response for GET requests
15
15
  */
16
- export interface SteveGetResponse extends KubeGetResponse {
16
+ export type SteveGetResponse<T = Record<string, any>> = T & KubeGetResponse & {
17
17
  // Rancher specific properties (there are more)
18
18
  id: string,
19
19
 
20
20
  // Bucket for everything else (hopefully to remove once above populated)
21
21
  [key: string]: any
22
- }
22
+ };
23
23
 
24
24
  /**
25
25
  * Steve API JSON response for LIST requests
@@ -28,6 +28,7 @@ export const IMPORTED_CLUSTER_VERSION_MANAGEMENT: "rancher.io/imported-cluster-v
28
28
  export const UI_PROJECT_SECRET: "management.cattle.io/project-scoped-secret";
29
29
  export const UI_PROJECT_SECRET_COPY: "management.cattle.io/project-scoped-secret-copy";
30
30
  export const SERVICE_LINKS: "ui.rancher/service-links";
31
+ export const NODE_DRIVER_FIELD_HINTS: "io.cattle.nodedriver/ui-field-hints";
31
32
  export namespace KUBERNETES {
32
33
  let SERVICE_ACCOUNT_UID: string;
33
34
  let SERVICE_ACCOUNT_NAME: string;
@@ -141,6 +142,9 @@ export namespace SNAPSHOT {
141
142
  let CLUSTER_NAME_1: string;
142
143
  export { CLUSTER_NAME_1 as CLUSTER_NAME };
143
144
  }
145
+ export namespace OPERATION_ANNOTATIONS {
146
+ let ENABLED: string;
147
+ }
144
148
  export namespace ISTIO {
145
149
  let AUTO_INJECTION: string;
146
150
  }
@@ -196,6 +200,7 @@ export const IMPORTED_CLUSTER_VERSION_MANAGEMENT: "rancher.io/imported-cluster-v
196
200
  export const UI_PROJECT_SECRET: "management.cattle.io/project-scoped-secret";
197
201
  export const UI_PROJECT_SECRET_COPY: "management.cattle.io/project-scoped-secret-copy";
198
202
  export const SERVICE_LINKS: "ui.rancher/service-links";
203
+ export const NODE_DRIVER_FIELD_HINTS: "io.cattle.nodedriver/ui-field-hints";
199
204
  export namespace KUBERNETES {
200
205
  let SERVICE_ACCOUNT_UID: string;
201
206
  let SERVICE_ACCOUNT_NAME: string;
@@ -309,6 +314,9 @@ export namespace SNAPSHOT {
309
314
  let CLUSTER_NAME_1: string;
310
315
  export { CLUSTER_NAME_1 as CLUSTER_NAME };
311
316
  }
317
+ export namespace OPERATION_ANNOTATIONS {
318
+ let ENABLED: string;
319
+ }
312
320
  export namespace ISTIO {
313
321
  let AUTO_INJECTION: string;
314
322
  }
@@ -2363,6 +2371,7 @@ export namespace FEATURE_DESCRIPTION {
2363
2371
  export { formatter_65 as formatter };
2364
2372
  export namespace formatterOpts_16 {
2365
2373
  let prefix: string;
2374
+ let fallbackPath: string;
2366
2375
  }
2367
2376
  export { formatterOpts_16 as formatterOpts };
2368
2377
  }
@@ -4160,6 +4169,7 @@ export namespace FEATURE_DESCRIPTION {
4160
4169
  export { formatter_65 as formatter };
4161
4170
  export namespace formatterOpts_16 {
4162
4171
  let prefix: string;
4172
+ let fallbackPath: string;
4163
4173
  }
4164
4174
  export { formatterOpts_16 as formatterOpts };
4165
4175
  }
@@ -4511,6 +4521,11 @@ export const LONGHORN_DRIVER: "driver.longhorn.io";
4511
4521
  export const LONGHORN_VERSION_V1: "LonghornV1";
4512
4522
  export const LONGHORN_VERSION_V2: "LonghornV2";
4513
4523
  export const SNAPSHOT: "rke.cattle.io.etcdsnapshot";
4524
+ export namespace OPERATION {
4525
+ let ETCD_SNAPSHOT: string;
4526
+ let ETCD_SNAPSHOT_RESTORE: string;
4527
+ let ENCRYPTION_KEY_ROTATE: string;
4528
+ }
4514
4529
  export namespace MANAGEMENT {
4515
4530
  let AUTH_CONFIG_1: string;
4516
4531
  export { AUTH_CONFIG_1 as AUTH_CONFIG };
@@ -4688,6 +4703,7 @@ export namespace AUTH_TYPE {
4688
4703
  let _S3: string;
4689
4704
  let _RKE: string;
4690
4705
  let _IMAGE_PULL_SECRET: string;
4706
+ let _GITHUB_APP: string;
4691
4707
  }
4692
4708
  export const LOCAL_CLUSTER: "local";
4693
4709
  export namespace CLUSTER_REPO_TYPES {
@@ -4896,6 +4912,11 @@ export const LONGHORN_DRIVER: "driver.longhorn.io";
4896
4912
  export const LONGHORN_VERSION_V1: "LonghornV1";
4897
4913
  export const LONGHORN_VERSION_V2: "LonghornV2";
4898
4914
  export const SNAPSHOT: "rke.cattle.io.etcdsnapshot";
4915
+ export namespace OPERATION {
4916
+ let ETCD_SNAPSHOT: string;
4917
+ let ETCD_SNAPSHOT_RESTORE: string;
4918
+ let ENCRYPTION_KEY_ROTATE: string;
4919
+ }
4899
4920
  export namespace MANAGEMENT {
4900
4921
  let AUTH_CONFIG_1: string;
4901
4922
  export { AUTH_CONFIG_1 as AUTH_CONFIG };
@@ -5073,6 +5094,7 @@ export namespace AUTH_TYPE {
5073
5094
  let _S3: string;
5074
5095
  let _RKE: string;
5075
5096
  let _IMAGE_PULL_SECRET: string;
5097
+ let _GITHUB_APP: string;
5076
5098
  }
5077
5099
  export const LOCAL_CLUSTER: "local";
5078
5100
  export namespace CLUSTER_REPO_TYPES {
@@ -6624,6 +6646,7 @@ export namespace STATES_ENUM {
6624
6646
  let BUILDING: string;
6625
6647
  let COMPLETED: string;
6626
6648
  let CORDONED: string;
6649
+ let CANCELLED: string;
6627
6650
  let COUNT: string;
6628
6651
  let CREATED: string;
6629
6652
  let CREATING: string;
@@ -6862,6 +6885,8 @@ export default class Resource {
6862
6885
  doActionGrowl(actionName: any, body: any, opt?: {}): Promise<any>;
6863
6886
  patch(data: any, opt?: {}, merge?: boolean, alertOnError?: boolean): any;
6864
6887
  save(...args: any[]): Promise<this>;
6888
+ _collectionUrl(): any;
6889
+ dryRunCreate(data: any): Promise<any>;
6865
6890
  /**
6866
6891
  * Remove any unwanted properties from the object that will be saved
6867
6892
  */
@@ -7202,6 +7227,7 @@ export namespace STATES_ENUM {
7202
7227
  let BUILDING: string;
7203
7228
  let COMPLETED: string;
7204
7229
  let CORDONED: string;
7230
+ let CANCELLED: string;
7205
7231
  let COUNT: string;
7206
7232
  let CREATED: string;
7207
7233
  let CREATING: string;
@@ -7440,6 +7466,8 @@ export default class Resource {
7440
7466
  doActionGrowl(actionName: any, body: any, opt?: {}): Promise<any>;
7441
7467
  patch(data: any, opt?: {}, merge?: boolean, alertOnError?: boolean): any;
7442
7468
  save(...args: any[]): Promise<this>;
7469
+ _collectionUrl(): any;
7470
+ dryRunCreate(data: any): Promise<any>;
7443
7471
  /**
7444
7472
  * Remove any unwanted properties from the object that will be saved
7445
7473
  */
@@ -7846,6 +7874,18 @@ export default class SteveModel extends HybridModel {
7846
7874
  * @param {*} res
7847
7875
  */
7848
7876
  processSaveResponse(res: any, opt?: {}): void;
7877
+ /**
7878
+ * RESOURCES API - ResourceInstance update method to send a PATCH request
7879
+ */
7880
+ update(data: any): Promise<this>;
7881
+ /**
7882
+ * RESOURCES API - ResourceInstance update method to send a PUT request
7883
+ */
7884
+ replace(): Promise<this>;
7885
+ /**
7886
+ * RESOURCES API - ResourceInstance delete method to send a DELETE request
7887
+ */
7888
+ delete(): Promise<void>;
7849
7889
  }
7850
7890
  import HybridModel from './hybrid-class';
7851
7891
  }
@@ -7875,6 +7915,18 @@ export default class SteveModel extends HybridModel {
7875
7915
  * @param {*} res
7876
7916
  */
7877
7917
  processSaveResponse(res: any, opt?: {}): void;
7918
+ /**
7919
+ * RESOURCES API - ResourceInstance update method to send a PATCH request
7920
+ */
7921
+ update(data: any): Promise<this>;
7922
+ /**
7923
+ * RESOURCES API - ResourceInstance update method to send a PUT request
7924
+ */
7925
+ replace(): Promise<this>;
7926
+ /**
7927
+ * RESOURCES API - ResourceInstance delete method to send a DELETE request
7928
+ */
7929
+ delete(): Promise<void>;
7878
7930
  }
7879
7931
  import HybridModel from './hybrid-class';
7880
7932
  }
@@ -7901,6 +7953,10 @@ export const PROVISIONING_PRE_BOOTSTRAP: any;
7901
7953
  export const SCHEDULING_CUSTOMIZATION: any;
7902
7954
  export const SCC: any;
7903
7955
  export const AUTOSCALER: any;
7956
+ export const CLUSTER_SHELL: any;
7957
+ export const NODE_SHELL: any;
7958
+ export const POD_SHELL: any;
7959
+ export const HIDE_LOCAL_AUTH_PROVIDER: any;
7904
7960
  export namespace getters {
7905
7961
  function get(state: any, getters: any, rootState: any, rootGetters: any): (name: any) => any;
7906
7962
  }
@@ -7934,6 +7990,10 @@ export const PROVISIONING_PRE_BOOTSTRAP: any;
7934
7990
  export const SCHEDULING_CUSTOMIZATION: any;
7935
7991
  export const SCC: any;
7936
7992
  export const AUTOSCALER: any;
7993
+ export const CLUSTER_SHELL: any;
7994
+ export const NODE_SHELL: any;
7995
+ export const POD_SHELL: any;
7996
+ export const HIDE_LOCAL_AUTH_PROVIDER: any;
7937
7997
  export namespace getters {
7938
7998
  function get(state: any, getters: any, rootState: any, rootGetters: any): (name: any) => any;
7939
7999
  }
@@ -7958,6 +8018,12 @@ export const fullFields: any[];
7958
8018
  export const prefixFields: any[];
7959
8019
  export const suffixFields: any[];
7960
8020
  export function state(): {};
8021
+ export namespace actions {
8022
+ function mapDriver(ctx: any, { name, to }: {
8023
+ name: any;
8024
+ to: any;
8025
+ }): void;
8026
+ }
7961
8027
  export namespace getters {
7962
8028
  function credentialOptions(): (name: any) => any;
7963
8029
  function credentialDriverFor(): (name: any) => any;
@@ -7983,6 +8049,12 @@ export const fullFields: any[];
7983
8049
  export const prefixFields: any[];
7984
8050
  export const suffixFields: any[];
7985
8051
  export function state(): {};
8052
+ export namespace actions {
8053
+ function mapDriver(ctx: any, { name, to }: {
8054
+ name: any;
8055
+ to: any;
8056
+ }): void;
8057
+ }
7986
8058
  export namespace getters {
7987
8059
  function credentialOptions(): (name: any) => any;
7988
8060
  function credentialDriverFor(): (name: any) => any;
@@ -9496,6 +9568,14 @@ export function monitoringStatus(): {
9496
9568
  };
9497
9569
  };
9498
9570
  export function haveV2Monitoring(getters: any): boolean;
9571
+ /**
9572
+ * Look up the installed Rancher monitoring app, preferring the new
9573
+ * `rancher-monitoring-dashboards` chart and falling back to the legacy
9574
+ * `rancher-monitoring`. Returns null if the user lacks permission, neither
9575
+ * chart is installed, or any lookup fails.
9576
+ */
9577
+ export function fetchMonitoringApp(store: any, storeName: any): Promise<any>;
9578
+ export function fetchMonitoringVersion(store: any, storeName: any): Promise<any>;
9499
9579
  export function canViewGrafanaLink(store: any): Promise<boolean>;
9500
9580
  export function canViewAlertManagerLink(store: any): Promise<boolean>;
9501
9581
  export function canViewPrometheusLink(store: any): Promise<boolean>;
@@ -9511,6 +9591,14 @@ export function monitoringStatus(): {
9511
9591
  };
9512
9592
  };
9513
9593
  export function haveV2Monitoring(getters: any): boolean;
9594
+ /**
9595
+ * Look up the installed Rancher monitoring app, preferring the new
9596
+ * `rancher-monitoring-dashboards` chart and falling back to the legacy
9597
+ * `rancher-monitoring`. Returns null if the user lacks permission, neither
9598
+ * chart is installed, or any lookup fails.
9599
+ */
9600
+ export function fetchMonitoringApp(store: any, storeName: any): Promise<any>;
9601
+ export function fetchMonitoringVersion(store: any, storeName: any): Promise<any>;
9514
9602
  export function canViewGrafanaLink(store: any): Promise<boolean>;
9515
9603
  export function canViewAlertManagerLink(store: any): Promise<boolean>;
9516
9604
  export function canViewPrometheusLink(store: any): Promise<boolean>;
@@ -9765,6 +9853,38 @@ export function convertStringToKV(input: string): {};
9765
9853
  declare function isEqualBasic(from: any, to: any): boolean;
9766
9854
  }
9767
9855
 
9856
+ // @shell/utils/operation-cr
9857
+
9858
+ declare module '@shell/utils/operation-cr' {
9859
+ /**
9860
+ * Create a day 2 operation CR for imported clusters.
9861
+ *
9862
+ * @param {Function} dispatch - The Vuex dispatch function
9863
+ * @param {string} type - The operation CRD type
9864
+ * @param {object} spec - The operation spec
9865
+ * @param {string} namespace - The namespace for the operation CR
9866
+ * @param {string} namePrefix - The name prefix for the generated name
9867
+ * @returns {Promise} The saved resource
9868
+ */
9869
+ export function createOperationCR(dispatch: Function, type: string, spec: object, namespace: string, namePrefix: string): Promise<any>;
9870
+ }
9871
+
9872
+ // @shell/utils/operation-cr.js
9873
+
9874
+ declare module '@shell/utils/operation-cr.js' {
9875
+ /**
9876
+ * Create a day 2 operation CR for imported clusters.
9877
+ *
9878
+ * @param {Function} dispatch - The Vuex dispatch function
9879
+ * @param {string} type - The operation CRD type
9880
+ * @param {object} spec - The operation spec
9881
+ * @param {string} namespace - The namespace for the operation CR
9882
+ * @param {string} namePrefix - The name prefix for the generated name
9883
+ * @returns {Promise} The saved resource
9884
+ */
9885
+ export function createOperationCR(dispatch: Function, type: string, spec: object, namespace: string, namePrefix: string): Promise<any>;
9886
+ }
9887
+
9768
9888
  // @shell/utils/parse-externalid
9769
9889
 
9770
9890
  declare module '@shell/utils/parse-externalid' {
@@ -180,7 +180,7 @@ export type ActionFindPageTransientResponse<T = any> = {
180
180
  *
181
181
  * If the request was not transient this will just be the array of resources
182
182
  */
183
- export type ActionFindPageResponse<T = any> = ActionFindPageTransientResponse | T[];
183
+ export type ActionFindPageResponse<T = Record<string, any>> = ActionFindPageTransientResponse<T> | T[];
184
184
 
185
185
  /**
186
186
  * Args used for findMatching action
@@ -221,7 +221,7 @@ export interface ActionFindMatchingArgs extends ActionCoreFindOptions {
221
221
  * @internal
222
222
  * Response to the findMatching action
223
223
  */
224
- export type ActionFindMatchingResponse<T = any> = ActionFindPageResponse<T>
224
+ export type ActionFindMatchingResponse<T = any> = T[]
225
225
 
226
226
  /**
227
227
  * @internal
@@ -1,3 +1,264 @@
1
+ import { PluginRouteRecordRaw } from '@shell/core/types';
2
+
3
+ /**
4
+ * The product as seen by the type-map
5
+ */
6
+ export interface TypeMapProduct {
7
+ /**
8
+ * The category this product belongs under. i.e. 'config'
9
+ */
10
+ category?: string;
11
+
12
+ /**
13
+ * Hide the Copy KubeConfig button in the header
14
+ */
15
+ hideCopyConfig?: boolean;
16
+
17
+ /**
18
+ * Hide the Download KubeConfig button in the header
19
+ */
20
+ hideKubeConfig?: boolean;
21
+
22
+ /**
23
+ * Hide the Kubectl Shell button in the header
24
+ */
25
+ hideKubeShell?: boolean;
26
+
27
+ /**
28
+ * Hide the Namespace location
29
+ */
30
+ hideNamespaceLocation?: boolean;
31
+
32
+ /**
33
+ * Hide the system resources
34
+ */
35
+ hideSystemResources?: boolean;
36
+
37
+ /**
38
+ * The icon that should be displayed beside this item in the navigation.
39
+ */
40
+ icon?: string;
41
+
42
+ /**
43
+ * Alternative to the icon property. Uses require
44
+ */
45
+ svg?: Function;
46
+
47
+ /**
48
+ * Only load the product if the feature is present
49
+ */
50
+ ifFeature?: string | RegExp;
51
+
52
+ /**
53
+ * Only load the product if the type is present
54
+ */
55
+ ifHave?: string;
56
+
57
+ /**
58
+ * Only load the product if the group is present
59
+ */
60
+ ifHaveGroup?: string | RegExp;
61
+
62
+ /**
63
+ * Only load the product if the type is present
64
+ */
65
+ ifHaveType?: string | RegExp;
66
+
67
+ /**
68
+ * Hide the product if the type is present (opposite of ifHaveType)
69
+ */
70
+ ifNotHaveType?: string | RegExp;
71
+
72
+ /**
73
+ * The vuex store that this product should use by default i.e. 'management'
74
+ */
75
+ inStore?: string;
76
+
77
+ /**
78
+ * Show the cluster switcher in the navigation
79
+ */
80
+ showClusterSwitcher?: boolean;
81
+
82
+ /**
83
+ * Indicates whether UI Extensions can add pages to this product
84
+ */
85
+ extendable?: boolean;
86
+
87
+ /**
88
+ * Show the namespace filter in the header
89
+ */
90
+ showNamespaceFilter?: boolean;
91
+
92
+ /**
93
+ * A number used to determine where in navigation this item will be placed. The highest number will be at the top of the list.
94
+ */
95
+ weight?: number;
96
+
97
+ /**
98
+ * The route that the product will lead to if click on in navigation.
99
+ */
100
+ to?: PluginRouteRecordRaw;
101
+
102
+ /**
103
+ * Product name
104
+ *
105
+ * Defaults to the DSL fn product arg
106
+ */
107
+ name?: string;
108
+
109
+ /**
110
+ *
111
+ */
112
+ label?: string;
113
+
114
+ labelKey?: string;
115
+
116
+ iconHeader?: string;
117
+
118
+ // Do not use - internal use only
119
+ version?: number;
120
+
121
+ renameGroups?: {
122
+ /** String or regex to match against group internal IDs */
123
+ groupSelector: RegExp | string;
124
+ /** Display name to use for matching groups */
125
+ newName: string;
126
+ }[];
127
+
128
+ moveToGroup?: {
129
+ /** Page identifier — the resource `type` string or the custom page `name` */
130
+ entryId: string;
131
+ /** Target group name as defined in your group config (`name` property) */
132
+ groupName: string;
133
+ /** Ordering weight for the mapping (default: 5). Higher weight takes precedence when multiple rules match */
134
+ weight?: number;
135
+ }[];
136
+
137
+ ignoreGroups?: {
138
+ /** String or regex to match against group names */
139
+ groupSelector: string | RegExp;
140
+ /** Optional conditional function that accepts the root Dashboard Vuex store getters and returns true if the group should be ignored */
141
+ condition?: (getters: any) => boolean;
142
+ }[];
143
+
144
+ /**
145
+ * Whether the product can be removed by users (default: false — products are built-in/not removable unless explicitly set to true)
146
+ */
147
+ removable?: boolean;
148
+ /**
149
+ * controls whether a workspace switcher dropdown appears in the header (instead of the namespace filter) if set to true
150
+ */
151
+ showWorkspaceSwitcher?: boolean;
152
+
153
+ /**
154
+ * Leaving these here for completeness but I don't think these should be advertised as useable to plugin creators.
155
+ */
156
+ // ifHaveVerb: string | RegExp;
157
+ // supportRoute: string;
158
+ // typeStoreMap: string;
159
+ }
160
+
161
+ /**
162
+ * Used by type-map configureType
163
+ */
164
+ export interface TypeMapConfigureType {
165
+ /** Override for the name displayed */
166
+ displayName?: string;
167
+ /** Override for the create button string on a list view */
168
+ listCreateButtonLabelKey?: string;
169
+ /** If false, disable create even if schema says it's allowed */
170
+ isCreatable?: boolean;
171
+ /** If false, disable for edit */
172
+ isEditable?: boolean;
173
+ /** If false, disable for remove/delete */
174
+ isRemovable?: boolean;
175
+ /** If false, hide state in columns and masthead */
176
+ showState?: boolean;
177
+ /** If false, hide age in columns and masthead */
178
+ showAge?: boolean;
179
+ /** If false, hide masthead config button in view mode */
180
+ showConfigView?: boolean;
181
+ /** If false, hide masthead in list view */
182
+ showListMasthead?: boolean;
183
+ /** If false, cannot edit or show yaml */
184
+ canYaml?: boolean;
185
+ /** Show the Masthead in the edit resource component */
186
+ resourceEditMasthead?: boolean;
187
+ /** Entry route definition for this resource page */
188
+ customRoute?: PluginRouteRecordRaw | Object;
189
+ /** Hide this type from the nav/search bar on downstream clusters (will only show in "local" cluster) */
190
+ localOnly?: boolean;
191
+ // resource: undefined; // Use this resource in ResourceDetails instead
192
+ // resourceDetail: undefined; // Use this resource specifically for ResourceDetail's detail component
193
+ // resourceEdit: undefined; // Use this resource specifically for ResourceDetail's edit component
194
+ /**
195
+ * Use this to depaginate requests for this type
196
+ */
197
+ depaginate?: undefined;
198
+ // notFilterNamespace: undefined; // Define namespaces that do not need to be filtered
199
+ // used in configureType options, to be typed later if needed
200
+
201
+ /**
202
+ * Whether this custom page has list groups (definition for grouping items in the list view)
203
+ */
204
+ listGroups?: {
205
+ /** Icon for the group (relates to icons in rancher-icons */
206
+ icon?: string;
207
+ /** Value for the group (used for grouping items in the list view) */
208
+ value?: string;
209
+ /** Field for the group (used for grouping items in the list view) */
210
+ field?: string;
211
+ /** Column to hide when this group is active */
212
+ hideColumn?: string;
213
+ /** Tooltip key for the group */
214
+ tooltipKey?: string;
215
+ }[];
216
+
217
+ /**
218
+ * Whether the provided list groups will override the default grouping options (e.g. group by namespace, group by cluster, etc.) or be added to them
219
+ */
220
+ listGroupsWillOverride?: boolean;
221
+
222
+ /**
223
+ * Use this to configure subtypes that should be shown in the list view for this type (e.g. show "pods" and "deployments" in the list view for "workloads")
224
+ */
225
+ subTypes?: string[];
226
+ }
227
+
228
+ /**
229
+ * Used by type-map virtualType
230
+ */
231
+ export interface TypeMapVirtualType {
232
+ /** Display only if condition is met (relates to IF_HAVE in shell/store/type-map) */
233
+ ifHave?: boolean;
234
+ /** Display only if feature is present (relates to shell/store/features) */
235
+ ifFeature?: string;
236
+ /** Display only if resource type exists */
237
+ ifHaveType?: string;
238
+ /** Used in conjunction with "ifHaveType", display only if resource type allows this verb (GET, POST, PUT, DELETE) */
239
+ ifHaveVerb?: string;
240
+ /** Display label for the custom page */
241
+ label?: string;
242
+ /** Translation key for the label */
243
+ labelKey?: string;
244
+ name: string;
245
+ // /** Name of the page (unique identifier) */
246
+ // name?: string;
247
+ /** Entry route definition for this custom page */
248
+ route?: PluginRouteRecordRaw | Object;
249
+ /** Icon for the custom page (relates to icons in https://github.com/rancher/icons) */
250
+ icon?: 'compass';
251
+ /** Whether this custom page is namespaced or not */
252
+ namespaced?: boolean;
253
+ /** Ordering weight for the custom page */
254
+ weight?: number;
255
+ /** Whether this custom page is exact match */
256
+ exact?: boolean;
257
+ /** Whether this custom page will act as an overview page */
258
+ overview?: boolean;
259
+ /** Whether this custom page has an exact path match */
260
+ 'exact-path'?: boolean;
261
+ }
1
262
 
2
263
  /**
3
264
  * interface for type-map's' definition for table headers/columns
@@ -11,7 +272,7 @@ export interface TableColumn {
11
272
  formatterOpts?: any,
12
273
  width?: number,
13
274
  tooltip?: string,
14
- search?: string | boolean,
275
+ search?: string | string[] | boolean,
15
276
  }
16
277
 
17
278
  export const COLUMN_BREAKPOINTS = {
@@ -0,0 +1,34 @@
1
+ import { createOperationCR } from '@shell/utils/operation-cr';
2
+
3
+ describe('util: operation-cr', () => {
4
+ it('should dispatch create and save the operation resource', async() => {
5
+ const save = jest.fn().mockResolvedValue({ id: 'op-1' });
6
+ const dispatch = jest.fn().mockResolvedValue({ save });
7
+ const spec = {
8
+ clusterRef: {
9
+ apiVersion: 'management.cattle.io/v3',
10
+ kind: 'Cluster',
11
+ name: 'c-m-1',
12
+ }
13
+ };
14
+
15
+ const out = await createOperationCR(dispatch, 'operation.test', spec, 'c-m-1', 'cluster-name');
16
+
17
+ expect(dispatch).toHaveBeenCalledWith('management/create', {
18
+ type: 'operation.test',
19
+ metadata: {
20
+ namespace: 'c-m-1',
21
+ generateName: 'cluster-name-'
22
+ },
23
+ spec,
24
+ }, { root: true });
25
+ expect(save).toHaveBeenCalledWith();
26
+ expect(out).toStrictEqual({ id: 'op-1' });
27
+ });
28
+
29
+ it('should surface create failures', async() => {
30
+ const dispatch = jest.fn().mockRejectedValue(new Error('forbidden'));
31
+
32
+ await expect(createOperationCR(dispatch, 'operation.test', {}, 'c-m-1', 'cluster-name')).rejects.toThrow('forbidden');
33
+ });
34
+ });
package/utils/async.ts CHANGED
@@ -5,6 +5,8 @@ export const waitFor = (testFn: Function, msg = '', timeoutMs = 3000000, interva
5
5
  if (testFn()) {
6
6
  gatedLog('Wait for', msg || 'unknown', 'done immediately');
7
7
  resolve(this);
8
+
9
+ return;
8
10
  }
9
11
  const timeout = setTimeout(() => {
10
12
  gatedLog('Wait for', msg, 'timed out');