Add Unknown to architecture possible values; Add translations

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia 2024-04-16 17:51:44 +02:00
parent 8631e6c8f1
commit 17677f3499
No known key found for this signature in database
GPG Key ID: E6D011B7415D4393
4 changed files with 18 additions and 11 deletions

View File

@ -1726,6 +1726,11 @@ cluster:
}
rkeTemplateUpgrade: Template revision {name} available for upgrade
architecture:
label:
unknown: Unknown
mixed: Mixed
availabilityWarnings:
node: Node {name} is inactive
machine: Machine {name} is inactive

View File

@ -408,11 +408,11 @@ export default class ProvCluster extends SteveModel {
const obj = {};
this.nodes?.forEach((node) => {
const key = capitalize(node.status?.nodeLabels?.[NODE_ARCHITECTURE] || '');
const architecture = node.status?.nodeLabels?.[NODE_ARCHITECTURE];
if (key) {
obj[key] = (obj[key] || 0) + 1;
}
const key = architecture ? capitalize(architecture) : this.t('cluster.architecture.label.unknown');
obj[key] = (obj[key] || 0) + 1;
});
return obj;
@ -422,7 +422,7 @@ export default class ProvCluster extends SteveModel {
const keys = Object.keys(this.nodesArchitecture);
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>`, '')
};
}

View File

@ -160,8 +160,10 @@ describe('page: cluster dashboard', () => {
['clusterProvider', [], 'other'],
['kubernetesVersion', [], '0.0.0 k3s'],
['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: { } }], 'unknown'],
])('should show %p label', (label, nodes, text) => {
const options = clone(mountOptions);

View File

@ -204,11 +204,11 @@ export default {
const obj = {};
this.nodes?.forEach((node) => {
const key = capitalize(node.labels?.[NODE_ARCHITECTURE] || '');
const architecture = node.labels?.[NODE_ARCHITECTURE];
if (key) {
obj[key] = (obj[key] || 0) + 1;
}
const key = architecture ? capitalize(architecture) : this.t('cluster.architecture.label.unknown');
obj[key] = (obj[key] || 0) + 1;
});
return obj;
@ -218,7 +218,7 @@ export default {
const keys = Object.keys(this.nodesArchitecture);
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>`, '')
};
},