dashboard-shell-shell 3.0.5-test.1 → 3.0.5-test.11
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/styles/base/_variables.scss +3 -3
- package/assets/styles/global/_button.scss +7 -7
- package/assets/styles/global/_tooltip.scss +4 -4
- package/assets/styles/themes/_light.scss +3 -1
- package/assets/translations/zh-hans.yaml +76 -0
- package/components/ActionDropdown.vue +1 -1
- package/components/CopyToClipboard.vue +15 -0
- package/components/Drawer/Chrome.vue +2 -2
- package/components/Drawer/ResourceDetailDrawer/ConfigTab.vue +22 -22
- package/components/Drawer/ResourceDetailDrawer/YamlTab.vue +1 -1
- package/components/Drawer/ResourceDetailDrawer/index.vue +2 -1
- package/components/ExplorerMembers.vue +18 -3
- package/components/PodSecurityAdmission.vue +1 -1
- package/components/Resource/Detail/Metadata/IdentifyingInformation/index.vue +1 -3
- package/components/Resource/Detail/Metadata/KeyValue.vue +8 -4
- package/components/Resource/Detail/Metadata/index.vue +3 -1
- package/components/Resource/Detail/TitleBar/Title.vue +4 -3
- package/components/Resource/Detail/TitleBar/Top.vue +2 -0
- package/components/Resource/Detail/TitleBar/index.vue +109 -24
- package/components/ResourceDetail/Masthead/legacy.vue +235 -164
- package/components/ResourceDetail/legacy.vue +29 -13
- package/components/ResourceList/Masthead.vue +22 -14
- package/components/SortableTable/index.vue +2 -2
- package/components/Tabbed/Tab.vue +1 -1
- package/components/Tabbed/index.vue +51 -32
- package/components/auth/Principal.vue +35 -11
- package/components/breadcrumb/index.vue +316 -0
- package/components/form/LabeledSelect.vue +3 -2
- package/components/form/NameNsDescription.vue +5 -5
- package/components/form/Taints.vue +2 -1
- package/components/form/WorkloadPorts.vue +143 -123
- package/components/nav/Header.vue +3 -4
- package/components/nav/NamespaceFilter.vue +1 -2
- package/edit/workload/index.vue +3 -3
- package/package.json +1 -1
- package/pages/account/index.vue +25 -79
- package/pages/c/_cluster/auth/roles/index.vue +38 -5
- package/pkg/tsconfig.json +9 -9
- package/pkg/vue.config.js +2 -2
- package/plugins/dashboard-store/resource-class.js +28 -27
- package/rancher-components/BadgeState/BadgeState.vue +33 -52
- package/rancher-components/Banner/Banner.vue +2 -2
- package/rancher-components/RcDropdown/RcDropdownMenu.vue +8 -7
- package/scripts/publish-shell.sh +1 -1
- package/store/i18n.js +3 -0
- package/store/type-map.js +1 -1
- package/types/shell/index.d.ts +4 -30
- package/utils/error.js +3 -1
- package/utils/errorTranslate.json +15 -0
- package/vue.config.js +2 -2
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { Banner } from '@components/Banner';
|
|
3
|
+
import { get } from '@shell/utils/object';;
|
|
4
|
+
import {
|
|
5
|
+
AS, _DETAIL, _CONFIG, _YAML, MODE, _CREATE, _EDIT, _VIEW, _UNFLAG, _GRAPH
|
|
6
|
+
} from '@shell/config/query-params';
|
|
7
|
+
import { ExtensionPoint, PanelLocation } from '@shell/core/types';
|
|
8
|
+
import { useRuntimeFlag } from '@shell/composables/useRuntimeFlag';
|
|
9
|
+
import { useStore } from 'vuex';
|
|
10
|
+
|
|
11
|
+
// i18n-uses resourceDetail.header.*
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Resource Detail Masthead component.
|
|
15
|
+
*
|
|
16
|
+
* ToDo: this component seem to be picking up a lot of logic from special cases, could be simplified down to parameters and then customized per use-case via wrapper component
|
|
17
|
+
*/
|
|
18
|
+
export default {
|
|
19
|
+
|
|
20
|
+
name: 'MastheadResourceDetail',
|
|
21
|
+
|
|
22
|
+
components: {
|
|
23
|
+
// BadgeState,
|
|
24
|
+
Banner,
|
|
25
|
+
},
|
|
26
|
+
props: {
|
|
27
|
+
value: {
|
|
28
|
+
type: Object,
|
|
29
|
+
default: () => {
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
mode: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: 'view'
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
realMode: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: 'view'
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
as: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: _YAML,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
storeOverride: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: null,
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
resource: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: null,
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
resourceSubtype: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: null,
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
parentRouteOverride: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: null,
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
setup() {
|
|
72
|
+
const store = useStore();
|
|
73
|
+
const { featureDropdownMenu } = useRuntimeFlag(store);
|
|
74
|
+
|
|
75
|
+
return { featureDropdownMenu };
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
data() {
|
|
79
|
+
return {
|
|
80
|
+
DETAIL_VIEW: _DETAIL,
|
|
81
|
+
extensionType: ExtensionPoint.PANEL,
|
|
82
|
+
extensionLocation: PanelLocation.DETAILS_MASTHEAD,
|
|
83
|
+
Svg: require('~shell/assets/images/API.svg')
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
computed: {
|
|
88
|
+
dev() {
|
|
89
|
+
return this.$store.getters['prefs/dev'];
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
schema() {
|
|
93
|
+
const inStore = this.storeOverride || this.$store.getters['currentStore'](this.resource);
|
|
94
|
+
|
|
95
|
+
return this.$store.getters[`${ inStore }/schemaFor`]( this.resource );
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
isProjectHelmChart() {
|
|
99
|
+
return this.schema?.id === HELM.PROJECTHELMCHART;
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
shouldHifenize() {
|
|
103
|
+
return (this.mode === 'view' || this.mode === 'edit') && this.resourceSubtype?.length && this.value?.nameDisplay?.length;
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
parent() {
|
|
107
|
+
const displayName = this.value?.parentNameOverride || this.$store.getters['type-map/labelFor'](this.schema);
|
|
108
|
+
const product = this.$store.getters['currentProduct'].name;
|
|
109
|
+
|
|
110
|
+
const defaultLocation = {
|
|
111
|
+
name: 'c-cluster-product-resource',
|
|
112
|
+
params: {
|
|
113
|
+
resource: this.resource,
|
|
114
|
+
product,
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const location = this.value?.parentLocationOverride || defaultLocation;
|
|
119
|
+
|
|
120
|
+
if (this.parentRouteOverride) {
|
|
121
|
+
location.name = this.parentRouteOverride;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const typeOptions = this.$store.getters[`type-map/optionsFor`]( this.resource );
|
|
125
|
+
|
|
126
|
+
// 转换为中文
|
|
127
|
+
const displayName_zh_hans = {
|
|
128
|
+
'GlobalRole': '全局角色',
|
|
129
|
+
'RoleTemplate': '集群角色',
|
|
130
|
+
}
|
|
131
|
+
if (displayName_zh_hans[displayName]) {
|
|
132
|
+
displayName = displayName_zh_hans[displayName]
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (displayName == '集群角色' && (this.$route.query?.roleContext == 'NAMESPACE' || location.hash == '#NAMESPACE')) {
|
|
136
|
+
displayName = '项目或资源组角色'
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const out = {
|
|
140
|
+
displayName, location, ...typeOptions
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
return out;
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
displayName() {
|
|
148
|
+
let displayName = this.value.nameDisplay;
|
|
149
|
+
|
|
150
|
+
if (this.isProjectHelmChart) {
|
|
151
|
+
displayName = this.value.projectDisplayName;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return this.shouldHifenize ? ` - ${ displayName }` : displayName;
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
demoDisplay() {
|
|
158
|
+
|
|
159
|
+
const resources = this.$route.params?.resource || ''
|
|
160
|
+
|
|
161
|
+
const productId = this.$store.getters['type-map/groupForBasicType'](this.$store.getters['productId'], resources);
|
|
162
|
+
|
|
163
|
+
if (productId === undefined) {
|
|
164
|
+
return '';
|
|
165
|
+
}
|
|
166
|
+
const parts = productId.split('::');
|
|
167
|
+
const newString = 'root';
|
|
168
|
+
|
|
169
|
+
if (!parts?.includes(newString)) {
|
|
170
|
+
parts.unshift(newString); // 将字符串添加到数组第一位
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const partsEn = parts.map((item) => {
|
|
174
|
+
return this.$store.getters['i18n/t'](`typeLabel."${ item.toLowerCase() }"`);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
return partsEn;
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
location() {
|
|
181
|
+
const { parent } = this;
|
|
182
|
+
|
|
183
|
+
return parent?.location;
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
methods: {
|
|
189
|
+
get,
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
</script>
|
|
193
|
+
|
|
194
|
+
<template>
|
|
195
|
+
<div class="masthead">
|
|
196
|
+
<div class="title">
|
|
197
|
+
<!-- 标题区域 -->
|
|
198
|
+
<div
|
|
199
|
+
class="excram-list"
|
|
200
|
+
>
|
|
201
|
+
<span
|
|
202
|
+
v-for="(item,index) in demoDisplay"
|
|
203
|
+
:key="index"
|
|
204
|
+
>
|
|
205
|
+
<span>{{ item }}</span>
|
|
206
|
+
<span>/</span>
|
|
207
|
+
</span>
|
|
208
|
+
<span class="excram-last-name">
|
|
209
|
+
{{ (realMode === 'view'? '查看': realMode === 'edit' ? '编辑':'创建') + parent.displayName }}
|
|
210
|
+
</span>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
</template>
|
|
215
|
+
|
|
216
|
+
<style lang='scss' scoped>
|
|
217
|
+
|
|
218
|
+
HEADER {
|
|
219
|
+
margin: 0;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.primaryheader {
|
|
223
|
+
display: flex;
|
|
224
|
+
flex-direction: row;
|
|
225
|
+
align-items: center;
|
|
226
|
+
font-size:14px;
|
|
227
|
+
height: 50px;
|
|
228
|
+
|
|
229
|
+
h1 {
|
|
230
|
+
margin: 0;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.subheader{
|
|
235
|
+
display: flex;
|
|
236
|
+
flex-direction: row;
|
|
237
|
+
color: var(--input-label);
|
|
238
|
+
& > * {
|
|
239
|
+
margin: 5px 20px 5px 0px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.live-data {
|
|
243
|
+
color: var(--body-text)
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.state-banner {
|
|
248
|
+
margin: 3px 0 0 0;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.masthead-state {
|
|
252
|
+
font-size: initial;
|
|
253
|
+
display: inline-block;
|
|
254
|
+
position: relative;
|
|
255
|
+
/* top: -2px; */
|
|
256
|
+
font-size: 12px;
|
|
257
|
+
margin-left: 5px;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.masthead-istio {
|
|
261
|
+
.icon {
|
|
262
|
+
vertical-align: middle;
|
|
263
|
+
color: var(--primary);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.left-right-split {
|
|
268
|
+
display: grid;
|
|
269
|
+
align-items: center;
|
|
270
|
+
|
|
271
|
+
.left-half {
|
|
272
|
+
grid-column: 1;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.right-half {
|
|
276
|
+
grid-column: 2;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.resource-external {
|
|
281
|
+
font-size: 18px;
|
|
282
|
+
}
|
|
283
|
+
.excram-list{
|
|
284
|
+
font-size: 14px;
|
|
285
|
+
margin-bottom: 20px;
|
|
286
|
+
}
|
|
287
|
+
.excram-last-name{
|
|
288
|
+
color: var(--link);
|
|
289
|
+
}
|
|
290
|
+
.valid{
|
|
291
|
+
color: #d7d7d7;
|
|
292
|
+
margin: 0px 10px;
|
|
293
|
+
}
|
|
294
|
+
.detailIcon-span{
|
|
295
|
+
width: 24px;
|
|
296
|
+
height: 24px;
|
|
297
|
+
display: inline-block;
|
|
298
|
+
position: relative;
|
|
299
|
+
background: var(--primary);
|
|
300
|
+
margin-right: 10px;
|
|
301
|
+
}
|
|
302
|
+
.detailIcon{
|
|
303
|
+
position: absolute;
|
|
304
|
+
color: #fff;
|
|
305
|
+
font-size: 38px;
|
|
306
|
+
left: 4px;
|
|
307
|
+
top: -2px;
|
|
308
|
+
}
|
|
309
|
+
.primary-title{
|
|
310
|
+
display: flex;
|
|
311
|
+
align-items: center;
|
|
312
|
+
}
|
|
313
|
+
.detailIcon-span-title{
|
|
314
|
+
font-weight: bold;
|
|
315
|
+
}
|
|
316
|
+
</style>
|
|
@@ -326,6 +326,7 @@ export default {
|
|
|
326
326
|
<template>
|
|
327
327
|
<div style="display: flex;">
|
|
328
328
|
<div
|
|
329
|
+
v-if="hasLabel"
|
|
329
330
|
:class="{ 'labeled-container': true, raised, empty, [mode]: true, 'is-lable': isLabel }"
|
|
330
331
|
:style="{ border: 'none', width: selectWidth===''?'160px':selectWidth,lineHeight: '32px' }"
|
|
331
332
|
>
|
|
@@ -348,7 +349,7 @@ export default {
|
|
|
348
349
|
ref="select"
|
|
349
350
|
class="labeled-select"
|
|
350
351
|
:class="[
|
|
351
|
-
$attrs.class,
|
|
352
|
+
$attrs.class && $attrs.class.replace('mb-20', ''),
|
|
352
353
|
{
|
|
353
354
|
disabled: isView || disabled,
|
|
354
355
|
focused,
|
|
@@ -529,7 +530,7 @@ export default {
|
|
|
529
530
|
// Prevent namespace field from wiggling or changing
|
|
530
531
|
// height when it is toggled from a LabeledInput to a
|
|
531
532
|
// LabeledSelect.
|
|
532
|
-
padding-bottom: 1px;
|
|
533
|
+
// padding-bottom: 1px;
|
|
533
534
|
&:deep() .vs__actions:after {
|
|
534
535
|
padding-top: 10px;
|
|
535
536
|
}
|
|
@@ -360,7 +360,7 @@ export default {
|
|
|
360
360
|
|
|
361
361
|
colSpan() {
|
|
362
362
|
if (!this.horizontal) {
|
|
363
|
-
return `span-
|
|
363
|
+
return `span-6`;
|
|
364
364
|
}
|
|
365
365
|
// Name and namespace take up two columns.
|
|
366
366
|
// let cols = (this.nameNsHidden ? 0 : 2) + (this.descriptionHidden ? 0 : 1) + this.extraColumns.length;
|
|
@@ -439,8 +439,8 @@ export default {
|
|
|
439
439
|
<div
|
|
440
440
|
v-if="namespaced && !nameNsHidden && createNamespace"
|
|
441
441
|
:data-testid="componentTestid + '-namespace-create'"
|
|
442
|
-
class="col span-
|
|
443
|
-
:class=" isDialog? 'namespace-item-row mb-20': 'col span-
|
|
442
|
+
class="col span-6"
|
|
443
|
+
:class=" isDialog? 'namespace-item-row mb-20': 'col span-6'"
|
|
444
444
|
style="display: flex;"
|
|
445
445
|
>
|
|
446
446
|
|
|
@@ -473,7 +473,7 @@ export default {
|
|
|
473
473
|
<div
|
|
474
474
|
v-if="namespaced && !nameNsHidden && !createNamespace"
|
|
475
475
|
:data-testid="componentTestid + '-namespace'"
|
|
476
|
-
:class=" isDialog? 'namespace-item-row mb-20': 'col span-
|
|
476
|
+
:class=" isDialog? 'namespace-item-row mb-20': 'col span-6'"
|
|
477
477
|
>
|
|
478
478
|
<LabeledSelect
|
|
479
479
|
v-show="!createNamespace"
|
|
@@ -518,7 +518,7 @@ export default {
|
|
|
518
518
|
<!-- <div
|
|
519
519
|
v-show="!descriptionHidden"
|
|
520
520
|
:data-testid="componentTestid + '-description'"
|
|
521
|
-
:class="['col', extraColumns.length > 0 ? 'span-3' : 'span-
|
|
521
|
+
:class="['col', extraColumns.length > 0 ? 'span-3' : 'span-6']"
|
|
522
522
|
> -->
|
|
523
523
|
|
|
524
524
|
<!-- 额外的动态列 -->
|