Skip to content

Commit

Permalink
Fix gitrepo detail view bundle count (rancher#9867)
Browse files Browse the repository at this point in the history
* use bundle repoName getter to filter bundles in repo

* fleetsummary unit test
  • Loading branch information
mantis-toboggan-md authored Nov 27, 2023
1 parent 91d756a commit 80762b5
Show file tree
Hide file tree
Showing 3 changed files with 324 additions and 14 deletions.
16 changes: 5 additions & 11 deletions shell/components/fleet/FleetBundles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export default {
computed: {
allBundles() {
// gitrepo model has getter for bundles.
allBundlesInRepo() {
// gitrepo model has getter for its bundles.
return this.value.bundles || [];
},
Expand All @@ -65,13 +65,7 @@ export default {
bundles() {
const harvester = this.harvesterClusters;
return this.allBundles.filter((bundle) => {
const isRepoBundle = bundle.metadata.name.startsWith(`${ this.value.metadata.name }-`);
if (!isRepoBundle) {
return false;
}
return this.allBundlesInRepo.filter((bundle) => {
const targets = bundle.spec?.targets || [];
// Filter out any bundle that has one target whose cluster is a harvester cluster
Expand All @@ -84,7 +78,7 @@ export default {
},
hidden() {
return this.allBundles.length - this.bundles.length;
return this.allBundlesInRepo.length - this.bundles.length;
},
headers() {
Expand All @@ -105,14 +99,14 @@ export default {
return out;
},
},
methods: {
displayWarning(row) {
return !!row.status?.summary && (row.status.summary.desiredReady !== row.status.summary.ready);
}
}
};
</script>
<template>
<div>
<Loading v-if="$fetchState.pending" />
Expand Down
6 changes: 3 additions & 3 deletions shell/components/fleet/FleetSummary.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script>
import capitalize from 'lodash/capitalize';
import { STATES, STATES_ENUM } from '@shell/plugins/dashboard-store/resource-class';
import FleetStatus from '@shell/components/fleet/FleetStatus';
Expand Down Expand Up @@ -85,7 +84,7 @@ export default {
},
bundleCounts() {
const resources = this.bundles.filter((item) => item.metadata.name.startsWith(`${ this.repoName }-`));
const resources = this.bundles.filter((item) => item.repoName === this.repoName);
if (!resources.length) {
return [];
Expand Down Expand Up @@ -179,7 +178,6 @@ export default {
},
methods: { capitalize },
};
</script>
Expand All @@ -190,11 +188,13 @@ export default {
title="Bundles"
:values="bundleCounts"
value-key="count"
data-testid="gitrepo-bundle-summary"
/>
<FleetStatus
title="Resources"
:values="resourceCounts"
value-key="count"
data-testid="gitrepo-deployment-summary"
/>
</div>
</template>
Expand Down
Loading

0 comments on commit 80762b5

Please sign in to comment.