dashboard/shell/models/cluster.x-k8s.io.machineset.js

24 lines
693 B
JavaScript

import { CAPI } from '@shell/config/types';
import { escapeHtml } from '@shell/utils/string';
import SteveModel from '@shell/plugins/steve/steve-class';
export default class CapiMachineSet extends SteveModel {
get cluster() {
if ( !this.spec.clusterName ) {
return null;
}
const clusterId = `${ this.metadata.namespace }/${ this.spec.clusterName }`;
const cluster = this.$rootGetters['management/byId'](CAPI.RANCHER_CLUSTER, clusterId);
return cluster;
}
get groupByLabel() {
const name = this.cluster?.nameDisplay || this.spec.clusterName;
return this.$rootGetters['i18n/t']('resourceTable.groupLabel.cluster', { name: escapeHtml(name) });
}
}