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

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 (33) hide show
  1. package/assets/styles/global/_button.scss +7 -7
  2. package/assets/styles/global/_tooltip.scss +4 -4
  3. package/assets/styles/themes/_light.scss +3 -1
  4. package/assets/translations/zh-hans.yaml +76 -0
  5. package/components/ActionDropdown.vue +1 -1
  6. package/components/CopyToClipboard.vue +15 -0
  7. package/components/Drawer/Chrome.vue +2 -2
  8. package/components/Drawer/ResourceDetailDrawer/ConfigTab.vue +23 -23
  9. package/components/Drawer/ResourceDetailDrawer/index.vue +2 -2
  10. package/components/ExplorerMembers.vue +18 -3
  11. package/components/PodSecurityAdmission.vue +1 -1
  12. package/components/Resource/Detail/Metadata/IdentifyingInformation/index.vue +1 -3
  13. package/components/Resource/Detail/Metadata/KeyValue.vue +8 -4
  14. package/components/Resource/Detail/Metadata/index.vue +2 -1
  15. package/components/Resource/Detail/TitleBar/Title.vue +4 -3
  16. package/components/Resource/Detail/TitleBar/index.vue +103 -24
  17. package/components/ResourceDetail/legacy.vue +3 -1
  18. package/components/SortableTable/index.vue +1 -1
  19. package/components/Tabbed/index.vue +1 -1
  20. package/components/auth/Principal.vue +2 -2
  21. package/components/breadcrumb/index.vue +340 -0
  22. package/components/form/LabeledSelect.vue +3 -2
  23. package/components/form/Taints.vue +2 -1
  24. package/components/form/WorkloadPorts.vue +143 -123
  25. package/edit/workload/index.vue +3 -3
  26. package/package.json +1 -1
  27. package/pages/account/index.vue +5 -13
  28. package/pages/account/pri.vue +229 -0
  29. package/pages/auth/login.vue +6 -1
  30. package/pages/c/_cluster/_product/namespaces.vue +1 -1
  31. package/rancher-components/BadgeState/BadgeState.vue +33 -52
  32. package/rancher-components/RcDropdown/RcDropdownMenu.vue +8 -7
  33. package/store/i18n.js +3 -0
@@ -280,145 +280,163 @@ export default {
280
280
  'show-ipam': showIpam,
281
281
  }"
282
282
  >
283
- <div class="service-type">
284
- <LabeledSelect
285
- v-model:value="row._serviceType"
286
- :mode="mode"
287
- :label="t('workload.container.ports.createService')"
288
- :options="serviceTypes"
289
- :disabled="canNotAccessService"
290
- :tooltip="serviceTypeTooltip"
291
- @update:value="queueUpdate"
292
- />
293
- </div>
294
-
295
- <div class="portName">
296
- <LabeledInput
297
- ref="name"
298
- v-model:value="row.name"
299
- :mode="mode"
300
- :label="t('workload.container.ports.name')"
301
- @update:value="queueUpdate"
302
- />
303
- </div>
283
+
284
+ <div class="row mt-20">
285
+ <div
286
+ v-if="!row._showHost && row._serviceType !== 'LoadBalancer' && row._serviceType !== 'NodePort'"
287
+ class="add-host col"
288
+ >
289
+ <button
290
+ :disabled="mode==='view'"
291
+ type="button"
292
+ class="btn btn-sm role-tertiary"
293
+ @click="row._showHost = true"
294
+ >
295
+ {{ t('workloadPorts.addHost') }}
296
+ </button>
297
+ </div>
304
298
 
305
- <div class="port">
306
- <LabeledInput
307
- v-model:value.number="row.containerPort"
308
- :mode="mode"
309
- type="number"
310
- min="1"
311
- max="65535"
312
- placeholder="e.g. 8080"
313
- :label="t('workload.container.ports.containerPort')"
314
- :required="row._serviceType === 'LoadBalancer' "
315
- @update:value="queueUpdate"
316
- />
317
- </div>
299
+ <div
300
+ v-if="showRemove"
301
+ class="remove"
302
+ >
303
+ <button
304
+ type="button"
305
+ class="btn role-link"
306
+ @click="remove(idx)"
307
+ >
308
+ {{ t('workloadPorts.remove') }}
309
+ </button>
310
+ </div>
318
311
 
319
- <div class="protocol col">
320
- <LabeledSelect
321
- v-model:value="row.protocol"
322
- :mode="mode"
323
- :options="workloadPortOptions"
324
- :multiple="false"
325
- :label="t('workload.container.ports.protocol')"
326
- @update:value="queueUpdate"
327
- />
328
312
  </div>
329
313
 
330
- <div
331
- v-if="row._showHost"
332
- class="targetPort"
333
- >
334
- <LabeledInput
335
- ref="port"
336
- v-model:value.number="row.hostPort"
337
- :mode="mode"
338
- type="number"
339
- min="1"
340
- max="65535"
341
- placeholder="e.g. 80"
342
- :label="t('workload.container.ports.hostPort')"
343
- @update:value="queueUpdate"
344
- />
314
+ <div class="row">
315
+ <div class="service-type col span-6">
316
+ <LabeledSelect
317
+ v-model:value="row._serviceType"
318
+ :mode="mode"
319
+ :label="t('workload.container.ports.createService')"
320
+ :options="serviceTypes"
321
+ :disabled="canNotAccessService"
322
+ :tooltip="serviceTypeTooltip"
323
+ @update:value="queueUpdate"
324
+ />
325
+ </div>
326
+
327
+ <div class="portName col span-6">
328
+ <LabeledInput
329
+ ref="name"
330
+ v-model:value="row.name"
331
+ :mode="mode"
332
+ :label="t('workload.container.ports.name')"
333
+ @update:value="queueUpdate"
334
+ />
335
+ </div>
345
336
  </div>
346
337
 
347
- <div
348
- v-if="row._showHost"
349
- class="hostip"
350
- >
351
- <LabeledInput
352
- ref="port"
353
- v-model:value="row.hostIP"
354
- :mode="mode"
355
- placeholder="e.g. 1.1.1.1"
356
- :label="t('workload.container.ports.hostIP')"
357
- @update:value="queueUpdate"
358
- />
338
+ <div class="row">
339
+ <div class="port col span-6">
340
+ <LabeledInput
341
+ v-model:value.number="row.containerPort"
342
+ :mode="mode"
343
+ type="number"
344
+ min="1"
345
+ max="65535"
346
+ placeholder="e.g. 8080"
347
+ :label="t('workload.container.ports.containerPort')"
348
+ :required="row._serviceType === 'LoadBalancer' "
349
+ @update:value="queueUpdate"
350
+ />
351
+ </div>
352
+
353
+ <div class="protocol col span-6">
354
+ <LabeledSelect
355
+ v-model:value="row.protocol"
356
+ :mode="mode"
357
+ :options="workloadPortOptions"
358
+ :multiple="false"
359
+ :label="t('workload.container.ports.protocol')"
360
+ @update:value="queueUpdate"
361
+ />
362
+ </div>
359
363
  </div>
360
364
 
361
- <div
362
- v-if="!row._showHost && row._serviceType !== 'LoadBalancer' && row._serviceType !== 'NodePort'"
363
- class="add-host"
364
- >
365
- <button
366
- :disabled="mode==='view'"
367
- type="button"
368
- class="btn btn-sm role-tertiary"
369
- @click="row._showHost = true"
365
+ <div class="row">
366
+ <div
367
+ v-if="row._showHost"
368
+ class="targetPort col span-6"
370
369
  >
371
- {{ t('workloadPorts.addHost') }}
372
- </button>
373
- </div>
374
-
375
- <div v-if="row._serviceType === 'LoadBalancer' || row._serviceType === 'NodePort'">
376
- <LabeledInput
377
- ref="port"
378
- v-model:value.number="row._listeningPort"
379
- type="number"
380
- :mode="mode"
381
- :label="t('workload.container.ports.listeningPort')"
382
- :required="row._serviceType === 'LoadBalancer' "
383
- @update:value="queueUpdate"
384
- />
385
- </div>
386
-
387
- <div v-if="showIpam && row._serviceType === 'LoadBalancer' && row.protocol === 'TCP'">
388
- <div v-if="idx === ipamIndex">
389
- <LabeledSelect
390
- v-model:value="row._ipam"
370
+ <LabeledInput
371
+ ref="port"
372
+ v-model:value.number="row.hostPort"
391
373
  :mode="mode"
392
- :options="ipamOptions"
393
- :label="t('servicesPage.harvester.ipam.label')"
394
- :disabled="mode === 'edit'"
374
+ type="number"
375
+ min="1"
376
+ max="65535"
377
+ placeholder="e.g. 80"
378
+ :label="t('workload.container.ports.hostPort')"
395
379
  @update:value="queueUpdate"
396
380
  />
397
381
  </div>
398
- <div v-else>
399
- <LabeledSelect
400
- v-model:value="rows[ipamIndex]._ipam"
382
+
383
+ <div
384
+ v-if="row._showHost"
385
+ class="hostip col span-6"
386
+ >
387
+ <LabeledInput
388
+ ref="port"
389
+ v-model:value="row.hostIP"
401
390
  :mode="mode"
402
- :options="ipamOptions"
403
- :label="t('servicesPage.harvester.ipam.label')"
404
- :disabled="true"
391
+ placeholder="e.g. 1.1.1.1"
392
+ :label="t('workload.container.ports.hostIP')"
405
393
  @update:value="queueUpdate"
406
394
  />
407
395
  </div>
408
396
  </div>
409
397
 
410
- <div
411
- v-if="showRemove"
412
- class="remove"
413
- >
414
- <button
415
- type="button"
416
- class="btn role-link"
417
- @click="remove(idx)"
398
+ <div class="row">
399
+ <div
400
+ v-if="row._serviceType === 'LoadBalancer' || row._serviceType === 'NodePort'"
401
+ class="col"
418
402
  >
419
- {{ t('workloadPorts.remove') }}
420
- </button>
403
+ <LabeledInput
404
+ ref="port"
405
+ v-model:value.number="row._listeningPort"
406
+ type="number"
407
+ :mode="mode"
408
+ :label="t('workload.container.ports.listeningPort')"
409
+ :required="row._serviceType === 'LoadBalancer' "
410
+ @update:value="queueUpdate"
411
+ />
412
+ </div>
421
413
  </div>
414
+
415
+ <div class="row">
416
+ <div v-if="showIpam && row._serviceType === 'LoadBalancer' && row.protocol === 'TCP'">
417
+ <div v-if="idx === ipamIndex">
418
+ <LabeledSelect
419
+ v-model:value="row._ipam"
420
+ :mode="mode"
421
+ :options="ipamOptions"
422
+ :label="t('servicesPage.harvester.ipam.label')"
423
+ :disabled="mode === 'edit'"
424
+ @update:value="queueUpdate"
425
+ />
426
+ </div>
427
+ <div v-else>
428
+ <LabeledSelect
429
+ v-model:value="rows[ipamIndex]._ipam"
430
+ :mode="mode"
431
+ :options="ipamOptions"
432
+ :label="t('servicesPage.harvester.ipam.label')"
433
+ :disabled="true"
434
+ @update:value="queueUpdate"
435
+ />
436
+ </div>
437
+ </div>
438
+ </div>
439
+
422
440
  </div>
423
441
  <div
424
442
  v-if="showAdd"
@@ -447,11 +465,11 @@ $checkbox: 75;
447
465
  }
448
466
  }
449
467
  .ports-headers, .ports-row{
450
- display: grid;
451
- grid-template-columns: 28% 28% 15% 10% 75px 0.5fr;
452
- grid-column-gap: $column-gutter;
453
- margin-bottom: 10px;
454
- align-items: center;
468
+ // display: grid;
469
+ // grid-template-columns: 28% 28% 15% 10% 75px 0.5fr;
470
+ // grid-column-gap: $column-gutter;
471
+ // margin-bottom: 20px;
472
+ // align-items: center;
455
473
  & .port{
456
474
  display: flex;
457
475
  justify-content: space-between;
@@ -475,6 +493,7 @@ $checkbox: 75;
475
493
  }
476
494
 
477
495
  .add-host {
496
+ margin-right: 20px;
478
497
  justify-self: center;
479
498
  }
480
499
 
@@ -492,6 +511,7 @@ $checkbox: 75;
492
511
 
493
512
  .remove BUTTON {
494
513
  padding: 0px;
514
+ min-width: auto;
495
515
  }
496
516
 
497
517
  .ports-row INPUT {
@@ -108,7 +108,7 @@ export default {
108
108
  >
109
109
  <div
110
110
  v-if="isCronJob"
111
- class="col span-3"
111
+ class="col span-6"
112
112
  >
113
113
  <LabeledInput
114
114
  v-model:value="spec.schedule"
@@ -122,7 +122,7 @@ export default {
122
122
  </div>
123
123
  <div
124
124
  v-if="isReplicable"
125
- class="col span-3"
125
+ class="col span-6"
126
126
  >
127
127
  <LabeledInput
128
128
  v-model:value.number="spec.replicas"
@@ -135,7 +135,7 @@ export default {
135
135
  </div>
136
136
  <div
137
137
  v-if="isStatefulSet"
138
- class="col span-3"
138
+ class="col span-6"
139
139
  >
140
140
  <LabeledSelect
141
141
  v-model:value="spec.serviceName"
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.5",
4
4
  "description": "Rancher Dashboard Shell",
5
5
  "repository": "https://github.com/rancherlabs/dashboard",
6
6
  "license": "Apache-2.0",
@@ -3,7 +3,8 @@ import BackLink from '@shell/components/BackLink';
3
3
  import { MANAGEMENT, NORMAN } from '@shell/config/types';
4
4
  import { SETTING } from '@shell/config/settings';
5
5
  import Loading from '@shell/components/Loading';
6
- import Principal from '@shell/components/auth/Principal';
6
+ // import Principal from '@shell/components/auth/Principal';
7
+ import Principal from './pri.vue';
7
8
  import BackRoute from '@shell/mixins/back-link';
8
9
  import { mapGetters } from 'vuex';
9
10
 
@@ -16,7 +17,7 @@ const API_ENDPOINT = '/v3';
16
17
 
17
18
  export default {
18
19
  components: {
19
- CopyToClipboardText, BackLink, Banner, Loading, ResourceTable, Principal, TabTitle
20
+ CopyToClipboardText, BackLink, Banner, PromptChangePassword, Loading, ResourceTable, Principal, TabTitle
20
21
  },
21
22
  mixins: [BackRoute],
22
23
  async fetch() {
@@ -189,12 +190,13 @@ export default {
189
190
  type="button"
190
191
  class="btn role-primary"
191
192
  data-testid="account_change_password"
192
- @click="showChangePasswordDialog"
193
+ @click="$refs.promptChangePassword.show(true)"
193
194
  >
194
195
  {{ t("accountAndKeys.account.change") }}
195
196
  </button>
196
197
  </div> -->
197
198
  </div>
199
+ <PromptChangePassword ref="promptChangePassword" />
198
200
 
199
201
  <!-- <hr role="none"> -->
200
202
  <div
@@ -215,16 +217,6 @@ export default {
215
217
  />
216
218
  </div>
217
219
  </div>
218
- <button
219
- v-if="apiKeySchema"
220
- role="button"
221
- :aria-label="t('accountAndKeys.apiKeys.add.label')"
222
- class="btn role-primary add mb-20"
223
- data-testid="account_create_api_keys"
224
- @click="addKey"
225
- >
226
- {{ t('accountAndKeys.apiKeys.add.label') }}
227
- </button>
228
220
  </div>
229
221
  <div
230
222
  v-if="apiKeySchema"
@@ -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;
@@ -29,8 +29,8 @@ export default {
29
29
  computed: {
30
30
  headers() {
31
31
  return [
32
- STATE,
33
32
  NAME,
33
+ STATE,
34
34
  AGE
35
35
  ];
36
36
  },