Skip to content

Commit

Permalink
Collection detail install - fix download failing on empty basePath, h…
Browse files Browse the repository at this point in the history
…ide signature expander when not signed

Issue: AAP-28589
  • Loading branch information
himdel committed Aug 20, 2024
1 parent 7240e60 commit bf5536b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 25 deletions.
17 changes: 9 additions & 8 deletions cypress/e2e/hub/collections-detail-install.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { randomE2Ename } from '../../support/utils';
import { Collections } from './constants';

// cypress
describe('collections-detail-install', () => {
let collectionName: string = '';
let namespaceName: string = '';
Expand All @@ -15,7 +14,7 @@ describe('collections-detail-install', () => {
cy.getByDataCy('collection-install-tab').click();
}

beforeEach(() => {
before(() => {
namespaceName = randomE2Ename();
collectionName = randomE2Ename();

Expand All @@ -24,6 +23,11 @@ describe('collections-detail-install', () => {
});
});

after(() => {
cy.deleteHubCollectionByName(collectionName);
cy.deleteHubNamespace({ name: namespaceName, failOnStatusCode: false });
});

it('can download tarball', () => {
goToInstallTab();

Expand Down Expand Up @@ -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');
});
});
30 changes: 13 additions & 17 deletions frontend/hub/collections/CollectionPage/CollectionInstall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function CollectionInstall() {

const content = contentResults?.results[0];

if ((!basePath && !error) || (!content && !contentError)) {
if ((!basePath && !error) || (!content && !contentError) || !collection) {
return <LoadingPage breadcrumbs tabs />;
}

Expand Down Expand Up @@ -141,22 +141,18 @@ export function CollectionInstall() {
</Button>
</PageDetail>

<PageDetail label={t('Signature')}>
<Button
variant="link"
icon={<DownloadIcon />}
onClick={() => {
if (!showSignature) {
setShowSignature(true);
} else {
setShowSignature(false);
}
}}
>
{showSignature ? t(`Hide signature`) : t(`Show signature`)}
</Button>
{showSignature && <ShowSignature collection={collection} />}
</PageDetail>
{collection?.is_signed ? (
<PageDetail label={t('Signature')}>
<Button
variant="link"
icon={<DownloadIcon />}
onClick={() => setShowSignature(!showSignature)}
>
{showSignature ? t(`Hide signature`) : t(`Show signature`)}
</Button>
{showSignature && <ShowSignature collection={collection} />}
</PageDetail>
) : null}

<PageDetail label={t('Requires')}>
{collection?.collection_version?.requires_ansible &&
Expand Down

0 comments on commit bf5536b

Please sign in to comment.