• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IQSS / dataverse-frontend / 18350304430

08 Oct 2025 03:44PM UTC coverage: 97.223% (+0.07%) from 97.156%
18350304430

Pull #845

github

pdurbin
we need "hasValidTermsOfAccess: true" for the test to pass

The DropdownButtonItem disabled property depends on it.
Pull Request #845: add use cases for creating datasets based on dataset type including linked metadata blocks

3879 of 4061 branches covered (95.52%)

Branch coverage included in aggregate %.

33 of 35 new or added lines in 9 files covered. (94.29%)

1 existing line in 1 file now uncovered.

7779 of 7930 relevant lines covered (98.1%)

11111.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.86
/src/sections/shared/add-data-actions/AddDataActionsButton.tsx
1
import { useTranslation } from 'react-i18next'
2
import { Dropdown } from 'react-bootstrap'
3
import { Link } from 'react-router-dom'
4
import { DropdownButton } from '@iqss/dataverse-design-system'
5
import { PlusLg } from 'react-bootstrap-icons'
6
import { RouteWithParams } from '../../Route.enum'
7
import styles from './AddDataActionsButton.module.scss'
8
import { DatasetRepository } from '@/dataset/domain/repositories/DatasetRepository'
9
import { useGetAvailableDatasetTypes } from '@/dataset/domain/hooks/useGetAvailableDatasetTypes'
10

11
interface AddDataActionsButtonProps {
12
  collectionId: string
13
  canAddCollection: boolean
14
  canAddDataset: boolean
15
  datasetRepository: DatasetRepository
18✔
16
}
17

18
export default function AddDataActionsButton({
19
  collectionId,
35✔
20
  canAddCollection,
35✔
21
  canAddDataset,
22
  datasetRepository
35✔
23
}: AddDataActionsButtonProps) {
35✔
24
  const { t } = useTranslation('header')
306✔
25

35✔
26
  const createCollectionRoute = RouteWithParams.CREATE_COLLECTION(collectionId)
306✔
27
  const createDatasetRoute = RouteWithParams.CREATE_DATASET(collectionId)
306✔
28
  const { datasetTypes } = useGetAvailableDatasetTypes({ datasetRepository })
306✔
29
  // We skip "dataset" because we hard-code it to appear at the top.
30
  const nonDatasetDatasetTypes = datasetTypes.filter((type) => type.name !== 'dataset')
306✔
31

32
  return (
306✔
33
    <DropdownButton
34
      id={'addDataBtn'}
35
      title={t('navigation.addData')}
36
      variant="secondary"
37
      icon={<PlusLg className={styles.icon} />}>
38
      <Dropdown.Item to={createCollectionRoute} as={Link} disabled={!canAddCollection}>
39
        {t('navigation.newCollection')}
18✔
40
      </Dropdown.Item>
41
      <Dropdown.Item to={createDatasetRoute} as={Link} disabled={!canAddDataset}>
42
        {t('navigation.newDataset')}
43
      </Dropdown.Item>
44
      {/* "Dataset" is hard coded above. Next we show "Software", "Review", etc. */}
45
      {...nonDatasetDatasetTypes.map((datasetType) => (
NEW
46
        <Dropdown.Item
×
47
          key={datasetType.name}
48
          to={`${createDatasetRoute}?datasetType=${datasetType.name}`}
49
          as={Link}
50
          disabled={!canAddDataset}>
51
          {/* We capitalize the name because we have modified public/locales/en/header.json to include "newReview: New Review" specifically for the "review" dataset type but what about "software" and "workflow" or others we can't even predict? Should the API return the type in right language? Or should we continue to add types we think we'll want to support in header.json? And what if a name has a space in it? */}
52
          {t(
53
            `navigation.new${datasetType.name.charAt(0).toUpperCase() + datasetType.name.slice(1)}`
54
          )}
55
        </Dropdown.Item>
56
      ))}
57
    </DropdownButton>
58
  )
59
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc