@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.
- package/apis/intf/resources-api/resource-base.ts +42 -2
- package/apis/intf/resources-api/resource-instance.ts +101 -0
- package/apis/intf/resources-api/resources-api.ts +177 -23
- package/apis/intf/resources.ts +8 -6
- package/apis/intf/shell-api/slide-in.ts +46 -17
- package/apis/resources/__tests__/resources-api-class.test.ts +309 -28
- package/apis/resources/resources-api-class.ts +232 -43
- package/apis/shell/__tests__/slide-in.test.ts +83 -2
- package/apis/shell/slide-in.ts +20 -0
- package/assets/images/providers/traefik.png +0 -0
- package/assets/translations/en-us.yaml +10 -4
- package/chart/__tests__/rancher-monitoring-dashboards-index.test.ts +269 -0
- package/chart/rancher-monitoring-dashboards/index.vue +155 -0
- package/cloud-credential/__tests__/generic.test.ts +132 -0
- package/cloud-credential/generic.vue +33 -3
- package/components/EtcdInfoBanner.vue +2 -12
- package/components/ExplorerProjectsNamespaces.vue +2 -2
- package/components/GrafanaDashboard.vue +2 -8
- package/components/Resource/Detail/Masthead/__tests__/index.test.ts +68 -14
- package/components/Resource/Detail/Masthead/index.vue +8 -3
- package/components/Resource/Detail/Metadata/IdentifyingInformation/__tests__/identifying-fields.test.ts +9 -0
- package/components/Resource/Detail/Metadata/IdentifyingInformation/identifying-fields.ts +5 -1
- package/components/SlideInPanelManager.vue +103 -25
- package/components/__tests__/SlideInPanelManager.spec.ts +153 -10
- package/components/auth/AuthBanner.vue +1 -1
- package/components/form/Security.vue +1 -1
- package/components/formatter/Translate.vue +22 -1
- package/components/nav/Group.vue +5 -10
- package/components/nav/TopLevelMenu.vue +1 -30
- package/components/nav/__tests__/Group.test.ts +61 -0
- package/config/labels-annotations.js +1 -0
- package/config/table-headers.js +5 -2
- package/core/__tests__/plugin-products-apply.test.ts +787 -0
- package/core/__tests__/plugin-products-extend.test.ts +189 -0
- package/core/__tests__/plugin-products-helpers.test.ts +81 -78
- package/core/__tests__/plugin-products-new.test.ts +389 -0
- package/core/__tests__/plugin-products-scenarios.test.ts +980 -0
- package/core/__tests__/plugin-products-side-menu.test.ts +1935 -0
- package/core/plugin-products-base.ts +201 -93
- package/core/plugin-products-extending.ts +1 -1
- package/core/plugin-products-external.ts +380 -0
- package/core/plugin-products-helpers.ts +28 -24
- package/core/plugin-products-internal.ts +207 -0
- package/core/plugin-products-top-level.ts +10 -5
- package/core/plugin-products-type-guards.ts +17 -6
- package/core/plugin-products.ts +5 -7
- package/core/plugin-types.ts +1 -389
- package/core/plugin.ts +10 -11
- package/core/plugins-loader.js +2 -0
- package/core/types.ts +6 -202
- package/detail/__tests__/provisioning.cattle.io.cluster.test.ts +52 -0
- package/detail/pod.vue +1 -1
- package/detail/provisioning.cattle.io.cluster.vue +0 -2
- package/edit/auth/AuthProviderWarningBanners.vue +12 -0
- package/edit/auth/__tests__/AuthProviderWarningBanners.test.ts +10 -1
- package/edit/auth/__tests__/azuread.test.ts +1 -0
- package/edit/auth/__tests__/github.test.ts +1 -0
- package/edit/auth/__tests__/oidc.test.ts +1 -0
- package/edit/auth/__tests__/saml.test.ts +1 -0
- package/edit/auth/ldap/__tests__/index.test.ts +1 -0
- package/edit/provisioning.cattle.io.cluster/index.vue +1 -1
- package/edit/provisioning.cattle.io.cluster/rke2.vue +1 -1
- package/edit/provisioning.cattle.io.cluster/tabs/networking/index.vue +2 -2
- package/list/management.cattle.io.user.vue +24 -5
- package/list/utils/management.cattle.io.cluster.utils.ts +1 -1
- package/machine-config/__tests__/generic.test.ts +163 -0
- package/machine-config/components/EC2Networking.vue +31 -7
- package/machine-config/components/__tests__/EC2Networking.test.ts +38 -15
- package/machine-config/generic.vue +32 -5
- package/mixins/resource-fetch.js +1 -1
- package/models/__tests__/namespace.test.ts +133 -8
- package/models/__tests__/provisioning.cattle.io.cluster.test.ts +57 -1
- package/models/__tests__/rke-machine.cattle.io.vmwarevspheremachinetemplate.test.ts +22 -0
- package/models/namespace.js +34 -2
- package/models/pod.js +12 -10
- package/models/provisioning.cattle.io.cluster.js +20 -13
- package/models/rke-machine.cattle.io.vmwarevspheremachinetemplate.js +9 -0
- package/package.json +1 -1
- package/pages/auth/login.vue +1 -1
- package/pages/c/_cluster/apps/charts/__tests__/install.test.ts +110 -0
- package/pages/c/_cluster/apps/charts/install.vue +29 -0
- package/pages/c/_cluster/auth/config/index.vue +11 -4
- package/pages/c/_cluster/explorer/workload-dashboard/__tests__/composable.test.ts +136 -1
- package/pages/c/_cluster/explorer/workload-dashboard/composable.ts +69 -1
- package/pages/c/_cluster/fleet/index.vue +5 -9
- package/pages/c/_cluster/monitoring/index.vue +6 -1
- package/pkg/vue.config.js +4 -3
- package/plugins/codemirror.js +2 -0
- package/plugins/dashboard-store/resource-class.js +13 -9
- package/plugins/steve/__tests__/steve-class-resource-api.test.ts +147 -0
- package/plugins/steve/steve-class.js +43 -0
- package/plugins/steve/subscribe.js +11 -0
- package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +115 -0
- package/rancher-components/Form/LabeledInput/LabeledInput.vue +83 -3
- package/store/__tests__/action-menu.test.ts +622 -0
- package/store/__tests__/auth.test.ts +18 -0
- package/store/__tests__/notifications.test.ts +466 -1
- package/store/__tests__/slideInPanel.test.ts +143 -43
- package/store/__tests__/ui-context.test.ts +255 -0
- package/store/__tests__/wm.test.ts +503 -0
- package/store/auth.js +11 -1
- package/store/aws.js +19 -4
- package/store/features.js +1 -0
- package/store/plugins.js +6 -0
- package/store/slideInPanel.ts +15 -3
- package/types/rancher/steve.api.ts +2 -2
- package/types/shell/index.d.ts +84 -2
- package/types/store/dashboard-store.types.ts +2 -2
- package/types/store/type-map.ts +262 -1
- package/utils/__tests__/fleet-appco.test.ts +23 -0
- package/utils/async.ts +2 -0
- package/utils/fleet-appco.ts +6 -1
- package/utils/grafana.js +2 -17
- package/utils/monitoring.js +38 -1
- package/utils/sort.js +1 -1
- package/core/__tests__/plugin-products.test.ts +0 -4694
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
ActionFindAllArgs, ActionFindArgs,
|
|
4
4
|
ActionFindMatchingArgs,
|
|
5
5
|
ActionFindPageArgs,
|
|
6
|
-
ActionFindPageResponse, ActionFindMatchingResponse
|
|
6
|
+
ActionFindPageResponse, ActionFindMatchingResponse,
|
|
7
7
|
} from '@shell/types/store/dashboard-store.types';
|
|
8
|
+
import { SteveListResponse, SteveGetResponse } from '@shell/types/rancher/steve.api';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @interface
|
|
@@ -23,6 +24,30 @@ import {
|
|
|
23
24
|
*/
|
|
24
25
|
export type ResourceType = K8SResourceType | string;
|
|
25
26
|
|
|
27
|
+
/**
|
|
28
|
+
* @interface
|
|
29
|
+
* Data object for creating a new resource. Must include a `type` property.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { useResources, K8S } from '@shell/apis';
|
|
34
|
+
*
|
|
35
|
+
* const resources = useResources();
|
|
36
|
+
*
|
|
37
|
+
* const newConfigMap: CreateResourceData = {
|
|
38
|
+
* type: K8S.CONFIG_MAP,
|
|
39
|
+
* metadata: { name: 'my-config', namespace: 'default' },
|
|
40
|
+
* data: { key: 'value' }
|
|
41
|
+
* };
|
|
42
|
+
*
|
|
43
|
+
* await resources.cluster.create(newConfigMap);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export type CreateResourceData = {
|
|
47
|
+
[key: string]: any,
|
|
48
|
+
type: ResourceType,
|
|
49
|
+
};
|
|
50
|
+
|
|
26
51
|
/**
|
|
27
52
|
* @interface
|
|
28
53
|
* Resources API "findAll" options
|
|
@@ -87,6 +112,7 @@ export type FindFilteredLabelSelectorOptions = Omit<ActionFindMatchingArgs, 'dep
|
|
|
87
112
|
// @internal We use an interface instead of a type alias so the documentation generator
|
|
88
113
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
89
114
|
export interface FindFilteredPageOptions extends ActionFindPageArgs {}
|
|
115
|
+
export interface FindFilteredPageOptionsTransient extends ActionFindPageArgs { transient: true }
|
|
90
116
|
|
|
91
117
|
/**
|
|
92
118
|
* @interface
|
|
@@ -104,4 +130,18 @@ export type FindFilteredPageResponse<T = any> = ActionFindPageResponse<T>;
|
|
|
104
130
|
* Aligns with the response type of the underlying `findMatching` store action via `findLabelSelector`.
|
|
105
131
|
* Can be either a transient response object (with data and pagination) or an array of resources.
|
|
106
132
|
*/
|
|
107
|
-
export type FindFilteredLabelSelectorResponse<T = any
|
|
133
|
+
export type FindFilteredLabelSelectorResponse<T = Record<string, any>> = ActionFindMatchingResponse<T>;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @interface
|
|
137
|
+
* Steve API JSON response for GET requests for a resource
|
|
138
|
+
*/
|
|
139
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
140
|
+
export type SteveResource<T = Record<string, any>> = T & SteveGetResponse;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @interface
|
|
144
|
+
* Steve API JSON response for LIST resource requests
|
|
145
|
+
*/
|
|
146
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
147
|
+
export type SteveList<T = Record<string, any>> = SteveListResponse<T & SteveGetResponse>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { SteveResource } from '@shell/apis/intf/resources-api/resource-base';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Instance-level operations available on resources returned by the Resources API.
|
|
5
|
+
*
|
|
6
|
+
* These methods operate on a specific resource that has already been fetched.
|
|
7
|
+
*/
|
|
8
|
+
export interface ResourceInstanceApi {
|
|
9
|
+
/**
|
|
10
|
+
* Applies a partial update to a resource using HTTP PATCH
|
|
11
|
+
* with merge-patch semantics (`application/strategic-merge-patch+json`).
|
|
12
|
+
*
|
|
13
|
+
* Only the fields provided in `data` are sent to the server — the rest of the resource
|
|
14
|
+
* remains unchanged. The server response is merged back into this instance.
|
|
15
|
+
*
|
|
16
|
+
* Requires edit permissions (`canEdit`).
|
|
17
|
+
*
|
|
18
|
+
* @param data - An object containing only the fields to update.
|
|
19
|
+
* @returns a resource instance, updated with the server response.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { useResources, K8S } from '@shell/apis';
|
|
24
|
+
*
|
|
25
|
+
* const resources = useResources();
|
|
26
|
+
* const configMap = await resources.cluster.find(K8S.CONFIG_MAP, 'default/my-config');
|
|
27
|
+
*
|
|
28
|
+
* await configMap.update({ newKey: 'newValue' });
|
|
29
|
+
*
|
|
30
|
+
* const result = configMap.newKey === 'newValue' // true
|
|
31
|
+
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
update(data: Record<string, any>): Promise<this>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Performs a full replacement update of a resource using HTTP PUT.
|
|
38
|
+
*
|
|
39
|
+
* Sends the entire current state of the resource to the server.
|
|
40
|
+
*
|
|
41
|
+
* Requires edit permissions (`canEdit`).
|
|
42
|
+
*
|
|
43
|
+
* @returns a resource instance, updated with the server response.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { useResources, K8S } from '@shell/apis';
|
|
48
|
+
*
|
|
49
|
+
* const resources = useResources();
|
|
50
|
+
* const configMap = await resources.cluster.find(K8S.CONFIG_MAP, 'default/my-config');
|
|
51
|
+
*
|
|
52
|
+
* configMap.data.myKey = 'updatedValue';
|
|
53
|
+
* await configMap.replace();
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
replace(): Promise<this>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Deletes a resource instance.
|
|
60
|
+
*
|
|
61
|
+
* Requires delete permissions (`canDelete`).
|
|
62
|
+
*
|
|
63
|
+
* @returns A promise that resolves when the resource has been deleted.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { useResources, K8S } from '@shell/apis';
|
|
68
|
+
*
|
|
69
|
+
* const resources = useResources();
|
|
70
|
+
* const pod = await resources.cluster.find(K8S.POD, 'default/my-pod-123');
|
|
71
|
+
*
|
|
72
|
+
* await pod.delete();
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
delete(): Promise<void>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Represents a single resource instance returned from the Resources API.
|
|
80
|
+
*
|
|
81
|
+
* Provides instance-level operations such as deleting or updating a resource instance.
|
|
82
|
+
* The resource data (metadata, spec, status, etc.) is accessible directly on the instance.
|
|
83
|
+
*
|
|
84
|
+
* @template T - Your specific resource type. Rancher will supplement the response with additional properties and methods
|
|
85
|
+
* @template I - The shape of the underlying resource data (defaults to SteveResource)
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* import { useResources, K8S } from '@shell/apis';
|
|
90
|
+
*
|
|
91
|
+
* const resources = useResources();
|
|
92
|
+
* const pod = await resources.cluster.find(K8S.POD, 'default/my-pod-123');
|
|
93
|
+
*
|
|
94
|
+
* // Access resource data directly
|
|
95
|
+
* console.log(pod.metadata.name);
|
|
96
|
+
*
|
|
97
|
+
* // Use instance operations
|
|
98
|
+
* await pod.delete();
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export type ResourceInstance<T = any, I = SteveResource<T>> = I & ResourceInstanceApi;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { ActionFindPageTransientResponse } from '@shell/types/store/dashboard-store.types';
|
|
1
2
|
import {
|
|
2
|
-
ResourceType, FindMethodOptions, FindAllMethodOptions, FindFilteredPageOptions, FindFilteredLabelSelectorOptions,
|
|
3
|
-
|
|
3
|
+
ResourceType, CreateResourceData, FindMethodOptions, FindAllMethodOptions, FindFilteredPageOptions, FindFilteredLabelSelectorOptions,
|
|
4
|
+
FindFilteredLabelSelectorResponse, SteveResource,
|
|
5
|
+
FindFilteredPageOptionsTransient,
|
|
4
6
|
} from './resource-base';
|
|
5
|
-
import {
|
|
7
|
+
import { ResourceInstance } from './resource-instance';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Base interface for all resource API operations.
|
|
@@ -24,8 +26,9 @@ export interface ResourcesApi {
|
|
|
24
26
|
/**
|
|
25
27
|
* Finds a specific resource by its type and ID.
|
|
26
28
|
*
|
|
27
|
-
* @template T -
|
|
28
|
-
* @
|
|
29
|
+
* @template T - Your specific resource type. Rancher will supplement the response with additional properties and methods
|
|
30
|
+
* @template I - An override for the response type. By default this uses T and supplements the response, or by supplying a value ignores T
|
|
31
|
+
* @param resourceType - The type of the resource to find (examples in **{@link K8S}**). See also {@link ResourceType}.
|
|
29
32
|
* @param resourceId - The unique identifier of the resource to find. If the resource is namespaced, this should be in the format `namespace/name`.
|
|
30
33
|
* @param options - Optional find arguments
|
|
31
34
|
* @returns The found resource item or null if not found.
|
|
@@ -43,21 +46,60 @@ export interface ResourcesApi {
|
|
|
43
46
|
* const node = await resources.cluster.find(K8S.NODE, 'worker-1');
|
|
44
47
|
* ```
|
|
45
48
|
*/
|
|
46
|
-
find<T =
|
|
49
|
+
find<T = Record<string, any>, I = ResourceInstance<T>>(
|
|
47
50
|
resourceType: ResourceType,
|
|
48
51
|
resourceId: string,
|
|
49
52
|
options?: FindMethodOptions
|
|
50
|
-
): Promise<
|
|
53
|
+
): Promise<I | null>;
|
|
51
54
|
|
|
52
55
|
/**
|
|
53
56
|
* Finds resources using pagination mode with server-side filtering, sorting, and pagination.
|
|
54
57
|
*
|
|
58
|
+
* The response is not cached
|
|
59
|
+
*
|
|
55
60
|
* Requires `ui-sql-cache` to be enabled.
|
|
56
61
|
*
|
|
57
|
-
* @template T -
|
|
58
|
-
* @
|
|
62
|
+
* @template T - Your specific resource type. Rancher will supplement the response with additional properties and methods
|
|
63
|
+
* @template I - An override for the response type. By default this uses T and supplements the response, or by supplying a value ignores T
|
|
64
|
+
* @param resourceType - The type of the resources to find (examples in **{@link K8S}**). See also {@link ResourceType}.
|
|
59
65
|
* @param options - Pagination options with server-side filtering and sorting via the Steve API's pagination cache. See {@link FindFilteredPageOptions}.
|
|
60
|
-
* @returns Response containing resource items
|
|
66
|
+
* @returns Response containing resource items
|
|
67
|
+
* @throws Error if pagination mode is requested but `ui-sql-cache` is not enabled.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* import { useResources, K8S } from '@shell/apis';
|
|
72
|
+
*
|
|
73
|
+
* const resources = useResources();
|
|
74
|
+
*
|
|
75
|
+
* const pods = await resources.cluster.findFiltered(K8S.POD, {
|
|
76
|
+
* transient: true,
|
|
77
|
+
* pagination: {
|
|
78
|
+
* page: 1,
|
|
79
|
+
* pageSize: 10,
|
|
80
|
+
* filters: [],
|
|
81
|
+
* sort: []
|
|
82
|
+
* }
|
|
83
|
+
* });
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
findFiltered<T = Record<string, any>, I = ActionFindPageTransientResponse<ResourceInstance<T>>>(
|
|
87
|
+
resourceType: ResourceType,
|
|
88
|
+
options: FindFilteredPageOptionsTransient
|
|
89
|
+
): Promise<I>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Finds resources using pagination mode with server-side filtering, sorting, and pagination.
|
|
93
|
+
*
|
|
94
|
+
* The response is cached.
|
|
95
|
+
*
|
|
96
|
+
* Requires `ui-sql-cache` to be enabled.
|
|
97
|
+
*
|
|
98
|
+
* @template T - Your specific resource type. Rancher will supplement the response with additional properties and methods
|
|
99
|
+
* @template I - An override for the response type. By default this uses T and supplements the response, or by supplying a value ignores T
|
|
100
|
+
* @param resourceType - The type of the resources to find (examples in **{@link K8S}**). See also {@link ResourceType}.
|
|
101
|
+
* @param options - Pagination options with server-side filtering and sorting via the Steve API's pagination cache. See {@link FindFilteredPageOptions}.
|
|
102
|
+
* @returns Response containing resource items
|
|
61
103
|
* @throws Error if pagination mode is requested but `ui-sql-cache` is not enabled.
|
|
62
104
|
*
|
|
63
105
|
* @example
|
|
@@ -76,10 +118,10 @@ export interface ResourcesApi {
|
|
|
76
118
|
* });
|
|
77
119
|
* ```
|
|
78
120
|
*/
|
|
79
|
-
findFiltered<T =
|
|
121
|
+
findFiltered<T = Record<string, any>, I = ResourceInstance<T>>(
|
|
80
122
|
resourceType: ResourceType,
|
|
81
123
|
options: FindFilteredPageOptions
|
|
82
|
-
): Promise<
|
|
124
|
+
): Promise<I[]>;
|
|
83
125
|
|
|
84
126
|
/**
|
|
85
127
|
* Finds resources using label selector matching.
|
|
@@ -88,8 +130,9 @@ export interface ResourcesApi {
|
|
|
88
130
|
* - If `ui-sql-cache` is enabled: uses server-side pagination
|
|
89
131
|
* - Otherwise: uses native Kubernetes API pagination
|
|
90
132
|
*
|
|
91
|
-
* @template T -
|
|
92
|
-
* @
|
|
133
|
+
* @template T - Your specific resource type. Rancher will supplement the response with additional properties and methods
|
|
134
|
+
* @template I - An override for the response type. By default this uses T and supplements the response, or by supplying a value ignores T
|
|
135
|
+
* @param resourceType - The type of the resources to find (examples in **{@link K8S}**). See also {@link ResourceType}.
|
|
93
136
|
* @param options - Label selector options for filtering. See {@link FindFilteredLabelSelectorOptions}.
|
|
94
137
|
* @returns Response containing resource items (may be transient if requested, otherwise cached array).
|
|
95
138
|
*
|
|
@@ -104,25 +147,26 @@ export interface ResourcesApi {
|
|
|
104
147
|
* });
|
|
105
148
|
* ```
|
|
106
149
|
*/
|
|
107
|
-
findFiltered<T =
|
|
150
|
+
findFiltered<T = Record<string, any>, I = FindFilteredLabelSelectorResponse<ResourceInstance<T>>>(
|
|
108
151
|
resourceType: ResourceType,
|
|
109
152
|
options: FindFilteredLabelSelectorOptions
|
|
110
|
-
): Promise<
|
|
153
|
+
): Promise<I>;
|
|
111
154
|
|
|
112
155
|
/**
|
|
113
156
|
* @internal Implementation - use one of the overloads above
|
|
114
157
|
*/
|
|
115
|
-
findFiltered<T =
|
|
158
|
+
findFiltered<T = Record<string, any>, I = ResourceInstance<T>>(
|
|
116
159
|
resourceType: ResourceType,
|
|
117
|
-
options: FindFilteredPageOptions | FindFilteredLabelSelectorOptions
|
|
118
|
-
): Promise<
|
|
160
|
+
options: FindFilteredPageOptions | FindFilteredPageOptionsTransient | FindFilteredLabelSelectorOptions
|
|
161
|
+
): Promise<I[] | ResourceInstance<T>[] | ActionFindPageTransientResponse<ResourceInstance<T>>>;
|
|
119
162
|
|
|
120
163
|
/**
|
|
121
164
|
* Fetches all resources of a specific type with advanced options.
|
|
122
165
|
* This method provides additional capabilities like incremental loading and namespace filtering.
|
|
123
166
|
*
|
|
124
|
-
* @template T -
|
|
125
|
-
* @
|
|
167
|
+
* @template T - Your specific resource type. Rancher will supplement the response with additional properties and methods
|
|
168
|
+
* @template I - An override for the response type. By default this uses T and supplements the response, or by supplying a value ignores T
|
|
169
|
+
* @param resourceType - The type of the resources to find (examples in **{@link K8S}**). See also {@link ResourceType}.
|
|
126
170
|
* @param options - Optional advanced fetch options (incremental loading, namespace filtering, etc.)
|
|
127
171
|
* @returns An array of resource items or an empty array if none are found.
|
|
128
172
|
*
|
|
@@ -136,8 +180,118 @@ export interface ResourcesApi {
|
|
|
136
180
|
* });
|
|
137
181
|
* ```
|
|
138
182
|
*/
|
|
139
|
-
findAll<T =
|
|
183
|
+
findAll<T = Record<string, any>, I = ResourceInstance<T>>(
|
|
140
184
|
resourceType: ResourceType,
|
|
141
185
|
options?: FindAllMethodOptions
|
|
142
|
-
): Promise<
|
|
186
|
+
): Promise<I[]>;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Creates a new resource.
|
|
190
|
+
*
|
|
191
|
+
* The `data` object must include a `type` property identifying the resource type.
|
|
192
|
+
* This is a raw HTTP operation — it does not check permissions or update the store cache.
|
|
193
|
+
*
|
|
194
|
+
* @template T - Your specific resource type. Rancher will supplement the response with additional properties and methods
|
|
195
|
+
* @template I - An override for the response type. By default this uses T and supplements the response, or by supplying a value ignores T
|
|
196
|
+
* @param data - The resource data to create. Must include a `type` property (examples in **{@link K8S}**). See also {@link CreateResourceData}.
|
|
197
|
+
* @returns The created resource instance.
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* import { useResources, K8S } from '@shell/apis';
|
|
202
|
+
*
|
|
203
|
+
* const resources = useResources();
|
|
204
|
+
*
|
|
205
|
+
* const configMap = await resources.cluster.create({
|
|
206
|
+
* type: K8S.CONFIG_MAP,
|
|
207
|
+
* metadata: { name: 'my-config', namespace: 'default' },
|
|
208
|
+
* data: { key: 'value' }
|
|
209
|
+
* });
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
create<T = Record<string, any>, I = SteveResource<T>>(
|
|
213
|
+
data: CreateResourceData
|
|
214
|
+
): Promise<I>;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Applies a partial update to a resource using HTTP PATCH (merge-patch).
|
|
218
|
+
*
|
|
219
|
+
* Only the fields provided in `data` are sent to the server.
|
|
220
|
+
* This is a raw HTTP operation — it does not check permissions or update the store cache.
|
|
221
|
+
*
|
|
222
|
+
* @template T - Your specific resource type. Rancher will supplement the response with additional properties and methods
|
|
223
|
+
* @template I - An override for the response type. By default this uses T and supplements the response, or by supplying a value ignores T
|
|
224
|
+
* @param resourceType - The type of the resource (examples in **{@link K8S}**). See also {@link ResourceType}.
|
|
225
|
+
* @param resourceId - The unique identifier. If namespaced, use `namespace/name` format.
|
|
226
|
+
* @param data - An object containing only the fields to update.
|
|
227
|
+
* @returns The server response.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* import { useResources, K8S } from '@shell/apis';
|
|
232
|
+
*
|
|
233
|
+
* const resources = useResources();
|
|
234
|
+
*
|
|
235
|
+
* const result = await resources.cluster.update(K8S.CONFIG_MAP, 'default/my-config', {
|
|
236
|
+
* someField: { newKey: 'newValue' }
|
|
237
|
+
* });
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
update<T = Record<string, any>, I = SteveResource<T>>(
|
|
241
|
+
resourceType: ResourceType,
|
|
242
|
+
resourceId: string,
|
|
243
|
+
data: Record<string, any>
|
|
244
|
+
): Promise<I>;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Performs a full replacement update of a resource using HTTP PUT.
|
|
248
|
+
*
|
|
249
|
+
* Runs `cleanForSave` on the data before sending.
|
|
250
|
+
* This is a raw HTTP operation — it does not check permissions or update the store cache.
|
|
251
|
+
*
|
|
252
|
+
* @template T - Your specific resource type. Rancher will supplement the response with additional properties and methods
|
|
253
|
+
* @template I - An override for the response type. By default this uses T and supplements the response, or by supplying a value ignores T
|
|
254
|
+
* @param resourceType - The type of the resource (examples in **{@link K8S}**). See also {@link ResourceType}.
|
|
255
|
+
* @param resourceId - The unique identifier. If namespaced, use `namespace/name` format.
|
|
256
|
+
* @param data - The complete resource data to send as the replacement.
|
|
257
|
+
* @returns The server response.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* import { useResources, K8S } from '@shell/apis';
|
|
262
|
+
*
|
|
263
|
+
* const resources = useResources();
|
|
264
|
+
* const configMapData = await resources.cluster.find(K8S.CONFIG_MAP, 'default/my-config');
|
|
265
|
+
* configMapData.someField = { newKey: 'newValue' };
|
|
266
|
+
*
|
|
267
|
+
* const result = await resources.cluster.replace(K8S.CONFIG_MAP, 'default/my-config', configMapData);
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
replace<T = Record<string, any>, I = SteveResource<T>>(
|
|
271
|
+
resourceType: ResourceType,
|
|
272
|
+
resourceId: string,
|
|
273
|
+
data: Record<string, any>
|
|
274
|
+
): Promise<I>;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Deletes a resource by type and ID using HTTP DELETE.
|
|
278
|
+
*
|
|
279
|
+
* This is a raw HTTP operation — it does not check permissions or update the store cache.
|
|
280
|
+
*
|
|
281
|
+
* @param resourceType - The type of the resource (examples in **{@link K8S}**). See also {@link ResourceType}.
|
|
282
|
+
* @param resourceId - The unique identifier. If namespaced, use `namespace/name` format.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* import { useResources, K8S } from '@shell/apis';
|
|
287
|
+
*
|
|
288
|
+
* const resources = useResources();
|
|
289
|
+
*
|
|
290
|
+
* await resources.cluster.delete(K8S.CONFIG_MAP, 'default/my-config');
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
delete(
|
|
294
|
+
resourceType: ResourceType,
|
|
295
|
+
resourceId: string
|
|
296
|
+
): Promise<void>;
|
|
143
297
|
}
|
package/apis/intf/resources.ts
CHANGED
|
@@ -5,16 +5,18 @@ import { MgmtApi } from '@shell/apis/intf/resources-api/mgmt-api';
|
|
|
5
5
|
export * from '@shell/apis/intf/resources-api/resources-api';
|
|
6
6
|
export * from '@shell/apis/intf/resources-api/cluster-api';
|
|
7
7
|
export * from '@shell/apis/intf/resources-api/mgmt-api';
|
|
8
|
-
export {
|
|
9
|
-
ResourceType, FindMethodOptions, FindAllMethodOptions, FindFilteredPageOptions, FindFilteredLabelSelectorOptions,
|
|
10
|
-
FindFilteredPageResponse, FindFilteredLabelSelectorResponse
|
|
8
|
+
export type {
|
|
9
|
+
ResourceType, CreateResourceData, FindMethodOptions, FindAllMethodOptions, FindFilteredPageOptions, FindFilteredLabelSelectorOptions,
|
|
10
|
+
FindFilteredPageResponse, FindFilteredLabelSelectorResponse, SteveResource, SteveList
|
|
11
11
|
} from '@shell/apis/intf/resources-api/resource-base';
|
|
12
12
|
export * from '@shell/apis/intf/resources-api/resource-constants';
|
|
13
13
|
|
|
14
|
-
export
|
|
15
|
-
|
|
14
|
+
export * from '@shell/apis/intf/resources-api/resource-instance';
|
|
15
|
+
|
|
16
|
+
export type { KubeLabelSelector, KubeLabelSelectorExpression } from '@shell/types/kube/kube-api';
|
|
17
|
+
export type { PaginationSort } from '@shell/types/store/pagination.types';
|
|
16
18
|
export {
|
|
17
|
-
|
|
19
|
+
PaginationParamFilter, PaginationParamProjectOrNamespace, PaginationFilterField
|
|
18
20
|
} from '@shell/types/store/pagination.types';
|
|
19
21
|
|
|
20
22
|
/**
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { Component } from 'vue';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Standard width presets for the Slide-In panel.
|
|
5
|
+
*
|
|
6
|
+
* - `'default'` — 33% of the viewport width
|
|
7
|
+
* - `'wide'` — 73% of the viewport width
|
|
8
|
+
*/
|
|
9
|
+
export type SlideInWidth = 'default' | 'wide';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Standard height presets for the Slide-In panel.
|
|
13
|
+
*
|
|
14
|
+
* - `'default'` — positioned below the header bar, filling the remaining viewport height
|
|
15
|
+
* - `'full'` — full viewport height (100vh), covering the header and side menu
|
|
16
|
+
*/
|
|
17
|
+
export type SlideInHeight = 'default' | 'full';
|
|
18
|
+
|
|
3
19
|
/**
|
|
4
20
|
*
|
|
5
21
|
* Configuration object for opening a Slide-In panel. Here's what a Slide-In looks like in Rancher UI:
|
|
@@ -8,45 +24,50 @@ import { Component } from 'vue';
|
|
|
8
24
|
export interface SlideInConfig {
|
|
9
25
|
/**
|
|
10
26
|
*
|
|
11
|
-
*
|
|
27
|
+
* title for the Slide-In panel.
|
|
28
|
+
* When set, a header bar with the title and a close button is displayed.
|
|
29
|
+
* When omitted, no header is shown.
|
|
12
30
|
*
|
|
13
31
|
*/
|
|
14
|
-
|
|
32
|
+
title?: string;
|
|
15
33
|
/**
|
|
16
34
|
*
|
|
17
|
-
*
|
|
18
|
-
* Can be set as `33%` or `80vh`
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
height?: string;
|
|
22
|
-
/**
|
|
35
|
+
* Width preset for the Slide-In panel. Defaults to `'default'` (33%).
|
|
23
36
|
*
|
|
24
|
-
*
|
|
37
|
+
* - `'default'` — 33% of the viewport width
|
|
38
|
+
* - `'wide'` — 73% of the viewport width
|
|
25
39
|
*
|
|
26
40
|
*/
|
|
27
|
-
|
|
41
|
+
width?: SlideInWidth;
|
|
28
42
|
/**
|
|
29
43
|
*
|
|
30
|
-
*
|
|
44
|
+
* Height preset for the Slide-In panel. Defaults to `'default'` (below header).
|
|
45
|
+
* When set to `'full'`, the panel covers the full viewport height and the z-index
|
|
46
|
+
* is automatically elevated above the side menu.
|
|
47
|
+
*
|
|
48
|
+
* - `'default'` — positioned below the header bar, filling the remaining viewport height
|
|
49
|
+
* - `'full'` — full viewport height (100vh), covering the header and side menu
|
|
31
50
|
*
|
|
32
51
|
*/
|
|
33
|
-
|
|
52
|
+
height?: SlideInHeight;
|
|
34
53
|
/**
|
|
35
54
|
*
|
|
36
|
-
*
|
|
55
|
+
* When `true`, disables the focus trap on the Slide-In panel.
|
|
56
|
+
* Useful for panels with no focusable elements or custom focus management.
|
|
37
57
|
*
|
|
38
58
|
*/
|
|
39
|
-
|
|
59
|
+
disableFocusTrap?: boolean;
|
|
40
60
|
/**
|
|
41
61
|
*
|
|
42
|
-
* Array of
|
|
62
|
+
* Array of route properties to watch. When any of them change, the Slide-In closes.
|
|
63
|
+
* Defaults to `['name', 'params', 'hash', 'query']`.
|
|
43
64
|
* @ignore
|
|
44
65
|
*
|
|
45
66
|
*/
|
|
46
|
-
closeOnRouteChange?: [
|
|
67
|
+
closeOnRouteChange?: string[];
|
|
47
68
|
/**
|
|
48
69
|
*
|
|
49
|
-
*
|
|
70
|
+
* CSS selector for the element that should receive focus when the Slide-In closes.
|
|
50
71
|
* @ignore
|
|
51
72
|
*
|
|
52
73
|
*/
|
|
@@ -68,6 +89,14 @@ export interface SlideInConfig {
|
|
|
68
89
|
props?: {
|
|
69
90
|
[key: string]: any;
|
|
70
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated No longer needed — automatically managed based on `panelHeight`. Full deprecation expected in Rancher 2.17.
|
|
94
|
+
*/
|
|
95
|
+
top?: string;
|
|
96
|
+
/**
|
|
97
|
+
* @deprecated No longer needed — header visibility is inferred from the presence of `title`. Full deprecation expected in Rancher 2.17.
|
|
98
|
+
*/
|
|
99
|
+
showHeader?: boolean;
|
|
71
100
|
}
|
|
72
101
|
|
|
73
102
|
/**
|