@rancher/shell 0.3.15 → 0.3.17
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/images/wechat-qr-code.jpg +0 -0
- package/assets/translations/en-us.yaml +70 -15
- package/assets/translations/zh-hans.yaml +155 -33
- package/chart/__tests__/S3.test.ts +50 -0
- package/chart/rancher-backup/S3.vue +21 -0
- package/chart/rancher-backup/index.vue +4 -0
- package/cloud-credential/generic.vue +1 -1
- package/components/BannerGraphic.vue +1 -0
- package/components/CommunityLinks.vue +1 -0
- package/components/CruResource.vue +1 -1
- package/components/EmberPage.vue +1 -0
- package/components/FileDiff.vue +92 -85
- package/components/GrafanaDashboard.vue +7 -1
- package/components/ResourceDetail/index.vue +4 -12
- package/components/ResourceList/index.vue +1 -1
- package/components/ResourceTable.vue +50 -2
- package/components/SimpleBox.vue +1 -0
- package/components/SortableTable/index.vue +5 -1
- package/components/YamlEditor.vue +1 -0
- package/components/auth/RoleDetailEdit.vue +1 -0
- package/components/form/GitPicker.vue +1 -1
- package/components/form/NameNsDescription.vue +28 -12
- package/components/form/NodeAffinity.vue +2 -2
- package/components/form/PodAffinity.vue +8 -3
- package/components/form/ResourceTabs/index.vue +8 -2
- package/components/form/Select.vue +16 -0
- package/components/form/__tests__/NodeAffinity.test.ts +38 -0
- package/components/form/__tests__/PodAffinity.test.ts +46 -0
- package/components/formatter/ClusterLink.vue +8 -4
- package/components/formatter/ImageName.vue +23 -0
- package/components/formatter/PodImages.vue +7 -1
- package/components/formatter/__tests__/ClusterLink.test.ts +101 -0
- package/components/nav/Header.vue +2 -2
- package/config/__test__/home-links.test.ts +62 -0
- package/config/home-links.js +15 -3
- package/config/labels-annotations.js +5 -1
- package/config/product/auth.js +1 -1
- package/config/router.js +0 -9
- package/config/settings.ts +4 -0
- package/config/table-headers.js +6 -5
- package/config/uiplugins.js +50 -5
- package/core/plugin-helpers.js +20 -12
- package/core/plugin.ts +9 -0
- package/core/plugins.js +1 -1
- package/core/types-provisioning.ts +253 -0
- package/core/types.ts +17 -3
- package/detail/autoscaling.horizontalpodautoscaler/index.vue +50 -1
- package/detail/catalog.cattle.io.clusterrepo.vue +8 -1
- package/detail/node.vue +6 -6
- package/detail/pod.vue +2 -6
- package/detail/provisioning.cattle.io.cluster.vue +46 -7
- package/detail/workload/index.vue +9 -9
- package/edit/__tests__/fleet.cattle.io.gitrepo.test.ts +62 -0
- package/edit/__tests__/monitoring.coreos.com.prometheusrule.test.ts +56 -0
- package/edit/auth/github.vue +1 -0
- package/edit/autoscaling.horizontalpodautoscaler/hpa-scaling-rule.vue +130 -0
- package/edit/autoscaling.horizontalpodautoscaler/index.vue +79 -0
- package/edit/fleet.cattle.io.gitrepo.vue +18 -1
- package/edit/monitoring.coreos.com.prometheusrule/index.vue +8 -3
- package/edit/namespace.vue +9 -1
- package/edit/networking.k8s.io.ingress/RulePath.vue +0 -2
- package/edit/provisioning.cattle.io.cluster/AgentConfiguration.vue +1 -30
- package/edit/provisioning.cattle.io.cluster/__tests__/rke2.test.ts +79 -1
- package/edit/provisioning.cattle.io.cluster/index.vue +52 -0
- package/edit/provisioning.cattle.io.cluster/rke2.vue +330 -150
- package/edit/ui.cattle.io.navlink.vue +2 -1
- package/initialize/App.js +3 -13
- package/initialize/layouts.ts +26 -0
- package/list/provisioning.cattle.io.cluster.vue +8 -1
- package/middleware/authenticated.js +93 -5
- package/mixins/brand.js +39 -3
- package/mixins/child-hook.js +2 -2
- package/mixins/create-edit-view/impl.js +2 -2
- package/models/fleet.cattle.io.gitrepo.js +1 -0
- package/models/provisioning.cattle.io.cluster.js +9 -1
- package/package.json +3 -3
- package/pages/about.vue +8 -2
- package/pages/auth/login.vue +10 -0
- package/pages/auth/logout.vue +11 -3
- package/pages/auth/setup.vue +4 -0
- package/pages/c/_cluster/apps/charts/index.vue +5 -2
- package/pages/c/_cluster/apps/charts/install.vue +5 -0
- package/pages/c/_cluster/auth/roles/index.vue +1 -1
- package/pages/c/_cluster/explorer/index.vue +1 -10
- package/pages/c/_cluster/uiplugins/AddExtensionRepos.vue +177 -0
- package/pages/c/_cluster/uiplugins/PluginInfoPanel.vue +19 -3
- package/pages/c/_cluster/uiplugins/RemoveUIPlugins.vue +90 -21
- package/pages/c/_cluster/uiplugins/SetupUIPlugins.vue +107 -37
- package/pages/c/_cluster/uiplugins/index.vue +155 -44
- package/pages/docs/_doc.vue +9 -3
- package/pages/home.vue +10 -5
- package/pages/support/index.vue +10 -4
- package/pkg/auto-import.js +1 -1
- package/plugins/clean-tooltip-directive.js +1 -1
- package/plugins/dashboard-store/resource-class.js +35 -2
- package/plugins/plugin.js +9 -1
- package/plugins/steve/actions.js +22 -0
- package/rancher-components/BadgeState/BadgeState.vue +5 -1
- package/rancher-components/Banner/Banner.test.ts +51 -1
- package/rancher-components/Banner/Banner.vue +134 -53
- package/rancher-components/Card/Card.vue +24 -7
- package/rancher-components/Form/Checkbox/Checkbox.test.ts +20 -29
- package/rancher-components/Form/Checkbox/Checkbox.vue +45 -20
- package/rancher-components/Form/LabeledInput/LabeledInput.test.ts +2 -8
- package/rancher-components/Form/LabeledInput/LabeledInput.vue +22 -10
- package/rancher-components/Form/Radio/RadioButton.vue +30 -13
- package/rancher-components/Form/Radio/RadioGroup.vue +26 -7
- package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +7 -6
- package/rancher-components/Form/ToggleSwitch/ToggleSwitch.test.ts +25 -38
- package/rancher-components/Form/ToggleSwitch/ToggleSwitch.vue +23 -11
- package/rancher-components/LabeledTooltip/LabeledTooltip.vue +19 -5
- package/rancher-components/StringList/StringList.test.ts +453 -49
- package/rancher-components/StringList/StringList.vue +92 -58
- package/scripts/extension/publish +2 -2
- package/scripts/typegen.sh +1 -0
- package/server/server-middleware.js +4 -12
- package/store/index.js +13 -0
- package/store/prefs.js +0 -3
- package/store/type-map.js +17 -29
- package/types/shell/index.d.ts +243 -90
- package/utils/kube.js +9 -0
- package/utils/object.js +27 -0
- package/utils/settings.ts +2 -2
- package/vue.config.js +3 -2
- package/pages/safeMode.vue +0 -17
- package/rancher-components/components/BadgeState/BadgeState.spec.ts +0 -12
- package/rancher-components/components/BadgeState/BadgeState.vue +0 -111
- package/rancher-components/components/BadgeState/index.ts +0 -1
- package/rancher-components/components/Banner/Banner.test.ts +0 -63
- package/rancher-components/components/Banner/Banner.vue +0 -244
- package/rancher-components/components/Banner/index.ts +0 -1
- package/rancher-components/components/Card/Card.vue +0 -167
- package/rancher-components/components/Card/index.ts +0 -1
- package/rancher-components/components/Form/Checkbox/Checkbox.test.ts +0 -68
- package/rancher-components/components/Form/Checkbox/Checkbox.vue +0 -420
- package/rancher-components/components/Form/Checkbox/index.ts +0 -1
- package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +0 -23
- package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +0 -355
- package/rancher-components/components/Form/LabeledInput/index.ts +0 -1
- package/rancher-components/components/Form/Radio/RadioButton.vue +0 -287
- package/rancher-components/components/Form/Radio/RadioGroup.vue +0 -254
- package/rancher-components/components/Form/Radio/index.ts +0 -2
- package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +0 -170
- package/rancher-components/components/Form/TextArea/index.ts +0 -1
- package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.test.ts +0 -94
- package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +0 -149
- package/rancher-components/components/Form/ToggleSwitch/index.ts +0 -1
- package/rancher-components/components/Form/index.ts +0 -5
- package/rancher-components/components/LabeledTooltip/LabeledTooltip.vue +0 -151
- package/rancher-components/components/LabeledTooltip/index.ts +0 -1
- package/rancher-components/components/StringList/StringList.test.ts +0 -484
- package/rancher-components/components/StringList/StringList.vue +0 -611
- package/rancher-components/components/StringList/index.ts +0 -1
- /package/rancher-components/{components/Card → Card}/Card.test.ts +0 -0
- /package/rancher-components/{components/Form → Form}/Radio/RadioButton.test.ts +0 -0
package/core/plugin-helpers.js
CHANGED
|
@@ -3,6 +3,7 @@ import { isMac } from '@shell/utils/platform';
|
|
|
3
3
|
import { ucFirst, randomStr } from '@shell/utils/string';
|
|
4
4
|
import { _EDIT, _CONFIG, _DETAIL, _LIST } from '@shell/config/query-params';
|
|
5
5
|
import { getProductFromRoute } from '@shell/middleware/authenticated';
|
|
6
|
+
import { isEqual } from '@shell/utils/object';
|
|
6
7
|
|
|
7
8
|
function checkRouteProduct({ name, params, query }, locationConfigParam) {
|
|
8
9
|
const product = getProductFromRoute({
|
|
@@ -34,7 +35,7 @@ function checkRouteMode({ name, query }, locationConfigParam) {
|
|
|
34
35
|
return false;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
function checkExtensionRouteBinding($route, locationConfig) {
|
|
38
|
+
function checkExtensionRouteBinding($route, locationConfig, context) {
|
|
38
39
|
// if no configuration is passed, consider it as global
|
|
39
40
|
if (!Object.keys(locationConfig).length) {
|
|
40
41
|
return true;
|
|
@@ -43,23 +44,30 @@ function checkExtensionRouteBinding($route, locationConfig) {
|
|
|
43
44
|
const { params } = $route;
|
|
44
45
|
|
|
45
46
|
// "params" to be checked based on the locationConfig
|
|
47
|
+
// This has become overloaded with mode and context
|
|
46
48
|
const paramsToCheck = [
|
|
47
49
|
'product',
|
|
48
50
|
'resource',
|
|
49
51
|
'namespace',
|
|
50
52
|
'cluster',
|
|
51
53
|
'id',
|
|
52
|
-
'mode'
|
|
54
|
+
'mode',
|
|
55
|
+
// url query params
|
|
56
|
+
'queryParam',
|
|
57
|
+
// Custom context specific params provided by the extension, not to be confused with location params
|
|
58
|
+
'context',
|
|
53
59
|
];
|
|
54
60
|
|
|
55
|
-
let res =
|
|
61
|
+
let res = true;
|
|
56
62
|
|
|
57
63
|
for (let i = 0; i < paramsToCheck.length; i++) {
|
|
58
64
|
const param = paramsToCheck[i];
|
|
59
65
|
|
|
60
66
|
if (locationConfig[param]) {
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
const asArray = Array.isArray(locationConfig[param]) ? locationConfig[param] : [locationConfig[param]];
|
|
68
|
+
|
|
69
|
+
for (let x = 0; x < asArray.length; x++) {
|
|
70
|
+
const locationConfigParam = asArray[x];
|
|
63
71
|
|
|
64
72
|
if (locationConfigParam) {
|
|
65
73
|
// handle "product" in a separate way...
|
|
@@ -68,6 +76,11 @@ function checkExtensionRouteBinding($route, locationConfig) {
|
|
|
68
76
|
// also handle "mode" in a separate way because it mainly depends on query params
|
|
69
77
|
} else if (param === 'mode') {
|
|
70
78
|
res = checkRouteMode($route, locationConfigParam);
|
|
79
|
+
} else if (param === 'context') {
|
|
80
|
+
// Need all keys and values to match
|
|
81
|
+
res = isEqual(locationConfigParam, context);
|
|
82
|
+
} else if (param === 'queryParam') {
|
|
83
|
+
res = isEqual(locationConfigParam, $route.query);
|
|
71
84
|
} else if (locationConfigParam === params[param]) {
|
|
72
85
|
res = true;
|
|
73
86
|
} else {
|
|
@@ -91,7 +104,7 @@ function checkExtensionRouteBinding($route, locationConfig) {
|
|
|
91
104
|
return res;
|
|
92
105
|
}
|
|
93
106
|
|
|
94
|
-
export function getApplicableExtensionEnhancements(pluginCtx, actionType, uiArea, currRoute, translationCtx = pluginCtx) {
|
|
107
|
+
export function getApplicableExtensionEnhancements(pluginCtx, actionType, uiArea, currRoute, translationCtx = pluginCtx, context) {
|
|
95
108
|
const extensionEnhancements = [];
|
|
96
109
|
|
|
97
110
|
// gate it so that we prevent errors on older versions of dashboard
|
|
@@ -99,7 +112,7 @@ export function getApplicableExtensionEnhancements(pluginCtx, actionType, uiArea
|
|
|
99
112
|
const actions = pluginCtx.$plugin.getUIConfig(actionType, uiArea);
|
|
100
113
|
|
|
101
114
|
actions.forEach((action, i) => {
|
|
102
|
-
if (checkExtensionRouteBinding(currRoute, action.locationConfig)) {
|
|
115
|
+
if (checkExtensionRouteBinding(currRoute, action.locationConfig, context || {})) {
|
|
103
116
|
// ADD CARD PLUGIN UI ENHANCEMENT
|
|
104
117
|
if (actionType === ExtensionPoint.CARD) {
|
|
105
118
|
// intercept to apply translation
|
|
@@ -116,11 +129,6 @@ export function getApplicableExtensionEnhancements(pluginCtx, actionType, uiArea
|
|
|
116
129
|
actions[i].label = translationCtx.t(action.labelKey);
|
|
117
130
|
}
|
|
118
131
|
|
|
119
|
-
// sets the enabled flag to true if omitted on the config
|
|
120
|
-
if (!Object.keys(action).includes('enabled')) {
|
|
121
|
-
actions[i].enabled = true;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
132
|
// bulkable flag
|
|
125
133
|
actions[i].bulkable = actions[i].multiple || actions[i].bulkable;
|
|
126
134
|
|
package/core/plugin.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
PluginRouteConfig, RegisterStore, UnregisterStore, CoreStoreSpecifics, CoreStoreConfig, OnNavToPackage, OnNavAwayFromPackage, OnLogOut
|
|
16
16
|
} from './types';
|
|
17
17
|
import coreStore, { coreStoreModule, coreStoreState } from '@shell/plugins/dashboard-store';
|
|
18
|
+
import { registerLayout } from '@shell/initialize/layouts';
|
|
18
19
|
|
|
19
20
|
export type ProductFunction = (plugin: IPlugin, store: any) => void;
|
|
20
21
|
|
|
@@ -267,6 +268,14 @@ export class Plugin implements IPlugin {
|
|
|
267
268
|
}
|
|
268
269
|
|
|
269
270
|
this.l10n[name].push(fn);
|
|
271
|
+
} else if (type === 'layouts') {
|
|
272
|
+
fn().then((component: any) => {
|
|
273
|
+
if (component.default) {
|
|
274
|
+
registerLayout(name, component.default);
|
|
275
|
+
} else {
|
|
276
|
+
console.error(`Failed to load layout ${ name } because the file didn't export a default component.`); // eslint-disable-line no-console
|
|
277
|
+
}
|
|
278
|
+
});
|
|
270
279
|
} else {
|
|
271
280
|
if (!this.types[type]) {
|
|
272
281
|
this.types[type] = {};
|
package/core/plugins.js
CHANGED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A function to run as part of the save cluster process
|
|
3
|
+
*/
|
|
4
|
+
export type ClusterSaveHook = (cluster: any) => Promise<any>
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Register a function to run as part of the save cluster process
|
|
8
|
+
*
|
|
9
|
+
* @param hook function to run
|
|
10
|
+
* @param name unique identifier
|
|
11
|
+
* @param priority higher numbers are lower priority
|
|
12
|
+
* @param fnContext the `this` context from inside the function. If left blank will be a Vue component (where this.value will be the cluster)
|
|
13
|
+
*/
|
|
14
|
+
export type RegisterClusterSaveHook = (hook: ClusterSaveHook, name: string, priority?: number, fnContext?: any) => void;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Params used when constructing an instance of the cluster provisioner
|
|
18
|
+
*/
|
|
19
|
+
export interface ClusterProvisionerContext {
|
|
20
|
+
/**
|
|
21
|
+
* Dispatch vuex actions
|
|
22
|
+
*/
|
|
23
|
+
dispatch: any,
|
|
24
|
+
/**
|
|
25
|
+
* Get from vuex store
|
|
26
|
+
*/
|
|
27
|
+
getters: any,
|
|
28
|
+
/**
|
|
29
|
+
* Used to make http requests
|
|
30
|
+
*/
|
|
31
|
+
axios: any,
|
|
32
|
+
/**
|
|
33
|
+
* Definition of the extension
|
|
34
|
+
*/
|
|
35
|
+
$plugin: any,
|
|
36
|
+
/**
|
|
37
|
+
* Function to retrieve a localised string
|
|
38
|
+
*/
|
|
39
|
+
t: (key: string) => string,
|
|
40
|
+
/**
|
|
41
|
+
* Are we in the context of creating a cluster
|
|
42
|
+
*/
|
|
43
|
+
isCreate: boolean
|
|
44
|
+
/**
|
|
45
|
+
* Are we in the context of editing an existing cluster
|
|
46
|
+
*/
|
|
47
|
+
isEdit: boolean
|
|
48
|
+
/**
|
|
49
|
+
* Are we viewing an existing cluster
|
|
50
|
+
*/
|
|
51
|
+
isView: boolean
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Interface that a custom Cluster Provisioner should implement
|
|
56
|
+
*
|
|
57
|
+
* The majority of these hooks are used in shell/edit/provisioning.cattle.io.cluster/rke2.vue
|
|
58
|
+
*/
|
|
59
|
+
export interface IClusterProvisioner {
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Unique ID of the Cluster Provisioner
|
|
63
|
+
*/
|
|
64
|
+
id: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Should the UI show a namespace selector when using this provisioner
|
|
68
|
+
*/
|
|
69
|
+
namespaced?: boolean;
|
|
70
|
+
|
|
71
|
+
/* --------------------------------------------------------------------------------------
|
|
72
|
+
* Define how the cluster provider is presented in a card to the user
|
|
73
|
+
* --------------------------------------------------------------------------------------- */
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* If missing the `cluster.provider.<provider id>` translation will be used
|
|
77
|
+
*
|
|
78
|
+
* It is recommended to not hardcode anything that might be localised
|
|
79
|
+
*/
|
|
80
|
+
label?: string;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The description will be shown when the user is selecting the type of cluster provider
|
|
84
|
+
*
|
|
85
|
+
* This isn't normally used.
|
|
86
|
+
*/
|
|
87
|
+
description?: string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Icon shown when the user is selecting the type of cluster provider
|
|
91
|
+
*/
|
|
92
|
+
icon?: any;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Cluster providers are in groups
|
|
96
|
+
*
|
|
97
|
+
* `rke2` - default
|
|
98
|
+
* `kontainer`
|
|
99
|
+
* `custom2`
|
|
100
|
+
*/
|
|
101
|
+
group?: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Disable the cluster provider card
|
|
105
|
+
*/
|
|
106
|
+
disabled?: boolean;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Custom Dashboard route to navigate to when the cluster provider card is clicked
|
|
110
|
+
*/
|
|
111
|
+
link?: string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Text to show top right on the cluster provider card. For example `Experimental`
|
|
115
|
+
*/
|
|
116
|
+
tag?: string;
|
|
117
|
+
|
|
118
|
+
/* --------------------------------------------------------------------------------------
|
|
119
|
+
* Custer Details View
|
|
120
|
+
* --------------------------------------------------------------------------------------- */
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Existing tabs to show or hide in the cluster's detail view
|
|
124
|
+
*
|
|
125
|
+
* `plugin.addTab(TabLocation.RESOURCE_DETAIL... ` can be used to add additional tabs to the same view
|
|
126
|
+
*/
|
|
127
|
+
detailTabs: {
|
|
128
|
+
/**
|
|
129
|
+
* RKE2 machine pool tabs
|
|
130
|
+
*/
|
|
131
|
+
machines: boolean,
|
|
132
|
+
/**
|
|
133
|
+
* RKE2 provisioning logs
|
|
134
|
+
*/
|
|
135
|
+
logs: boolean,
|
|
136
|
+
/**
|
|
137
|
+
* RKE2 registration commands
|
|
138
|
+
*/
|
|
139
|
+
registration: boolean,
|
|
140
|
+
/**
|
|
141
|
+
* RKE2 snapshots
|
|
142
|
+
*/
|
|
143
|
+
snapshots: boolean,
|
|
144
|
+
/**
|
|
145
|
+
* Kube resources related to the instance of provisioning.cattle.io.cluster
|
|
146
|
+
*/
|
|
147
|
+
related: boolean,
|
|
148
|
+
/**
|
|
149
|
+
* Kube events associated with the instance of provisioning.cattle.io.cluster
|
|
150
|
+
*/
|
|
151
|
+
events: boolean,
|
|
152
|
+
/**
|
|
153
|
+
* Kube conditions of the provisioning.cattle.io.cluster instance
|
|
154
|
+
*/
|
|
155
|
+
conditions: boolean
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/* --------------------------------------------------------------------------------------
|
|
159
|
+
* Getters / Functions for Managing Machine Configs
|
|
160
|
+
* --------------------------------------------------------------------------------------- */
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Schema for machine config object. For example rke-machine-config.cattle.io.digitaloceanconfig
|
|
164
|
+
*
|
|
165
|
+
* The `id` should be in the format of `rke-machine-config.cattle.io.${ provider id }config`
|
|
166
|
+
*
|
|
167
|
+
* The `attributes: { kind: <value> }` should match the last part of the id
|
|
168
|
+
* The `attributes: { group: <value> }` should match the remaining parts of the id
|
|
169
|
+
*/
|
|
170
|
+
machineConfigSchema?: { [key: string]: any };
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Override the default method to create a machine config object that will be inserted into a new machine pool
|
|
174
|
+
*
|
|
175
|
+
* The machine config will be an instance related to the machine config schema
|
|
176
|
+
*
|
|
177
|
+
* This is usually used when the user has selected to add a machine pool when creating/editing the cluster.
|
|
178
|
+
*
|
|
179
|
+
* > If the user updates the cluster's namespace after pools have been created.... the machine config's will need updating later on
|
|
180
|
+
*
|
|
181
|
+
* @param idx Index of new pool
|
|
182
|
+
* @param pools Existing machine pools
|
|
183
|
+
* @param cluster The cluster (`provisioning.cattle.io.cluster`)
|
|
184
|
+
* @returns Instance of a machine config
|
|
185
|
+
*/
|
|
186
|
+
createMachinePoolMachineConfig?(idx: number, pools: any[], cluster: any): Promise<{[key: string]: any}>;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Override the default process to save the machine config's associated with the machine pools
|
|
190
|
+
*
|
|
191
|
+
* If machine config's will be the pool's `config` property.
|
|
192
|
+
*
|
|
193
|
+
* The pool will have `create: true` if the pool is new or `update: true` if the pool already exists
|
|
194
|
+
*
|
|
195
|
+
* For information on proxying HTTP requests from the browser via Rancher https://rancher.github.io/dashboard/code-base-works/machine-drivers#api-calls
|
|
196
|
+
* These docs also cover how to reference a Cloud Credential and use it's properties in the proxy's request `Authorization` header
|
|
197
|
+
*
|
|
198
|
+
* @param pools Machine pools
|
|
199
|
+
* @param cluster The cluster (`provisioning.cattle.io.cluster`)
|
|
200
|
+
* @returns Content of async result / promise N/A, only the success / fail state
|
|
201
|
+
*/
|
|
202
|
+
saveMachinePoolConfigs?(pools: any[], cluster: any): Promise<any>
|
|
203
|
+
|
|
204
|
+
/* --------------------------------------------------------------------------------------
|
|
205
|
+
* Optionally override parts of the cluster save process with
|
|
206
|
+
* - hooks that run before or after the cluster resource is saved
|
|
207
|
+
* - the actual save of the cluster resource
|
|
208
|
+
* --------------------------------------------------------------------------------------- */
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Update the cluster before and or after the cluster is saved
|
|
212
|
+
*
|
|
213
|
+
* @param registerBeforeHook
|
|
214
|
+
* Call `registerBeforeHook` with a function. The function will be executed before the cluster is saved.
|
|
215
|
+
* This allows the model used in the API request to be updated before being sent
|
|
216
|
+
* @param registerAfterHook
|
|
217
|
+
* Call `registerAfterHook` with a function. The function will be executed after the cluster has been saved.
|
|
218
|
+
* This allows the model received in response to the API request to be updated
|
|
219
|
+
* @param cluster The cluster (`provisioning.cattle.io.cluster`)
|
|
220
|
+
*/
|
|
221
|
+
registerSaveHooks?(registerBeforeHook: RegisterClusterSaveHook, registerAfterHook: RegisterClusterSaveHook, cluster: any): void;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Optionally override the save of the cluster resource itself.
|
|
225
|
+
*
|
|
226
|
+
* https://github.com/rancher/dashboard/blob/master/shell/mixins/create-edit-view/impl.js#L179
|
|
227
|
+
*
|
|
228
|
+
* This means a lot of the generic handling of cluster provisioning is not skipped (as per the `provision` method)
|
|
229
|
+
*
|
|
230
|
+
* @param cluster The cluster (`provisioning.cattle.io.cluster`)
|
|
231
|
+
* @returns Rejected promise / exception from `await` if failed to save
|
|
232
|
+
*/
|
|
233
|
+
saveCluster?(cluster: any): Promise<any>
|
|
234
|
+
|
|
235
|
+
/* --------------------------------------------------------------------------------------
|
|
236
|
+
* Optionally override all of cluster save process
|
|
237
|
+
* --------------------------------------------------------------------------------------- */
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Optionally override all of the ui's save cluster process (including hooks and saving the resource)
|
|
241
|
+
*
|
|
242
|
+
* https://github.com/rancher/dashboard/blob/master/shell/edit/provisioning.cattle.io.cluster/rke2.vue#L1420
|
|
243
|
+
*
|
|
244
|
+
* For information on proxying HTTP requests from the browser via Rancher https://rancher.github.io/dashboard/code-base-works/machine-drivers#api-calls
|
|
245
|
+
* These docs also cover how to reference a Cloud Credential and use it's properties in the proxy's request `Authorization` header
|
|
246
|
+
*
|
|
247
|
+
* @param pools Machine pools
|
|
248
|
+
* @param cluster The cluster (`provisioning.cattle.io.cluster`)
|
|
249
|
+
* @param isCreate True if the cluster is being created, false if an existing cluster being edited
|
|
250
|
+
* @returns Array of errors. If there are no errors the array will be empty
|
|
251
|
+
*/
|
|
252
|
+
provision?(cluster: any, pools: any[]): Promise<any[]>;
|
|
253
|
+
}
|
package/core/types.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ProductFunction } from './plugin';
|
|
2
2
|
import { RouteConfig, Location } from 'vue-router';
|
|
3
3
|
|
|
4
|
+
// Cluster Provisioning types
|
|
5
|
+
export * from './types-provisioning';
|
|
6
|
+
|
|
4
7
|
// package.json metadata
|
|
5
8
|
export interface PackageMetadata {
|
|
6
9
|
name: string;
|
|
@@ -62,6 +65,7 @@ export enum PanelLocation {
|
|
|
62
65
|
/** Enum regarding tab locations that are extensionable in the UI */
|
|
63
66
|
export enum TabLocation {
|
|
64
67
|
RESOURCE_DETAIL = 'tab', // eslint-disable-line no-unused-vars
|
|
68
|
+
CLUSTER_CREATE_RKE2 = 'cluster-create-rke2', // eslint-disable-line no-unused-vars
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
/** Enum regarding card locations that are extensionable in the UI */
|
|
@@ -97,7 +101,7 @@ export type Action = {
|
|
|
97
101
|
svg?: Function;
|
|
98
102
|
icon?: string;
|
|
99
103
|
multiple?: boolean;
|
|
100
|
-
enabled?:
|
|
104
|
+
enabled?: Function | boolean;
|
|
101
105
|
invoke: (opts: ActionOpts, resources: any[]) => void | boolean | Promise<boolean>;
|
|
102
106
|
};
|
|
103
107
|
|
|
@@ -134,7 +138,17 @@ export type LocationConfig = {
|
|
|
134
138
|
namespace?: string[],
|
|
135
139
|
cluster?: string[],
|
|
136
140
|
id?: string[],
|
|
137
|
-
mode?: string[]
|
|
141
|
+
mode?: string[],
|
|
142
|
+
/**
|
|
143
|
+
* Query Params from URL
|
|
144
|
+
*/
|
|
145
|
+
queryParam?: { [key: string]: string},
|
|
146
|
+
/**
|
|
147
|
+
* Context specific params.
|
|
148
|
+
*
|
|
149
|
+
* Components can provide additional context specific params that this value must match
|
|
150
|
+
*/
|
|
151
|
+
context?: { [key: string]: string},
|
|
138
152
|
};
|
|
139
153
|
|
|
140
154
|
export interface ProductOptions {
|
|
@@ -516,7 +530,7 @@ export interface IPlugin {
|
|
|
516
530
|
* @param {String} name unique name of 'something'
|
|
517
531
|
* @param {Function} fn function that dynamically loads the module for the thing being registered
|
|
518
532
|
*/
|
|
519
|
-
register(type: string, name: string, fn: Function): void;
|
|
533
|
+
register(type: string, name: string, fn: Function | Boolean): void;
|
|
520
534
|
|
|
521
535
|
/**
|
|
522
536
|
* Will return all of the configuration functions used for creating a new product.
|
|
@@ -94,7 +94,7 @@ export default {
|
|
|
94
94
|
name="metrics"
|
|
95
95
|
:label="t('hpa.tabs.metrics')"
|
|
96
96
|
class="bordered-table hpa-metrics-table"
|
|
97
|
-
:weight="
|
|
97
|
+
:weight="4"
|
|
98
98
|
>
|
|
99
99
|
<div
|
|
100
100
|
v-for="(metric, index) in mappedMetrics"
|
|
@@ -185,6 +185,55 @@ export default {
|
|
|
185
185
|
</InfoBox>
|
|
186
186
|
</div>
|
|
187
187
|
</Tab>
|
|
188
|
+
<Tab
|
|
189
|
+
v-if="!!value.spec.behavior"
|
|
190
|
+
name="behavior"
|
|
191
|
+
:label="t('hpa.tabs.behavior')"
|
|
192
|
+
class="bordered-table hpa-behavior-table"
|
|
193
|
+
:weight="3"
|
|
194
|
+
>
|
|
195
|
+
<div
|
|
196
|
+
v-for="(type, i) in ['scaleDown', 'scaleUp']"
|
|
197
|
+
:key="`${i}`"
|
|
198
|
+
>
|
|
199
|
+
<InfoBox v-if="!!value.spec.behavior[type]">
|
|
200
|
+
<div class="row info-row">
|
|
201
|
+
<div class="col span-6 info-column">
|
|
202
|
+
<h4>
|
|
203
|
+
<t
|
|
204
|
+
:k="`hpa.${type}Rules.label`"
|
|
205
|
+
/>
|
|
206
|
+
</h4>
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
<div class="row">
|
|
210
|
+
<div class="col span-6 info-column">
|
|
211
|
+
<label class="text-label"><t k="hpa.scalingRule.policyHeader" /></label>
|
|
212
|
+
<ul
|
|
213
|
+
v-for="(current, currentIndex) in value.spec.behavior[type].policies"
|
|
214
|
+
:key="`${currentIndex}`"
|
|
215
|
+
>
|
|
216
|
+
<li>
|
|
217
|
+
<span>{{ current.value }}</span>
|
|
218
|
+
<span>{{ current.type }}</span>
|
|
219
|
+
<span>(for {{ current.periodSeconds }}s)</span>
|
|
220
|
+
</li>
|
|
221
|
+
</ul>
|
|
222
|
+
</div>
|
|
223
|
+
<div class="col span-6">
|
|
224
|
+
<div class="mb-5">
|
|
225
|
+
<label class="text-label"><t k="hpa.scalingRule.selectPolicy" />: </label>
|
|
226
|
+
<span>{{ value.spec.behavior[type].selectPolicy }}</span>
|
|
227
|
+
</div>
|
|
228
|
+
<div class="mb-5">
|
|
229
|
+
<label class="text-label"><t k="hpa.scalingRule.stabilizationWindowSeconds" />: </label>
|
|
230
|
+
<span>{{ value.spec.behavior[type].stabilizationWindowSeconds }}s</span>
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
</InfoBox>
|
|
235
|
+
</div>
|
|
236
|
+
</Tab>
|
|
188
237
|
</ResourceTabs>
|
|
189
238
|
</template>
|
|
190
239
|
|
|
@@ -19,10 +19,17 @@ export default {
|
|
|
19
19
|
</div>
|
|
20
20
|
<div
|
|
21
21
|
v-if="value.isGit"
|
|
22
|
-
class="span-
|
|
22
|
+
class="span-3"
|
|
23
23
|
>
|
|
24
24
|
<h3>{{ t('tableHeaders.branch') }}</h3>
|
|
25
25
|
<span>{{ value.branchDisplay }}</span>
|
|
26
26
|
</div>
|
|
27
|
+
<div
|
|
28
|
+
v-if="value.isGit"
|
|
29
|
+
class="span-3"
|
|
30
|
+
>
|
|
31
|
+
<h3>{{ t('tableHeaders.commit') }}</h3>
|
|
32
|
+
<span>{{ value.status.commit }}</span>
|
|
33
|
+
</div>
|
|
27
34
|
</div>
|
|
28
35
|
</template>
|
package/detail/node.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import ConsumptionGauge from '@shell/components/ConsumptionGauge';
|
|
3
3
|
import Alert from '@shell/components/Alert';
|
|
4
|
-
import
|
|
4
|
+
import ResourceTable from '@shell/components/ResourceTable';
|
|
5
5
|
import Tab from '@shell/components/Tabbed/Tab';
|
|
6
6
|
import {
|
|
7
7
|
EFFECT,
|
|
@@ -35,7 +35,7 @@ export default {
|
|
|
35
35
|
Loading,
|
|
36
36
|
ResourceTabs,
|
|
37
37
|
Tab,
|
|
38
|
-
|
|
38
|
+
ResourceTable,
|
|
39
39
|
EmberPage,
|
|
40
40
|
},
|
|
41
41
|
|
|
@@ -252,7 +252,7 @@ export default {
|
|
|
252
252
|
:label="t('node.detail.tab.pods')"
|
|
253
253
|
:weight="4"
|
|
254
254
|
>
|
|
255
|
-
<
|
|
255
|
+
<ResourceTable
|
|
256
256
|
key-field="_key"
|
|
257
257
|
:headers="podTableHeaders"
|
|
258
258
|
:rows="value.pods"
|
|
@@ -283,7 +283,7 @@ export default {
|
|
|
283
283
|
class="bordered-table"
|
|
284
284
|
:weight="2"
|
|
285
285
|
>
|
|
286
|
-
<
|
|
286
|
+
<ResourceTable
|
|
287
287
|
key-field="_key"
|
|
288
288
|
:headers="infoTableHeaders"
|
|
289
289
|
:rows="infoTableRows"
|
|
@@ -298,7 +298,7 @@ export default {
|
|
|
298
298
|
:label="t('node.detail.tab.images')"
|
|
299
299
|
:weight="1"
|
|
300
300
|
>
|
|
301
|
-
<
|
|
301
|
+
<ResourceTable
|
|
302
302
|
key-field="_key"
|
|
303
303
|
:headers="imageTableHeaders"
|
|
304
304
|
:rows="imageTableRows"
|
|
@@ -311,7 +311,7 @@ export default {
|
|
|
311
311
|
:label="t('node.detail.tab.taints')"
|
|
312
312
|
:weight="0"
|
|
313
313
|
>
|
|
314
|
-
<
|
|
314
|
+
<ResourceTable
|
|
315
315
|
key-field="_key"
|
|
316
316
|
:headers="taintTableHeaders"
|
|
317
317
|
:rows="taintTableRows"
|
package/detail/pod.vue
CHANGED
|
@@ -3,14 +3,13 @@ import CreateEditView from '@shell/mixins/create-edit-view';
|
|
|
3
3
|
import Tab from '@shell/components/Tabbed/Tab';
|
|
4
4
|
import ResourceTabs from '@shell/components/form/ResourceTabs';
|
|
5
5
|
import SortableTable from '@shell/components/SortableTable';
|
|
6
|
-
import { STATE, SIMPLE_NAME,
|
|
6
|
+
import { STATE, SIMPLE_NAME, IMAGE_NAME } from '@shell/config/table-headers';
|
|
7
7
|
import { sortableNumericSuffix } from '@shell/utils/sort';
|
|
8
8
|
import { findBy } from '@shell/utils/array';
|
|
9
9
|
import DashboardMetrics from '@shell/components/DashboardMetrics';
|
|
10
10
|
import V1WorkloadMetrics from '@shell/mixins/v1-workload-metrics';
|
|
11
11
|
import { mapGetters } from 'vuex';
|
|
12
12
|
import { allDashboardsExist } from '@shell/utils/grafana';
|
|
13
|
-
import Loading from '@shell/components/Loading';
|
|
14
13
|
import LabeledSelect from '@shell/components/form/LabeledSelect';
|
|
15
14
|
import day from 'dayjs';
|
|
16
15
|
import { DATE_FORMAT, TIME_FORMAT } from '@shell/store/prefs';
|
|
@@ -24,7 +23,6 @@ export default {
|
|
|
24
23
|
|
|
25
24
|
components: {
|
|
26
25
|
DashboardMetrics,
|
|
27
|
-
Loading,
|
|
28
26
|
ResourceTabs,
|
|
29
27
|
Tab,
|
|
30
28
|
SortableTable,
|
|
@@ -142,7 +140,7 @@ export default {
|
|
|
142
140
|
...SIMPLE_NAME,
|
|
143
141
|
value: 'name'
|
|
144
142
|
},
|
|
145
|
-
|
|
143
|
+
IMAGE_NAME,
|
|
146
144
|
{
|
|
147
145
|
name: 'isInit',
|
|
148
146
|
labelKey: 'workload.container.init',
|
|
@@ -224,9 +222,7 @@ export default {
|
|
|
224
222
|
</script>
|
|
225
223
|
|
|
226
224
|
<template>
|
|
227
|
-
<Loading v-if="$fetchState.pending" />
|
|
228
225
|
<ResourceTabs
|
|
229
|
-
v-else
|
|
230
226
|
mode="view"
|
|
231
227
|
class="mt-20"
|
|
232
228
|
:value="value"
|