mirror of https://github.com/rancher/dashboard.git
39 lines
954 B
JavaScript
39 lines
954 B
JavaScript
import { CAPI } from '@/config/types';
|
|
import { CAPI as CAPI_LABELS } from '@/config/labels-annotations';
|
|
|
|
import { escapeHtml } from '@/utils/string';
|
|
|
|
export default {
|
|
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;
|
|
},
|
|
|
|
poolName() {
|
|
return this.metadata?.labels?.[ CAPI_LABELS.DEPLOYMENT_NAME ] || '';
|
|
},
|
|
|
|
poolId() {
|
|
const poolId = `${ this.metadata.namespace }/${ this.poolName }`;
|
|
|
|
return poolId;
|
|
},
|
|
|
|
pool() {
|
|
return this.$rootGetters['management/byId'](CAPI.MACHINE_DEPLOYMENT, this.poolId);
|
|
},
|
|
|
|
groupByLabel() {
|
|
const name = this.cluster?.nameDisplay || this.spec.clusterName;
|
|
|
|
return this.$rootGetters['i18n/t']('resourceTable.groupLabel.cluster', { name: escapeHtml(name) });
|
|
},
|
|
};
|