diff --git a/package.json b/package.json index 648d5849..7c7c13fb 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "dev:watch": " lerna watch -- lerna run dev --scope=\\$LERNA_PACKAGE_NAME", "start": "lerna run start", "build:start": "npm run build && npm run start", + "setProxy" : "(cd ./packages/tools/localDev/nginx/; ./configureNginx.sh -d $npm_config_domain)", "test": "npm run test --workspaces", "test:int": "npm run test:int --workspaces", "test:all": "npm run test:all --workspaces" diff --git a/packages/core/src/features/cohort/cohortSlice.ts b/packages/core/src/features/cohort/cohortSlice.ts index 9648a4fb..20568391 100644 --- a/packages/core/src/features/cohort/cohortSlice.ts +++ b/packages/core/src/features/cohort/cohortSlice.ts @@ -14,13 +14,15 @@ export interface CohortState { cohort: Cohort; } +export const EmptyCohort: Cohort = { + id: 'default', + name: 'Filters', + filters: {}, + modified_datetime: new Date().toISOString(), +}; + const initialCohortState: CohortState = { - cohort: { - id: 'default', - name: 'Filters', - filters: {}, - modified_datetime: new Date().toISOString(), - }, + cohort: { ...EmptyCohort }, }; interface UpdateFilterParams { @@ -34,6 +36,10 @@ interface SetFilterParams { filters: FilterSet; } +interface SetAllIndexFiltersParams { + filters: IndexedFilterSet; +} + interface RemoveFilterParams { index: string; field: string; @@ -98,6 +104,18 @@ export const cohortSlice = createSlice({ }, }; }, + setCohortIndexFilters: ( + state: Draft, + action: PayloadAction, + ) => { + return { + cohort: { + ...state.cohort, + filters: { ...action.payload.filters }, + }, + }; + }, + // removes a filter to the cohort filter set at the given index removeCohortFilter: ( state: Draft, @@ -149,6 +167,7 @@ export const cohortSlice = createSlice({ export const { updateCohortFilter, setCohortFilter, + setCohortIndexFilters, removeCohortFilter, clearCohortFilters, } = cohortSlice.actions; @@ -181,6 +200,7 @@ export const selectIndexedFilterByName = ( }; const EmptyFilterSet: FilterSet = { mode: 'and', root: {} }; + /** * Select a filter from the index. * returns undefined. diff --git a/packages/core/src/features/cohort/index.ts b/packages/core/src/features/cohort/index.ts index ff85d19f..98de9a5e 100644 --- a/packages/core/src/features/cohort/index.ts +++ b/packages/core/src/features/cohort/index.ts @@ -9,6 +9,7 @@ import { selectCurrentCohort, updateCohortFilter, setCohortFilter, + setCohortIndexFilters, removeCohortFilter, clearCohortFilters, } from './cohortSlice'; @@ -23,6 +24,7 @@ export { cohortReducer, updateCohortFilter, setCohortFilter, + setCohortIndexFilters, removeCohortFilter, clearCohortFilters, }; diff --git a/packages/frontend/src/components/Buttons/UploadJSONButton.tsx b/packages/frontend/src/components/Buttons/UploadJSONButton.tsx index dad6461e..1924492c 100644 --- a/packages/frontend/src/components/Buttons/UploadJSONButton.tsx +++ b/packages/frontend/src/components/Buttons/UploadJSONButton.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { Button, FileButton, Loader, Tooltip } from '@mantine/core'; +import { Button, FileButton, Tooltip } from '@mantine/core'; import { Icon } from '@iconify/react'; interface UploadJSONButtonProps { @@ -29,9 +29,10 @@ const UploadJSONButton: React.FC = ({ }} accept="application/json" > - {() => ( + {(props) => ( )}
- +