@rancher/shell 0.2.1 → 0.2.3
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 +9 -5
- package/assets/translations/zh-hans.yaml +328 -117
- package/components/Carousel.vue +25 -9
- package/components/Import.vue +7 -1
- package/components/SortableTable/index.vue +7 -1
- package/components/form/MatchExpressions.vue +15 -3
- package/components/nav/Header.vue +14 -1
- package/detail/cis.cattle.io.clusterscan.vue +6 -2
- package/detail/provisioning.cattle.io.cluster.vue +2 -2
- package/edit/provisioning.cattle.io.cluster/ACE.vue +1 -2
- package/edit/provisioning.cattle.io.cluster/MachinePool.vue +5 -3
- package/list/node.vue +7 -2
- package/mixins/resource-manager.js +5 -0
- package/models/cluster.x-k8s.io.machinedeployment.js +8 -0
- package/models/management.cattle.io.cluster.js +6 -1
- package/nuxt.config.js +113 -108
- package/package.json +1 -1
- package/pages/c/_cluster/apps/charts/index.vue +1 -1
- package/pages/c/_cluster/apps/charts/install.vue +24 -38
- package/pages/c/_cluster/settings/performance.vue +11 -0
- package/pages/c/_cluster/uiplugins/InstallDialog.vue +15 -1
- package/pages/c/_cluster/uiplugins/RemoveUIPlugins.vue +28 -6
- package/pages/c/_cluster/uiplugins/index.vue +1 -1
- package/rancher-components/Form/TextArea/TextAreaAutoGrow.vue +7 -7
- package/scripts/publish-shell.sh +1 -1
- package/scripts/test-plugins-build.sh +1 -0
- package/scripts/typegen.sh +2 -2
- package/store/type-map.js +11 -2
- package/types/vue-shim.d +20 -0
- package/utils/create-yaml.js +30 -6
- package/creators/update/yarn-error.log +0 -54
- package/rancher-components/components/BadgeState/BadgeState.spec.ts +0 -12
- package/rancher-components/components/BadgeState/BadgeState.vue +0 -107
- package/rancher-components/components/BadgeState/index.ts +0 -1
- package/rancher-components/components/Banner/Banner.test.ts +0 -13
- package/rancher-components/components/Banner/Banner.vue +0 -163
- package/rancher-components/components/Banner/index.ts +0 -1
- package/rancher-components/components/Card/Card.vue +0 -150
- package/rancher-components/components/Card/index.ts +0 -1
- package/rancher-components/components/Form/Checkbox/Checkbox.test.ts +0 -77
- package/rancher-components/components/Form/Checkbox/Checkbox.vue +0 -395
- package/rancher-components/components/Form/Checkbox/index.ts +0 -1
- package/rancher-components/components/Form/LabeledInput/LabeledInput.test.ts +0 -29
- package/rancher-components/components/Form/LabeledInput/LabeledInput.vue +0 -343
- package/rancher-components/components/Form/LabeledInput/index.ts +0 -1
- package/rancher-components/components/Form/Radio/RadioButton.vue +0 -270
- package/rancher-components/components/Form/Radio/RadioGroup.vue +0 -235
- package/rancher-components/components/Form/Radio/index.ts +0 -2
- package/rancher-components/components/Form/TextArea/TextAreaAutoGrow.vue +0 -168
- package/rancher-components/components/Form/TextArea/index.ts +0 -1
- package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.test.ts +0 -107
- package/rancher-components/components/Form/ToggleSwitch/ToggleSwitch.vue +0 -137
- 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 -137
- package/rancher-components/components/LabeledTooltip/index.ts +0 -1
|
@@ -95,11 +95,9 @@ export default {
|
|
|
95
95
|
this.errors = [];
|
|
96
96
|
|
|
97
97
|
// If the chart doesn't contain system `systemDefaultRegistry` properties there's no point applying them
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this.defaultRegistrySetting = this.clusterRegistry || this.globalRegistry;
|
|
102
|
-
}
|
|
98
|
+
this.clusterRegistry = await this.getClusterRegistry();
|
|
99
|
+
this.globalRegistry = await this.getGlobalRegistry();
|
|
100
|
+
this.defaultRegistrySetting = this.clusterRegistry || this.globalRegistry;
|
|
103
101
|
|
|
104
102
|
this.serverUrlSetting = await this.$store.dispatch('management/find', {
|
|
105
103
|
type: MANAGEMENT.SETTING,
|
|
@@ -284,15 +282,13 @@ export default {
|
|
|
284
282
|
*/
|
|
285
283
|
this.chartValues = merge(merge({}, this.versionInfo?.values || {}), userValues);
|
|
286
284
|
|
|
287
|
-
|
|
288
|
-
const existingRegistry = this.chartValues?.global?.systemDefaultRegistry || this.chartValues?.global?.cattle?.systemDefaultRegistry;
|
|
285
|
+
const existingRegistry = this.chartValues?.global?.systemDefaultRegistry || this.chartValues?.global?.cattle?.systemDefaultRegistry;
|
|
289
286
|
|
|
290
|
-
|
|
291
|
-
|
|
287
|
+
delete this.chartValues?.global?.systemDefaultRegistry;
|
|
288
|
+
delete this.chartValues?.global?.cattle?.systemDefaultRegistry;
|
|
292
289
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
290
|
+
this.customRegistrySetting = existingRegistry || this.defaultRegistrySetting;
|
|
291
|
+
this.showCustomRegistryInput = !!this.customRegistrySetting;
|
|
296
292
|
|
|
297
293
|
/* Serializes an object as a YAML document */
|
|
298
294
|
this.valuesYaml = saferDump(this.chartValues);
|
|
@@ -664,22 +660,6 @@ export default {
|
|
|
664
660
|
return null;
|
|
665
661
|
},
|
|
666
662
|
|
|
667
|
-
/**
|
|
668
|
-
* Check if the chart contains `systemDefaultRegistry` properties. If not we shouldn't apply the setting (or show the UI for them)
|
|
669
|
-
*/
|
|
670
|
-
showCustomRegistry() {
|
|
671
|
-
const global = this.versionInfo?.values?.global || {};
|
|
672
|
-
|
|
673
|
-
return global.systemDefaultRegistry !== undefined || global.cattle?.systemDefaultRegistry !== undefined;
|
|
674
|
-
},
|
|
675
|
-
|
|
676
|
-
/**
|
|
677
|
-
* True if we should apply/save the custom registry value. This should be false if matching the global registry
|
|
678
|
-
* (we shouldn't save the global registry to avoid issues on upgrade where we might confused it with a custom one)
|
|
679
|
-
*/
|
|
680
|
-
applyCustomRegistry() {
|
|
681
|
-
return this.customRegistrySetting !== this.globalRegistry;
|
|
682
|
-
}
|
|
683
663
|
},
|
|
684
664
|
|
|
685
665
|
watch: {
|
|
@@ -799,6 +779,19 @@ export default {
|
|
|
799
779
|
return clusterRegistry;
|
|
800
780
|
}
|
|
801
781
|
}
|
|
782
|
+
if (provCluster.isRke1) {
|
|
783
|
+
// For RKE1 clusters, the cluster scoped private registry is on the management
|
|
784
|
+
// cluster, not the provisioning cluster.
|
|
785
|
+
const rke1Registries = mgmCluster.spec.rancherKubernetesEngineConfig.privateRegistries;
|
|
786
|
+
|
|
787
|
+
if (rke1Registries?.length > 0) {
|
|
788
|
+
const defaultRegistry = rke1Registries.find((registry) => {
|
|
789
|
+
return registry.isDefault;
|
|
790
|
+
});
|
|
791
|
+
|
|
792
|
+
return defaultRegistry.url;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
802
795
|
}
|
|
803
796
|
},
|
|
804
797
|
|
|
@@ -983,14 +976,8 @@ export default {
|
|
|
983
976
|
|
|
984
977
|
setIfNotSet(cattle, 'clusterId', cluster?.id);
|
|
985
978
|
setIfNotSet(cattle, 'clusterName', cluster?.nameDisplay);
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
// been updated is confused with a custom user registry
|
|
989
|
-
const registry = this.applyCustomRegistry ? this.customRegistrySetting : '';
|
|
990
|
-
|
|
991
|
-
set(cattle, 'systemDefaultRegistry', registry);
|
|
992
|
-
set(global, 'systemDefaultRegistry', registry);
|
|
993
|
-
}
|
|
979
|
+
set(cattle, 'systemDefaultRegistry', this.customRegistrySetting);
|
|
980
|
+
set(global, 'systemDefaultRegistry', this.customRegistrySetting);
|
|
994
981
|
|
|
995
982
|
setIfNotSet(global, 'cattle.systemProjectId', systemProjectId);
|
|
996
983
|
setIfNotSet(cattle, 'url', serverUrl);
|
|
@@ -1389,13 +1376,12 @@ export default {
|
|
|
1389
1376
|
<Checkbox v-model="showCommandStep" class="mb-20" :label="t('catalog.install.steps.helmCli.checkbox', { action, existing: !!existing })" />
|
|
1390
1377
|
|
|
1391
1378
|
<Checkbox
|
|
1392
|
-
v-if="showCustomRegistry"
|
|
1393
1379
|
v-model="showCustomRegistryInput"
|
|
1394
1380
|
class="mb-20"
|
|
1395
1381
|
:label="t('catalog.chart.registry.custom.checkBoxLabel')"
|
|
1396
1382
|
:tooltip="t('catalog.chart.registry.tooltip')"
|
|
1397
1383
|
/>
|
|
1398
|
-
<div
|
|
1384
|
+
<div class="row">
|
|
1399
1385
|
<div class="col span-6">
|
|
1400
1386
|
<LabeledInput
|
|
1401
1387
|
v-if="showCustomRegistryInput"
|
|
@@ -95,6 +95,7 @@ export default {
|
|
|
95
95
|
<p>{{ t('performance.websocketNotification.description') }}</p>
|
|
96
96
|
<Checkbox
|
|
97
97
|
v-model="value.disableWebsocketNotification"
|
|
98
|
+
:mode="mode"
|
|
98
99
|
:label="t('performance.websocketNotification.checkboxLabel')"
|
|
99
100
|
class="mt-10 mb-20"
|
|
100
101
|
:primary="true"
|
|
@@ -106,6 +107,7 @@ export default {
|
|
|
106
107
|
<p>{{ t('performance.incrementalLoad.description') }}</p>
|
|
107
108
|
<Checkbox
|
|
108
109
|
v-model="value.incrementalLoading.enabled"
|
|
110
|
+
:mode="mode"
|
|
109
111
|
:label="t('performance.incrementalLoad.checkboxLabel')"
|
|
110
112
|
class="mt-10 mb-20"
|
|
111
113
|
:primary="true"
|
|
@@ -116,6 +118,7 @@ export default {
|
|
|
116
118
|
</p>
|
|
117
119
|
<LabeledInput
|
|
118
120
|
v-model="value.incrementalLoading.threshold"
|
|
121
|
+
:mode="mode"
|
|
119
122
|
:label="t('performance.incrementalLoad.inputLabel')"
|
|
120
123
|
:disabled="!value.incrementalLoading.enabled"
|
|
121
124
|
class="input"
|
|
@@ -131,6 +134,7 @@ export default {
|
|
|
131
134
|
<Banner color="error" label-key="performance.manualRefresh.banner" />
|
|
132
135
|
<Checkbox
|
|
133
136
|
v-model="value.manualRefresh.enabled"
|
|
137
|
+
:mode="mode"
|
|
134
138
|
:label="t('performance.manualRefresh.checkboxLabel')"
|
|
135
139
|
class="mt-10 mb-20"
|
|
136
140
|
:primary="true"
|
|
@@ -141,6 +145,7 @@ export default {
|
|
|
141
145
|
</p>
|
|
142
146
|
<LabeledInput
|
|
143
147
|
v-model.number="value.manualRefresh.threshold"
|
|
148
|
+
:mode="mode"
|
|
144
149
|
:label="t('performance.manualRefresh.inputLabel')"
|
|
145
150
|
:disabled="!value.manualRefresh.enabled"
|
|
146
151
|
class="input"
|
|
@@ -156,6 +161,7 @@ export default {
|
|
|
156
161
|
<Banner color="error" label-key="performance.gc.banner" />
|
|
157
162
|
<Checkbox
|
|
158
163
|
v-model="value.garbageCollection.enabled"
|
|
164
|
+
:mode="mode"
|
|
159
165
|
:label="t('performance.gc.checkboxLabel')"
|
|
160
166
|
class="mt-10 mb-20"
|
|
161
167
|
:primary="true"
|
|
@@ -165,6 +171,7 @@ export default {
|
|
|
165
171
|
<div class="ml-20 mb-10">
|
|
166
172
|
<Checkbox
|
|
167
173
|
v-model="value.garbageCollection.enabledInterval"
|
|
174
|
+
:mode="mode"
|
|
168
175
|
:class="{ 'text-muted': !value.garbageCollection.enabled }"
|
|
169
176
|
:label="t('performance.gc.whenRun.intervalCheckBox.label')"
|
|
170
177
|
class="mt-10 mb-10"
|
|
@@ -174,6 +181,7 @@ export default {
|
|
|
174
181
|
<div class="ml-20">
|
|
175
182
|
<UnitInput
|
|
176
183
|
v-model="value.garbageCollection.interval"
|
|
184
|
+
:mode="mode"
|
|
177
185
|
:suffix="t('suffix.seconds', { count: value.garbageCollection.interval })"
|
|
178
186
|
:label="t('performance.gc.whenRun.interval.inputLabel')"
|
|
179
187
|
:disabled="!value.garbageCollection.enabled || !value.garbageCollection.enabledInterval"
|
|
@@ -183,6 +191,7 @@ export default {
|
|
|
183
191
|
</div>
|
|
184
192
|
<Checkbox
|
|
185
193
|
v-model="value.garbageCollection.enabledOnNavigate"
|
|
194
|
+
:mode="mode"
|
|
186
195
|
:class="{ 'text-muted': !value.garbageCollection.enabled }"
|
|
187
196
|
:label="t('performance.gc.whenRun.route.description')"
|
|
188
197
|
class="mt-20 mb-10"
|
|
@@ -197,6 +206,7 @@ export default {
|
|
|
197
206
|
</p>
|
|
198
207
|
<UnitInput
|
|
199
208
|
v-model="value.garbageCollection.ageThreshold"
|
|
209
|
+
:mode="mode"
|
|
200
210
|
:suffix="t('suffix.seconds', { count: value.garbageCollection.ageThreshold })"
|
|
201
211
|
:label="t('performance.gc.howRun.age.inputLabel')"
|
|
202
212
|
:disabled="!value.garbageCollection.enabled"
|
|
@@ -208,6 +218,7 @@ export default {
|
|
|
208
218
|
</p>
|
|
209
219
|
<LabeledInput
|
|
210
220
|
v-model.number="value.garbageCollection.countThreshold"
|
|
221
|
+
:mode="mode"
|
|
211
222
|
:label="t('performance.gc.howRun.count.inputLabel')"
|
|
212
223
|
:disabled="!value.garbageCollection.enabled"
|
|
213
224
|
class="input"
|
|
@@ -24,6 +24,7 @@ export default {
|
|
|
24
24
|
|
|
25
25
|
data() {
|
|
26
26
|
return {
|
|
27
|
+
currentVersion: '',
|
|
27
28
|
defaultRegistrySetting: null,
|
|
28
29
|
plugin: undefined,
|
|
29
30
|
busy: false,
|
|
@@ -43,7 +44,16 @@ export default {
|
|
|
43
44
|
return [];
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
// Don't allow update/rollback to curent version
|
|
48
|
+
const versions = this.plugin.versions.filter((v) => {
|
|
49
|
+
if (this.currentVersion) {
|
|
50
|
+
return v.version !== this.currentVersion;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return true;
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return versions.map((version) => {
|
|
47
57
|
return {
|
|
48
58
|
label: version.version,
|
|
49
59
|
value: version.version,
|
|
@@ -65,6 +75,8 @@ export default {
|
|
|
65
75
|
this.version = plugin.displayVersion;
|
|
66
76
|
|
|
67
77
|
if (mode === 'update') {
|
|
78
|
+
this.currentVersion = plugin.displayVersion;
|
|
79
|
+
|
|
68
80
|
// Update to latest version, so take the first version
|
|
69
81
|
if (plugin.versions.length > 0) {
|
|
70
82
|
this.version = plugin.versions[0].version;
|
|
@@ -73,6 +85,8 @@ export default {
|
|
|
73
85
|
// Find the newest version once we remove the current version
|
|
74
86
|
const versionNames = plugin.versions.filter(v => v.version !== plugin.displayVersion);
|
|
75
87
|
|
|
88
|
+
this.currentVersion = plugin.displayVersion;
|
|
89
|
+
|
|
76
90
|
if (versionNames.length > 0) {
|
|
77
91
|
this.version = versionNames[0].version;
|
|
78
92
|
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
UI_PLUGIN_CHARTS,
|
|
8
8
|
UI_PLUGINS_REPO_NAME,
|
|
9
9
|
UI_PLUGINS_REPO_URL,
|
|
10
|
+
UI_PLUGIN_OPERATOR_CRD_CHART_NAME,
|
|
10
11
|
} from '@shell/config/uiplugins';
|
|
11
12
|
|
|
12
13
|
export default {
|
|
@@ -21,13 +22,23 @@ export default {
|
|
|
21
22
|
|
|
22
23
|
this.defaultRepo = repos.find(r => r.name === UI_PLUGINS_REPO_NAME && r.spec.gitRepo === UI_PLUGINS_REPO_URL);
|
|
23
24
|
}
|
|
25
|
+
|
|
26
|
+
if (this.$store.getters['management/schemaFor'](UI_PLUGIN)) {
|
|
27
|
+
const plugins = await this.$store.dispatch('management/findAll', { type: UI_PLUGIN });
|
|
28
|
+
|
|
29
|
+
// Are there any plugins installed?
|
|
30
|
+
this.hasPluginsInstalled = (plugins || []).length > 0;
|
|
31
|
+
this.removeCRD = !this.hasPluginsInstalled;
|
|
32
|
+
}
|
|
24
33
|
},
|
|
25
34
|
|
|
26
35
|
data() {
|
|
27
36
|
return {
|
|
28
|
-
errors:
|
|
29
|
-
defaultRepo:
|
|
30
|
-
removeRepo:
|
|
37
|
+
errors: [],
|
|
38
|
+
defaultRepo: undefined,
|
|
39
|
+
removeRepo: false,
|
|
40
|
+
removeCRD: true,
|
|
41
|
+
hasPluginsInstalled: false,
|
|
31
42
|
};
|
|
32
43
|
},
|
|
33
44
|
|
|
@@ -42,8 +53,8 @@ export default {
|
|
|
42
53
|
return found.remove();
|
|
43
54
|
}
|
|
44
55
|
|
|
45
|
-
//
|
|
46
|
-
return
|
|
56
|
+
// Return rejected promise - could not find the required chart
|
|
57
|
+
return Promise.reject(new Error(`Could not find chart §{ name }`));
|
|
47
58
|
},
|
|
48
59
|
|
|
49
60
|
showDialog() {
|
|
@@ -55,7 +66,12 @@ export default {
|
|
|
55
66
|
this.errors = [];
|
|
56
67
|
|
|
57
68
|
// Remove the charts in the reverse order that we install them in
|
|
58
|
-
|
|
69
|
+
let uninstall = [...UI_PLUGIN_CHARTS].reverse();
|
|
70
|
+
|
|
71
|
+
if (!this.removeCRD) {
|
|
72
|
+
// User does not want to uninstall the CRD, so remove the chart
|
|
73
|
+
uninstall = uninstall.filter(chart => chart !== UI_PLUGIN_OPERATOR_CRD_CHART_NAME);
|
|
74
|
+
}
|
|
59
75
|
|
|
60
76
|
for (let i = 0; i < uninstall.length; i++) {
|
|
61
77
|
const chart = uninstall[i];
|
|
@@ -103,6 +119,12 @@ export default {
|
|
|
103
119
|
{{ t('plugins.setup.remove.registry.prompt') }}
|
|
104
120
|
</div>
|
|
105
121
|
</div>
|
|
122
|
+
<div v-if="hasPluginsInstalled" class="mt-20">
|
|
123
|
+
<Checkbox v-model="removeCRD" :primary="true" label-key="plugins.setup.remove.crd.title" />
|
|
124
|
+
<div class="checkbox-info">
|
|
125
|
+
{{ t('plugins.setup.remove.crd.prompt') }}
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
106
128
|
</template>
|
|
107
129
|
</Dialog>
|
|
108
130
|
</template>
|
|
@@ -567,7 +567,7 @@ export default {
|
|
|
567
567
|
</div>
|
|
568
568
|
<div>{{ plugin.description }}</div>
|
|
569
569
|
<div class="plugin-version">
|
|
570
|
-
<span v-if="plugin.installing
|
|
570
|
+
<span v-if="plugin.installing" class="plugin-installing">
|
|
571
571
|
-
|
|
572
572
|
</span>
|
|
573
573
|
<span v-else>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import Vue
|
|
2
|
+
import Vue from 'vue';
|
|
3
3
|
import debounce from 'lodash/debounce';
|
|
4
4
|
import { _EDIT, _VIEW } from '@shell/config/query-params';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
declare module 'vue/types/vue' {
|
|
7
|
+
/* eslint-disable no-unused-vars */
|
|
8
|
+
interface Vue {
|
|
9
|
+
queueResize(): void;
|
|
10
|
+
}
|
|
8
11
|
}
|
|
9
|
-
|
|
10
|
-
export default (
|
|
11
|
-
Vue as VueConstructor<Vue & TextAreaResize>
|
|
12
|
-
).extend({
|
|
12
|
+
export default Vue.extend({
|
|
13
13
|
inheritAttrs: false,
|
|
14
14
|
|
|
15
15
|
props: {
|
package/scripts/publish-shell.sh
CHANGED
|
@@ -55,7 +55,7 @@ function publish() {
|
|
|
55
55
|
pushd ${FOLDER} >/dev/null
|
|
56
56
|
|
|
57
57
|
# For now, copy the rancher components into the shell and ship them with it
|
|
58
|
-
if [ "$NAME" == "
|
|
58
|
+
if [ "$NAME" == "Shell" ]; then
|
|
59
59
|
echo "Adding Rancher Components"
|
|
60
60
|
cp -R ${BASE_DIR}/pkg/rancher-components/src/components ./rancher-components/
|
|
61
61
|
fi
|
package/scripts/typegen.sh
CHANGED
|
@@ -46,8 +46,8 @@ echo "// Auto-generated type definitions for shell" > ${INDEX}
|
|
|
46
46
|
echo "// Do not modify this file as changes will get overwritten" >> ${INDEX}
|
|
47
47
|
|
|
48
48
|
# Copy in the vue shim type definitions
|
|
49
|
-
if [ -f "$BASE_DIR/vue-shim.d
|
|
50
|
-
cat "$BASE_DIR/vue-shim.d
|
|
49
|
+
if [ -f "$BASE_DIR/shell/types/vue-shim.d" ]; then
|
|
50
|
+
cat "$BASE_DIR/shell/types/vue-shim.d" >> ${INDEX}
|
|
51
51
|
fi
|
|
52
52
|
|
|
53
53
|
function processDir() {
|
package/store/type-map.js
CHANGED
|
@@ -121,7 +121,13 @@
|
|
|
121
121
|
// continueOnMatch
|
|
122
122
|
// )
|
|
123
123
|
import { AGE, NAME, NAMESPACE as NAMESPACE_COL, STATE } from '@shell/config/table-headers';
|
|
124
|
-
import {
|
|
124
|
+
import {
|
|
125
|
+
CATALOG,
|
|
126
|
+
COUNT,
|
|
127
|
+
SCHEMA,
|
|
128
|
+
MANAGEMENT,
|
|
129
|
+
NAMESPACE
|
|
130
|
+
} from '@shell/config/types';
|
|
125
131
|
import { VIEW_IN_API, EXPANDED_GROUPS, FAVORITE_TYPES } from '@shell/store/prefs';
|
|
126
132
|
import {
|
|
127
133
|
addObject, findBy, insertAt, isArray, removeObject, filterBy
|
|
@@ -1762,8 +1768,11 @@ function ifHave(getters, option) {
|
|
|
1762
1768
|
export function isAdminUser(getters) {
|
|
1763
1769
|
const canEditSettings = (getters['management/schemaFor'](MANAGEMENT.SETTING)?.resourceMethods || []).includes('PUT');
|
|
1764
1770
|
const canEditFeatureFlags = (getters['management/schemaFor'](MANAGEMENT.FEATURE)?.resourceMethods || []).includes('PUT');
|
|
1771
|
+
const canInstallApps = (getters['management/schemaFor'](CATALOG.APP)?.resourceMethods || []).includes('PUT');
|
|
1772
|
+
const canAddRepos = (getters['management/schemaFor'](CATALOG.CLUSTER_REPO)?.resourceMethods || []).includes('PUT');
|
|
1773
|
+
const canPutHelmOperations = (getters['management/schemaFor'](CATALOG.OPERATION)?.resourceMethods || []).includes('PUT');
|
|
1765
1774
|
|
|
1766
|
-
return canEditSettings && canEditFeatureFlags;
|
|
1775
|
+
return canEditSettings && canEditFeatureFlags && canInstallApps && canAddRepos && canPutHelmOperations;
|
|
1767
1776
|
}
|
|
1768
1777
|
|
|
1769
1778
|
// Is V1 Istio installed?
|
package/types/vue-shim.d
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare module '*.vue' {
|
|
2
|
+
import Vue from 'vue';
|
|
3
|
+
export default Vue;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// This is required to keep typescript from complaining. It is required for
|
|
7
|
+
// our i18n plugin. For more info see:
|
|
8
|
+
// https://v2.vuejs.org/v2/guide/typescript.html?redirect=true#Augmenting-Types-for-Use-with-Plugins
|
|
9
|
+
declare module 'vue/types/vue' {
|
|
10
|
+
// eslint-disable-next-line no-unused-vars
|
|
11
|
+
interface Vue {
|
|
12
|
+
/**
|
|
13
|
+
* Lookup a given string with the given arguments
|
|
14
|
+
* @param raw if set, do not do HTML escaping.
|
|
15
|
+
*/
|
|
16
|
+
t: (key: string, args?: Record<string, any>, raw?: boolean) => string,
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare module 'js-yaml';
|
package/utils/create-yaml.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { indent as _indent } from '@shell/utils/string';
|
|
2
2
|
import { addObject, findBy, removeObject, removeObjects } from '@shell/utils/array';
|
|
3
3
|
import jsyaml from 'js-yaml';
|
|
4
|
-
import { cleanUp } from '@shell/utils/object';
|
|
4
|
+
import { cleanUp, isEmpty } from '@shell/utils/object';
|
|
5
5
|
|
|
6
6
|
export const SIMPLE_TYPES = [
|
|
7
7
|
'string',
|
|
@@ -114,7 +114,7 @@ export function createYaml(schemas, type, data, processAlwaysAdd = true, depth =
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
//
|
|
117
|
+
// Include all fields in schema's resourceFields as comments
|
|
118
118
|
const commentFields = Object.keys(schema.resourceFields || {});
|
|
119
119
|
|
|
120
120
|
commentFields.forEach((key) => {
|
|
@@ -123,12 +123,14 @@ export function createYaml(schemas, type, data, processAlwaysAdd = true, depth =
|
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
+
// add any fields defined in data as uncommented fields in yaml
|
|
126
127
|
for ( const key in data ) {
|
|
127
128
|
if ( typeof data[key] !== 'undefined' ) {
|
|
128
129
|
addObject(regularFields, key);
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
|
|
133
|
+
// ACTIVELY_REMOVE are fields that should be removed even if they are defined in data
|
|
132
134
|
for ( const entry of ACTIVELY_REMOVE ) {
|
|
133
135
|
const parts = entry.split(/\./);
|
|
134
136
|
const key = parts[parts.length - 1];
|
|
@@ -139,6 +141,7 @@ export function createYaml(schemas, type, data, processAlwaysAdd = true, depth =
|
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
143
|
|
|
144
|
+
// NEVER_ADD are fields that should not be added as comments, but may added as regular fields if already defined in data
|
|
142
145
|
for ( const entry of NEVER_ADD ) {
|
|
143
146
|
const parts = entry.split(/\./);
|
|
144
147
|
const key = parts[parts.length - 1];
|
|
@@ -149,6 +152,7 @@ export function createYaml(schemas, type, data, processAlwaysAdd = true, depth =
|
|
|
149
152
|
}
|
|
150
153
|
}
|
|
151
154
|
|
|
155
|
+
// do not include commented fields if already defined in data
|
|
152
156
|
removeObjects(commentFields, regularFields);
|
|
153
157
|
|
|
154
158
|
const regular = regularFields.map(k => stringifyField(k));
|
|
@@ -183,6 +187,7 @@ export function createYaml(schemas, type, data, processAlwaysAdd = true, depth =
|
|
|
183
187
|
out = 'type:';
|
|
184
188
|
}
|
|
185
189
|
|
|
190
|
+
// if a key on data is not listed in the schema's resourceFields, just convert it to yaml, add indents where needed, and return
|
|
186
191
|
if ( !field ) {
|
|
187
192
|
if (data[key]) {
|
|
188
193
|
try {
|
|
@@ -209,7 +214,9 @@ export function createYaml(schemas, type, data, processAlwaysAdd = true, depth =
|
|
|
209
214
|
const arrayOf = typeRef('array', type);
|
|
210
215
|
const referenceTo = typeRef('reference', type);
|
|
211
216
|
|
|
217
|
+
// type == map[mapOf]
|
|
212
218
|
if ( mapOf ) {
|
|
219
|
+
// if key is defined in data, convert the value to yaml, add newline+indent and add to output yaml string
|
|
213
220
|
if (data[key]) {
|
|
214
221
|
try {
|
|
215
222
|
const cleaned = cleanUp(data);
|
|
@@ -224,17 +231,20 @@ export function createYaml(schemas, type, data, processAlwaysAdd = true, depth =
|
|
|
224
231
|
if ( SIMPLE_TYPES.includes(mapOf) ) {
|
|
225
232
|
out += `\n# key: ${ mapOf }`;
|
|
226
233
|
} else {
|
|
234
|
+
// If not a simple type ie some sort of object/array, recusively build out commented fields (note data = null here) per the type's (mapOf's) schema
|
|
227
235
|
const chunk = createYaml(schemas, mapOf, null, processAlwaysAdd, depth + 1, (path ? `${ path }.${ key }` : key), rootType);
|
|
228
|
-
let indented = indent(chunk
|
|
236
|
+
let indented = indent(chunk);
|
|
229
237
|
|
|
238
|
+
// convert "# foo" to "#foo"
|
|
230
239
|
indented = indented.replace(/^(#)?\s\s\s\s/, '$1');
|
|
231
240
|
|
|
232
|
-
out += `\n
|
|
241
|
+
out += `\n${ indented }`;
|
|
233
242
|
}
|
|
234
243
|
|
|
235
244
|
return out;
|
|
236
245
|
}
|
|
237
246
|
|
|
247
|
+
// type == array[arrayOf]
|
|
238
248
|
if ( arrayOf ) {
|
|
239
249
|
if (data[key]) {
|
|
240
250
|
try {
|
|
@@ -256,6 +266,7 @@ export function createYaml(schemas, type, data, processAlwaysAdd = true, depth =
|
|
|
256
266
|
const chunk = createYaml(schemas, arrayOf, null, false, depth + 1, (path ? `${ path }.${ key }` : key), rootType);
|
|
257
267
|
let indented = indent(chunk, 2);
|
|
258
268
|
|
|
269
|
+
// turn "# foo" into "# - foo"
|
|
259
270
|
indented = indented.replace(/^(#)?\s*\s\s([^\s])/, '$1 - $2');
|
|
260
271
|
|
|
261
272
|
out += `\n${ indented }`;
|
|
@@ -303,8 +314,21 @@ export function createYaml(schemas, type, data, processAlwaysAdd = true, depth =
|
|
|
303
314
|
|
|
304
315
|
const subDef = findBy(schemas, 'id', type);
|
|
305
316
|
|
|
306
|
-
if ( subDef
|
|
307
|
-
|
|
317
|
+
if ( subDef) {
|
|
318
|
+
let chunk;
|
|
319
|
+
|
|
320
|
+
if (subDef?.resourceFields && !isEmpty(subDef?.resourceFields)) {
|
|
321
|
+
chunk = createYaml(schemas, type, data[key], processAlwaysAdd, depth + 1, (path ? `${ path }.${ key }` : key), rootType);
|
|
322
|
+
} else if (data[key]) {
|
|
323
|
+
// if there are no fields defined on the schema but there are in the data, just format data as yaml and add to output yaml
|
|
324
|
+
try {
|
|
325
|
+
const parsed = jsyaml.dump(data[key]);
|
|
326
|
+
|
|
327
|
+
chunk = parsed.trim();
|
|
328
|
+
} catch (e) {
|
|
329
|
+
console.error(`Error: Unale to parse data for yaml of type: ${ type }`, e); // eslint-disable-line no-console
|
|
330
|
+
}
|
|
331
|
+
}
|
|
308
332
|
|
|
309
333
|
out += `\n${ indent(chunk) }`;
|
|
310
334
|
} else {
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
Arguments:
|
|
2
|
-
/usr/local/bin/node /usr/local/Cellar/yarn/1.22.11/libexec/bin/yarn.js add @rancher/pkg@0.0.0
|
|
3
|
-
|
|
4
|
-
PATH:
|
|
5
|
-
/Users/nwm/.gem/ruby/3.1.2/bin:/Users/nwm/.rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/bin:/Users/nwm/.rubies/ruby-3.1.2/bin:/Users/nwm/.deno/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/Users/nwm/.rd/bin:/Users/nwm/go/bin:/usr/local/bin:/Users/nwm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/Library/Apple/usr/bin:/Users/nwm/.deno/bin:/usr/local/sbin:/Users/nwm/google-cloud-sdk/bin:/opt/local/bin:/opt/local/sbin:/Users/nwm/.rd/bin:/Users/nwm/go/bin:/Users/nwm/bin:/Applications/Utilities/kdiff3.app/Contents/MacOS/:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/Applications/Utilities/kdiff3.app/Contents/MacOS/:/Applications/Visual Studio Code.app/Contents/Resources/app/bin
|
|
6
|
-
|
|
7
|
-
Yarn version:
|
|
8
|
-
1.22.11
|
|
9
|
-
|
|
10
|
-
Node version:
|
|
11
|
-
16.16.0
|
|
12
|
-
|
|
13
|
-
Platform:
|
|
14
|
-
darwin x64
|
|
15
|
-
|
|
16
|
-
Trace:
|
|
17
|
-
Error: https://registry.yarnpkg.com/@rancher%2fpkg: Not found
|
|
18
|
-
at Request.params.callback [as _callback] (/usr/local/Cellar/yarn/1.22.11/libexec/lib/cli.js:66992:18)
|
|
19
|
-
at Request.self.callback (/usr/local/Cellar/yarn/1.22.11/libexec/lib/cli.js:140763:22)
|
|
20
|
-
at Request.emit (node:events:527:28)
|
|
21
|
-
at Request.<anonymous> (/usr/local/Cellar/yarn/1.22.11/libexec/lib/cli.js:141735:10)
|
|
22
|
-
at Request.emit (node:events:527:28)
|
|
23
|
-
at IncomingMessage.<anonymous> (/usr/local/Cellar/yarn/1.22.11/libexec/lib/cli.js:141657:12)
|
|
24
|
-
at Object.onceWrapper (node:events:641:28)
|
|
25
|
-
at IncomingMessage.emit (node:events:539:35)
|
|
26
|
-
at endReadableNT (node:internal/streams/readable:1345:12)
|
|
27
|
-
at processTicksAndRejections (node:internal/process/task_queues:83:21)
|
|
28
|
-
|
|
29
|
-
npm manifest:
|
|
30
|
-
{
|
|
31
|
-
"name": "@rancher/create-app",
|
|
32
|
-
"description": "Rancher UI Upgrade helper",
|
|
33
|
-
"version": "0.0.0",
|
|
34
|
-
"license": "Apache-2.0",
|
|
35
|
-
"author": "SUSE",
|
|
36
|
-
"private": false,
|
|
37
|
-
"bin": "./init",
|
|
38
|
-
"files": [
|
|
39
|
-
"*.*",
|
|
40
|
-
"init"
|
|
41
|
-
],
|
|
42
|
-
"engines": {
|
|
43
|
-
"node": ">=12"
|
|
44
|
-
},
|
|
45
|
-
"dependencies": {
|
|
46
|
-
"fs-extra": "^10.0.0"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
yarn manifest:
|
|
51
|
-
No manifest
|
|
52
|
-
|
|
53
|
-
Lockfile:
|
|
54
|
-
No lockfile
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import { BadgeState } from './index';
|
|
3
|
-
|
|
4
|
-
describe('BadgeState.vue', () => {
|
|
5
|
-
it('renders props.msg when passed', () => {
|
|
6
|
-
const label = 'Hello, World!';
|
|
7
|
-
|
|
8
|
-
const wrapper = shallowMount(BadgeState, { propsData: { label } });
|
|
9
|
-
|
|
10
|
-
expect(wrapper.find('span').text()).toMatch(label);
|
|
11
|
-
});
|
|
12
|
-
});
|