Merge pull request #11589 from richard-cox/fix-home-scaling-issue

Fix home page cluster description scaling issue
This commit is contained in:
Richard Cox 2024-08-07 13:03:21 +01:00 committed by GitHub
commit 4fe4aa16be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 20 deletions

View File

@ -10,7 +10,7 @@ import { addParams } from '@shell/utils/url';
import { isEmpty } from '@shell/utils/object'; import { isEmpty } from '@shell/utils/object';
import { HARVESTER_NAME as HARVESTER } from '@shell/config/features'; import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
import { isHarvesterCluster } from '@shell/utils/cluster'; import { isHarvesterCluster } from '@shell/utils/cluster';
import HybridModel from '@shell/plugins/steve/hybrid-class'; import SteveModel from '@shell/plugins/steve/steve-class';
import { LINUX, WINDOWS } from '@shell/store/catalog'; import { LINUX, WINDOWS } from '@shell/store/catalog';
import { KONTAINER_TO_DRIVER } from './management.cattle.io.kontainerdriver'; import { KONTAINER_TO_DRIVER } from './management.cattle.io.kontainerdriver';
import { PINNED_CLUSTERS } from '@shell/store/prefs'; import { PINNED_CLUSTERS } from '@shell/store/prefs';
@ -27,7 +27,7 @@ function findRelationship(verb, type, relationships = []) {
return relationships.find((r) => r[from] === type)?.[id]; return relationships.find((r) => r[from] === type)?.[id];
} }
export default class MgmtCluster extends HybridModel { export default class MgmtCluster extends SteveModel {
get details() { get details() {
const out = [ const out = [
{ {

View File

@ -986,4 +986,8 @@ export default class ProvCluster extends SteveModel {
'spec.rkeConfig.machinePools.dynamicSchemaSpec', 'spec.rkeConfig.machinePools.dynamicSchemaSpec',
]; ];
} }
get description() {
return super.description || this.mgmt?.description;
}
} }

View File

@ -91,10 +91,6 @@ export default {
...mapGetters(['currentCluster', 'defaultClusterId', 'releaseNotesUrl']), ...mapGetters(['currentCluster', 'defaultClusterId', 'releaseNotesUrl']),
mcm: mapFeature(MULTI_CLUSTER), mcm: mapFeature(MULTI_CLUSTER),
mgmtClusters() {
return this.$store.getters['management/all'](MANAGEMENT.CLUSTER);
},
provClusters() { provClusters() {
return this.$store.getters['management/all'](CAPI.RANCHER_CLUSTER); return this.$store.getters['management/all'](CAPI.RANCHER_CLUSTER);
}, },
@ -211,15 +207,7 @@ export default {
}, },
kubeClusters() { kubeClusters() {
const filteredClusters = filterHiddenLocalCluster(filterOnlyKubernetesClusters(this.provClusters || [], this.$store), this.$store); return filterHiddenLocalCluster(filterOnlyKubernetesClusters(this.provClusters || [], this.$store), this.$store);
return filteredClusters.map((provCluster) => {
const mgmtCluster = this.mgmtClusters?.find((c) => provCluster.mgmt?.id === c.id);
provCluster.description = provCluster.description || mgmtCluster?.description;
return provCluster;
});
} }
}, },

View File

@ -1,4 +1,4 @@
import { ANNOTATIONS_TO_IGNORE_REGEX, LABELS_TO_IGNORE_REGEX, DESCRIPTION } from '@shell/config/labels-annotations'; import { ANNOTATIONS_TO_IGNORE_REGEX, LABELS_TO_IGNORE_REGEX } from '@shell/config/labels-annotations';
import omitBy from 'lodash/omitBy'; import omitBy from 'lodash/omitBy';
import pickBy from 'lodash/pickBy'; import pickBy from 'lodash/pickBy';
import Vue from 'vue'; import Vue from 'vue';
@ -100,8 +100,4 @@ export default class HybridModel extends Resource {
get state() { get state() {
return this.stateObj?.name || 'unknown'; return this.stateObj?.name || 'unknown';
} }
get description() {
return this.metadata?.annotations?.[DESCRIPTION] || this.spec?.description || this._description;
}
} }