@openneuro/app 4.32.0 → 4.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openneuro/app",
3
- "version": "4.32.0",
3
+ "version": "4.33.0",
4
4
  "description": "React JS web frontend for the OpenNeuro platform.",
5
5
  "license": "MIT",
6
6
  "main": "public/client.js",
@@ -20,7 +20,7 @@
20
20
  "@emotion/react": "11.11.1",
21
21
  "@emotion/styled": "11.11.0",
22
22
  "@niivue/niivue": "0.45.1",
23
- "@openneuro/components": "^4.32.0",
23
+ "@openneuro/components": "^4.33.0",
24
24
  "@sentry/react": "^8.25.0",
25
25
  "@tanstack/react-table": "^8.9.3",
26
26
  "buffer": "^6.0.3",
@@ -74,5 +74,5 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "3dd549a9ec43bbbf00a295a35b30f43cb7c29ffd"
77
+ "gitHead": "ea2d4e9d00382b967075fb8fb206dce4f2a480af"
78
78
  }
@@ -50,7 +50,7 @@ export const ValidationBlock: React.FC<ValidationBlockProps> = ({
50
50
  )
51
51
  } else {
52
52
  // If data exists, populate this. Otherwise we show pending.
53
- if (validation?.warnings + validation?.errors > 0) {
53
+ if (validation) {
54
54
  return (
55
55
  <div className="validation-accordion">
56
56
  <Validation
@@ -44,4 +44,14 @@ describe("ValidationBlock component", () => {
44
44
  render(<ValidationBlock datasetId="ds000031" />)
45
45
  expect(screen.getByText("Validation Pending")).toBeInTheDocument()
46
46
  })
47
+ it("renders validation if `validation` is present but errors and warnings are zero", () => {
48
+ render(
49
+ <ValidationBlock
50
+ datasetId="ds000031"
51
+ validation={{ errors: 0, warnings: 0, issues: [], codeMessages: [] }}
52
+ />,
53
+ )
54
+ expect(screen.getByText("Valid")).toBeInTheDocument()
55
+ expect(screen.queryByText("Validation Pending")).not.toBeInTheDocument()
56
+ })
47
57
  })
@@ -29,13 +29,16 @@ const AggregateCountsContainer: React.FC<AggregateCountsContainerProps> = ({
29
29
  else {
30
30
  return (
31
31
  <>
32
- <AggregateCount
33
- type="participants"
34
- count={participantData.participantCount}
35
- />
32
+ {participantData.participantCount > 0 && (
33
+ <AggregateCount
34
+ type="participants"
35
+ count={participantData.participantCount}
36
+ />
37
+ )}
36
38
  <AggregateCount
37
39
  type="publicDataset"
38
- count={publicDatasetsData.datasets?.pageInfo?.count || 0}
40
+ count={publicDatasetsData.datasets?.pageInfo?.count ||
41
+ publicDatasetsData.advancedSearch?.pageInfo.count || 0}
39
42
  />
40
43
  </>
41
44
  )
@@ -10,9 +10,31 @@ const PUBLIC_DATASETS_COUNT = gql`
10
10
  }
11
11
  `
12
12
 
13
+ const BRAIN_INITIATIVE_COUNT = gql`
14
+ query AdvancedSearch($query: JSON!, $datasetType: String!) {
15
+ advancedSearch(query: $query, datasetType: $datasetType) {
16
+ pageInfo {
17
+ count
18
+ }
19
+ }
20
+ }
21
+ `
22
+
13
23
  const usePublicDatasetsCount = (modality?: string) => {
14
- return useQuery(PUBLIC_DATASETS_COUNT, {
15
- variables: { modality },
24
+ const isNIH = modality === "NIH"
25
+
26
+ const query = isNIH ? BRAIN_INITIATIVE_COUNT : PUBLIC_DATASETS_COUNT
27
+ const variables = isNIH
28
+ ? {
29
+ query: {
30
+ bool: { filter: [{ match: { brainInitiative: { query: "true" } } }] },
31
+ },
32
+ datasetType: "public",
33
+ }
34
+ : { modality }
35
+
36
+ return useQuery(query, {
37
+ variables,
16
38
  errorPolicy: "all",
17
39
  })
18
40
  }