@rancher/shell 3.0.8-rc.9 → 3.0.8
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/impl/apis.ts +61 -0
- package/apis/index.ts +40 -0
- package/apis/intf/modal.ts +90 -0
- package/apis/intf/shell.ts +36 -0
- package/apis/intf/slide-in.ts +98 -0
- package/apis/intf/system.ts +41 -0
- package/apis/shell/__tests__/modal.test.ts +80 -0
- package/apis/shell/__tests__/notifications.test.ts +71 -0
- package/apis/shell/__tests__/slide-in.test.ts +54 -0
- package/apis/shell/__tests__/system.test.ts +129 -0
- package/apis/shell/index.ts +38 -0
- package/apis/shell/modal.ts +41 -0
- package/apis/shell/notifications.ts +65 -0
- package/apis/shell/slide-in.ts +33 -0
- package/apis/shell/system.ts +65 -0
- package/apis/vue-shim.d.ts +11 -0
- package/assets/styles/global/_tooltip.scss +6 -1
- package/assets/translations/en-us.yaml +5 -0
- package/components/ActionMenuShell.vue +3 -1
- package/components/CruResource.vue +8 -1
- package/components/Drawer/ResourceDetailDrawer/__tests__/composables.test.ts +50 -1
- package/components/Drawer/ResourceDetailDrawer/composables.ts +19 -0
- package/components/Drawer/ResourceDetailDrawer/index.vue +3 -1
- package/components/LocaleSelector.vue +2 -2
- package/components/ModalManager.vue +11 -1
- package/components/Questions/__tests__/Yaml.test.ts +1 -1
- package/components/RelatedResources.vue +5 -0
- package/components/Resource/Detail/ResourcePopover/index.vue +5 -1
- package/components/ResourceDetail/Masthead/latest.vue +23 -21
- package/components/ResourceDetail/index.vue +3 -0
- package/components/ResourceTable.vue +54 -21
- package/components/SlideInPanelManager.vue +16 -11
- package/components/SortableTable/THead.vue +2 -1
- package/components/SortableTable/index.vue +20 -2
- package/components/Tabbed/index.vue +37 -2
- package/components/__tests__/NamespaceFilter.test.ts +49 -0
- package/components/auth/SelectPrincipal.vue +4 -0
- package/components/auth/login/ldap.vue +3 -3
- package/components/fleet/FleetSecretSelector.vue +1 -1
- package/components/form/KeyValue.vue +1 -1
- package/components/form/NameNsDescription.vue +1 -1
- package/components/form/NodeScheduling.vue +2 -2
- package/components/form/ResourceTabs/composable.ts +2 -2
- package/components/form/ResourceTabs/index.vue +0 -2
- package/components/form/__tests__/NameNsDescription.test.ts +42 -0
- package/components/formatter/LinkName.vue +5 -0
- package/components/nav/Group.vue +25 -7
- package/components/nav/Header.vue +1 -1
- package/components/nav/NamespaceFilter.vue +1 -0
- package/components/nav/Type.vue +17 -6
- package/components/nav/WindowManager/panels/TabBodyContainer.vue +1 -1
- package/components/nav/__tests__/Type.test.ts +59 -0
- package/composables/cruResource.ts +27 -0
- package/composables/focusTrap.ts +3 -1
- package/composables/resourceDetail.ts +15 -0
- package/composables/useLabeledFormElement.ts +3 -4
- package/config/product/fleet.js +1 -1
- package/config/router/navigation-guards/clusters.js +3 -3
- package/config/router/navigation-guards/products.js +1 -1
- package/config/router/routes.js +1 -5
- package/core/__tests__/extension-manager-impl.test.js +437 -0
- package/core/extension-manager-impl.js +6 -27
- package/core/plugin-helpers.ts +2 -2
- package/core/plugin.ts +9 -1
- package/core/plugins-loader.js +2 -2
- package/core/types-provisioning.ts +4 -0
- package/core/types.ts +35 -0
- package/detail/provisioning.cattle.io.cluster.vue +8 -6
- package/dialog/DeveloperLoadExtensionDialog.vue +1 -1
- package/dialog/MoveNamespaceDialog.vue +20 -4
- package/dialog/SearchDialog.vue +1 -0
- package/dialog/__tests__/MoveNamespaceDialog.test.ts +249 -0
- package/directives/__tests__/clean-tooltip.test.ts +298 -0
- package/directives/clean-tooltip.ts +234 -0
- package/edit/__tests__/fleet.cattle.io.gitrepo.test.ts +2 -2
- package/edit/__tests__/fleet.cattle.io.helmop.test.ts +98 -1
- package/edit/fleet.cattle.io.helmop.vue +5 -0
- package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +21 -21
- package/edit/provisioning.cattle.io.cluster/index.vue +5 -5
- package/edit/provisioning.cattle.io.cluster/rke2.vue +8 -8
- package/edit/resources.cattle.io.restore.vue +1 -1
- package/edit/workload/Job.vue +2 -2
- package/edit/workload/index.vue +1 -1
- package/initialize/install-plugins.js +4 -5
- package/machine-config/azure.vue +1 -1
- package/machine-config/components/GCEImage.vue +1 -1
- package/models/__tests__/provisioning.cattle.io.cluster.test.ts +16 -0
- package/models/chart.js +70 -74
- package/models/management.cattle.io.cluster.js +1 -1
- package/models/provisioning.cattle.io.cluster.js +11 -3
- package/package.json +7 -7
- package/pages/auth/login.vue +3 -3
- package/pages/auth/setup.vue +1 -1
- package/pages/auth/verify.vue +3 -3
- package/pages/c/_cluster/apps/charts/index.vue +122 -24
- package/pages/c/_cluster/apps/charts/install.vue +33 -0
- package/pages/c/_cluster/explorer/__tests__/index.test.ts +1 -1
- package/pages/c/_cluster/fleet/index.vue +4 -7
- package/pages/c/_cluster/settings/index.vue +5 -0
- package/pkg/auto-import.js +3 -3
- package/pkg/dynamic-importer.lib.js +1 -1
- package/pkg/import.js +1 -1
- package/plugins/__tests__/mutations.tests.ts +179 -0
- package/plugins/dashboard-store/getters.js +1 -1
- package/plugins/dashboard-store/model-loader.js +1 -1
- package/plugins/dashboard-store/mutations.js +23 -2
- package/plugins/dashboard-store/resource-class.js +8 -3
- package/plugins/plugin.js +2 -2
- package/plugins/steve/__tests__/steve-pagination-utils.test.ts +301 -128
- package/plugins/steve/steve-class.js +1 -1
- package/plugins/steve/steve-pagination-utils.ts +108 -43
- package/rancher-components/Form/Checkbox/Checkbox.vue +1 -1
- package/rancher-components/Form/LabeledInput/LabeledInput.vue +1 -1
- package/rancher-components/RcDropdown/useDropdownContext.ts +2 -4
- package/rancher-components/RcItemCard/RcItemCard.vue +1 -1
- package/scripts/publish-shell.sh +25 -0
- package/store/__tests__/catalog.test.ts +1 -1
- package/store/__tests__/type-map.test.ts +164 -2
- package/store/auth.js +23 -11
- package/store/i18n.js +3 -3
- package/store/index.js +5 -3
- package/store/notifications.ts +2 -0
- package/store/prefs.js +2 -2
- package/store/type-map.js +17 -7
- package/types/internal-api/shell/modal.d.ts +6 -6
- package/types/notifications/index.ts +126 -15
- package/types/rancher/index.d.ts +9 -0
- package/types/shell/index.d.ts +16 -1
- package/types/vue-shim.d.ts +5 -4
- package/utils/__tests__/router.test.js +238 -0
- package/utils/cluster.js +4 -1
- package/utils/fleet.ts +8 -1
- package/utils/pagination-utils.ts +2 -2
- package/utils/pagination-wrapper.ts +1 -1
- package/utils/router.js +50 -0
- package/utils/unit-tests/pagination-utils.spec.ts +8 -8
- package/vue.config.js +3 -3
- package/composables/useExtensionManager.ts +0 -17
- package/core/__test__/extension-manager-impl.test.js +0 -236
- package/core/plugins.js +0 -38
- package/directives/clean-tooltip.js +0 -32
- package/plugins/internal-api/index.ts +0 -37
- package/plugins/internal-api/shared/base-api.ts +0 -13
- package/plugins/internal-api/shell/shell.api.ts +0 -108
- package/types/internal-api/shell/growl.d.ts +0 -25
- package/types/internal-api/shell/slideIn.d.ts +0 -15
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { PaginationFilterEquality, PaginationFilterField, PaginationParamFilter, PaginationParamProjectOrNamespace } from '@shell/types/store/pagination.types';
|
|
3
|
-
import { NAMESPACE_FILTER_P_FULL_PREFIX } from '@shell/utils/namespace-filter';
|
|
3
|
+
import { NAMESPACE_FILTER_ALL_SYSTEM, NAMESPACE_FILTER_ALL_USER, NAMESPACE_FILTER_P_FULL_PREFIX } from '@shell/utils/namespace-filter';
|
|
4
4
|
import stevePaginationUtils from '../steve-pagination-utils';
|
|
5
5
|
import Schema from '@shell/models/schema';
|
|
6
6
|
|
|
@@ -20,6 +20,14 @@ class TestNamespaceProjectFilters {
|
|
|
20
20
|
public handleSelectionFilter(neu: string[], isLocalCluster: boolean) {
|
|
21
21
|
return stevePaginationUtils.handleSelectionFilter(neu, isLocalCluster);
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
public combineNsProjectFilterResults(a: any, b: any) {
|
|
25
|
+
return stevePaginationUtils.combineNsProjectFilterResults(a, b);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public createFiltersFromNamespaceProjectFilterResult(filterResult: any) {
|
|
29
|
+
return stevePaginationUtils.createFiltersFromNamespaceProjectFilterResult(filterResult);
|
|
30
|
+
}
|
|
23
31
|
}
|
|
24
32
|
|
|
25
33
|
describe('class: NamespaceProjectFilters', () => {
|
|
@@ -48,7 +56,7 @@ describe('class: NamespaceProjectFilters', () => {
|
|
|
48
56
|
productHidesSystemNamespaces: false,
|
|
49
57
|
});
|
|
50
58
|
|
|
51
|
-
expect(result).toStrictEqual(
|
|
59
|
+
expect(result).toStrictEqual({});
|
|
52
60
|
});
|
|
53
61
|
|
|
54
62
|
it('should filter obscure namespaces if showReservedRancherNamespaces is false', () => {
|
|
@@ -58,12 +66,10 @@ describe('class: NamespaceProjectFilters', () => {
|
|
|
58
66
|
productHidesSystemNamespaces: false,
|
|
59
67
|
});
|
|
60
68
|
|
|
61
|
-
expect(result).
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
})]
|
|
66
|
-
}));
|
|
69
|
+
expect(result).toStrictEqual({
|
|
70
|
+
obscure: false,
|
|
71
|
+
'obscure-system': false
|
|
72
|
+
});
|
|
67
73
|
});
|
|
68
74
|
|
|
69
75
|
it('should filter system namespaces if productHidesSystemNamespaces is true', () => {
|
|
@@ -73,12 +79,10 @@ describe('class: NamespaceProjectFilters', () => {
|
|
|
73
79
|
productHidesSystemNamespaces: true,
|
|
74
80
|
});
|
|
75
81
|
|
|
76
|
-
expect(result).
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
})]
|
|
81
|
-
}));
|
|
82
|
+
expect(result).toStrictEqual({
|
|
83
|
+
system: false,
|
|
84
|
+
'obscure-system': false
|
|
85
|
+
});
|
|
82
86
|
});
|
|
83
87
|
|
|
84
88
|
it('should filter both obscure and system namespaces when both settings are active', () => {
|
|
@@ -88,12 +92,11 @@ describe('class: NamespaceProjectFilters', () => {
|
|
|
88
92
|
productHidesSystemNamespaces: true,
|
|
89
93
|
});
|
|
90
94
|
|
|
91
|
-
expect(result).
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}));
|
|
95
|
+
expect(result).toStrictEqual({
|
|
96
|
+
obscure: false,
|
|
97
|
+
system: false,
|
|
98
|
+
'obscure-system': false
|
|
99
|
+
});
|
|
97
100
|
});
|
|
98
101
|
});
|
|
99
102
|
|
|
@@ -105,16 +108,10 @@ describe('class: NamespaceProjectFilters', () => {
|
|
|
105
108
|
isAllUser: false,
|
|
106
109
|
});
|
|
107
110
|
|
|
108
|
-
expect(result).
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
expect(filter.fields).toContainEqual(expect.objectContaining({
|
|
113
|
-
value: 'system', equality: '=', field: 'metadata.namespace'
|
|
114
|
-
}));
|
|
115
|
-
expect(filter.fields).toContainEqual(expect.objectContaining({
|
|
116
|
-
value: 'obscure-system', equality: '=', field: 'metadata.namespace'
|
|
117
|
-
}));
|
|
111
|
+
expect(result).toStrictEqual({
|
|
112
|
+
system: true,
|
|
113
|
+
'obscure-system': true
|
|
114
|
+
});
|
|
118
115
|
});
|
|
119
116
|
|
|
120
117
|
it('should create AND filters to exclude system namespaces when isAllUser is true', () => {
|
|
@@ -124,17 +121,59 @@ describe('class: NamespaceProjectFilters', () => {
|
|
|
124
121
|
isAllUser: true,
|
|
125
122
|
});
|
|
126
123
|
|
|
127
|
-
expect(result).
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
124
|
+
expect(result).toStrictEqual({
|
|
125
|
+
system: false,
|
|
126
|
+
'obscure-system': false
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
describe('method: combineNsProjectFilterResults', () => {
|
|
132
|
+
it('should merge two results, prioritizing the first', () => {
|
|
133
|
+
const a = { ns1: true, ns2: false };
|
|
134
|
+
const b = { ns2: true, ns3: true };
|
|
135
|
+
const result = testNamespaceProjectFilters.combineNsProjectFilterResults(a, b);
|
|
136
|
+
|
|
137
|
+
expect(result).toStrictEqual({
|
|
138
|
+
ns1: true,
|
|
139
|
+
ns2: false, // kept from a
|
|
140
|
+
ns3: true // added from b
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
describe('method: createFiltersFromNamespaceProjectFilterResult', () => {
|
|
146
|
+
it('should create IN filter if there are included namespaces', () => {
|
|
147
|
+
const input = {
|
|
148
|
+
ns1: true, ns2: true, ns3: false
|
|
149
|
+
};
|
|
150
|
+
const result = testNamespaceProjectFilters.createFiltersFromNamespaceProjectFilterResult(input);
|
|
151
|
+
|
|
152
|
+
expect(result).toHaveLength(1);
|
|
153
|
+
expect(result[0].fields[0]).toMatchObject({
|
|
154
|
+
field: 'metadata.namespace',
|
|
155
|
+
equality: PaginationFilterEquality.IN,
|
|
156
|
+
value: 'ns1,ns2'
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('should create NOT_IN filter if there are only excluded namespaces', () => {
|
|
161
|
+
const input = { ns1: false, ns2: false };
|
|
162
|
+
const result = testNamespaceProjectFilters.createFiltersFromNamespaceProjectFilterResult(input);
|
|
163
|
+
|
|
164
|
+
expect(result).toHaveLength(1);
|
|
165
|
+
expect(result[0].fields[0]).toMatchObject({
|
|
166
|
+
field: 'metadata.namespace',
|
|
167
|
+
equality: PaginationFilterEquality.NOT_IN,
|
|
168
|
+
value: 'ns1,ns2'
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('should return empty array if input is empty', () => {
|
|
173
|
+
const input = {};
|
|
174
|
+
const result = testNamespaceProjectFilters.createFiltersFromNamespaceProjectFilterResult(input);
|
|
175
|
+
|
|
176
|
+
expect(result).toHaveLength(0);
|
|
138
177
|
});
|
|
139
178
|
});
|
|
140
179
|
|
|
@@ -231,103 +270,237 @@ describe('class StevePaginationUtils', () => {
|
|
|
231
270
|
const testStevePaginationUtils = new TestStevePaginationUtils();
|
|
232
271
|
const schema = { id: 'pod' } as unknown as Schema;
|
|
233
272
|
|
|
234
|
-
|
|
235
|
-
const
|
|
273
|
+
describe('method: createParamsFromNsFilter', () => {
|
|
274
|
+
const normalNs = {
|
|
275
|
+
id: 'normal', name: 'normal', isObscure: false, isSystem: false
|
|
276
|
+
} as any;
|
|
277
|
+
const obscureNs = {
|
|
278
|
+
id: 'obscure', name: 'obscure', isObscure: true, isSystem: false
|
|
279
|
+
} as any;
|
|
280
|
+
const systemNs = {
|
|
281
|
+
id: 'system', name: 'system', isObscure: false, isSystem: true
|
|
282
|
+
} as any;
|
|
283
|
+
const allNamespaces = [normalNs, obscureNs, systemNs];
|
|
284
|
+
|
|
285
|
+
it('should return empty filters if all namespaces requested and settings allow all', () => {
|
|
286
|
+
const result = stevePaginationUtils.createParamsFromNsFilter({
|
|
287
|
+
allNamespaces,
|
|
288
|
+
selection: [],
|
|
289
|
+
isAllNamespaces: true,
|
|
290
|
+
isLocalCluster: false,
|
|
291
|
+
showReservedRancherNamespaces: true,
|
|
292
|
+
productHidesSystemNamespaces: false,
|
|
293
|
+
});
|
|
236
294
|
|
|
237
|
-
|
|
238
|
-
|
|
295
|
+
expect(result.projectsOrNamespaces).toHaveLength(0);
|
|
296
|
+
expect(result.filters).toHaveLength(0);
|
|
297
|
+
});
|
|
239
298
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
299
|
+
it('should filter obscure namespaces if showReservedRancherNamespaces is false', () => {
|
|
300
|
+
const result = stevePaginationUtils.createParamsFromNsFilter({
|
|
301
|
+
allNamespaces,
|
|
302
|
+
selection: [],
|
|
303
|
+
isAllNamespaces: true,
|
|
304
|
+
isLocalCluster: false,
|
|
305
|
+
showReservedRancherNamespaces: false,
|
|
306
|
+
productHidesSystemNamespaces: false,
|
|
307
|
+
});
|
|
245
308
|
|
|
246
|
-
|
|
247
|
-
|
|
309
|
+
expect(result.filters).toHaveLength(1);
|
|
310
|
+
expect(result.filters[0].fields[0]).toMatchObject({
|
|
311
|
+
field: 'metadata.namespace',
|
|
312
|
+
equality: PaginationFilterEquality.NOT_IN,
|
|
313
|
+
value: 'obscure'
|
|
314
|
+
});
|
|
315
|
+
});
|
|
248
316
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
317
|
+
it('should filter system namespaces if productHidesSystemNamespaces is true', () => {
|
|
318
|
+
const result = stevePaginationUtils.createParamsFromNsFilter({
|
|
319
|
+
allNamespaces,
|
|
320
|
+
selection: [],
|
|
321
|
+
isAllNamespaces: true,
|
|
322
|
+
isLocalCluster: false,
|
|
323
|
+
showReservedRancherNamespaces: true,
|
|
324
|
+
productHidesSystemNamespaces: true,
|
|
325
|
+
});
|
|
254
326
|
|
|
255
|
-
|
|
256
|
-
|
|
327
|
+
expect(result.filters).toHaveLength(1);
|
|
328
|
+
expect(result.filters[0].fields[0]).toMatchObject({
|
|
329
|
+
field: 'metadata.namespace',
|
|
330
|
+
equality: PaginationFilterEquality.NOT_IN,
|
|
331
|
+
value: 'system'
|
|
332
|
+
});
|
|
333
|
+
});
|
|
257
334
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
const result = testStevePaginationUtils.convertPaginationParams({ schema, filters });
|
|
268
|
-
|
|
269
|
-
expect(result).toBe('filter=metadata.name=test1,metadata.namespace=ns1');
|
|
270
|
-
});
|
|
335
|
+
it('should filter both obscure and system namespaces when both settings are active', () => {
|
|
336
|
+
const result = stevePaginationUtils.createParamsFromNsFilter({
|
|
337
|
+
allNamespaces,
|
|
338
|
+
selection: [],
|
|
339
|
+
isAllNamespaces: true,
|
|
340
|
+
isLocalCluster: false,
|
|
341
|
+
showReservedRancherNamespaces: false,
|
|
342
|
+
productHidesSystemNamespaces: true,
|
|
343
|
+
});
|
|
271
344
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
345
|
+
expect(result.filters).toHaveLength(1);
|
|
346
|
+
expect(result.filters[0].fields[0]).toMatchObject({
|
|
347
|
+
field: 'metadata.namespace',
|
|
348
|
+
equality: PaginationFilterEquality.NOT_IN,
|
|
349
|
+
value: 'obscure,system'
|
|
350
|
+
});
|
|
351
|
+
});
|
|
278
352
|
|
|
279
|
-
|
|
280
|
-
|
|
353
|
+
it('should handle ALL_SYSTEM selection', () => {
|
|
354
|
+
const result = stevePaginationUtils.createParamsFromNsFilter({
|
|
355
|
+
allNamespaces,
|
|
356
|
+
selection: [NAMESPACE_FILTER_ALL_SYSTEM],
|
|
357
|
+
isAllNamespaces: false,
|
|
358
|
+
isLocalCluster: false,
|
|
359
|
+
showReservedRancherNamespaces: true,
|
|
360
|
+
productHidesSystemNamespaces: false,
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
expect(result.filters).toHaveLength(1);
|
|
364
|
+
expect(result.filters[0].fields[0]).toMatchObject({
|
|
365
|
+
field: 'metadata.namespace',
|
|
366
|
+
equality: PaginationFilterEquality.IN,
|
|
367
|
+
value: 'system'
|
|
368
|
+
});
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
it('should handle ALL_USER selection', () => {
|
|
372
|
+
const result = stevePaginationUtils.createParamsFromNsFilter({
|
|
373
|
+
allNamespaces,
|
|
374
|
+
selection: [NAMESPACE_FILTER_ALL_USER],
|
|
375
|
+
isAllNamespaces: false,
|
|
376
|
+
isLocalCluster: false,
|
|
377
|
+
showReservedRancherNamespaces: true,
|
|
378
|
+
productHidesSystemNamespaces: false,
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
expect(result.filters).toHaveLength(1);
|
|
382
|
+
expect(result.filters[0].fields[0]).toMatchObject({
|
|
383
|
+
field: 'metadata.namespace',
|
|
384
|
+
equality: PaginationFilterEquality.NOT_IN,
|
|
385
|
+
value: 'system'
|
|
386
|
+
});
|
|
387
|
+
});
|
|
281
388
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
field: 'metadata.name',
|
|
297
|
-
value: 'test',
|
|
298
|
-
equality: PaginationFilterEquality.NOT_EQUALS,
|
|
299
|
-
}),
|
|
300
|
-
],
|
|
301
|
-
}),
|
|
302
|
-
];
|
|
303
|
-
const result = testStevePaginationUtils.convertPaginationParams({ schema, filters });
|
|
304
|
-
|
|
305
|
-
expect(result).toBe('filter=spec.containers.image~nginx&filter=metadata.name!=test');
|
|
389
|
+
it('should handle specific project/namespace selection', () => {
|
|
390
|
+
const selection = ['ns-1'];
|
|
391
|
+
const result = stevePaginationUtils.createParamsFromNsFilter({
|
|
392
|
+
allNamespaces,
|
|
393
|
+
selection,
|
|
394
|
+
isAllNamespaces: false,
|
|
395
|
+
isLocalCluster: false,
|
|
396
|
+
showReservedRancherNamespaces: true,
|
|
397
|
+
productHidesSystemNamespaces: false,
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
expect(result.projectsOrNamespaces).toHaveLength(1);
|
|
401
|
+
expect(result.projectsOrNamespaces[0].fields[0].value).toBe('ns-1');
|
|
402
|
+
});
|
|
306
403
|
});
|
|
307
404
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
],
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
],
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
405
|
+
describe('method: convertPaginationParams', () => {
|
|
406
|
+
it('should return an empty string for no filters', () => {
|
|
407
|
+
const result = testStevePaginationUtils.convertPaginationParams({ schema, filters: [] });
|
|
408
|
+
|
|
409
|
+
expect(result).toBe('');
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
it('should handle a single filter with a single field', () => {
|
|
413
|
+
const filters = [
|
|
414
|
+
new PaginationParamFilter({ fields: [new PaginationFilterField({ field: 'metadata.name', value: 'test' })] }),
|
|
415
|
+
];
|
|
416
|
+
const result = testStevePaginationUtils.convertPaginationParams({ schema, filters });
|
|
417
|
+
|
|
418
|
+
expect(result).toBe('filter=metadata.name=test');
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
it('should handle a single filter with a single field with encoded char', () => {
|
|
422
|
+
const filters = [
|
|
423
|
+
new PaginationParamFilter({ fields: [new PaginationFilterField({ field: 'metadata.name', value: 'te/st' })] }),
|
|
424
|
+
];
|
|
425
|
+
const result = testStevePaginationUtils.convertPaginationParams({ schema, filters });
|
|
426
|
+
|
|
427
|
+
expect(result).toBe('filter=metadata.name="te%2Fst"');
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
it('should handle a single filter with multiple fields (OR)', () => {
|
|
431
|
+
const filters = [
|
|
432
|
+
new PaginationParamFilter({
|
|
433
|
+
fields: [
|
|
434
|
+
new PaginationFilterField({ field: 'metadata.name', value: 'test1' }),
|
|
435
|
+
new PaginationFilterField({ field: 'metadata.namespace', value: 'ns1' }),
|
|
436
|
+
],
|
|
437
|
+
}),
|
|
438
|
+
];
|
|
439
|
+
const result = testStevePaginationUtils.convertPaginationParams({ schema, filters });
|
|
440
|
+
|
|
441
|
+
expect(result).toBe('filter=metadata.name=test1,metadata.namespace=ns1');
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
it('should handle multiple filters (AND)', () => {
|
|
445
|
+
const filters = [
|
|
446
|
+
new PaginationParamFilter({ fields: [new PaginationFilterField({ field: 'metadata.name', value: 'test1' })] }),
|
|
447
|
+
new PaginationParamFilter({ fields: [new PaginationFilterField({ field: 'metadata.namespace', value: 'ns1' })] }),
|
|
448
|
+
];
|
|
449
|
+
const result = testStevePaginationUtils.convertPaginationParams({ schema, filters });
|
|
450
|
+
|
|
451
|
+
expect(result).toBe('filter=metadata.name=test1&filter=metadata.namespace=ns1');
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
it('should handle different equality operators', () => {
|
|
455
|
+
const filters = [
|
|
456
|
+
new PaginationParamFilter({
|
|
457
|
+
fields: [
|
|
458
|
+
new PaginationFilterField({
|
|
459
|
+
field: 'spec.containers.image',
|
|
460
|
+
value: 'nginx',
|
|
461
|
+
equality: PaginationFilterEquality.CONTAINS,
|
|
462
|
+
}),
|
|
463
|
+
],
|
|
464
|
+
}),
|
|
465
|
+
new PaginationParamFilter({
|
|
466
|
+
fields: [
|
|
467
|
+
new PaginationFilterField({
|
|
468
|
+
field: 'metadata.name',
|
|
469
|
+
value: 'test',
|
|
470
|
+
equality: PaginationFilterEquality.NOT_EQUALS,
|
|
471
|
+
}),
|
|
472
|
+
],
|
|
473
|
+
}),
|
|
474
|
+
];
|
|
475
|
+
const result = testStevePaginationUtils.convertPaginationParams({ schema, filters });
|
|
476
|
+
|
|
477
|
+
expect(result).toBe('filter=spec.containers.image~nginx&filter=metadata.name!=test');
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
it('should handle IN and NOT_IN operators', () => {
|
|
481
|
+
const filters = [
|
|
482
|
+
new PaginationParamFilter({
|
|
483
|
+
fields: [
|
|
484
|
+
new PaginationFilterField({
|
|
485
|
+
field: 'metadata.name',
|
|
486
|
+
value: 'test1,test2',
|
|
487
|
+
equality: PaginationFilterEquality.IN,
|
|
488
|
+
}),
|
|
489
|
+
],
|
|
490
|
+
}),
|
|
491
|
+
new PaginationParamFilter({
|
|
492
|
+
fields: [
|
|
493
|
+
new PaginationFilterField({
|
|
494
|
+
field: 'metadata.namespace',
|
|
495
|
+
value: 'ns1,ns2',
|
|
496
|
+
equality: PaginationFilterEquality.NOT_IN,
|
|
497
|
+
}),
|
|
498
|
+
],
|
|
499
|
+
}),
|
|
500
|
+
];
|
|
501
|
+
const result = testStevePaginationUtils.convertPaginationParams({ schema, filters });
|
|
502
|
+
|
|
503
|
+
expect(result).toBe('filter=metadata.name IN (test1,test2)&filter=metadata.namespace NOTIN (ns1,ns2)');
|
|
504
|
+
});
|
|
332
505
|
});
|
|
333
506
|
});
|
|
@@ -47,7 +47,7 @@ export default class SteveModel extends HybridModel {
|
|
|
47
47
|
* Get all model extensions for this model
|
|
48
48
|
*/
|
|
49
49
|
get modelExtensions() {
|
|
50
|
-
return this.$
|
|
50
|
+
return this.$extension.getDynamic(EXT_IDS.MODEL_EXTENSION, this.type) || [];
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
cleanForSave(data, forNew) {
|