dashboard-shell-shell 3.0.5-test.4 → 3.0.5-test.41

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 (165) hide show
  1. package/assets/brand/csp/favicon.png +0 -0
  2. package/assets/icons/iconfont.css +4 -1
  3. package/assets/images/pl/dark/logo.png +0 -0
  4. package/assets/styles/all.scss +23 -3
  5. package/assets/styles/base/_variables.scss +5 -5
  6. package/assets/styles/fonts/_icons.scss +3 -2
  7. package/assets/styles/global/_button.scss +8 -8
  8. package/assets/styles/global/_form.scss +1 -0
  9. package/assets/styles/global/_select.scss +1 -1
  10. package/assets/styles/global/_tooltip.scss +9 -5
  11. package/assets/styles/themes/_light.scss +6 -4
  12. package/assets/styles/vendor/vue-select.scss +2 -1
  13. package/assets/translations/en-us.yaml +59 -0
  14. package/assets/translations/zh-hans.yaml +175 -15
  15. package/components/ActionDropdown.vue +1 -1
  16. package/components/ButtonDropdown.vue +3 -1
  17. package/components/CodeMirror.vue +6 -4
  18. package/components/ContainerResourceLimit.vue +2 -2
  19. package/components/CopyToClipboard.vue +15 -0
  20. package/components/Drawer/Chrome.vue +2 -2
  21. package/components/Drawer/ResourceDetailDrawer/ConfigTab.vue +30 -27
  22. package/components/Drawer/ResourceDetailDrawer/YamlTab.vue +1 -1
  23. package/components/Drawer/ResourceDetailDrawer/index.vue +5 -4
  24. package/components/ExplorerMembers.vue +28 -4
  25. package/components/GlobalRoleBindings.vue +51 -112
  26. package/components/PodSecurityAdmission.vue +2 -2
  27. package/components/PromptRemove.vue +17 -1
  28. package/components/RelatedResources.vue +3 -0
  29. package/components/Resource/Detail/Metadata/IdentifyingInformation/index.vue +1 -3
  30. package/components/Resource/Detail/Metadata/KeyValue.vue +8 -4
  31. package/components/Resource/Detail/Metadata/index.vue +3 -1
  32. package/components/Resource/Detail/TitleBar/Title.vue +4 -3
  33. package/components/Resource/Detail/TitleBar/Top.vue +2 -0
  34. package/components/Resource/Detail/TitleBar/composables.ts +16 -1
  35. package/components/Resource/Detail/TitleBar/index.vue +123 -25
  36. package/components/ResourceDetail/Masthead/index.vue +1 -1
  37. package/components/ResourceDetail/Masthead/latest.vue +1 -1
  38. package/components/ResourceDetail/Masthead/legacy.vue +8 -7
  39. package/components/ResourceDetail/legacy.vue +18 -16
  40. package/components/ResourceList/Masthead.vue +13 -17
  41. package/components/ResourceTable.vue +10 -0
  42. package/components/SideNav.vue +21 -21
  43. package/components/SortableTable/THead.vue +46 -1
  44. package/components/SortableTable/index.vue +40 -20
  45. package/components/Tabbed/index.vue +6 -1
  46. package/components/auth/Principal.vue +10 -5
  47. package/components/auth/RoleDetailEdit.vue +11 -7
  48. package/components/breadcrumb/index.vue +119 -0
  49. package/components/form/ArrayList.vue +164 -147
  50. package/components/form/ArrayListGrouped.vue +5 -3
  51. package/components/form/ChangePassword.vue +1 -1
  52. package/components/form/Command.vue +4 -5
  53. package/components/form/Conditions.vue +15 -1
  54. package/components/form/Footer.vue +1 -0
  55. package/components/form/HealthCheck.vue +0 -2
  56. package/components/form/HookOption.vue +87 -58
  57. package/components/form/InputWithSelect.vue +8 -7
  58. package/components/form/KeyValue.vue +20 -2
  59. package/components/form/LabeledSelect.vue +6 -3
  60. package/components/form/Labels.vue +2 -2
  61. package/components/form/MatchExpressions.vue +4 -4
  62. package/components/form/Members/ClusterMembershipEditor.vue +1 -1
  63. package/components/form/Members/ClusterPermissionsEditor.vue +31 -28
  64. package/components/form/Members/MembershipEditor.vue +2 -2
  65. package/components/form/NameNsDescription.vue +1 -1
  66. package/components/form/Networking.vue +6 -9
  67. package/components/form/NodeAffinity.vue +29 -28
  68. package/components/form/PodAffinity.vue +23 -23
  69. package/components/form/Probe.vue +15 -11
  70. package/components/form/ProjectMemberEditor.vue +28 -25
  71. package/components/form/ResourceQuota/Namespace.vue +4 -4
  72. package/components/form/ResourceQuota/NamespaceRow.vue +11 -9
  73. package/components/form/ResourceQuota/Project.vue +4 -4
  74. package/components/form/ResourceQuota/ProjectRow.vue +36 -30
  75. package/components/form/ResourceSelector.vue +1 -1
  76. package/components/form/Security.vue +1 -3
  77. package/components/form/Select.vue +7 -1
  78. package/components/form/ServiceNameSelect.vue +2 -5
  79. package/components/form/ServicePorts.vue +149 -75
  80. package/components/form/Taints.vue +2 -1
  81. package/components/form/Tolerations.vue +13 -9
  82. package/components/form/ValueFromResource.vue +110 -96
  83. package/components/form/WorkloadPorts.vue +143 -123
  84. package/components/formatter/WorkloadHealthScale.vue +4 -3
  85. package/components/nav/Group.vue +6 -0
  86. package/components/nav/Header.vue +7 -4
  87. package/components/nav/NamespaceFilter.vue +15 -21
  88. package/components/nav/TopLevelMenu.vue +99 -125
  89. package/components/nav/Type.vue +11 -3
  90. package/config/menuRouteMap.js +10 -0
  91. package/config/product/explorer.js +31 -9
  92. package/config/product/manager.js +28 -17
  93. package/config/router/navigation-guards/index.js +61 -3
  94. package/detail/node.vue +28 -23
  95. package/dialog/AddCustomBadgeDialog.vue +17 -9
  96. package/edit/autoscaling.horizontalpodautoscaler/external-metric.vue +1 -1
  97. package/edit/autoscaling.horizontalpodautoscaler/hpa-scaling-rule.vue +9 -6
  98. package/edit/autoscaling.horizontalpodautoscaler/index.vue +3 -1
  99. package/edit/autoscaling.horizontalpodautoscaler/metric-identifier.vue +2 -2
  100. package/edit/autoscaling.horizontalpodautoscaler/metric-object-reference.vue +7 -5
  101. package/edit/autoscaling.horizontalpodautoscaler/metric-target.vue +5 -3
  102. package/edit/autoscaling.horizontalpodautoscaler/metrics-row.vue +2 -2
  103. package/edit/autoscaling.horizontalpodautoscaler/object-metric.vue +2 -2
  104. package/edit/autoscaling.horizontalpodautoscaler/pod-metric.vue +1 -1
  105. package/edit/autoscaling.horizontalpodautoscaler/resource-metric.vue +2 -2
  106. package/edit/configmap.vue +4 -0
  107. package/edit/networking.k8s.io.ingress/Certificate.vue +14 -5
  108. package/edit/networking.k8s.io.ingress/DefaultBackend.vue +2 -2
  109. package/edit/networking.k8s.io.ingress/Rule.vue +5 -11
  110. package/edit/networking.k8s.io.ingress/RulePath.vue +105 -96
  111. package/edit/networking.k8s.io.networkpolicy/PolicyRule.vue +3 -3
  112. package/edit/networking.k8s.io.networkpolicy/PolicyRulePort.vue +4 -2
  113. package/edit/networking.k8s.io.networkpolicy/PolicyRuleTarget.vue +12 -11
  114. package/edit/networking.k8s.io.networkpolicy/index.vue +1 -1
  115. package/edit/persistentvolume/index.vue +3 -1
  116. package/edit/persistentvolumeclaim.vue +2 -0
  117. package/edit/secret/index.vue +2 -2
  118. package/edit/service.vue +4 -1
  119. package/edit/storage.k8s.io.storageclass/index.vue +10 -8
  120. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/aws-ebs.vue +34 -27
  121. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/gce-pd.vue +15 -13
  122. package/edit/storage.k8s.io.storageclass/provisioners/kubernetes.io/vsphere-volume.vue +41 -39
  123. package/edit/workload/Job.vue +31 -34
  124. package/edit/workload/Upgrading.vue +5 -5
  125. package/edit/workload/index.vue +22 -18
  126. package/edit/workload/storage/Mount.vue +1 -0
  127. package/edit/workload/storage/awsElasticBlockStore.vue +9 -7
  128. package/edit/workload/storage/azureDisk.vue +14 -10
  129. package/edit/workload/storage/azureFile.vue +9 -7
  130. package/edit/workload/storage/csi/index.vue +6 -9
  131. package/edit/workload/storage/emptyDir.vue +7 -5
  132. package/edit/workload/storage/gcePersistentDisk.vue +9 -7
  133. package/edit/workload/storage/hostPath.vue +7 -5
  134. package/edit/workload/storage/nfs.vue +8 -6
  135. package/edit/workload/storage/persistentVolumeClaim/index.vue +12 -10
  136. package/edit/workload/storage/persistentVolumeClaim/persistentvolumeclaim.vue +20 -15
  137. package/edit/workload/storage/secret.vue +9 -6
  138. package/edit/workload/storage/vsphereVolume.vue +11 -7
  139. package/initialize/app-extended.js +7 -1
  140. package/models/provisioning.cattle.io.cluster.js +19 -18
  141. package/package.json +1 -1
  142. package/pages/account/index.vue +90 -118
  143. package/pages/account/pri.vue +229 -0
  144. package/pages/auth/login.vue +6 -1
  145. package/pages/auth/setup.vue +36 -17
  146. package/pages/c/_cluster/_product/namespaces.vue +1 -1
  147. package/pages/c/_cluster/auth/roles/index.vue +38 -5
  148. package/pages/c/_cluster/explorer/ConfigBadge.vue +1 -1
  149. package/pages/c/_cluster/explorer/tools/index.vue +6 -6
  150. package/pages/home.vue +3 -4
  151. package/pkg/tsconfig.json +9 -9
  152. package/pkg/vue.config.js +1 -1
  153. package/plugins/dashboard-store/resource-class.js +28 -27
  154. package/rancher-components/BadgeState/BadgeState.vue +33 -52
  155. package/rancher-components/Banner/Banner.vue +12 -2
  156. package/rancher-components/Form/Radio/RadioGroup.vue +9 -1
  157. package/rancher-components/LabeledTooltip/LabeledTooltip.vue +31 -2
  158. package/rancher-components/RcDropdown/RcDropdownMenu.vue +8 -7
  159. package/scripts/publish-shell.sh +1 -1
  160. package/store/i18n.js +4 -0
  161. package/store/type-map.js +1 -3
  162. package/types/shell/index.d.ts +4 -30
  163. package/utils/error.js +3 -1
  164. package/utils/errorTranslate.json +416 -2
  165. package/vue.config.js +1 -1
@@ -25,8 +25,8 @@ export default {
25
25
 
26
26
  <template>
27
27
  <div>
28
- <div class="row mb-10">
29
- <div class="col span-6">
28
+ <div class="row">
29
+ <div class="col">
30
30
  <LabeledInput
31
31
  v-model:value="value.name"
32
32
  :required="true"
@@ -35,8 +35,8 @@ export default {
35
35
  />
36
36
  </div>
37
37
  </div>
38
- <div class="row mb-10">
39
- <div class="col span-6">
38
+ <div class="row">
39
+ <div class="col">
40
40
  <LabeledInput
41
41
  v-model:value="value.vsphereVolume.storagePolicyID"
42
42
  :mode="mode"
@@ -44,7 +44,9 @@ export default {
44
44
  :required="true"
45
45
  />
46
46
  </div>
47
- <div class="col span-6">
47
+ </div>
48
+ <div class="row">
49
+ <div class="col">
48
50
  <LabeledInput
49
51
  v-model:value.number="value.vsphereVolume.storagePolicyName"
50
52
  :mode="mode"
@@ -53,7 +55,7 @@ export default {
53
55
  </div>
54
56
  </div>
55
57
  <div class="row">
56
- <div class="col span-6">
58
+ <div class="col">
57
59
  <LabeledInput
58
60
  v-model:value="value.vsphereVolume.volumePath"
59
61
  :mode="mode"
@@ -61,7 +63,9 @@ export default {
61
63
  :required="true"
62
64
  />
63
65
  </div>
64
- <div class="col span-6">
66
+ </div>
67
+ <div class="row">
68
+ <div class="col">
65
69
  <LabeledInput
66
70
  v-model:value="value.vsphereVolume.fsType"
67
71
  :mode="mode"
@@ -55,7 +55,13 @@ async function extendApp(vueApp) {
55
55
  const next = (location) => appPartials.router.push(location);
56
56
  // Resolve route
57
57
 
58
- const path = getLocation(router.options.base, router.options.mode);
58
+ let path = getLocation(router.options.base, router.options.mode);
59
+
60
+ // 🔹 增加 rewrite,不改变原逻辑
61
+ if (path.includes('/cloud/')) {
62
+ path = path.replace(/cloud/g, 'harvester');
63
+ }
64
+
59
65
  const route = router.resolve(path);
60
66
 
61
67
  // Set context to app.context
@@ -115,25 +115,26 @@ export default class ProvCluster extends SteveModel {
115
115
  const actions = [
116
116
  // Note: Actions are not supported in the Steve API, so we check
117
117
  // available actions for RKE1 clusters, but not RKE2 clusters.
118
+ // {
119
+ // action: 'openShell',
120
+ // label: this.$rootGetters['i18n/t']('nav.shell'),
121
+ // icon: 'icon icon-terminal',
122
+ // enabled: !!this.mgmt?.links.shell && ready,
123
+ // }, {
124
+ // action: 'downloadKubeConfig',
125
+ // bulkAction: 'downloadKubeConfigBulk',
126
+ // label: this.$rootGetters['i18n/t']('nav.kubeconfig.download'),
127
+ // icon: 'icon icon-download',
128
+ // bulkable: true,
129
+ // enabled: this.mgmt?.hasAction('generateKubeconfig'),
130
+ // }, {
131
+ // action: 'copyKubeConfig',
132
+ // label: this.t('cluster.copyConfig'),
133
+ // bulkable: false,
134
+ // enabled: this.mgmt?.hasAction('generateKubeconfig'),
135
+ // icon: 'icon icon-copy',
136
+ // },
118
137
  {
119
- action: 'openShell',
120
- label: this.$rootGetters['i18n/t']('nav.shell'),
121
- icon: 'icon icon-terminal',
122
- enabled: !!this.mgmt?.links.shell && ready,
123
- }, {
124
- action: 'downloadKubeConfig',
125
- bulkAction: 'downloadKubeConfigBulk',
126
- label: this.$rootGetters['i18n/t']('nav.kubeconfig.download'),
127
- icon: 'icon icon-download',
128
- bulkable: true,
129
- enabled: this.mgmt?.hasAction('generateKubeconfig'),
130
- }, {
131
- action: 'copyKubeConfig',
132
- label: this.t('cluster.copyConfig'),
133
- bulkable: false,
134
- enabled: this.mgmt?.hasAction('generateKubeconfig'),
135
- icon: 'icon icon-copy',
136
- }, {
137
138
  action: 'snapshotAction',
138
139
  label: this.$rootGetters['i18n/t']('nav.takeSnapshot'),
139
140
  icon: 'icon icon-snapshot',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dashboard-shell-shell",
3
- "version": "3.0.5-test.4",
3
+ "version": "3.0.5-test.41",
4
4
  "description": "Rancher Dashboard Shell",
5
5
  "repository": "https://github.com/rancherlabs/dashboard",
6
6
  "license": "Apache-2.0",
@@ -151,71 +151,39 @@ export default {
151
151
  <template>
152
152
  <Loading v-if="$fetchState.pending" />
153
153
  <div v-else>
154
- <!-- <BackLink :link="backLink" />
155
- <h1>
156
- <TabTitle breadcrumb="vendor-only">
157
- {{ t('accountAndKeys.title') }}
158
- </TabTitle>
159
- </h1> -->
160
- <div class="api-key-title mb-20">
161
- {{ t('accountAndKeys.title') }}
162
- </div>
163
-
164
- <!-- <h2 v-t="'accountAndKeys.account.title'" /> -->
165
- <div class="account">
166
- <div class="account-title">
167
- {{ t('accountAndKeys.account.title') }}
154
+ <div style="display: flex;align-items: center;margin-bottom: 20px;">
155
+ <!-- <BackLink class="backLinkCls" :link="backLink" /> -->
156
+ <div style="font-size: 26px;">
157
+ <TabTitle breadcrumb="vendor-only">
158
+ {{ t('accountAndKeys.title') }}
159
+ </TabTitle>
168
160
  </div>
169
- <Principal
170
- :value="principal.id"
171
- :use-muted="false"
172
- :show-labels="true"
173
- :isShowPass="true"
174
- >
175
- <template #edit>
176
- <span
177
- v-if="canChangePassword"
178
- class="edit-pass-txt"
179
- @click="$refs.promptChangePassword.show(true)"
180
- >修改
181
- </span>
182
- </template>
183
- </Principal>
184
- <!-- <div>
185
- <button
186
- v-if="canChangePassword"
187
- role="button"
188
- :aria-label="t('accountAndKeys.account.change')"
189
- type="button"
190
- class="btn role-primary"
191
- data-testid="account_change_password"
192
- @click="showChangePasswordDialog"
193
- >
194
- {{ t("accountAndKeys.account.change") }}
195
- </button>
196
- </div> -->
197
161
  </div>
198
162
 
199
- <!-- <hr role="none"> -->
200
- <div
201
- style=" border: 1px solid #d7d7d7;padding: 20px 20px 0px 20px;"
202
- class="mt-20">
203
- <div class="keys-header">
204
- <div>
205
- <!-- <h2 v-t="'accountAndKeys.apiKeys.title'" /> -->
206
- <div
207
- v-t="'accountAndKeys.apiKeys.title'"
208
- class="account-title mb-20"
209
- />
210
- <div class="api-url">
211
- <span>{{ t("accountAndKeys.apiKeys.apiEndpoint") }}</span>
212
- <CopyToClipboardText
213
- :aria-label="t('accountAndKeys.apiKeys.copyApiEnpoint')"
214
- :text="apiUrl"
215
- />
163
+ <div class="account_card mb-20">
164
+ <h5 v-t="'accountAndKeys.account.title'" />
165
+ <div class="account">
166
+ <Principal
167
+ :userLogoSize="79"
168
+ :value="principal.id"
169
+ :use-muted="false"
170
+ :show-labels="true"
171
+ />
172
+ <div>
173
+ <button
174
+ v-if="canChangePassword"
175
+ role="button"
176
+ :aria-label="t('accountAndKeys.account.change')"
177
+ type="button"
178
+ class="btn role-primary"
179
+ data-testid="account_change_password"
180
+ @click="showChangePasswordDialog"
181
+ >
182
+ {{ t("accountAndKeys.account.change") }}
183
+ </button>
216
184
  </div>
217
185
  </div>
218
- <button
186
+ <!-- <button
219
187
  v-if="apiKeySchema"
220
188
  role="button"
221
189
  :aria-label="t('accountAndKeys.apiKeys.add.label')"
@@ -224,58 +192,82 @@ export default {
224
192
  @click="addKey"
225
193
  >
226
194
  {{ t('accountAndKeys.apiKeys.add.label') }}
227
- </button>
195
+ </button> -->
228
196
  </div>
229
- <div
230
- v-if="apiKeySchema"
231
- class="keys mb-20"
232
- >
233
- <ResourceTable
234
- :schema="apiKeySchema"
235
- :rows="apiKeys"
236
- :headers="apiKeyheaders"
237
- key-field="id"
238
- data-testid="api_keys_list"
239
- :search="true"
240
- :row-actions="true"
241
- :table-actions="true"
242
- >
243
- <template #header-right>
244
- <button
197
+
198
+ <div class="account_card mb-20">
199
+ <div class="keys-header">
200
+ <div>
201
+ <h5 v-t="'accountAndKeys.apiKeys.title'" />
202
+ <div class="api-url">
203
+ <span>{{ t("accountAndKeys.apiKeys.apiEndpoint") }}</span>
204
+ <CopyToClipboardText
205
+ :aria-label="t('accountAndKeys.apiKeys.copyApiEnpoint')"
206
+ :text="apiUrl"
207
+ />
208
+ </div>
209
+ </div>
210
+ </div>
211
+ <div
245
212
  v-if="apiKeySchema"
246
- role="button"
247
- :aria-label="t('accountAndKeys.apiKeys.add.label')"
248
- class="btn role-primary add mb-20"
249
- data-testid="account_create_api_keys"
250
- @click="addKey"
213
+ class="keys"
251
214
  >
252
- {{ t('accountAndKeys.apiKeys.add.label') }}
253
- </button>
215
+ <ResourceTable
216
+ :schema="apiKeySchema"
217
+ :rows="apiKeys"
218
+ :headers="apiKeyheaders"
219
+ key-field="id"
220
+ data-testid="api_keys_list"
221
+ :search="true"
222
+ :row-actions="true"
223
+ :table-actions="true"
224
+ >
225
+ <template #header-right>
226
+ <button
227
+ style="margin-right: 10px;"
228
+ v-if="apiKeySchema"
229
+ role="button"
230
+ :aria-label="t('accountAndKeys.apiKeys.add.label')"
231
+ class="btn role-primary add"
232
+ data-testid="account_create_api_keys"
233
+ @click="addKey"
234
+ >
235
+ {{ t('accountAndKeys.apiKeys.add.label') }}
236
+ </button>
254
237
  </template>
255
- </ResourceTable>
256
- </div>
257
- <div v-else>
258
- <Banner
259
- color="warning"
260
- :label="t('accountAndKeys.apiKeys.notAllowed')"
261
- />
238
+ </ResourceTable>
239
+ </div>
240
+ <div v-else>
241
+ <Banner
242
+ color="warning"
243
+ :label="t('accountAndKeys.apiKeys.notAllowed')"
244
+ />
245
+ </div>
262
246
  </div>
263
247
  </div>
264
- </div>
265
248
  </template>
266
249
 
267
250
  <style lang='scss' scoped>
251
+ .account_card {
252
+ border: 1px solid #d7d7d7;
253
+ padding: 20px;
254
+ box-sizing: border-box;
255
+ }
256
+ :deep() .back-link {
257
+ font-size: 26px;
258
+ margin: 0 20px 0 0 !important;
259
+ }
268
260
  hr {
269
261
  margin: 20px 0;
270
262
  }
271
263
 
272
264
  .account {
273
- /* display: flex;
274
- justify-content: space-between */
275
- border: 1px solid #D7D7D7;
276
- padding: 20px;
277
- box-sizing: border-box;
265
+ display: flex;
266
+ justify-content: space-between
267
+ }
278
268
 
269
+ .principal .avatar {
270
+ width: 287px !important;
279
271
  }
280
272
 
281
273
  .keys-header {
@@ -288,37 +280,17 @@ export default {
288
280
  .keys {
289
281
  display: flex;
290
282
  flex-direction: column;
291
- margin-top: 20px;
292
283
  .add {
293
284
  align-self: flex-end;
294
- margin-left: 10px
295
285
  }
296
286
  }
297
287
 
298
288
  .api-url {
299
289
  display: flex;
290
+ margin: 20px 0;
300
291
 
301
292
  > span {
302
293
  margin-right: 6px;
303
294
  }
304
295
  }
305
- .api-key-title{
306
- font-size: 26px;
307
- /* line-height: 20px; */
308
- font-weight: 400;
309
- }
310
-
311
- .edit-pass-txt{
312
- cursor: pointer;
313
- color: var(--primary);
314
- }
315
-
316
- .table-account{
317
- border: 1px solid #d7d7d7;
318
- }
319
- .account-title{
320
- font-size: 14px;
321
- line-height: 19px;
322
- margin-bottom: 16px;
323
- }
324
296
  </style>
@@ -0,0 +1,229 @@
1
+ <script>
2
+ import { NORMAN } from '@shell/config/types';
3
+
4
+ export default {
5
+ props: {
6
+ value: {
7
+ type: String,
8
+ required: true,
9
+ },
10
+
11
+ useMuted: {
12
+ type: Boolean,
13
+ default: true,
14
+ },
15
+
16
+ showLabels: {
17
+ type: Boolean,
18
+ default: false,
19
+ },
20
+ isShowPass: {
21
+ type: Boolean,
22
+ default: false,
23
+ }
24
+ },
25
+
26
+ async fetch() {
27
+ this.principal = this.$store.getters['rancher/byId'](NORMAN.PRINCIPAL, this.value);
28
+
29
+ if ( this.principal ) {
30
+ return;
31
+ }
32
+
33
+ const principalId = escape(this.value).replace(/\//g, '%2F');
34
+
35
+ try {
36
+ this.principal = await this.$store.dispatch('rancher/find', {
37
+ type: NORMAN.PRINCIPAL,
38
+ id: this.value,
39
+ opt: { url: `/v3/principals/${ principalId }` }
40
+ });
41
+ } catch (e) {
42
+ console.error('Failed to fetch principal', this.value, principalId); // eslint-disable-line no-console
43
+ }
44
+ },
45
+
46
+ data() {
47
+ // Load from cache immediately if possible
48
+ return { principal: null };
49
+ },
50
+
51
+ computed: {
52
+ showBoth() {
53
+ const p = this.principal;
54
+
55
+ return p.name && p.loginName && p.name.trim().toLowerCase() !== p.loginName.trim().toLowerCase();
56
+ }
57
+ },
58
+ };
59
+ </script>
60
+
61
+ <template>
62
+ <div
63
+ class="principal"
64
+ :class="{'showLabels': showLabels}"
65
+ >
66
+ <template v-if="!principal && $fetchState.pending">
67
+ <div class="avatar">
68
+ <div class="empty">
69
+ <i class="icon icon-spinner icon-lg" />
70
+ </div>
71
+ </div>
72
+ <div
73
+ v-clean-html="t('principal.loading', null, true)"
74
+ class="name"
75
+ :class="{'text-muted': useMuted}"
76
+ />
77
+ <div class="description" />
78
+ </template>
79
+
80
+ <template v-else-if="principal">
81
+ <div class="avatar">
82
+ <img
83
+ src="@shell/assets/images/user.png"
84
+ >
85
+ </div>
86
+ <div
87
+ v-if="showLabels"
88
+ class="name"
89
+ >
90
+ <table>
91
+ <tr class="mb-10">
92
+ <td>{{ t('principal.name') }}: </td><td>{{ principal.name || principal.loginName }}</td>
93
+ </tr>
94
+ <tr class="mb-10">
95
+ <td>{{ t('principal.loginName') }}: </td><td>{{ principal.loginName }}</td>
96
+ </tr>
97
+ <tr
98
+ v-if="isShowPass"
99
+ class="mb-10"
100
+ >
101
+ <td>修改密码: </td><td>****** <slot name="edit" /></td>
102
+ </tr>
103
+ <tr><td>{{ t('principal.type') }}: </td><td>{{ principal.displayType }}</td></tr>
104
+ </table>
105
+ </div>
106
+ <template v-else>
107
+ <div class="name">
108
+ <template v-if="showBoth">
109
+ {{ principal.name }}
110
+ <span
111
+ v-if="principal.loginName"
112
+ :class="{'text-muted': useMuted}"
113
+ >({{ principal.loginName }})</span>
114
+ </template>
115
+ <template v-else-if="principal.name">
116
+ {{ principal.name }}
117
+ </template>
118
+ <template v-else>
119
+ {{ principal.loginName }}
120
+ </template>
121
+ </div>
122
+ <div
123
+ class="description"
124
+ :class="{'text-muted': useMuted}"
125
+ >
126
+ {{ principal.displayType }}
127
+ </div>
128
+ </template>
129
+ </template>
130
+
131
+ <template v-else>
132
+ <div class="avatar">
133
+ <div
134
+ class="empty"
135
+ :class="{'text-muted': useMuted}"
136
+ >
137
+ <i class="icon icon-warning icon-lg" />
138
+ </div>
139
+ </div>
140
+ <div
141
+ v-t="'principal.error'"
142
+ class="name text-error"
143
+ />
144
+ <div
145
+ class="description"
146
+ :class="{'text-muted': useMuted}"
147
+ >
148
+ {{ value }}
149
+ </div>
150
+ </template>
151
+ </div>
152
+ </template>
153
+
154
+ <style lang="scss" scoped>
155
+ $size: 79px;
156
+
157
+ .principal {
158
+ display: grid;
159
+ grid-template-areas:
160
+ "avatar name"
161
+ "avatar description";
162
+ grid-template-columns: $size auto;
163
+ grid-template-rows: auto math.div($size, 2);
164
+ column-gap: 10px;
165
+
166
+ th {
167
+ text-align: left;
168
+ font-weight: normal;
169
+ padding-right: 10px;
170
+ }
171
+
172
+ &.showLabels {
173
+ /* grid-template-areas:
174
+ "avatar name";
175
+ grid-template-columns: 60px auto;
176
+ grid-template-rows: 60px;
177
+ column-gap: 0; */
178
+ display: flex;
179
+ column-gap:0;
180
+ .name {
181
+ display: flex;
182
+ line-height: unset;
183
+ }
184
+ table tr {
185
+ display: block;
186
+ }
187
+ table tr td:not(:first-of-type) {
188
+ padding-left: 10px;
189
+ }
190
+ table tr td:not(:last-of-type) {
191
+ width: 100px;
192
+ }
193
+ }
194
+
195
+ .avatar {
196
+ /* grid-area: avatar;
197
+ text-align: center; */
198
+ width: 287px;
199
+ display: flex;
200
+ justify-content: center;
201
+ align-items: center;
202
+
203
+ DIV.empty {
204
+ border: 1px solid var(--border);
205
+ line-height: $size;
206
+ }
207
+
208
+ IMG {
209
+ width: $size;
210
+ height: $size;
211
+ }
212
+
213
+ DIV.round, IMG.round {
214
+ border-radius: 50%;
215
+ }
216
+ }
217
+
218
+ .name {
219
+ grid-area: name;
220
+ line-height: math.div($size, 2);
221
+ overflow-wrap: anywhere;
222
+ }
223
+
224
+ .description {
225
+ grid-area: description;
226
+ line-height: math.div($size, 2);
227
+ }
228
+ }
229
+ </style>
@@ -32,6 +32,7 @@ import loadPlugins from '@shell/plugins/plugin';
32
32
  import Loading from '@shell/components/Loading';
33
33
  import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
34
34
  import TabTitle from '@shell/components/TabTitle.vue';
35
+ import { AFTER_LOGIN_ROUTE } from '@shell/store/prefs';
35
36
 
36
37
  export default {
37
38
  name: 'Login',
@@ -63,6 +64,10 @@ export default {
63
64
  };
64
65
  },
65
66
 
67
+ created () {
68
+ // this.$store.dispatch('i18n/switchTo', 'zh-hans');
69
+ },
70
+
66
71
  computed: {
67
72
  ...mapGetters(['isSingleProduct']),
68
73
  ...mapGetters({ t: 'i18n/t', hasMultipleLocales: 'i18n/hasMultipleLocales' }),
@@ -168,7 +173,7 @@ export default {
168
173
  this.focusSomething();
169
174
  });
170
175
  },
171
-
176
+
172
177
  methods: {
173
178
  async loadInitialSettings() {
174
179
  let firstLoginSetting, plSetting, brand;