@rancher/shell 0.3.17 → 0.3.19
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/assets/translations/en-us.yaml +8 -4
- package/assets/translations/zh-hans.yaml +64 -8
- package/components/AsyncButton.vue +1 -1
- package/components/Inactivity.vue +10 -0
- package/components/LazyImage.vue +2 -2
- package/components/PromptRestore.vue +8 -6
- package/components/ResourceDetail/Masthead.vue +1 -1
- package/components/ResourceDetail/index.vue +4 -2
- package/components/__tests__/PromptRestore.test.ts +142 -0
- package/components/auth/AzureWarning.vue +1 -1
- package/components/auth/RoleDetailEdit.vue +2 -0
- package/components/fleet/FleetResources.vue +3 -64
- package/components/form/FileImageSelector.vue +9 -0
- package/components/form/FileSelector.vue +2 -1
- package/components/form/MatchExpressions.vue +1 -3
- package/components/form/__tests__/FileImageSelector.test.ts +42 -0
- package/components/form/__tests__/FileSelector.test.ts +76 -0
- package/components/formatter/ClusterProvider.vue +3 -1
- package/components/formatter/__tests__/ClusterProvider.test.ts +24 -0
- package/components/nav/WindowManager/ContainerShell.vue +60 -36
- package/components/nav/WindowManager/__tests__/ContainerShell.test.ts +561 -0
- package/config/labels-annotations.js +2 -1
- package/config/persistentVolume.ts +108 -0
- package/config/product/manager.js +5 -1
- package/config/types.js +2 -0
- package/core/plugin-helpers.js +19 -3
- package/core/types.ts +4 -0
- package/detail/fleet.cattle.io.gitrepo.vue +10 -2
- package/detail/pod.vue +36 -3
- package/detail/workload/index.vue +40 -9
- package/dialog/DiagnosticTimingsDialog.vue +1 -0
- package/edit/__tests__/ui.cattle.io.navlink.test.ts +110 -0
- package/edit/fleet.cattle.io.clustergroup.vue +14 -3
- package/edit/persistentvolume/__tests__/persistentvolume.test.ts +82 -0
- package/edit/persistentvolume/index.vue +2 -1
- package/edit/persistentvolume/plugins/csi.vue +3 -1
- package/edit/persistentvolume/plugins/longhorn.vue +12 -12
- package/edit/provisioning.cattle.io.cluster/RegistryConfigs.vue +15 -11
- package/edit/provisioning.cattle.io.cluster/index.vue +1 -1
- package/edit/provisioning.cattle.io.cluster/rke2.vue +5 -1
- package/edit/storage.k8s.io.storageclass/index.vue +1 -2
- package/edit/ui.cattle.io.navlink.vue +213 -186
- package/layouts/default.vue +1 -1
- package/list/group.principal.vue +1 -1
- package/middleware/authenticated.js +12 -4
- package/mixins/create-edit-view/impl.js +2 -2
- package/models/chart.js +1 -1
- package/models/etcdbackup.js +2 -1
- package/models/fleet.cattle.io.cluster.js +33 -4
- package/models/fleet.cattle.io.gitrepo.js +112 -38
- package/models/management.cattle.io.cluster.js +13 -3
- package/models/management.cattle.io.kontainerdriver.js +14 -0
- package/models/persistentvolume.js +2 -111
- package/models/pod.js +30 -0
- package/models/rke.cattle.io.etcdsnapshot.js +10 -7
- package/package.json +1 -1
- package/pages/c/_cluster/apps/charts/install.vue +74 -25
- package/pages/c/_cluster/auth/group.principal/assign-edit.vue +1 -1
- package/pages/c/_cluster/auth/roles/index.vue +1 -1
- package/pages/c/_cluster/explorer/index.vue +1 -1
- package/pages/c/_cluster/manager/cloudCredential/_id.vue +0 -1
- package/pages/c/_cluster/manager/cloudCredential/create.vue +0 -1
- package/pages/c/_cluster/settings/brand.vue +11 -8
- package/pages/c/_cluster/uiplugins/index.vue +9 -4
- package/pages/diagnostic.vue +5 -3
- package/pages/home.vue +1 -1
- package/plugins/dashboard-store/__tests__/actions.spec.ts +165 -0
- package/plugins/dashboard-store/__tests__/getters.spec.ts +100 -0
- package/plugins/dashboard-store/__tests__/{mutations.spec.js → mutations.spec.ts} +2 -2
- package/plugins/dashboard-store/actions.js +1 -1
- package/plugins/dashboard-store/resource-class.js +4 -0
- package/plugins/steve/__tests__/getters.spec.ts +93 -0
- package/plugins/steve/getters.js +21 -1
- package/plugins/steve/subscribe.js +1 -3
- package/rancher-components/components/BadgeState/BadgeState.spec.ts +12 -0
- package/rancher-components/components/BadgeState/BadgeState.vue +111 -0
- package/rancher-components/components/BadgeState/index.ts +1 -0
- package/rancher-components/components/Banner/Banner.test.ts +63 -0
- package/rancher-components/components/Banner/Banner.vue +244 -0
- package/rancher-components/components/Banner/index.ts +1 -0
- package/rancher-components/components/Card/Card.test.ts +37 -0
- package/rancher-components/components/Card/Card.vue +167 -0
- package/rancher-components/components/Card/index.ts +1 -0
- package/rancher-components/components/Form/Checkbox/Checkbox.test.ts +68 -0
- package/rancher-components/components/Form/Checkbox/Checkbox.vue +420 -0
- package/rancher-components/components/Form/Checkbox/index.ts +1 -0
- package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +23 -0
- package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +355 -0
- package/rancher-components/components/Form/LabeledInput/index.ts +1 -0
- package/rancher-components/components/Form/Radio/RadioButton.test.ts +31 -0
- package/rancher-components/components/Form/Radio/RadioButton.vue +287 -0
- package/rancher-components/components/Form/Radio/RadioGroup.vue +254 -0
- package/rancher-components/components/Form/Radio/index.ts +2 -0
- package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +170 -0
- package/rancher-components/components/Form/TextArea/index.ts +1 -0
- package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.test.ts +94 -0
- package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +149 -0
- package/rancher-components/components/Form/ToggleSwitch/index.ts +1 -0
- package/rancher-components/components/Form/index.ts +5 -0
- package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +151 -0
- package/rancher-components/components/LabeledTooltip/index.ts +1 -0
- package/rancher-components/components/StringList/StringList.test.ts +484 -0
- package/rancher-components/components/StringList/StringList.vue +611 -0
- package/rancher-components/components/StringList/index.ts +1 -0
- package/scripts/extension/publish +54 -14
- package/scripts/typegen.sh +10 -2
- package/store/index.js +1 -3
- package/store/store-types.js +2 -0
- package/types/api.d.ts +1 -0
- package/types/fleet.d.ts +1 -0
- package/types/shell/index.d.ts +696 -2
- package/types/userPreferences.d.ts +1 -1
- package/utils/__mocks__/socket.js +21 -0
- package/utils/grafana.js +23 -11
- package/utils/selector.js +2 -1
- package/utils/socket.js +1 -0
- package/utils/validators/formRules/index.ts +3 -3
- package/plugins/steve/urloptions.js +0 -47
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const addEventListener = jest.fn();
|
|
2
|
+
export const connect = jest.fn();
|
|
3
|
+
export const disconnect = jest.fn();
|
|
4
|
+
export const send = jest.fn();
|
|
5
|
+
|
|
6
|
+
export const EVENT_CONNECTED = 'connected';
|
|
7
|
+
export const EVENT_CONNECTING = 'connecting';
|
|
8
|
+
export const EVENT_DISCONNECTED = 'disconnected';
|
|
9
|
+
export const EVENT_MESSAGE = 'message';
|
|
10
|
+
export const EVENT_CONNECT_ERROR = 'connect_error';
|
|
11
|
+
|
|
12
|
+
const mock = jest.fn().mockImplementation(() => {
|
|
13
|
+
return {
|
|
14
|
+
addEventListener,
|
|
15
|
+
connect,
|
|
16
|
+
disconnect,
|
|
17
|
+
send
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export default mock;
|
package/utils/grafana.js
CHANGED
|
@@ -32,14 +32,19 @@ export function computeDashboardUrl(monitoringVersion, embedUrl, clusterId, para
|
|
|
32
32
|
return newUrl;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export async function dashboardExists(monitoringVersion, store, clusterId, embedUrl, storeName = 'cluster') {
|
|
35
|
+
export async function dashboardExists(monitoringVersion, store, clusterId, embedUrl, storeName = 'cluster', projectId = null) {
|
|
36
36
|
if ( !haveV2Monitoring(store.getters) ) {
|
|
37
37
|
return false;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const url = parseUrl(embedUrl);
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
let prefix = `${ getClusterPrefix(monitoringVersion, clusterId) }/api/v1/namespaces/cattle-monitoring-system/services/http:rancher-monitoring-grafana:80/proxy/`;
|
|
42
|
+
let delimiter = 'http:rancher-monitoring-grafana:80/proxy/';
|
|
43
|
+
|
|
44
|
+
if (projectId) {
|
|
45
|
+
prefix = `${ getClusterPrefix(monitoringVersion, clusterId) }/api/v1/namespaces/cattle-project-${ projectId }-monitoring/services/http:cattle-project-${ projectId }-monitoring-grafana:80/proxy/`;
|
|
46
|
+
delimiter = `http:cattle-project-${ projectId }-monitoring-grafana:80/proxy/`;
|
|
47
|
+
}
|
|
43
48
|
const path = url.path.split(delimiter)[1];
|
|
44
49
|
const uid = path.split('/')[1];
|
|
45
50
|
const newUrl = `${ prefix }api/dashboards/uid/${ uid }`;
|
|
@@ -53,18 +58,25 @@ export async function dashboardExists(monitoringVersion, store, clusterId, embed
|
|
|
53
58
|
}
|
|
54
59
|
}
|
|
55
60
|
|
|
56
|
-
export async function allDashboardsExist(store, clusterId, embeddedUrls, storeName = 'cluster') {
|
|
61
|
+
export async function allDashboardsExist(store, clusterId, embeddedUrls, storeName = 'cluster', projectId = null) {
|
|
57
62
|
let res;
|
|
58
63
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
let monitoringVersion = '';
|
|
65
|
+
|
|
66
|
+
if (!projectId) {
|
|
67
|
+
try {
|
|
68
|
+
res = await store.dispatch(`${ storeName }/find`, {
|
|
69
|
+
type: CATALOG.APP,
|
|
70
|
+
id: 'cattle-monitoring-system/rancher-monitoring'
|
|
71
|
+
});
|
|
72
|
+
} catch (err) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
64
75
|
|
|
65
|
-
|
|
76
|
+
monitoringVersion = res?.currentVersion;
|
|
77
|
+
}
|
|
66
78
|
|
|
67
|
-
const existPromises = embeddedUrls.map((url) => dashboardExists(monitoringVersion, store, clusterId, url, storeName));
|
|
79
|
+
const existPromises = embeddedUrls.map((url) => dashboardExists(monitoringVersion, store, clusterId, url, storeName, projectId));
|
|
68
80
|
|
|
69
81
|
return (await Promise.all(existPromises)).every((exists) => exists);
|
|
70
82
|
}
|
package/utils/selector.js
CHANGED
|
@@ -198,7 +198,8 @@ export function matches(obj, selector, labelKey = 'metadata.labels') {
|
|
|
198
198
|
}
|
|
199
199
|
break;
|
|
200
200
|
case 'In':
|
|
201
|
-
|
|
201
|
+
// we need to cater empty strings because when creating a label with value = null it's translated into a empty string value ''
|
|
202
|
+
if ( !rule.values.length || !rule.values.includes(value) ) {
|
|
202
203
|
return false;
|
|
203
204
|
}
|
|
204
205
|
break;
|
package/utils/socket.js
CHANGED
|
@@ -11,6 +11,7 @@ const SECURE = 'wss://';
|
|
|
11
11
|
|
|
12
12
|
const STATE_DISCONNECTED = 'disconnected';
|
|
13
13
|
|
|
14
|
+
export const addEventListener = EventTarget.addEventListener;
|
|
14
15
|
export const STATE_CONNECTING = 'connecting';
|
|
15
16
|
export const STATE_CONNECTED = 'connected';
|
|
16
17
|
const STATE_CLOSING = 'closing';
|
|
@@ -7,7 +7,7 @@ import cronstrue from 'cronstrue';
|
|
|
7
7
|
import { Translation } from '@shell/types/t';
|
|
8
8
|
|
|
9
9
|
// import uniq from 'lodash/uniq';
|
|
10
|
-
export type Validator = (val: any, arg?: any) =>
|
|
10
|
+
export type Validator<T = undefined | string> = (val: any, arg?: any) => T;
|
|
11
11
|
|
|
12
12
|
export type ValidatorFactory = (arg1: any, arg2?: any) => Validator
|
|
13
13
|
|
|
@@ -53,7 +53,7 @@ export interface ValidationOptions {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
// "t" is the function name we use for getting a translated string
|
|
56
|
-
export default function(t: Translation, { key = 'Value' }: ValidationOptions):
|
|
56
|
+
export default function(t: Translation, { key = 'Value' }: ValidationOptions): { [key:string]: Validator<any> | ValidatorFactory } {
|
|
57
57
|
// utility validators these validators only get used by other validators
|
|
58
58
|
const startDot: ValidatorFactory = (label: string): Validator => (val: string) => val?.slice(0, 1) === '.' ? t(`validation.dns.${ label }.startDot`, { key }) : undefined;
|
|
59
59
|
|
|
@@ -257,7 +257,7 @@ export default function(t: Translation, { key = 'Value' }: ValidationOptions): u
|
|
|
257
257
|
|
|
258
258
|
const clusterName: ValidatorFactory = (isRke2: boolean): Validator => (val: string | undefined) => isRke2 && (val || '')?.match(/^(c-.{5}|local)$/i) ? t('validation.cluster.name') : undefined;
|
|
259
259
|
|
|
260
|
-
const servicePort = (val: ServicePort) => {
|
|
260
|
+
const servicePort: Validator<string | Port | undefined> = (val: ServicePort) => {
|
|
261
261
|
const {
|
|
262
262
|
name,
|
|
263
263
|
idx
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { isArray } from '@shell/utils/array';
|
|
2
|
-
|
|
3
|
-
export default function urlOptions(url, opt) {
|
|
4
|
-
opt = opt || {};
|
|
5
|
-
|
|
6
|
-
// Filter
|
|
7
|
-
if ( opt.filter ) {
|
|
8
|
-
const keys = Object.keys(opt.filter);
|
|
9
|
-
|
|
10
|
-
keys.forEach((key) => {
|
|
11
|
-
let vals = opt.filter[key];
|
|
12
|
-
|
|
13
|
-
if ( !isArray(vals) ) {
|
|
14
|
-
vals = [vals];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
vals.forEach((val) => {
|
|
18
|
-
url += `${ (url.includes('?') ? '&' : '?') + encodeURIComponent(key) }=${ encodeURIComponent(val) }`;
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
// End: Filter
|
|
23
|
-
|
|
24
|
-
// Limit
|
|
25
|
-
const limit = opt.limit;
|
|
26
|
-
|
|
27
|
-
if ( limit ) {
|
|
28
|
-
url += `${ url.includes('?') ? '&' : '?' }limit=${ limit }`;
|
|
29
|
-
}
|
|
30
|
-
// End: Limit
|
|
31
|
-
|
|
32
|
-
// Sort
|
|
33
|
-
const sortBy = opt.sortBy;
|
|
34
|
-
|
|
35
|
-
if ( sortBy ) {
|
|
36
|
-
url += `${ url.includes('?') ? '&' : '?' }sort=${ encodeURIComponent(sortBy) }`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const orderBy = opt.sortOrder;
|
|
40
|
-
|
|
41
|
-
if ( orderBy ) {
|
|
42
|
-
url += `${ url.includes('?') ? '&' : '?' }order=${ encodeURIComponent(orderBy) }`;
|
|
43
|
-
}
|
|
44
|
-
// End: Sort
|
|
45
|
-
|
|
46
|
-
return url;
|
|
47
|
-
}
|