dashboard-shell-shell 1.0.112 → 1.0.114
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/.DS_Store +0 -0
- package/assets/icons/demo.css +539 -0
- package/assets/icons/demo_index.html +1131 -0
- package/assets/icons/iconfont.css +200 -0
- package/assets/icons/iconfont.js +1 -0
- package/assets/icons/iconfont.json +296 -0
- package/assets/icons/iconfont.ttf +0 -0
- package/assets/icons/iconfont.woff +0 -0
- package/assets/icons/iconfont.woff2 +0 -0
- package/assets/images/API.svg +3 -0
- package/assets/images/login/password.svg +20 -0
- package/assets/images/login/user.svg +6 -0
- package/assets/images/login-bg.png +0 -0
- package/assets/images/login-left.png +0 -0
- package/assets/images/login-logo.svg +19 -0
- package/assets/images/logo.png +0 -0
- package/assets/images/pl/harvester.png +0 -0
- package/assets/images/promp-yellow.svg +5 -0
- package/assets/images/user.png +0 -0
- package/assets/styles/all.scss +63 -0
- package/assets/styles/app.scss +2 -0
- package/assets/styles/base/_basic.scss +8 -2
- package/assets/styles/base/_helpers.scss +4 -0
- package/assets/styles/base/_typography.scss +2 -1
- package/assets/styles/base/_variables.scss +10 -2
- package/assets/styles/global/_button.scss +37 -25
- package/assets/styles/global/_columns.scss +3 -1
- package/assets/styles/global/_form.scss +45 -13
- package/assets/styles/global/_labeled-input.scss +50 -25
- package/assets/styles/global/_layout.scss +9 -3
- package/assets/styles/global/_select.scss +20 -13
- package/assets/styles/global/_table.scss +1 -1
- package/assets/styles/global/_tooltip.scss +47 -6
- package/assets/styles/themes/_dark.scss +1 -0
- package/assets/styles/themes/_light.scss +59 -46
- package/assets/styles/themes/_suse.scss +1 -0
- package/assets/styles/vendor/vue-select.scss +18 -7
- package/assets/translations/en-us.yaml +93 -12
- package/assets/translations/zh-hans.yaml +278 -141
- package/package.json +1 -1
- package/store/type-map.js +29 -2
- package/utils/error.js +30 -8
- package/utils/errorTranslate.json +916 -0
package/package.json
CHANGED
package/store/type-map.js
CHANGED
|
@@ -107,6 +107,7 @@
|
|
|
107
107
|
// graphConfig: undefined -- Use this to pass along the graph configuration
|
|
108
108
|
// notFilterNamespace: undefined -- Define namespaces that do not need to be filtered
|
|
109
109
|
// localOnly: False -- Hide this type from the nav/search bar on downstream clusters
|
|
110
|
+
// custom: any - Custom options for a given type
|
|
110
111
|
// }
|
|
111
112
|
// )
|
|
112
113
|
// ignoreGroup(group): Never show group or any types in it
|
|
@@ -508,6 +509,12 @@ export const getters = {
|
|
|
508
509
|
return state.basicTypes?.[product]?.[schemaId];
|
|
509
510
|
};
|
|
510
511
|
},
|
|
512
|
+
|
|
513
|
+
groupsForVirTypes(state) {
|
|
514
|
+
return (product, name) => {
|
|
515
|
+
return state.virtualTypes?.[product].find(item => item.name === name)?.icon;
|
|
516
|
+
};
|
|
517
|
+
},
|
|
511
518
|
|
|
512
519
|
optionsFor(state, getters, rootState, rootGetters) {
|
|
513
520
|
const def = {
|
|
@@ -524,6 +531,7 @@ export const getters = {
|
|
|
524
531
|
depaginate: false,
|
|
525
532
|
customRoute: undefined,
|
|
526
533
|
resourceEditMasthead: true,
|
|
534
|
+
custom: {},
|
|
527
535
|
};
|
|
528
536
|
|
|
529
537
|
return (schemaOrType, pagination) => {
|
|
@@ -657,7 +665,18 @@ export const getters = {
|
|
|
657
665
|
|
|
658
666
|
const label = typeObj.labelKey ? rootGetters['i18n/t'](typeObj.labelKey) || typeObj.label : typeObj.label;
|
|
659
667
|
|
|
660
|
-
const
|
|
668
|
+
const virtual = !!typeObj.virtual;
|
|
669
|
+
let icon = typeObj.icon;
|
|
670
|
+
|
|
671
|
+
if ( (!virtual || typeObj.isSpoofed ) && !icon ) {
|
|
672
|
+
if ( namespaced ) {
|
|
673
|
+
icon = 'folder';
|
|
674
|
+
} else {
|
|
675
|
+
icon = 'globe';
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
const labelDisplay = highlightLabel(label,icon, count, typeObj.schema);
|
|
661
680
|
|
|
662
681
|
if ( !labelDisplay ) {
|
|
663
682
|
// Search happens in highlight and returns null if not found
|
|
@@ -765,7 +784,7 @@ export const getters = {
|
|
|
765
784
|
return group;
|
|
766
785
|
}
|
|
767
786
|
|
|
768
|
-
function highlightLabel(original, count, schema) {
|
|
787
|
+
function highlightLabel(original, icon, count, schema) {
|
|
769
788
|
let label = escapeHtml(original);
|
|
770
789
|
|
|
771
790
|
if ( searchRegex ) {
|
|
@@ -789,6 +808,12 @@ export const getters = {
|
|
|
789
808
|
}
|
|
790
809
|
}
|
|
791
810
|
|
|
811
|
+
if ( icon ) {
|
|
812
|
+
console.log(icon)
|
|
813
|
+
label = `<i class="icon icon-fw icon-${ icon }"></i>${ label }`;
|
|
814
|
+
console.log(label)
|
|
815
|
+
}
|
|
816
|
+
|
|
792
817
|
return label;
|
|
793
818
|
}
|
|
794
819
|
};
|
|
@@ -1729,6 +1754,8 @@ export const mutations = {
|
|
|
1729
1754
|
let obj = { ...options, match };
|
|
1730
1755
|
|
|
1731
1756
|
if ( idx >= 0 ) {
|
|
1757
|
+
// Merge the custom data object - multiple configures will update existing rather than overwrite
|
|
1758
|
+
obj.custom = Object.assign(state.typeOptions[idx].custom || {}, obj.custom || {});
|
|
1732
1759
|
obj = Object.assign(state.typeOptions[idx], obj);
|
|
1733
1760
|
state.typeOptions.splice(idx, 1, obj);
|
|
1734
1761
|
} else {
|
package/utils/error.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { isArray } from '@shell/utils/array';
|
|
2
2
|
|
|
3
|
+
import translations from './errorTranslate.json';
|
|
4
|
+
|
|
3
5
|
export class ClusterNotFoundError extends Error {
|
|
4
6
|
static NAME = 'ClusterNotFoundError'
|
|
5
7
|
|
|
@@ -48,7 +50,7 @@ export class ApiError extends Error {
|
|
|
48
50
|
|
|
49
51
|
export function stringify(err) {
|
|
50
52
|
let str;
|
|
51
|
-
|
|
53
|
+
console.log('00043', err);
|
|
52
54
|
if ( typeof err === 'string' ) {
|
|
53
55
|
str = err;
|
|
54
56
|
} else if ( err && typeof err === 'object' ) {
|
|
@@ -60,7 +62,7 @@ export function stringify(err) {
|
|
|
60
62
|
const data = JSON.parse(str).data;
|
|
61
63
|
|
|
62
64
|
if (data) {
|
|
63
|
-
return data;
|
|
65
|
+
return translateError(data);
|
|
64
66
|
}
|
|
65
67
|
} catch {}
|
|
66
68
|
}
|
|
@@ -84,24 +86,30 @@ export function stringify(err) {
|
|
|
84
86
|
str = JSON.stringify(err);
|
|
85
87
|
}
|
|
86
88
|
|
|
87
|
-
return str;
|
|
89
|
+
return translateError(str);
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
export function exceptionToErrorsArray(err) {
|
|
93
|
+
console.log('00055', err);
|
|
91
94
|
if ( err?.response?.data ) {
|
|
92
95
|
const body = err.response.data;
|
|
93
96
|
|
|
94
97
|
if ( body && body.message ) {
|
|
95
|
-
return [body.message];
|
|
98
|
+
return [translateError(body.message)];
|
|
96
99
|
} else {
|
|
97
|
-
return [err];
|
|
100
|
+
return [translateError(err)];
|
|
98
101
|
}
|
|
99
102
|
} else if (err.status && err.message) {
|
|
100
|
-
return [err.message];
|
|
103
|
+
return [translateError(err.message)];
|
|
101
104
|
} else if ( isArray(err) ) {
|
|
102
|
-
|
|
105
|
+
let arr = []
|
|
106
|
+
for (let index = 0; index < err.length; index++) {
|
|
107
|
+
arr[index] = translateError(err[index])
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return [...new Set(arr)];
|
|
103
111
|
} else {
|
|
104
|
-
return [err];
|
|
112
|
+
return [translateError(err)];
|
|
105
113
|
}
|
|
106
114
|
}
|
|
107
115
|
|
|
@@ -129,3 +137,17 @@ export const normalizeError = (err) => {
|
|
|
129
137
|
statusCode: (err.statusCode || err.status || (err.response && err.response.status) || 500)
|
|
130
138
|
};
|
|
131
139
|
};
|
|
140
|
+
export function translateError(error) {
|
|
141
|
+
const originError = error;
|
|
142
|
+
error = error.toLowerCase();
|
|
143
|
+
console.log('00044', error);
|
|
144
|
+
|
|
145
|
+
// Apply translations from JSON
|
|
146
|
+
for (const translation of translations.translations) {
|
|
147
|
+
if (error.includes(translation.pattern)) {
|
|
148
|
+
error = error.replace(new RegExp(translation.pattern, 'g'), translation.replacement);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return error;
|
|
153
|
+
}
|