dashboard-shell-shell 3.0.5-test.9 → 3.0.5-tsh-rh02

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.
Files changed (213) hide show
  1. package/assets/brand/csp/favicon.png +0 -0
  2. package/assets/icons/iconfont.css +4 -1
  3. package/assets/iconsNew/demo.css +539 -0
  4. package/assets/iconsNew/demo.css:Zone.Identifier +0 -0
  5. package/assets/iconsNew/demo_index.html +303 -0
  6. package/assets/iconsNew/demo_index.html:Zone.Identifier +0 -0
  7. package/assets/iconsNew/iconfont.css +43 -0
  8. package/assets/iconsNew/iconfont.css:Zone.Identifier +0 -0
  9. package/assets/iconsNew/iconfont.js +1 -0
  10. package/assets/iconsNew/iconfont.js:Zone.Identifier +0 -0
  11. package/assets/iconsNew/iconfont.json +44 -0
  12. package/assets/iconsNew/iconfont.json:Zone.Identifier +0 -0
  13. package/assets/iconsNew/iconfont.ttf +0 -0
  14. package/assets/iconsNew/iconfont.ttf:Zone.Identifier +0 -0
  15. package/assets/iconsNew/iconfont.woff +0 -0
  16. package/assets/iconsNew/iconfont.woff2 +0 -0
  17. package/assets/iconsNew/iconfont.woff2:Zone.Identifier +0 -0
  18. package/assets/iconsNew/iconfont.woff:Zone.Identifier +0 -0
  19. package/assets/images/login-logo.svg +9 -19
  20. package/assets/images/login-logo1.svg +9 -0
  21. package/assets/images/logo.svg +11 -0
  22. package/assets/images/pl/dark/logo.png +0 -0
  23. package/assets/images/pl/logo.svg +11 -0
  24. package/assets/styles/all.scss +23 -3
  25. package/assets/styles/app.scss +1 -0
  26. package/assets/styles/base/_helpers.scss +1 -1
  27. package/assets/styles/base/_variables.scss +2 -2
  28. package/assets/styles/fonts/_icons.scss +3 -2
  29. package/assets/styles/global/_button.scss +1 -1
  30. package/assets/styles/global/_form.scss +1 -0
  31. package/assets/styles/global/_select.scss +1 -1
  32. package/assets/styles/global/_tooltip.scss +5 -1
  33. package/assets/styles/themes/_light.scss +3 -3
  34. package/assets/styles/vendor/vue-select.scss +2 -1
  35. package/assets/translations/en-us.yaml +67 -0
  36. package/assets/translations/zh-hans.yaml +226 -24
  37. package/components/ButtonDropdown.vue +3 -1
  38. package/components/ClusterIconMenu.vue +1 -1
  39. package/components/CodeMirror.vue +6 -4
  40. package/components/ConsumptionGauge.vue +1 -1
  41. package/components/ContainerResourceLimit.vue +2 -2
  42. package/components/CruResource.vue +3 -2
  43. package/components/Drawer/ResourceDetailDrawer/ConfigTab.vue +22 -19
  44. package/components/Drawer/ResourceDetailDrawer/index.vue +3 -3
  45. package/components/ExplorerMembers.vue +10 -1
  46. package/components/GlobalRoleBindings.vue +69 -114
  47. package/components/PodSecurityAdmission.vue +1 -1
  48. package/components/PromptRemove.vue +23 -1
  49. package/components/RelatedResources.vue +3 -0
  50. package/components/Resource/Detail/TitleBar/composables.ts +16 -1
  51. package/components/Resource/Detail/TitleBar/index.vue +37 -24
  52. package/components/ResourceDetail/Masthead/index.vue +1 -1
  53. package/components/ResourceDetail/Masthead/latest.vue +1 -1
  54. package/components/ResourceDetail/Masthead/legacy.vue +8 -7
  55. package/components/ResourceDetail/legacy.vue +15 -15
  56. package/components/ResourceList/Masthead.vue +16 -15
  57. package/components/ResourceTable.vue +16 -0
  58. package/components/SideNav.vue +21 -21
  59. package/components/SingleClusterInfo.vue +2 -1
  60. package/components/SortableTable/THead.vue +46 -1
  61. package/components/SortableTable/index.vue +54 -18
  62. package/components/Tabbed/index.vue +6 -1
  63. package/components/actionButton/index.vue +649 -0
  64. package/components/auth/Principal.vue +16 -8
  65. package/components/auth/RoleDetailEdit.vue +11 -7
  66. package/components/breadcrumb/index.vue +13 -210
  67. package/components/form/ArrayList.vue +164 -147
  68. package/components/form/ArrayListGrouped.vue +5 -3
  69. package/components/form/ChangePassword.vue +1 -1
  70. package/components/form/ClusterAppearance.vue +4 -3
  71. package/components/form/Command.vue +4 -5
  72. package/components/form/Conditions.vue +15 -1
  73. package/components/form/Footer.vue +1 -0
  74. package/components/form/HealthCheck.vue +0 -2
  75. package/components/form/HookOption.vue +87 -58
  76. package/components/form/InputWithSelect.vue +8 -7
  77. package/components/form/KeyValue.vue +20 -2
  78. package/components/form/LabeledSelect.vue +3 -1
  79. package/components/form/Labels.vue +2 -2
  80. package/components/form/MatchExpressions.vue +4 -4
  81. package/components/form/Members/ClusterMembershipEditor.vue +1 -1
  82. package/components/form/Members/ClusterPermissionsEditor.vue +60 -41
  83. package/components/form/Members/MembershipEditor.vue +4 -4
  84. package/components/form/Members/ProjectMembershipEditor.vue +1 -1
  85. package/components/form/NameNsDescription.vue +3 -2
  86. package/components/form/Networking.vue +6 -9
  87. package/components/form/NodeAffinity.vue +29 -28
  88. package/components/form/PodAffinity.vue +23 -23
  89. package/components/form/Probe.vue +15 -11
  90. package/components/form/ProjectMemberEditor.vue +66 -48
  91. package/components/form/ResourceQuota/Namespace.vue +4 -4
  92. package/components/form/ResourceQuota/NamespaceRow.vue +11 -9
  93. package/components/form/ResourceQuota/Project.vue +4 -4
  94. package/components/form/ResourceQuota/ProjectRow.vue +36 -30
  95. package/components/form/ResourceSelector.vue +1 -1
  96. package/components/form/SecretSelector.vue +24 -23
  97. package/components/form/Security.vue +1 -3
  98. package/components/form/Select.vue +7 -1
  99. package/components/form/ServiceNameSelect.vue +2 -5
  100. package/components/form/ServicePorts.vue +149 -75
  101. package/components/form/Tolerations.vue +13 -9
  102. package/components/form/ValueFromResource.vue +110 -96
  103. package/components/formatter/WorkloadHealthScale.vue +4 -3
  104. package/components/nav/Group.vue +8 -1
  105. package/components/nav/Header.vue +51 -174
  106. package/components/nav/NamespaceFilter.vue +14 -19
  107. package/components/nav/TopLevelMenu.vue +101 -134
  108. package/components/nav/Type.vue +11 -3
  109. package/config/menuRouteMap.js +10 -0
  110. package/config/product/explorer.js +32 -10
  111. package/config/product/manager.js +28 -17
  112. package/config/product/uiplugins.js +13 -10
  113. package/config/router/navigation-guards/index.js +61 -3
  114. package/detail/node.vue +28 -23
  115. package/dialog/AddCustomBadgeDialog.vue +17 -9
  116. package/dialog/RollbackWorkloadDialog.vue +1 -1
  117. package/edit/autoscaling.horizontalpodautoscaler/external-metric.vue +1 -1
  118. package/edit/autoscaling.horizontalpodautoscaler/hpa-scaling-rule.vue +9 -6
  119. package/edit/autoscaling.horizontalpodautoscaler/index.vue +3 -1
  120. package/edit/autoscaling.horizontalpodautoscaler/metric-identifier.vue +2 -2
  121. package/edit/autoscaling.horizontalpodautoscaler/metric-object-reference.vue +7 -5
  122. package/edit/autoscaling.horizontalpodautoscaler/metric-target.vue +5 -3
  123. package/edit/autoscaling.horizontalpodautoscaler/metrics-row.vue +2 -2
  124. package/edit/autoscaling.horizontalpodautoscaler/object-metric.vue +2 -2
  125. package/edit/autoscaling.horizontalpodautoscaler/pod-metric.vue +1 -1
  126. package/edit/autoscaling.horizontalpodautoscaler/resource-metric.vue +2 -2
  127. package/edit/configmap.vue +4 -0
  128. package/edit/logging-flow/index.vue +1 -2
  129. package/edit/logging.banzaicloud.io.output/providers/awsElasticsearch.vue +3 -3
  130. package/edit/logging.banzaicloud.io.output/providers/azurestorage.vue +19 -19
  131. package/edit/logging.banzaicloud.io.output/providers/cloudwatch.vue +23 -23
  132. package/edit/logging.banzaicloud.io.output/providers/datadog.vue +19 -19
  133. package/edit/logging.banzaicloud.io.output/providers/elasticsearch.vue +14 -14
  134. package/edit/logging.banzaicloud.io.output/providers/forward.vue +12 -12
  135. package/edit/logging.banzaicloud.io.output/providers/gcs.vue +23 -23
  136. package/edit/logging.banzaicloud.io.output/providers/gelf.vue +6 -6
  137. package/edit/logging.banzaicloud.io.output/providers/kafka.vue +10 -10
  138. package/edit/logging.banzaicloud.io.output/providers/kinesisStream.vue +8 -8
  139. package/edit/logging.banzaicloud.io.output/providers/logdna.vue +17 -17
  140. package/edit/logging.banzaicloud.io.output/providers/logz.vue +7 -7
  141. package/edit/logging.banzaicloud.io.output/providers/loki.vue +12 -12
  142. package/edit/logging.banzaicloud.io.output/providers/newrelic.vue +3 -3
  143. package/edit/logging.banzaicloud.io.output/providers/opensearch.vue +14 -14
  144. package/edit/logging.banzaicloud.io.output/providers/redis.vue +6 -6
  145. package/edit/logging.banzaicloud.io.output/providers/s3.vue +23 -23
  146. package/edit/logging.banzaicloud.io.output/providers/splunkHec.vue +13 -13
  147. package/edit/logging.banzaicloud.io.output/providers/sumologic.vue +2 -2
  148. package/edit/logging.banzaicloud.io.output/providers/syslog.vue +54 -54
  149. package/edit/monitoring.coreos.com.alertmanagerconfig/receiverConfig.vue +32 -8
  150. package/edit/monitoring.coreos.com.alertmanagerconfig/types/dingding.vue +32 -0
  151. package/edit/monitoring.coreos.com.alertmanagerconfig/types/message.vue +52 -0
  152. package/edit/monitoring.coreos.com.alertmanagerconfig/types/snmp.vue +45 -0
  153. package/edit/monitoring.coreos.com.alertmanagerconfig/types/work.vue +31 -0
  154. package/edit/networking.k8s.io.ingress/Certificate.vue +14 -5
  155. package/edit/networking.k8s.io.ingress/DefaultBackend.vue +2 -2
  156. package/edit/networking.k8s.io.ingress/Rule.vue +5 -11
  157. package/edit/networking.k8s.io.ingress/RulePath.vue +105 -96
  158. package/edit/networking.k8s.io.networkpolicy/PolicyRule.vue +3 -3
  159. package/edit/networking.k8s.io.networkpolicy/PolicyRulePort.vue +4 -2
  160. package/edit/networking.k8s.io.networkpolicy/PolicyRuleTarget.vue +12 -11
  161. package/edit/networking.k8s.io.networkpolicy/index.vue +1 -1
  162. package/edit/persistentvolume/index.vue +3 -1
  163. package/edit/persistentvolumeclaim.vue +2 -0
  164. package/edit/provisioning.cattle.io.cluster/tabs/Basics.vue +1 -1
  165. package/edit/secret/index.vue +2 -2
  166. package/edit/service.vue +4 -1
  167. package/edit/storage.k8s.io.storageclass/index.vue +10 -8
  168. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/aws-ebs.vue +34 -27
  169. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/gce-pd.vue +15 -13
  170. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/vsphere-volume.vue +41 -39
  171. package/edit/workload/Job.vue +31 -34
  172. package/edit/workload/Upgrading.vue +5 -5
  173. package/edit/workload/index.vue +19 -15
  174. package/edit/workload/storage/Mount.vue +1 -0
  175. package/edit/workload/storage/awsElasticBlockStore.vue +9 -7
  176. package/edit/workload/storage/azureDisk.vue +14 -10
  177. package/edit/workload/storage/azureFile.vue +9 -7
  178. package/edit/workload/storage/csi/index.vue +6 -9
  179. package/edit/workload/storage/emptyDir.vue +7 -5
  180. package/edit/workload/storage/gcePersistentDisk.vue +9 -7
  181. package/edit/workload/storage/hostPath.vue +7 -5
  182. package/edit/workload/storage/nfs.vue +8 -6
  183. package/edit/workload/storage/persistentVolumeClaim/index.vue +12 -10
  184. package/edit/workload/storage/persistentVolumeClaim/persistentvolumeclaim.vue +20 -15
  185. package/edit/workload/storage/secret.vue +9 -6
  186. package/edit/workload/storage/vsphereVolume.vue +11 -7
  187. package/initialize/app-extended.js +7 -1
  188. package/list/management.cattle.io.podsecurityadmissionconfigurationtemplate.vue +8 -6
  189. package/mixins/create-edit-view/impl.js +10 -0
  190. package/models/provisioning.cattle.io.cluster.js +19 -18
  191. package/models/workload.js +2 -2
  192. package/package.json +1 -1
  193. package/pages/account/index.vue +93 -58
  194. package/pages/auth/setup.vue +36 -17
  195. package/pages/c/_cluster/auth/roles/index.vue +27 -3
  196. package/pages/c/_cluster/explorer/ConfigBadge.vue +1 -1
  197. package/pages/c/_cluster/explorer/index.vue +2 -1
  198. package/pages/c/_cluster/explorer/tools/index.vue +6 -6
  199. package/pages/home.vue +55 -13
  200. package/plugins/dashboard-store/actions.js +1 -1
  201. package/rancher-components/Banner/Banner.vue +14 -2
  202. package/rancher-components/Form/Radio/RadioGroup.vue +9 -1
  203. package/rancher-components/LabeledTooltip/LabeledTooltip.vue +31 -2
  204. package/scripts/build-pkg.sh +18 -23
  205. package/scripts/publish-shell.sh +1 -1
  206. package/store/i18n.js +1 -0
  207. package/store/index.js +4 -4
  208. package/store/type-map.js +0 -2
  209. package/types/shell/index.d.ts +8 -0
  210. package/utils/error.js +23 -3
  211. package/utils/errorTranslate.json +402 -8
  212. package/utils/errorTranslateNew.json +39 -0
  213. package/utils/roleFiltering.js +33 -0
@@ -0,0 +1,649 @@
1
+ <script>
2
+ import { KUBERNETES, PROJECT } from '@shell/config/labels-annotations';
3
+ import { FLEET, NAMESPACE, MANAGEMENT, HELM } from '@shell/config/types';
4
+ import ButtonGroup from '@shell/components/ButtonGroup';
5
+ // import { BadgeState } from '@components/BadgeState';
6
+ import DotState from '@shell/components/DotState.vue';
7
+ import { Banner } from '@components/Banner';
8
+ import { get } from '@shell/utils/object';
9
+ import { NAME as FLEET_NAME } from '@shell/config/product/fleet';
10
+ import { HIDE_SENSITIVE } from '@shell/store/prefs';
11
+ import {
12
+ AS, _DETAIL, _CONFIG, _YAML, MODE, _CREATE, _EDIT, _VIEW, _UNFLAG, _GRAPH
13
+ } from '@shell/config/query-params';
14
+ import { ExtensionPoint, PanelLocation } from '@shell/core/types';
15
+ import ExtensionPanel from '@shell/components/ExtensionPanel';
16
+ import TabTitle from '@shell/components/TabTitle';
17
+ import ActionMenu from '@shell/components/ActionMenuShell.vue';
18
+ import { useRuntimeFlag } from '@shell/composables/useRuntimeFlag';
19
+ import { useStore } from 'vuex';
20
+
21
+ // i18n-uses resourceDetail.header.*
22
+
23
+ /**
24
+ * Resource Detail Masthead component.
25
+ *
26
+ * 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
27
+ */
28
+ export default {
29
+
30
+ name: 'MastheadResourceDetail',
31
+
32
+ components: {
33
+ // BadgeState,
34
+ DotState,
35
+ Banner,
36
+ ButtonGroup,
37
+ ExtensionPanel,
38
+ TabTitle,
39
+ ActionMenu,
40
+ },
41
+ props: {
42
+ value: {
43
+ type: Object,
44
+ default: () => {
45
+ return {};
46
+ }
47
+ },
48
+
49
+ isManuallyHide: {
50
+ type: Boolean,
51
+ default: true
52
+ },
53
+
54
+ mode: {
55
+ type: String,
56
+ default: 'create'
57
+ },
58
+
59
+ realMode: {
60
+ type: String,
61
+ default: 'create'
62
+ },
63
+
64
+ as: {
65
+ type: String,
66
+ default: _YAML,
67
+ },
68
+
69
+ hasGraph: {
70
+ type: Boolean,
71
+ default: false
72
+ },
73
+
74
+ hasDetail: {
75
+ type: Boolean,
76
+ default: false
77
+ },
78
+
79
+ hasEdit: {
80
+ type: Boolean,
81
+ default: false
82
+ },
83
+
84
+ storeOverride: {
85
+ type: String,
86
+ default: null,
87
+ },
88
+
89
+ resource: {
90
+ type: String,
91
+ default: null,
92
+ },
93
+
94
+ resourceSubtype: {
95
+ type: String,
96
+ default: null,
97
+ },
98
+
99
+ parentRouteOverride: {
100
+ type: String,
101
+ default: null,
102
+ },
103
+
104
+ canViewYaml: {
105
+ type: Boolean,
106
+ default: false,
107
+ }
108
+ },
109
+
110
+ setup() {
111
+ const store = useStore();
112
+ const { featureDropdownMenu } = useRuntimeFlag(store);
113
+
114
+ return { featureDropdownMenu };
115
+ },
116
+
117
+ data() {
118
+ return {
119
+ DETAIL_VIEW: _DETAIL,
120
+ extensionType: ExtensionPoint.PANEL,
121
+ extensionLocation: PanelLocation.DETAILS_MASTHEAD,
122
+ Svg: require('~shell/assets/images/API.svg')
123
+ };
124
+ },
125
+
126
+ computed: {
127
+ dev() {
128
+ return this.$store.getters['prefs/dev'];
129
+ },
130
+
131
+ schema() {
132
+ const inStore = this.storeOverride || this.$store.getters['currentStore'](this.resource);
133
+
134
+ return this.$store.getters[`${ inStore }/schemaFor`]( this.resource );
135
+ },
136
+
137
+ isView() {
138
+ return this.mode === _VIEW;
139
+ },
140
+
141
+ isEdit() {
142
+ return this.mode === _EDIT;
143
+ },
144
+
145
+ isCreate() {
146
+ return this.mode === _CREATE;
147
+ },
148
+
149
+ isNamespace() {
150
+ return this.schema?.id === NAMESPACE;
151
+ },
152
+
153
+ isProject() {
154
+ return this.schema?.id === MANAGEMENT.PROJECT;
155
+ },
156
+
157
+ isProjectHelmChart() {
158
+ return this.schema?.id === HELM.PROJECTHELMCHART;
159
+ },
160
+
161
+ hasMultipleNamespaces() {
162
+ return !!this.value.namespaces;
163
+ },
164
+
165
+ namespace() {
166
+ if (this.value?.metadata?.namespace) {
167
+ return this.value?.metadata?.namespace;
168
+ }
169
+
170
+ return null;
171
+ },
172
+
173
+ detailsAction() {
174
+ return this.value?.detailsAction;
175
+ },
176
+
177
+ shouldHifenize() {
178
+ return (this.mode === 'view' || this.mode === 'edit') && this.resourceSubtype?.length && this.value?.nameDisplay?.length;
179
+ },
180
+
181
+ namespaceLocation() {
182
+ if (!this.isNamespace) {
183
+ return this.value.namespaceLocation || {
184
+ name: 'c-cluster-product-resource-id',
185
+ params: {
186
+ cluster: this.$route.params.cluster,
187
+ product: this.$store.getters['productId'],
188
+ resource: NAMESPACE,
189
+ id: this.$route.params.namespace
190
+ }
191
+ };
192
+ }
193
+
194
+ return null;
195
+ },
196
+
197
+ isWorkspace() {
198
+ return this.$store.getters['productId'] === FLEET_NAME && !!this.value?.metadata?.namespace;
199
+ },
200
+
201
+ workspaceLocation() {
202
+ return {
203
+ name: 'c-cluster-product-resource-id',
204
+ params: {
205
+ cluster: this.$route.params.cluster,
206
+ product: this.$store.getters['productId'],
207
+ resource: FLEET.WORKSPACE,
208
+ id: this.$route.params.namespace
209
+ }
210
+ };
211
+ },
212
+
213
+ project() {
214
+ if (this.isNamespace) {
215
+ const cluster = this.$store.getters['currentCluster'];
216
+
217
+ if (cluster) {
218
+ const id = (this.value?.metadata?.labels || {})[PROJECT];
219
+
220
+ return this.$store.getters['management/byId'](MANAGEMENT.PROJECT, `${ cluster.id }/${ id }`);
221
+ }
222
+ }
223
+
224
+ return null;
225
+ },
226
+
227
+ banner() {
228
+ if (this.value?.stateObj?.error) {
229
+ const defaultErrorMessage = this.t('resourceDetail.masthead.defaultBannerMessage.error', undefined, true);
230
+
231
+ return {
232
+ color: 'error',
233
+ message: this.value.stateObj.message || defaultErrorMessage
234
+ };
235
+ }
236
+
237
+ if (this.value?.spec?.paused) {
238
+ return {
239
+ color: 'info',
240
+ message: this.t('asyncButton.pause.description')
241
+ };
242
+ }
243
+
244
+ if (this.value?.stateObj?.transitioning) {
245
+ const defaultTransitioningMessage = this.t('resourceDetail.masthead.defaultBannerMessage.transitioning', undefined, true);
246
+
247
+ return {
248
+ color: 'info',
249
+ message: this.value.stateObj.message || defaultTransitioningMessage
250
+ };
251
+ }
252
+
253
+ return null;
254
+ },
255
+
256
+ parent() {
257
+ let displayName = this.value?.parentNameOverride || this.$store.getters['type-map/labelFor'](this.schema);
258
+ const product = this.$store.getters['currentProduct'].name;
259
+
260
+ const defaultLocation = {
261
+ name: 'c-cluster-product-resource',
262
+ params: {
263
+ resource: this.resource,
264
+ product,
265
+ }
266
+ };
267
+
268
+ const location = this.value?.parentLocationOverride || defaultLocation;
269
+
270
+ if (this.parentRouteOverride) {
271
+ location.name = this.parentRouteOverride;
272
+ }
273
+
274
+ const typeOptions = this.$store.getters[`type-map/optionsFor`]( this.resource );
275
+
276
+ // 转换为中文
277
+ const displayName_zh_hans = {
278
+ 'GlobalRole': '全局角色',
279
+ 'RoleTemplate': '集群角色',
280
+ }
281
+ if (displayName_zh_hans[displayName]) {
282
+ displayName = displayName_zh_hans[displayName]
283
+ }
284
+
285
+ if (displayName == '集群角色' && (this.$route.query?.roleContext == 'NAMESPACE' || location.hash == '#NAMESPACE')) {
286
+ displayName = '项目或资源组角色'
287
+ }
288
+
289
+ const out = {
290
+ displayName, location, ...typeOptions
291
+ };
292
+
293
+ return out;
294
+ },
295
+
296
+ hideSensitiveData() {
297
+ return this.$store.getters['prefs/get'](HIDE_SENSITIVE);
298
+ },
299
+
300
+ sensitiveOptions() {
301
+ return [
302
+ {
303
+ tooltipKey: 'resourceDetail.masthead.sensitive.hide',
304
+ icon: 'icon-hide',
305
+ value: true,
306
+ },
307
+ {
308
+ tooltipKey: 'resourceDetail.masthead.sensitive.show',
309
+ icon: 'icon-show',
310
+ value: false
311
+ }
312
+ ];
313
+ },
314
+
315
+ viewOptions() {
316
+ const out = [];
317
+
318
+ if ( this.hasDetail ) {
319
+ out.push({
320
+ labelKey: 'resourceDetail.masthead.detail',
321
+ value: _DETAIL,
322
+ });
323
+ }
324
+
325
+ if ( this.hasEdit && this.parent?.showConfigView !== false) {
326
+ out.push({
327
+ labelKey: 'resourceDetail.masthead.config',
328
+ value: _CONFIG,
329
+ });
330
+ }
331
+
332
+ if ( this.hasGraph ) {
333
+ out.push({
334
+ labelKey: 'resourceDetail.masthead.graph',
335
+ value: _GRAPH,
336
+ });
337
+ }
338
+
339
+ // if ( this.canViewYaml ) {
340
+ // out.push({
341
+ // labelKey: 'resourceDetail.masthead.yaml',
342
+ // value: _YAML,
343
+ // });
344
+ // }
345
+
346
+ if ( out.length < 2 ) {
347
+ return null;
348
+ }
349
+
350
+ return out;
351
+ },
352
+
353
+ currentView: {
354
+ get() {
355
+ return this.as;
356
+ },
357
+
358
+ set(val) {
359
+ switch ( val ) {
360
+ case _DETAIL:
361
+ this.$router.applyQuery({
362
+ [MODE]: _UNFLAG,
363
+ [AS]: _UNFLAG,
364
+ });
365
+ break;
366
+ case _CONFIG:
367
+ this.$router.applyQuery({
368
+ [MODE]: _UNFLAG,
369
+ [AS]: _CONFIG,
370
+ });
371
+ break;
372
+ case _GRAPH:
373
+ this.$router.applyQuery({
374
+ [MODE]: _UNFLAG,
375
+ [AS]: _GRAPH,
376
+ });
377
+ break;
378
+ case _YAML:
379
+ this.$router.applyQuery({
380
+ [MODE]: _UNFLAG,
381
+ [AS]: _YAML,
382
+ });
383
+ break;
384
+ }
385
+ },
386
+ },
387
+
388
+ showSensitiveToggle() {
389
+ return !!this.value.hasSensitiveData && this.mode === _VIEW && this.as !== _YAML;
390
+ },
391
+
392
+ managedWarning() {
393
+ const { value } = this;
394
+ const labels = value?.metadata?.labels || {};
395
+
396
+ const managedBy = labels[KUBERNETES.MANAGED_BY] || '';
397
+ const appName = labels[KUBERNETES.MANAGED_NAME] || labels[KUBERNETES.INSTANCE] || '';
398
+
399
+ return {
400
+ show: this.mode === _EDIT && !!managedBy,
401
+ type: value?.kind || '',
402
+ hasName: appName ? 'yes' : 'no',
403
+ appName,
404
+ managedBy,
405
+ };
406
+ },
407
+
408
+ displayName() {
409
+ let displayName = this.value.nameDisplay;
410
+
411
+ if (this.isProjectHelmChart) {
412
+ displayName = this.value.projectDisplayName;
413
+ }
414
+
415
+ return this.shouldHifenize ? ` - ${ displayName }` : displayName;
416
+ },
417
+
418
+ demoDisplay() {
419
+ const product = this.$store.getters['productId'];
420
+
421
+ const resources = this.location?.params?.resource || this.$route.params?.resource || ''
422
+
423
+ const productId = this.$store.getters['type-map/groupForBasicType'](this.$store.getters['productId'], resources);
424
+
425
+ if (productId === undefined) {
426
+ return '';
427
+ }
428
+ const parts = productId?.split('::') || [];
429
+ const newString = 'root';
430
+
431
+ if (!parts?.includes(newString)) {
432
+ parts.unshift(newString); // 将字符串添加到数组第一位
433
+ }
434
+
435
+ const partsEn = parts.map((item) => {
436
+ return this.$store.getters['i18n/t'](`typeLabel."${ item.toLowerCase() }"`);
437
+ });
438
+
439
+ return partsEn;
440
+ },
441
+ menuIcon() {
442
+ const product = this.$store.getters['productId'];
443
+
444
+ const resources = this.location?.params?.resource || this.$route.params?.resource || ''
445
+
446
+
447
+ return this.$store.getters['type-map/groupsForVirTypes'](product, resources) || 'default menuIcon';
448
+ },
449
+
450
+ location() {
451
+ const { parent } = this;
452
+
453
+ return parent?.location;
454
+ },
455
+
456
+ hideNamespaceLocation() {
457
+ return this.$store.getters['currentProduct'].hideNamespaceLocation || this.value.namespaceLocation === null;
458
+ },
459
+
460
+ resourceExternalLink() {
461
+ return this.value.resourceExternalLink;
462
+ },
463
+ },
464
+
465
+ methods: {
466
+ get,
467
+
468
+ showActions() {
469
+ this.$store.commit('action-menu/show', {
470
+ resources: this.value,
471
+ elem: this.$refs.actions,
472
+ });
473
+ },
474
+
475
+ toggleSensitiveData(e) {
476
+ this.$store.dispatch('prefs/set', { key: HIDE_SENSITIVE, value: !!e });
477
+ },
478
+
479
+ invokeDetailsAction() {
480
+ const action = this.detailsAction;
481
+
482
+ if (action) {
483
+ const fn = this.value[action.action];
484
+
485
+ if (fn) {
486
+ fn.apply(this.value, []);
487
+ }
488
+ }
489
+ }
490
+ }
491
+ };
492
+ </script>
493
+
494
+ <template>
495
+ <div class="actions">
496
+ <button
497
+ v-if="detailsAction && currentView === DETAIL_VIEW && isView"
498
+ type="button"
499
+ class="btn role-primary actions mr-10"
500
+ :disabled="!detailsAction.enabled"
501
+ @click="invokeDetailsAction"
502
+ >
503
+ {{ detailsAction.label }}
504
+ </button>
505
+ <ButtonGroup
506
+ v-if="showSensitiveToggle"
507
+ :value="!!hideSensitiveData"
508
+ icon-size="lg"
509
+ :options="sensitiveOptions"
510
+ class="mr-10"
511
+ @update:value="toggleSensitiveData"
512
+ />
513
+ <ButtonGroup
514
+ v-if="viewOptions && isView"
515
+ v-model:value="currentView"
516
+ :options="viewOptions"
517
+ class="mr-10"
518
+ />
519
+ <template v-if="featureDropdownMenu">
520
+ <ActionMenu
521
+ v-if="isView"
522
+ button-role="multiAction"
523
+ button-size="compact"
524
+ :resource="value"
525
+ data-testid="masthead-action-menu"
526
+ />
527
+ </template>
528
+ <template v-else>
529
+ <button
530
+ v-if="isView"
531
+ ref="actions"
532
+ data-testid="masthead-action-menu"
533
+ aria-haspopup="true"
534
+ type="button"
535
+ class="btn role-multi-action actions"
536
+ @click="showActions"
537
+ >
538
+ <i class="icon icon-actions" />
539
+ </button>
540
+ </template>
541
+ </div>
542
+ </template>
543
+
544
+ <style lang='scss' scoped>
545
+ .masthead {
546
+ padding-bottom: 10px;
547
+ /* border-bottom: 1px solid var(--border); */
548
+ margin-bottom: 10px;
549
+ }
550
+
551
+ HEADER {
552
+ margin: 0;
553
+ }
554
+
555
+ .primaryheader {
556
+ display: flex;
557
+ flex-direction: row;
558
+ align-items: center;
559
+ font-size:14px;
560
+ height: 50px;
561
+
562
+ h1 {
563
+ margin: 0;
564
+ }
565
+ }
566
+
567
+ .subheader{
568
+ display: flex;
569
+ flex-direction: row;
570
+ color: var(--input-label);
571
+ & > * {
572
+ margin: 5px 20px 5px 0px;
573
+ }
574
+
575
+ .live-data {
576
+ color: var(--body-text)
577
+ }
578
+ }
579
+
580
+ .state-banner {
581
+ margin: 3px 0 0 0;
582
+ }
583
+
584
+ .masthead-state {
585
+ font-size: initial;
586
+ display: inline-block;
587
+ position: relative;
588
+ /* top: -2px; */
589
+ font-size: 12px;
590
+ margin-left: 5px;
591
+ }
592
+
593
+ .masthead-istio {
594
+ .icon {
595
+ vertical-align: middle;
596
+ color: var(--primary);
597
+ }
598
+ }
599
+
600
+ .left-right-split {
601
+ display: grid;
602
+ align-items: center;
603
+
604
+ .left-half {
605
+ grid-column: 1;
606
+ }
607
+
608
+ .right-half {
609
+ grid-column: 2;
610
+ }
611
+ }
612
+
613
+ .resource-external {
614
+ font-size: 18px;
615
+ }
616
+ .excram-list{
617
+ font-size: 14px;
618
+ margin-bottom: 20px;
619
+ }
620
+ .excram-last-name{
621
+ color: var(--link);
622
+ }
623
+ .valid{
624
+ color: #d7d7d7;
625
+ margin: 0px 10px;
626
+ }
627
+ .detailIcon-span{
628
+ width: 24px;
629
+ height: 24px;
630
+ display: inline-block;
631
+ position: relative;
632
+ background: var(--primary);
633
+ margin-right: 10px;
634
+ }
635
+ .detailIcon{
636
+ position: absolute;
637
+ color: #fff;
638
+ font-size: 38px;
639
+ left: 4px;
640
+ top: -2px;
641
+ }
642
+ .primary-title{
643
+ display: flex;
644
+ align-items: center;
645
+ }
646
+ .detailIcon-span-title{
647
+ font-weight: bold;
648
+ }
649
+ </style>
@@ -3,6 +3,10 @@ import { NORMAN } from '@shell/config/types';
3
3
 
4
4
  export default {
5
5
  props: {
6
+ userLogo: {
7
+ type: Boolean,
8
+ default: false,
9
+ },
6
10
  value: {
7
11
  type: String,
8
12
  required: true,
@@ -20,7 +24,11 @@ export default {
20
24
  isShowPass: {
21
25
  type: Boolean,
22
26
  default: false,
23
- }
27
+ },
28
+ userLogoSize: {
29
+ type: Number,
30
+ default: 20,
31
+ },
24
32
  },
25
33
 
26
34
  async fetch() {
@@ -90,8 +98,9 @@ export default {
90
98
  </template>
91
99
 
92
100
  <template v-else-if="principal">
93
- <div class="avatar">
101
+ <div v-if="userLogo" :style="userLogoSize === 79 ? { width: '287px' } : {}" class="avatar">
94
102
  <img
103
+ :style="{ width: userLogoSize + 'px', height: userLogoSize + 'px', marginRight: '10px' }"
95
104
  src="@shell/assets/images/user.png"
96
105
  :class="{'round': principal.roundAvatar}"
97
106
  :alt="t('principal.alt.avatar')"
@@ -166,16 +175,15 @@ export default {
166
175
  </template>
167
176
 
168
177
  <style lang="scss" scoped>
169
- $size: 20px;
178
+ $size: 24px;
170
179
 
171
180
  .principal {
172
181
  display: grid;
173
182
  grid-template-areas:
174
183
  "avatar name"
175
184
  "avatar description";
176
- grid-template-columns: $size auto;
185
+ grid-template-columns: min-content auto;
177
186
  // grid-template-rows: auto math.div($size, 2);
178
- column-gap: 10px;
179
187
 
180
188
  th {
181
189
  text-align: left;
@@ -209,7 +217,7 @@ export default {
209
217
  .avatar {
210
218
  /* grid-area: avatar;
211
219
  text-align: center; */
212
- width: 287px;
220
+ // width: 287px;
213
221
  display: flex;
214
222
  justify-content: center;
215
223
  align-items: center;
@@ -231,13 +239,13 @@ export default {
231
239
 
232
240
  .name {
233
241
  grid-area: name;
234
- line-height: math.div($size, 2);
242
+ line-height: 16px;
235
243
  overflow-wrap: anywhere;
236
244
  }
237
245
 
238
246
  .description {
239
247
  grid-area: description;
240
- line-height: math.div($size, 2);
248
+ line-height: 16px;
241
249
  }
242
250
  }
243
251
  </style>