mirror of https://github.com/rancher/dashboard.git
Add Unknown to architecture possible values; Add translations
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
parent
8631e6c8f1
commit
17677f3499
|
|
@ -1726,6 +1726,11 @@ cluster:
|
||||||
}
|
}
|
||||||
rkeTemplateUpgrade: Template revision {name} available for upgrade
|
rkeTemplateUpgrade: Template revision {name} available for upgrade
|
||||||
|
|
||||||
|
architecture:
|
||||||
|
label:
|
||||||
|
unknown: Unknown
|
||||||
|
mixed: Mixed
|
||||||
|
|
||||||
availabilityWarnings:
|
availabilityWarnings:
|
||||||
node: Node {name} is inactive
|
node: Node {name} is inactive
|
||||||
machine: Machine {name} is inactive
|
machine: Machine {name} is inactive
|
||||||
|
|
|
||||||
|
|
@ -408,11 +408,11 @@ export default class ProvCluster extends SteveModel {
|
||||||
const obj = {};
|
const obj = {};
|
||||||
|
|
||||||
this.nodes?.forEach((node) => {
|
this.nodes?.forEach((node) => {
|
||||||
const key = capitalize(node.status?.nodeLabels?.[NODE_ARCHITECTURE] || '');
|
const architecture = node.status?.nodeLabels?.[NODE_ARCHITECTURE];
|
||||||
|
|
||||||
|
const key = architecture ? capitalize(architecture) : this.t('cluster.architecture.label.unknown');
|
||||||
|
|
||||||
if (key) {
|
|
||||||
obj[key] = (obj[key] || 0) + 1;
|
obj[key] = (obj[key] || 0) + 1;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
|
@ -422,7 +422,7 @@ export default class ProvCluster extends SteveModel {
|
||||||
const keys = Object.keys(this.nodesArchitecture);
|
const keys = Object.keys(this.nodesArchitecture);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
label: keys.length === 1 ? keys[0] : 'Mixed',
|
label: keys.length === 1 ? keys[0] : this.t('cluster.architecture.label.mixed'),
|
||||||
tooltip: keys.length === 1 ? undefined : keys.reduce((acc, k) => `${ acc }${ k }: ${ this.nodesArchitecture[k] }<br>`, '')
|
tooltip: keys.length === 1 ? undefined : keys.reduce((acc, k) => `${ acc }${ k }: ${ this.nodesArchitecture[k] }<br>`, '')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -160,8 +160,10 @@ describe('page: cluster dashboard', () => {
|
||||||
['clusterProvider', [], 'other'],
|
['clusterProvider', [], 'other'],
|
||||||
['kubernetesVersion', [], '0.0.0 k3s'],
|
['kubernetesVersion', [], '0.0.0 k3s'],
|
||||||
['created', [], 'glance.created'],
|
['created', [], 'glance.created'],
|
||||||
['architecture', [{ labels: { [NODE_ARCHITECTURE]: 'amd64' } }, { labels: { [NODE_ARCHITECTURE]: 'intel' } }], 'Mixed'],
|
['architecture', [{ labels: { [NODE_ARCHITECTURE]: 'amd64' } }, { labels: { [NODE_ARCHITECTURE]: 'intel' } }], 'mixed'],
|
||||||
|
['architecture', [{ labels: { [NODE_ARCHITECTURE]: 'amd64' } }, { labels: { } }], 'mixed'],
|
||||||
['architecture', [{ labels: { [NODE_ARCHITECTURE]: 'amd64' } }], 'Amd64'],
|
['architecture', [{ labels: { [NODE_ARCHITECTURE]: 'amd64' } }], 'Amd64'],
|
||||||
|
['architecture', [{ labels: { } }], 'unknown'],
|
||||||
])('should show %p label', (label, nodes, text) => {
|
])('should show %p label', (label, nodes, text) => {
|
||||||
const options = clone(mountOptions);
|
const options = clone(mountOptions);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,11 +204,11 @@ export default {
|
||||||
const obj = {};
|
const obj = {};
|
||||||
|
|
||||||
this.nodes?.forEach((node) => {
|
this.nodes?.forEach((node) => {
|
||||||
const key = capitalize(node.labels?.[NODE_ARCHITECTURE] || '');
|
const architecture = node.labels?.[NODE_ARCHITECTURE];
|
||||||
|
|
||||||
|
const key = architecture ? capitalize(architecture) : this.t('cluster.architecture.label.unknown');
|
||||||
|
|
||||||
if (key) {
|
|
||||||
obj[key] = (obj[key] || 0) + 1;
|
obj[key] = (obj[key] || 0) + 1;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
|
@ -218,7 +218,7 @@ export default {
|
||||||
const keys = Object.keys(this.nodesArchitecture);
|
const keys = Object.keys(this.nodesArchitecture);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
label: keys.length === 1 ? keys[0] : 'Mixed',
|
label: keys.length === 1 ? keys[0] : this.t('cluster.architecture.label.mixed'),
|
||||||
tooltip: keys.length === 1 ? undefined : keys.reduce((acc, k) => `${ acc }${ k }: ${ this.nodesArchitecture[k] }<br>`, '')
|
tooltip: keys.length === 1 ? undefined : keys.reduce((acc, k) => `${ acc }${ k }: ${ this.nodesArchitecture[k] }<br>`, '')
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue