dashboard-shell-shell 3.0.5-test.40 → 3.0.5-test.42

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.
@@ -595,6 +595,7 @@ assignTo:
595
595
  workspace: 工作空间
596
596
 
597
597
  stateLabel:
598
+ Waiting: 等待中
598
599
  Images preloading: 图像预加载中
599
600
  Images preloaded: 图像已预加载
600
601
  Waiting Reboot: 等待重启
@@ -4563,6 +4564,12 @@ promptRemove:
4563
4564
  promptRemoveApp:
4564
4565
  removeCrd: "删除与此应用关联的 CRD"
4565
4566
 
4567
+ promptRemoveText:
4568
+ globalrole: "角色"
4569
+ globalroles: "角色"
4570
+ roletemplate: "角色"
4571
+ roletemplates: "角色"
4572
+
4566
4573
  promptRestore:
4567
4574
  title: 还原快照
4568
4575
  name: 名称
@@ -83,6 +83,22 @@ export default {
83
83
  return this.$store.getters['type-map/labelFor'](schema, this.toRemove.length);
84
84
  },
85
85
 
86
+ typeZh() {
87
+ const typeLabel = this.type
88
+
89
+ const lowerKey = typeLabel.toLowerCase();
90
+ const i18nKey = `promptRemoveText.${lowerKey}`;
91
+
92
+ console.log(i18nKey, ' i18nKey-------------------------');
93
+
94
+
95
+ if (this.t(i18nKey)) {
96
+ return this.t(i18nKey);
97
+ }
98
+
99
+ return typeLabel;
100
+ },
101
+
86
102
  selfLinks() {
87
103
  return this.toRemove.map((resource) => {
88
104
  return get(resource, 'links.self');
@@ -380,7 +396,7 @@ export default {
380
396
  :needs-confirm="needsConfirm"
381
397
  :value="toRemove"
382
398
  :names="names"
383
- :type="type"
399
+ :type="typeZh"
384
400
  :done-location="doneLocation"
385
401
  @errors="e => error = e"
386
402
  @done="done"
@@ -698,6 +698,12 @@ export default {
698
698
  />
699
699
  </template>
700
700
 
701
+ <template #banner>
702
+ <slot
703
+ name="banner"
704
+ />
705
+ </template>
706
+
701
707
 
702
708
  <template
703
709
  v-if="externalPaginationEnabled"
@@ -170,7 +170,7 @@ export default {
170
170
  >
171
171
  <template #column-headers>
172
172
  <div class="box mb-0">
173
- <div class="column-headers row" style="width: calc(100% - 100px);">
173
+ <div class="column-headers row" :style="{ width: (isCreate && i === 0) || isView ? '100%' : 'calc(100% - 100px)' }">
174
174
  <div class="col span-6">
175
175
  <label class="text-label">{{ t('membershipEditor.user') }}</label>
176
176
  </div>
@@ -58,6 +58,6 @@ export default {
58
58
  :type="NORMAN.PROJECT_ROLE_TEMPLATE_BINDING"
59
59
  :mode="mode"
60
60
  parent-key="projectId"
61
- :parent-id="parentId"
61
+ :parent-id="parentId"
62
62
  />
63
63
  </template>
@@ -391,7 +391,7 @@ export default {
391
391
  <style lang="scss" scoped>
392
392
  .unlabeled-select {
393
393
  position: relative;
394
- width: 100%;
394
+ width: 400px;
395
395
 
396
396
  :deep() .vs__actions:after {
397
397
  // padding-top: 2px;
@@ -13,6 +13,7 @@ import { DSL } from '@shell/store/type-map';
13
13
  import { BLANK_CLUSTER } from '@shell/store/store-types.js';
14
14
 
15
15
  export const NAME = 'manager';
16
+ const topLevelPermissions = sessionStorage.getItem('TOPLEVELPERMISSIONS')
16
17
 
17
18
  export function init(store) {
18
19
  const {
@@ -60,11 +61,17 @@ export function init(store) {
60
61
  route: { name: 'c-cluster-manager-cloudCredential' },
61
62
  });
62
63
 
63
- basicType([
64
- CAPI.RANCHER_CLUSTER,
65
- 'cloud-credentials',
66
- 'drivers',
67
- ]);
64
+ if (topLevelPermissions && topLevelPermissions === 'superadmin') {
65
+ basicType([
66
+ CAPI.RANCHER_CLUSTER,
67
+ 'cloud-credentials',
68
+ 'drivers',
69
+ ]);
70
+ } else {
71
+ basicType([
72
+ CAPI.RANCHER_CLUSTER,
73
+ ]);
74
+ }
68
75
 
69
76
  configureType(SNAPSHOT, { depaginate: true });
70
77
 
@@ -111,10 +118,12 @@ export function init(store) {
111
118
  exact: true
112
119
  });
113
120
 
114
- basicType([
115
- 'rke-kontainer-drivers',
116
- 'rke-node-drivers',
117
- ], 'drivers');
121
+ if (topLevelPermissions && topLevelPermissions === 'superadmin') {
122
+ basicType([
123
+ 'rke-kontainer-drivers',
124
+ 'rke-node-drivers',
125
+ ], 'drivers');
126
+ }
118
127
 
119
128
  weightType(CAPI.MACHINE_DEPLOYMENT, 4, true);
120
129
  weightType(CAPI.MACHINE_SET, 3, true);
@@ -123,14 +132,16 @@ export function init(store) {
123
132
  weightType(MANAGEMENT.PSA, 5, true);
124
133
  weightType(VIRTUAL_TYPES.JWT_AUTHENTICATION, 0, true);
125
134
 
126
- basicType([
127
- CAPI.MACHINE_DEPLOYMENT,
128
- CAPI.MACHINE_SET,
129
- CAPI.MACHINE,
130
- CATALOG.CLUSTER_REPO,
131
- MANAGEMENT.PSA,
132
- VIRTUAL_TYPES.JWT_AUTHENTICATION
133
- ], 'advanced');
135
+ if (topLevelPermissions && topLevelPermissions === 'superadmin') {
136
+ basicType([
137
+ CAPI.MACHINE_DEPLOYMENT,
138
+ CAPI.MACHINE_SET,
139
+ CAPI.MACHINE,
140
+ CATALOG.CLUSTER_REPO,
141
+ MANAGEMENT.PSA,
142
+ VIRTUAL_TYPES.JWT_AUTHENTICATION
143
+ ], 'advanced');
144
+ }
134
145
 
135
146
  weightGroup('advanced', -1, true);
136
147
 
@@ -37,15 +37,17 @@ export default {
37
37
 
38
38
  <template>
39
39
  <div>
40
- <Banner
41
- color="info"
42
- :label="t('podSecurityAdmission.banner.modifications')"
43
- />
44
-
45
40
  <ResourceTable
46
41
  :loading="loading"
47
42
  :schema="schema"
48
43
  :rows="rows"
49
- />
44
+ >
45
+ <template #banner>
46
+ <Banner
47
+ color="info"
48
+ :label="t('podSecurityAdmission.banner.modifications')"
49
+ />
50
+ </template>
51
+ </ResourceTable>
50
52
  </div>
51
53
  </template>
@@ -170,6 +170,16 @@ export default {
170
170
  } catch (err) {
171
171
  // This exception handles errors from the `request` action when it receives a failed http request. The `err` object could be from the action's error handler (raw http response object containing `status`) or thrown later on given the response of the action (a massaged object containing `_status`). TBD why one 409 triggers the error handler and another does not.
172
172
  const IS_ERR_409 = err.status === 409 || err._status === 409;
173
+
174
+ const IS_ERR_403 = err.status === 403 || err._status === 403;
175
+
176
+ if (err.message === '' && err.fieldName && err.code) {
177
+ err.message = err.code + ' ' + err.fieldName
178
+ }
179
+
180
+ if (IS_ERR_403) {
181
+ err.message = '权限不足'
182
+ }
173
183
 
174
184
  // Conflict, the resource being edited has changed since starting editing
175
185
  if (IS_ERR_409 && depth === 0 && this.isEdit) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dashboard-shell-shell",
3
- "version": "3.0.5-test.40",
3
+ "version": "3.0.5-test.42",
4
4
  "description": "Rancher Dashboard Shell",
5
5
  "repository": "https://github.com/rancherlabs/dashboard",
6
6
  "license": "Apache-2.0",
@@ -78,7 +78,16 @@ export default defineComponent({
78
78
  * Return message text as label.
79
79
  */
80
80
  messageLabel(): string | void {
81
- return !(typeof this.label === 'string') ? stringify(this.label) : undefined;
81
+
82
+ let labelStr = this.label
83
+
84
+ if (labelStr === 'waiting for api to be available') {
85
+ labelStr = '等待api可用'
86
+ } else if (labelStr === 'Cluster agent is not connected') {
87
+ labelStr = '集群agent未连接'
88
+ }
89
+
90
+ return !(typeof labelStr === 'string') ? stringify(labelStr) : undefined;
82
91
  },
83
92
  },
84
93
  methods: { nlToBr }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
3
  # 执行命令示例:
4
- # TAG=shell-pkg-v3.0.5-test.40 ./shell/scripts/publish-shell.sh
4
+ # TAG=shell-pkg-v3.0.5-test.42 ./shell/scripts/publish-shell.sh
5
5
 
6
6
  set -euo pipefail
7
7
 
package/utils/error.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { isArray } from '@shell/utils/array';
2
2
 
3
3
  import translations from './errorTranslate.json';
4
+ import errorTranslateNew from './errorTranslateNew.json';
4
5
 
5
6
  export class ClusterNotFoundError extends Error {
6
7
  static NAME = 'ClusterNotFoundError'
@@ -49,6 +50,9 @@ export class ApiError extends Error {
49
50
  }
50
51
 
51
52
  export function stringify(err) {
53
+
54
+ console.log(err, ' err-------------------------------------------------1')
55
+
52
56
  let str;
53
57
  if ( typeof err === 'string' ) {
54
58
  str = err;
@@ -92,6 +96,8 @@ export function exceptionToErrorsArray(err) {
92
96
  if ( err?.response?.data ) {
93
97
  const body = err.response.data;
94
98
 
99
+ console.log(err, ' err-------------------------------------------------1')
100
+
95
101
  if ( body && body.message ) {
96
102
  return [translateError(body.message)];
97
103
  } else {
@@ -147,7 +153,9 @@ export function translateError(error) {
147
153
  console.log('00044', error);
148
154
 
149
155
 
150
- if (error.includes('spec and status of disks on node') && error.includes('are being syncing and please retry later')) {
156
+ if (error.includes("a lowercase rfc 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character")) {
157
+ error = "无效的名称不符合 RFC 1123 命名规则。名称只能包含小写字母、数字或 '-',并且必须以字母或数字开头和结尾(例如 'my-name' 或 '123-abc')。"
158
+ } else if (error.includes('spec and status of disks on node') && error.includes('are being syncing and please retry later')) {
151
159
  error = error.replace('spec and status of disks on node','').replace('are being syncing and please retry later','')
152
160
  error = '节点' + error + '上的硬盘规格和状态正在同步,请稍后重试'
153
161
  } else if (error.includes('same granularity as schedule') && error.includes('and offset less than')) {
@@ -174,7 +182,7 @@ export function translateError(error) {
174
182
 
175
183
  error = `子网 '${subnetName}' 配置无效:1) 名称禁止以数字开头;2) 排除IP[${idx}] 不能为空且必须是合法 IPv4/IPv6 地址或地址段`;
176
184
  }
177
-
185
+
178
186
  // error = error.replace(/admission webhook(.*?)denied the request:/g, (match, p1) => {
179
187
  // return '';
180
188
  // })
@@ -187,8 +195,9 @@ export function translateError(error) {
187
195
  error = error.substring(errorIndex + 4);
188
196
  }
189
197
 
198
+ const translationsList = [...errorTranslateNew.translations, ...translations.translations]
190
199
 
191
- for (const translation of translations.translations) {
200
+ for (const translation of translationsList) {
192
201
 
193
202
  // if (error.includes(translation.pattern)) {
194
203
  // error = error.replace(translation.pattern, translation.replacement);
@@ -1,5 +1,55 @@
1
1
  {
2
2
  "translations": [
3
+ {
4
+ "pattern": "storageclasses.storage.k8sio \"(\\S+)\" is forbidden: User \"(\\S+)\" cannot patch resource \"(\\S+)\" in APl group \"(\\S+)\" at the cluster scope",
5
+ "replacement": "权限不足",
6
+ "flags": "gi"
7
+ },
8
+ {
9
+ "pattern": "virtualmachineimages.harvesterhciio \"(\\S+)\" is forbidden: User \"(\\S+)\" cannot patch resource \"(\\S+)\" in Apl group \"(\\S+)\" in the namespace \"(\\S+)\"",
10
+ "replacement": "权限不足",
11
+ "flags": "gi"
12
+ },
13
+ {
14
+ "pattern": "Method POST not supported",
15
+ "replacement": "权限不足",
16
+ "flags": "gi"
17
+ },
18
+ {
19
+ "pattern": "Method GET not supported",
20
+ "replacement": "权限不足",
21
+ "flags": "gi"
22
+ },
23
+ {
24
+ "pattern": "Method CREATE not supported",
25
+ "replacement": "权限不足",
26
+ "flags": "gi"
27
+ },
28
+ {
29
+ "pattern": "Method GET not supported",
30
+ "replacement": "权限不足",
31
+ "flags": "gi"
32
+ },
33
+ {
34
+ "pattern": "Method DELETE not supported",
35
+ "replacement": "权限不足",
36
+ "flags": "gi"
37
+ },
38
+ {
39
+ "pattern": "Method PUT not supported",
40
+ "replacement": "权限不足",
41
+ "flags": "gi"
42
+ },
43
+ {
44
+ "pattern": "failure while starting vmi: arm64 not support this disk bus type, please use virtio or scsi",
45
+ "replacement": "启动虚拟机实例失败:ARM64 架构不支持此磁盘总线类型,请使用 virtio 或 scsi",
46
+ "flags": "gi"
47
+ },
48
+ {
49
+ "pattern": "the server could not find the requested resource",
50
+ "replacement": "服务器无法找到请求的资源",
51
+ "flags": "gi"
52
+ },
3
53
  {
4
54
  "pattern": "failed to create vm backup, error: provisioner nfs.csi.k8s.io is not supported for type backup",
5
55
  "replacement": "创建虚拟机备份失败, 错误:nfs存储不支持备份",
@@ -1532,6 +1582,10 @@
1532
1582
  "pattern": "could not",
1533
1583
  "replacement": "无法"
1534
1584
  },
1585
+ {
1586
+ "pattern": "MissingRequired",
1587
+ "replacement": "缺少"
1588
+ },
1535
1589
  {
1536
1590
  "pattern": "cannot",
1537
1591
  "replacement": "不能"
@@ -1692,6 +1746,14 @@
1692
1746
  "pattern": "replicaset",
1693
1747
  "replacement": "副本集"
1694
1748
  },
1749
+ {
1750
+ "pattern": "Cluster",
1751
+ "replacement": "名称"
1752
+ },
1753
+ {
1754
+ "pattern": "name",
1755
+ "replacement": "名称"
1756
+ },
1695
1757
  {
1696
1758
  "pattern": "%",
1697
1759
  "replacement": ""
@@ -0,0 +1,34 @@
1
+ {
2
+ "translations": [
3
+ {
4
+ "pattern": "Cluster agent is not connected",
5
+ "replacement": "集群agent未连接",
6
+ "flags": "gi"
7
+ },
8
+ {
9
+ "pattern": "waiting for api to be available",
10
+ "replacement": "等待api可用",
11
+ "flags": "gi"
12
+ },
13
+ {
14
+ "pattern": "MissingRequired Cluster name",
15
+ "replacement": "缺少集群名称",
16
+ "flags": "gi"
17
+ },
18
+ {
19
+ "pattern": "users\\.management\\.cattle\\.io.*forbidden.*user.*cannot update resource.*users.*management\\.cattle\\.io.*cluster scope",
20
+ "replacement": "权限不足:当前用户无权修改用户资源。",
21
+ "flags": "gi"
22
+ },
23
+ {
24
+ "pattern": "Cluster agent is not connected",
25
+ "replacement": "集群agent未连接",
26
+ "flags": "gi"
27
+ },
28
+ {
29
+ "pattern": "waiting for api to be available",
30
+ "replacement": "等待api可用",
31
+ "flags": "gi"
32
+ }
33
+ ]
34
+ }