Skip to content

Commit

Permalink
undo change to DatasetCardHeader.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
ekraffmiller committed Jun 29, 2024
1 parent d981dcd commit c49764d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,18 @@ import { LinkToPage } from '../../../shared/link-to-page/LinkToPage'
import { Route } from '../../../Route.enum'
import { DatasetLabels } from '../../../dataset/dataset-labels/DatasetLabels'
import { DatasetIcon } from '../../../dataset/dataset-icon/DatasetIcon'
import { DatasetPublishingStatus, DatasetVersion } from '../../../../dataset/domain/models/Dataset'
import { DatasetVersion } from '../../../../dataset/domain/models/Dataset'

interface DatasetCardHeaderProps {
persistentId: string
version: DatasetVersion
}
function getVersionSearchParam(version: DatasetVersion): string {
return version.publishingStatus == DatasetPublishingStatus.DRAFT
? 'DRAFT'
: version.number.toString()
}

export function DatasetCardHeader({ persistentId, version }: DatasetCardHeaderProps) {
return (
<div className={styles.header}>
<div className={styles.title}>
<LinkToPage
page={Route.DATASETS}
searchParams={{
persistentId: persistentId,
version: getVersionSearchParam(version)
}}>
<LinkToPage page={Route.DATASETS} searchParams={{ persistentId: persistentId }}>
{version.title}
</LinkToPage>
<DatasetLabels labels={version.labels} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('DatasetCardHeader', () => {

cy.findByText(dataset.version.title)
.should('exist')
.should('have.attr', 'href', `/datasets?persistentId=${dataset.persistentId}&version=1.0`)
.should('have.attr', 'href', `/datasets?persistentId=${dataset.persistentId}`)
dataset.version.labels.forEach((label) => {
cy.findByText(label.value).should('exist')
})
Expand All @@ -25,6 +25,6 @@ describe('DatasetCardHeader', () => {

cy.findByText(dataset.version.title)
.should('exist')
.should('have.attr', 'href', `/datasets?persistentId=${dataset.persistentId}&version=DRAFT`)
.should('have.attr', 'href', `/datasets?persistentId=${dataset.persistentId}`)
})
})

0 comments on commit c49764d

Please sign in to comment.