- Add providerSummary getter to machinedeployment model

- Hide provider labels for Harvester clusters

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia 2024-01-02 15:17:35 +01:00
parent 5770637a4c
commit b5ec434a42
No known key found for this signature in database
GPG Key ID: E6D011B7415D4393
3 changed files with 18 additions and 2 deletions

View File

@ -1 +1,3 @@
export const NAME = 'harvesterManager';
export const KIND = { MACHINE_TEMPLATE: 'HarvesterMachineTemplate' };

View File

@ -775,10 +775,10 @@ export default {
v-clean-html="t('resourceTable.groupLabel.notInANodePool')"
/>
<div
v-if="group.ref && group.ref.template"
v-if="group.ref && group.ref.providerSummary"
class="description text-muted text-small"
>
{{ group.ref.providerDisplay }} &ndash; {{ group.ref.providerLocation }} / {{ group.ref.providerSize }} ({{ group.ref.providerName }})
{{ group.ref.providerSummary }}
</div>
</div>
<div

View File

@ -7,6 +7,7 @@ import { handleConflict } from '@shell/plugins/dashboard-store/normalize';
import { MACHINE_ROLES } from '@shell/config/labels-annotations';
import { notOnlyOfRole } from '@shell/models/cluster.x-k8s.io.machine';
import { KIND } from '../config/elemental-types';
import { KIND as HARVESTER_KIND } from '../config/harvester-manager-types';
export default class CapiMachineDeployment extends SteveModel {
get cluster() {
@ -69,6 +70,19 @@ export default class CapiMachineDeployment extends SteveModel {
return this.template?.providerSize || this.t('node.list.poolDescription.noSize');
}
get providerSummary() {
if (this.template) {
switch (this.infrastructureRefKind) {
case HARVESTER_KIND.MACHINE_TEMPLATE:
return null;
default:
return `${ this.providerDisplay } \u2013 ${ this.providerLocation } / ${ this.providerSize } (${ this.providerName })`;
}
}
return null;
}
get desired() {
return this.spec?.replicas || 0;
}