From bf5536b788e4215b7187b5cc14d47d33f7ab745c Mon Sep 17 00:00:00 2001 From: Martin Hradil Date: Tue, 20 Aug 2024 20:48:13 +0000 Subject: [PATCH] Collection detail install - fix download failing on empty basePath, hide signature expander when not signed Issue: AAP-28589 --- .../e2e/hub/collections-detail-install.cy.ts | 17 ++++++----- .../CollectionPage/CollectionInstall.tsx | 30 ++++++++----------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/cypress/e2e/hub/collections-detail-install.cy.ts b/cypress/e2e/hub/collections-detail-install.cy.ts index 9bf9e80226..e62d08b58f 100644 --- a/cypress/e2e/hub/collections-detail-install.cy.ts +++ b/cypress/e2e/hub/collections-detail-install.cy.ts @@ -1,7 +1,6 @@ import { randomE2Ename } from '../../support/utils'; import { Collections } from './constants'; -// cypress describe('collections-detail-install', () => { let collectionName: string = ''; let namespaceName: string = ''; @@ -15,7 +14,7 @@ describe('collections-detail-install', () => { cy.getByDataCy('collection-install-tab').click(); } - beforeEach(() => { + before(() => { namespaceName = randomE2Ename(); collectionName = randomE2Ename(); @@ -24,6 +23,11 @@ describe('collections-detail-install', () => { }); }); + after(() => { + cy.deleteHubCollectionByName(collectionName); + cy.deleteHubNamespace({ name: namespaceName, failOnStatusCode: false }); + }); + it('can download tarball', () => { goToInstallTab(); @@ -51,11 +55,8 @@ describe('collections-detail-install', () => { // for now we test button is rendered cy.contains('button', 'Download tarball'); - cy.contains('button', 'Show signature').click(); - //cy.contains('BEGIN PGP SIGNATURE'); - }); - - afterEach(() => { - cy.deleteHubCollectionByName(collectionName); + // FIXME: sign collection first + // cy.contains('button', 'Show signature').click(); + // cy.contains('BEGIN PGP SIGNATURE'); }); }); diff --git a/frontend/hub/collections/CollectionPage/CollectionInstall.tsx b/frontend/hub/collections/CollectionPage/CollectionInstall.tsx index 969edd63c5..624df2be53 100644 --- a/frontend/hub/collections/CollectionPage/CollectionInstall.tsx +++ b/frontend/hub/collections/CollectionPage/CollectionInstall.tsx @@ -45,7 +45,7 @@ export function CollectionInstall() { const content = contentResults?.results[0]; - if ((!basePath && !error) || (!content && !contentError)) { + if ((!basePath && !error) || (!content && !contentError) || !collection) { return ; } @@ -141,22 +141,18 @@ export function CollectionInstall() { - - - {showSignature && } - + {collection?.is_signed ? ( + + + {showSignature && } + + ) : null} {collection?.collection_version?.requires_ansible &&