Skip to content

Commit

Permalink
Merge pull request #11308 from codyrancher/fleet-repo-button
Browse files Browse the repository at this point in the history
Fixing the Add Repository button on the fleet cluster detail page
  • Loading branch information
codyrancher authored Jun 28, 2024
2 parents 6aeadc3 + 48e0901 commit 9d91de0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
4 changes: 4 additions & 0 deletions cypress/e2e/po/detail/fleet/tabs/git-repos-tab.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ export default class GitReposTab extends ComponentPo {
list() {
return new BaseResourceList('#repos [data-testid="sortable-table-list-container"]');
}

addRepostoryButton() {
return this.self().get('.btn').contains('Add Repository');
}
}
9 changes: 9 additions & 0 deletions cypress/e2e/tests/pages/fleet/fleet-clusters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@ describe('Fleet Clusters', { tags: ['@fleet', '@adminUser'] }, () => {
});
});

it('Git Repos Tab Add Repository button takes you to the correct page', function() {
const fleetClusterDetailsPage = new FleetClusterDetailsPo(namespace, this.rke2Ec2ClusterName);

fleetClusterDetailsPage.waitForPage(null, 'repos');
fleetClusterDetailsPage.gitReposTab().addRepostoryButton().click();

cy.url().should('include', `${ Cypress.config().baseUrl }/c/_/fleet/fleet.cattle.io.gitrepo/create`);
});

it('adding git repo should add bundles on downstream cluster (deployments added)', function() {
const deploymentsList = new WorkloadsDeploymentsListPagePo(this.clusterId);

Expand Down
24 changes: 9 additions & 15 deletions shell/components/fleet/FleetIntro.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
<script>
import { AS, _YAML } from '@shell/config/query-params';
import { FLEET } from '@shell/config/types';
import { NAME } from '@shell/config/product/fleet';
export default {
name: 'FleetIntro',
data() {
const params = { ...this.$route.params };
const formRoute = { name: `${ this.$route.name }-create`, params };
const hasEditComponent = this.$store.getters['type-map/hasCustomEdit'](this.resource);
const yamlRoute = {
name: `${ this.$route.name }-create`,
params,
query: { [AS]: _YAML },
const gitRepoRoute = {
name: 'c-cluster-product-resource-create',
params: {
product: NAME,
resource: FLEET.GIT_REPO
},
};
const gitRepoSchema = this.$store.getters['management/schemaFor'](FLEET.GIT_REPO);
const canCreateRepos = gitRepoSchema && gitRepoSchema.resourceMethods.includes('PUT');
return {
formRoute,
yamlRoute,
hasEditComponent,
gitRepoRoute,
canCreateRepos
};
},
Expand All @@ -42,7 +36,7 @@ export default {
class="actions"
>
<router-link
:to="formRoute"
:to="gitRepoRoute"
class="btn role-secondary"
>
{{ t('fleet.gitRepo.repo.addRepo') }}
Expand Down

0 comments on commit 9d91de0

Please sign in to comment.