Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix home page cluster description scaling issue #11595

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions shell/models/management.cattle.io.cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { addParams } from '@shell/utils/url';
import { isEmpty } from '@shell/utils/object';
import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
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 { KONTAINER_TO_DRIVER } from './management.cattle.io.kontainerdriver';
import { PINNED_CLUSTERS } from '@shell/store/prefs';
Expand All @@ -27,7 +27,7 @@ function findRelationship(verb, type, relationships = []) {
return relationships.find((r) => r[from] === type)?.[id];
}

export default class MgmtCluster extends HybridModel {
export default class MgmtCluster extends SteveModel {
get details() {
const out = [
{
Expand Down
4 changes: 4 additions & 0 deletions shell/models/provisioning.cattle.io.cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -986,4 +986,8 @@ export default class ProvCluster extends SteveModel {
'spec.rkeConfig.machinePools.dynamicSchemaSpec',
];
}

get description() {
return super.description || this.mgmt?.description;
}
}
14 changes: 1 addition & 13 deletions shell/pages/home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ export default {
...mapGetters(['currentCluster', 'defaultClusterId', 'releaseNotesUrl']),
mcm: mapFeature(MULTI_CLUSTER),

mgmtClusters() {
return this.$store.getters['management/all'](MANAGEMENT.CLUSTER);
},

provClusters() {
return this.$store.getters['management/all'](CAPI.RANCHER_CLUSTER);
},
Expand Down Expand Up @@ -211,15 +207,7 @@ export default {
},

kubeClusters() {
const filteredClusters = 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;
});
return filterHiddenLocalCluster(filterOnlyKubernetesClusters(this.provClusters || [], this.$store), this.$store);
}
},

Expand Down
6 changes: 1 addition & 5 deletions shell/plugins/steve/hybrid-class.js
Original file line number Diff line number Diff line change
@@ -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 pickBy from 'lodash/pickBy';
import Vue from 'vue';
Expand Down Expand Up @@ -100,8 +100,4 @@ export default class HybridModel extends Resource {
get state() {
return this.stateObj?.name || 'unknown';
}

get description() {
return this.metadata?.annotations?.[DESCRIPTION] || this.spec?.description || this._description;
}
}
Loading