mirror of https://github.com/rancher/dashboard.git
Obtain bundle and resource statuses from GitRepo status
This commit is contained in:
parent
1b9d95f3cc
commit
69a89d81d7
|
|
@ -20,6 +20,21 @@ function quacksLikeAHash(str) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function normalizeStateCounts(data) {
|
||||
if (!data || data === {}) {
|
||||
return {
|
||||
total: 0,
|
||||
states: {},
|
||||
};
|
||||
}
|
||||
const { desiredReady, ...rest } = data ;
|
||||
|
||||
return {
|
||||
total: desiredReady,
|
||||
states: rest,
|
||||
};
|
||||
}
|
||||
|
||||
export default class GitRepo extends SteveModel {
|
||||
applyDefaults() {
|
||||
const spec = this.spec || {};
|
||||
|
|
@ -325,6 +340,16 @@ export default class GitRepo extends SteveModel {
|
|||
return bds.filter((bd) => bd.metadata?.labels?.['fleet.cattle.io/repo-name'] === this.name);
|
||||
}
|
||||
|
||||
get allBundlesStatuses() {
|
||||
const { nonReadyResources, ...bundlesSummary } = this.status?.summary || {};
|
||||
|
||||
return normalizeStateCounts(bundlesSummary);
|
||||
}
|
||||
|
||||
get allResourceStatuses() {
|
||||
return normalizeStateCounts(this.status?.resourceCounts || {});
|
||||
}
|
||||
|
||||
statusResourceCountsForCluster(clusterId) {
|
||||
if (!this.targetClusters.some((c) => c.id === clusterId)) {
|
||||
return {};
|
||||
|
|
|
|||
Loading…
Reference in New Issue