From 046eb4600990c6a0ea03097bb92b19a80a04fa75 Mon Sep 17 00:00:00 2001 From: Alejandro Ruiz Date: Thu, 31 Oct 2024 13:33:39 +0100 Subject: [PATCH] Use BundleDeployment status to calculate GitRepo resources --- .../pages/fleet/advanced/bundles.spec.ts | 2 +- shell/components/ResourceDetail/index.vue | 3 +- shell/components/fleet/FleetRepos.vue | 7 - shell/config/labels-annotations.js | 1 + shell/detail/fleet.cattle.io.bundle.vue | 73 +------- shell/detail/fleet.cattle.io.gitrepo.vue | 3 +- shell/models/fleet.cattle.io.bundle.js | 4 +- shell/models/fleet.cattle.io.gitrepo.js | 93 +++++----- shell/pages/c/_cluster/fleet/index.vue | 1 + shell/types/resources/fleet.d.ts | 40 +++++ shell/utils/auth.js | 2 +- shell/utils/fleet.ts | 159 ++++++++++++++++++ 12 files changed, 258 insertions(+), 130 deletions(-) create mode 100644 shell/types/resources/fleet.d.ts create mode 100644 shell/utils/fleet.ts diff --git a/cypress/e2e/tests/pages/fleet/advanced/bundles.spec.ts b/cypress/e2e/tests/pages/fleet/advanced/bundles.spec.ts index ae495d0e397..89b76b955ea 100644 --- a/cypress/e2e/tests/pages/fleet/advanced/bundles.spec.ts +++ b/cypress/e2e/tests/pages/fleet/advanced/bundles.spec.ts @@ -52,7 +52,7 @@ describe('Bundles', { testIsolation: 'off', tags: ['@fleet', '@adminUser'] }, () fleetBundleeDetailsPage.waitForPage(); // check table headers - const expectedHeadersDetailsViewEvents = ['Name']; + const expectedHeadersDetailsViewEvents = ['State', 'API Version', 'Kind', 'Name', 'Namespace']; fleetBundleeDetailsPage.list().resourceTable().sortableTable() .tableHeaderRow() diff --git a/shell/components/ResourceDetail/index.vue b/shell/components/ResourceDetail/index.vue index 10a94e907c6..8b845c91c01 100644 --- a/shell/components/ResourceDetail/index.vue +++ b/shell/components/ResourceDetail/index.vue @@ -173,7 +173,8 @@ export default { }, bundle: { inStoreType: 'management', - type: FLEET.BUNDLE + type: FLEET.BUNDLE, + opt: { excludeFields: ['metadata.managedFields', 'spec.resources'] }, }, bundleDeployment: { diff --git a/shell/components/fleet/FleetRepos.vue b/shell/components/fleet/FleetRepos.vue index 57ffddd53aa..4fed19ad5f8 100644 --- a/shell/components/fleet/FleetRepos.vue +++ b/shell/components/fleet/FleetRepos.vue @@ -16,7 +16,6 @@ import { FLEET_REPO_PER_CLUSTER_STATE } from '@shell/config/table-headers'; -import { FLEET } from '@shell/config/labels-annotations'; import { STATES_ENUM } from '@shell/plugins/dashboard-store/resource-class'; // i18n-ignore repoDisplay @@ -118,12 +117,6 @@ export default { parseTargetMode(row) { return row.targetInfo?.mode === 'clusterGroup' ? this.t('fleet.gitRepo.warningTooltip.clusterGroup') : this.t('fleet.gitRepo.warningTooltip.cluster'); }, - - clusterViewResourceStatus(row) { - return row.clusterResourceStatus.find((c) => { - return c.metadata?.labels[FLEET.CLUSTER_NAME] === this.clusterId; - }); - } }, }; diff --git a/shell/config/labels-annotations.js b/shell/config/labels-annotations.js index 237d96ffc78..193c241e982 100644 --- a/shell/config/labels-annotations.js +++ b/shell/config/labels-annotations.js @@ -113,6 +113,7 @@ export const FLEET = { CLUSTER_NAME: 'management.cattle.io/cluster-name', BUNDLE_ID: 'fleet.cattle.io/bundle-id', MANAGED: 'fleet.cattle.io/managed', + CLUSTER_NAMESPACE: 'fleet.cattle.io/cluster-namespace', CLUSTER: 'fleet.cattle.io/cluster' }; diff --git a/shell/detail/fleet.cattle.io.bundle.vue b/shell/detail/fleet.cattle.io.bundle.vue index d4ed8a0c8ea..765b19fdf80 100644 --- a/shell/detail/fleet.cattle.io.bundle.vue +++ b/shell/detail/fleet.cattle.io.bundle.vue @@ -1,77 +1,25 @@