From c7acf5fd4baa6d950ed0cf5329c532e75bf15d3f Mon Sep 17 00:00:00 2001 From: Fran McDade Date: Tue, 7 Jan 2025 04:18:01 +1000 Subject: [PATCH] feat: update findable-ui to latest v21.0.0 (#516) (#517) --- .../components/Table/common/constants.ts | 4 +- .../components/Table/common/constants.ts | 3 + .../ViewAtlasSourceDatasets/constants.ts | 4 +- .../ViewComponentAtlases/constants.ts | 4 +- .../ViewSourceDatasets/constants.ts | 4 +- .../components/ViewSourceStudies/constants.ts | 4 +- app/components/Table/features/constants.ts | 6 - package-lock.json | 8 +- package.json | 2 +- site-config/hca-atlas-tracker/local/config.ts | 4 +- .../index/{ => atlas}/atlasEntityConfig.ts | 34 ++-- .../local/index/atlas/tableOptions.ts | 24 +++ .../local/index/common/constants.ts | 18 -- .../local/index/tasks/{common => }/column.ts | 16 +- .../local/index/tasks/{common => }/columns.ts | 2 +- .../local/index/tasks/savedFilters.ts | 147 ++++++++++++++++ .../local/index/tasks/tableOptions.ts | 40 +++++ .../local/index/tasks/tasksEntityConfig.ts | 166 +----------------- .../local/index/user/tableOptions.ts | 18 ++ .../index/{ => user}/userEntityConfig.ts | 26 +-- 20 files changed, 277 insertions(+), 257 deletions(-) delete mode 100644 app/components/Table/features/constants.ts rename site-config/hca-atlas-tracker/local/index/{ => atlas}/atlasEntityConfig.ts (86%) create mode 100644 site-config/hca-atlas-tracker/local/index/atlas/tableOptions.ts delete mode 100644 site-config/hca-atlas-tracker/local/index/common/constants.ts rename site-config/hca-atlas-tracker/local/index/tasks/{common => }/column.ts (94%) rename site-config/hca-atlas-tracker/local/index/tasks/{common => }/columns.ts (94%) create mode 100644 site-config/hca-atlas-tracker/local/index/tasks/savedFilters.ts create mode 100644 site-config/hca-atlas-tracker/local/index/tasks/tableOptions.ts create mode 100644 site-config/hca-atlas-tracker/local/index/user/tableOptions.ts rename site-config/hca-atlas-tracker/local/index/{ => user}/userEntityConfig.ts (83%) diff --git a/app/components/Detail/components/TrackerForm/components/Section/components/ComponentAtlas/components/LinkedSourceDatasets/components/Table/common/constants.ts b/app/components/Detail/components/TrackerForm/components/Section/components/ComponentAtlas/components/LinkedSourceDatasets/components/Table/common/constants.ts index fc0411fe..fca33c3c 100644 --- a/app/components/Detail/components/TrackerForm/components/Section/components/ComponentAtlas/components/LinkedSourceDatasets/components/Table/common/constants.ts +++ b/app/components/Detail/components/TrackerForm/components/Section/components/ComponentAtlas/components/LinkedSourceDatasets/components/Table/common/constants.ts @@ -1,3 +1,4 @@ +import { COLUMN_IDENTIFIER } from "@databiosphere/findable-ui/lib/components/Table/common/columnIdentifier"; import { SORT_DIRECTION } from "@databiosphere/findable-ui/lib/config/entities"; import { getSortedRowModel, @@ -5,7 +6,6 @@ import { TableOptions, } from "@tanstack/react-table"; import { HCAAtlasTrackerSourceDataset } from "../../../../../../../../../../../../../apis/catalog/hca-atlas-tracker/common/entities"; -import { COLUMN_VISIBILITY } from "../../../../../../../../../../../../Table/features/constants"; const PUBLICATION_STRING = "publicationString"; const TITLE = "title"; @@ -25,7 +25,7 @@ export const TABLE_OPTIONS: Partial< enableSorting: true, getSortedRowModel: getSortedRowModel(), initialState: { - columnVisibility: COLUMN_VISIBILITY.ROW_POSITION, + columnVisibility: { [COLUMN_IDENTIFIER.ROW_POSITION]: true }, sorting: SORTING, }, }; diff --git a/app/components/Detail/components/TrackerForm/components/Section/components/SourceStudiesSourceDatasets/components/FormContent/components/Table/common/constants.ts b/app/components/Detail/components/TrackerForm/components/Section/components/SourceStudiesSourceDatasets/components/FormContent/components/Table/common/constants.ts index 6a10d5d8..de6130a4 100644 --- a/app/components/Detail/components/TrackerForm/components/Section/components/SourceStudiesSourceDatasets/components/FormContent/components/Table/common/constants.ts +++ b/app/components/Detail/components/TrackerForm/components/Section/components/SourceStudiesSourceDatasets/components/FormContent/components/Table/common/constants.ts @@ -1,3 +1,4 @@ +import { COLUMN_IDENTIFIER } from "@databiosphere/findable-ui/lib/components/Table/common/columnIdentifier"; import { SORT_DIRECTION } from "@databiosphere/findable-ui/lib/config/entities"; import { getExpandedRowModel, @@ -22,11 +23,13 @@ export const TABLE_OPTIONS: Partial< > = { enableGrouping: true, enableMultiSort: true, + enableRowPosition: false, enableSorting: true, getExpandedRowModel: getExpandedRowModel(), getGroupedRowModel: getGroupedRowModel(), getSortedRowModel: getSortedRowModel(), initialState: { + columnVisibility: { [COLUMN_IDENTIFIER.ROW_POSITION]: false }, expanded: true, grouping: GROUPING, sorting: SORTING, diff --git a/app/components/Detail/components/ViewAtlasSourceDatasets/constants.ts b/app/components/Detail/components/ViewAtlasSourceDatasets/constants.ts index bcc7921d..f789b468 100644 --- a/app/components/Detail/components/ViewAtlasSourceDatasets/constants.ts +++ b/app/components/Detail/components/ViewAtlasSourceDatasets/constants.ts @@ -1,10 +1,10 @@ +import { COLUMN_IDENTIFIER } from "@databiosphere/findable-ui/lib/components/Table/common/columnIdentifier"; import { ListConfig } from "@databiosphere/findable-ui/lib/config/entities"; import { HCAAtlasTrackerSourceDataset } from "../../../../apis/catalog/hca-atlas-tracker/common/entities"; -import { COLUMN_VISIBILITY } from "../../../Table/features/constants"; export const TABLE_OPTIONS: ListConfig["tableOptions"] = { initialState: { - columnVisibility: COLUMN_VISIBILITY.ROW_POSITION, + columnVisibility: { [COLUMN_IDENTIFIER.ROW_POSITION]: true }, }, }; diff --git a/app/components/Detail/components/ViewComponentAtlases/constants.ts b/app/components/Detail/components/ViewComponentAtlases/constants.ts index 2068c053..c40d265f 100644 --- a/app/components/Detail/components/ViewComponentAtlases/constants.ts +++ b/app/components/Detail/components/ViewComponentAtlases/constants.ts @@ -1,10 +1,10 @@ +import { COLUMN_IDENTIFIER } from "@databiosphere/findable-ui/lib/components/Table/common/columnIdentifier"; import { ListConfig } from "@databiosphere/findable-ui/lib/config/entities"; import { HCAAtlasTrackerComponentAtlas } from "../../../../apis/catalog/hca-atlas-tracker/common/entities"; -import { COLUMN_VISIBILITY } from "../../../Table/features/constants"; export const TABLE_OPTIONS: ListConfig["tableOptions"] = { initialState: { - columnVisibility: COLUMN_VISIBILITY.ROW_POSITION, + columnVisibility: { [COLUMN_IDENTIFIER.ROW_POSITION]: true }, }, }; diff --git a/app/components/Detail/components/ViewSourceDatasets/constants.ts b/app/components/Detail/components/ViewSourceDatasets/constants.ts index bcc7921d..f789b468 100644 --- a/app/components/Detail/components/ViewSourceDatasets/constants.ts +++ b/app/components/Detail/components/ViewSourceDatasets/constants.ts @@ -1,10 +1,10 @@ +import { COLUMN_IDENTIFIER } from "@databiosphere/findable-ui/lib/components/Table/common/columnIdentifier"; import { ListConfig } from "@databiosphere/findable-ui/lib/config/entities"; import { HCAAtlasTrackerSourceDataset } from "../../../../apis/catalog/hca-atlas-tracker/common/entities"; -import { COLUMN_VISIBILITY } from "../../../Table/features/constants"; export const TABLE_OPTIONS: ListConfig["tableOptions"] = { initialState: { - columnVisibility: COLUMN_VISIBILITY.ROW_POSITION, + columnVisibility: { [COLUMN_IDENTIFIER.ROW_POSITION]: true }, }, }; diff --git a/app/components/Detail/components/ViewSourceStudies/constants.ts b/app/components/Detail/components/ViewSourceStudies/constants.ts index 1b9c296f..a8e7c357 100644 --- a/app/components/Detail/components/ViewSourceStudies/constants.ts +++ b/app/components/Detail/components/ViewSourceStudies/constants.ts @@ -1,10 +1,10 @@ +import { COLUMN_IDENTIFIER } from "@databiosphere/findable-ui/lib/components/Table/common/columnIdentifier"; import { ListConfig } from "@databiosphere/findable-ui/lib/config/entities"; import { HCAAtlasTrackerSourceStudy } from "../../../../apis/catalog/hca-atlas-tracker/common/entities"; -import { COLUMN_VISIBILITY } from "../../../Table/features/constants"; export const TABLE_OPTIONS: ListConfig["tableOptions"] = { initialState: { - columnVisibility: COLUMN_VISIBILITY.ROW_POSITION, + columnVisibility: { [COLUMN_IDENTIFIER.ROW_POSITION]: true }, }, }; diff --git a/app/components/Table/features/constants.ts b/app/components/Table/features/constants.ts deleted file mode 100644 index 690acd4d..00000000 --- a/app/components/Table/features/constants.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ACCESSOR_KEYS } from "@databiosphere/findable-ui/lib/components/TableCreator/common/constants"; -import { VisibilityState } from "@tanstack/react-table"; - -export const COLUMN_VISIBILITY: Record = { - ROW_POSITION: { [ACCESSOR_KEYS.ROW_POSITION]: true }, -}; diff --git a/package-lock.json b/package-lock.json index d3c33359..a721b94e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,7 +8,7 @@ "name": "hca-atlas-tracker", "version": "1.0.0", "dependencies": { - "@databiosphere/findable-ui": "20.0.0", + "@databiosphere/findable-ui": "21.0.0", "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", "@hookform/resolvers": "^3.3.4", @@ -1770,9 +1770,9 @@ } }, "node_modules/@databiosphere/findable-ui": { - "version": "20.0.0", - "resolved": "https://registry.npmjs.org/@databiosphere/findable-ui/-/findable-ui-20.0.0.tgz", - "integrity": "sha512-SkkTFw2MM7PdA2vLr+1FINwQ1Tiih/UAddGki5U3v7C+AR9SGxmxyma+dy299pX9r8r1YFfaVPDxIq9m5Pc4yA==", + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@databiosphere/findable-ui/-/findable-ui-21.0.0.tgz", + "integrity": "sha512-uYDLbNEBWTkgW5bS7YsRRFKCJusGhaG0OosPHBL5ZEZwchsXPuVaV6himlnuHcsgVZmV4ur5lPA0pyjOWAIJ5g==", "engines": { "node": "20.10.0" }, diff --git a/package.json b/package.json index 1f906636..25b4caa2 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "migrate": "ts-node -O '{\"module\": \"commonjs\"}' ./scripts/migration-runner.ts -j ts" }, "dependencies": { - "@databiosphere/findable-ui": "20.0.0", + "@databiosphere/findable-ui": "21.0.0", "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", "@hookform/resolvers": "^3.3.4", diff --git a/site-config/hca-atlas-tracker/local/config.ts b/site-config/hca-atlas-tracker/local/config.ts index f9459a70..15af7870 100644 --- a/site-config/hca-atlas-tracker/local/config.ts +++ b/site-config/hca-atlas-tracker/local/config.ts @@ -12,9 +12,9 @@ import { ROUTE } from "../../../app/routes/constants"; import { SiteConfig } from "../../common/entities"; import { announcementsConfig } from "./announcements/announcementsConfig"; import { authenticationConfig } from "./authentication/authentication"; -import { atlasEntityConfig } from "./index/atlasEntityConfig"; +import { atlasEntityConfig } from "./index/atlas/atlasEntityConfig"; import { tasksEntityConfig } from "./index/tasks/tasksEntityConfig"; -import { userEntityConfig } from "./index/userEntityConfig"; +import { userEntityConfig } from "./index/user/userEntityConfig"; // Template constants const LOCALHOST = "http://localhost:3000"; diff --git a/site-config/hca-atlas-tracker/local/index/atlasEntityConfig.ts b/site-config/hca-atlas-tracker/local/index/atlas/atlasEntityConfig.ts similarity index 86% rename from site-config/hca-atlas-tracker/local/index/atlasEntityConfig.ts rename to site-config/hca-atlas-tracker/local/index/atlas/atlasEntityConfig.ts index d8e6e192..6f48f957 100644 --- a/site-config/hca-atlas-tracker/local/index/atlasEntityConfig.ts +++ b/site-config/hca-atlas-tracker/local/index/atlas/atlasEntityConfig.ts @@ -1,4 +1,3 @@ -import { ACCESSOR_KEYS } from "@databiosphere/findable-ui/lib/components/TableCreator/common/constants"; import { ComponentConfig, EntityConfig, @@ -6,20 +5,21 @@ import { SORT_DIRECTION, } from "@databiosphere/findable-ui/lib/config/entities"; import { EXPLORE_MODE } from "@databiosphere/findable-ui/lib/hooks/useExploreMode"; -import { HCAAtlasTrackerListAtlas } from "../../../../app/apis/catalog/hca-atlas-tracker/common/entities"; +import { HCAAtlasTrackerListAtlas } from "../../../../../app/apis/catalog/hca-atlas-tracker/common/entities"; import { atlasInputMapper, getAtlasId, -} from "../../../../app/apis/catalog/hca-atlas-tracker/common/utils"; -import * as C from "../../../../app/components"; -import { mapSelectCategoryValue } from "../../../../app/config/utils"; -import { formatDateToQuarterYear } from "../../../../app/utils/date-fns"; -import * as V from "../../../../app/viewModelBuilders/catalog/hca-atlas-tracker/common/viewModelBuilders"; +} from "../../../../../app/apis/catalog/hca-atlas-tracker/common/utils"; +import * as C from "../../../../../app/components"; +import { mapSelectCategoryValue } from "../../../../../app/config/utils"; +import { formatDateToQuarterYear } from "../../../../../app/utils/date-fns"; +import * as V from "../../../../../app/viewModelBuilders/catalog/hca-atlas-tracker/common/viewModelBuilders"; import { HCA_ATLAS_TRACKER_CATEGORY_KEY, HCA_ATLAS_TRACKER_CATEGORY_LABEL, -} from "../../category"; -import { subTitleHero } from "../viewList/subTitleHero"; +} from "../../../category"; +import { subTitleHero } from "../../viewList/subTitleHero"; +import { TABLE_OPTIONS } from "./tableOptions"; /** * Entity config object responsible to config anything related to the /atlases route. @@ -112,7 +112,6 @@ export const atlasEntityConfig: EntityConfig = { width: { max: "1fr", min: "212px" }, }, { - columnVisible: false, componentConfig: { component: C.BasicCell, viewBuilder: V.buildAtlasVersion, @@ -123,7 +122,6 @@ export const atlasEntityConfig: EntityConfig = { width: { max: "0.5fr", min: "112px" }, }, { - columnVisible: false, componentConfig: { component: C.BasicCell, viewBuilder: V.buildWave, @@ -163,7 +161,6 @@ export const atlasEntityConfig: EntityConfig = { width: { max: "0.5fr", min: "112px" }, }, { - columnVisible: false, componentConfig: { component: C.NTagCell, viewBuilder: V.buildIntegrationLead, @@ -203,18 +200,7 @@ export const atlasEntityConfig: EntityConfig = { width: { max: "0.5fr", min: "168px" }, }, ], - defaultSort: { - desc: SORT_DIRECTION.ASCENDING, - id: HCA_ATLAS_TRACKER_CATEGORY_KEY.NAME, - }, - tableOptions: { - initialState: { - columnVisibility: { - [ACCESSOR_KEYS.ROW_POSITION]: true, - [ACCESSOR_KEYS.SELECT]: false, - }, - }, - }, + tableOptions: TABLE_OPTIONS, } as ListConfig, listView: { disablePagination: true, diff --git a/site-config/hca-atlas-tracker/local/index/atlas/tableOptions.ts b/site-config/hca-atlas-tracker/local/index/atlas/tableOptions.ts new file mode 100644 index 00000000..c665f630 --- /dev/null +++ b/site-config/hca-atlas-tracker/local/index/atlas/tableOptions.ts @@ -0,0 +1,24 @@ +import { + ListConfig, + SORT_DIRECTION, +} from "@databiosphere/findable-ui/lib/config/entities"; +import { HCAAtlasTrackerListAtlas } from "../../../../../app/apis/catalog/hca-atlas-tracker/common/entities"; +import { HCA_ATLAS_TRACKER_CATEGORY_KEY } from "../../../category"; + +export const TABLE_OPTIONS: ListConfig["tableOptions"] = + { + enableRowPosition: true, + initialState: { + columnVisibility: { + [HCA_ATLAS_TRACKER_CATEGORY_KEY.VERSION]: false, + [HCA_ATLAS_TRACKER_CATEGORY_KEY.WAVE]: false, + [HCA_ATLAS_TRACKER_CATEGORY_KEY.INTEGRATION_LEAD]: false, + }, + sorting: [ + { + desc: SORT_DIRECTION.ASCENDING, + id: HCA_ATLAS_TRACKER_CATEGORY_KEY.NAME, + }, + ], + }, + }; diff --git a/site-config/hca-atlas-tracker/local/index/common/constants.ts b/site-config/hca-atlas-tracker/local/index/common/constants.ts deleted file mode 100644 index 39b81a44..00000000 --- a/site-config/hca-atlas-tracker/local/index/common/constants.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { SORT_DIRECTION } from "@databiosphere/findable-ui/lib/config/entities"; -import { ColumnSort } from "@tanstack/react-table"; -import { HCA_ATLAS_TRACKER_CATEGORY_KEY } from "../../../category"; - -export const SAVED_FILTERS_SORTING_TARGET_COMPLETION_DATE: ColumnSort[] = [ - { - desc: SORT_DIRECTION.ASCENDING, - id: HCA_ATLAS_TRACKER_CATEGORY_KEY.TARGET_COMPLETION_DATE, - }, - { - desc: SORT_DIRECTION.ASCENDING, - id: HCA_ATLAS_TRACKER_CATEGORY_KEY.ATLAS_NAMES, - }, - { - desc: SORT_DIRECTION.ASCENDING, - id: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, - }, -]; diff --git a/site-config/hca-atlas-tracker/local/index/tasks/common/column.ts b/site-config/hca-atlas-tracker/local/index/tasks/column.ts similarity index 94% rename from site-config/hca-atlas-tracker/local/index/tasks/common/column.ts rename to site-config/hca-atlas-tracker/local/index/tasks/column.ts index bcf79b20..ebcac25e 100644 --- a/site-config/hca-atlas-tracker/local/index/tasks/common/column.ts +++ b/site-config/hca-atlas-tracker/local/index/tasks/column.ts @@ -2,13 +2,13 @@ import { ColumnConfig, ComponentConfig, } from "@databiosphere/findable-ui/lib/config/entities"; -import { HCAAtlasTrackerListValidationRecord } from "../../../../../../app/apis/catalog/hca-atlas-tracker/common/entities"; -import * as C from "../../../../../../app/components"; -import * as V from "../../../../../../app/viewModelBuilders/catalog/hca-atlas-tracker/common/viewModelBuilders"; +import { HCAAtlasTrackerListValidationRecord } from "../../../../../app/apis/catalog/hca-atlas-tracker/common/entities"; +import * as C from "../../../../../app/components"; +import * as V from "../../../../../app/viewModelBuilders/catalog/hca-atlas-tracker/common/viewModelBuilders"; import { HCA_ATLAS_TRACKER_CATEGORY_KEY, HCA_ATLAS_TRACKER_CATEGORY_LABEL, -} from "../../../../category"; +} from "../../../category"; export const ATLAS_NAMES: ColumnConfig = { componentConfig: { @@ -23,7 +23,6 @@ export const ATLAS_NAMES: ColumnConfig = { export const ATLAS_VERSIONS: ColumnConfig = { - columnVisible: false, componentConfig: { component: C.NTagCell, viewBuilder: V.buildTaskAtlasVersions, @@ -38,7 +37,6 @@ export const ATLAS_VERSIONS: ColumnConfig = }; export const CREATED_AT: ColumnConfig = { - columnVisible: false, componentConfig: { component: C.BasicCell, viewBuilder: V.buildCreatedAt, @@ -76,7 +74,6 @@ export const DOI: ColumnConfig = { }; export const ENTITY_TITLE: ColumnConfig = { - columnVisible: false, componentConfig: { component: C.BasicCell, viewBuilder: V.buildEntityTitle, @@ -88,7 +85,6 @@ export const ENTITY_TITLE: ColumnConfig = { }; export const ENTITY_TYPE: ColumnConfig = { - columnVisible: false, componentConfig: { component: C.BasicCell, viewBuilder: V.buildEntityType, @@ -100,7 +96,6 @@ export const ENTITY_TYPE: ColumnConfig = { }; export const NETWORKS: ColumnConfig = { - columnVisible: false, componentConfig: { component: C.BioNetworkCell, viewBuilder: V.buildTaskNetworks, @@ -191,7 +186,6 @@ export const TASK_STATUS: ColumnConfig = { }; export const UPDATED_AT: ColumnConfig = { - columnVisible: false, componentConfig: { component: C.BasicCell, viewBuilder: V.buildUpdatedAt, @@ -203,7 +197,6 @@ export const UPDATED_AT: ColumnConfig = { }; export const WAVES: ColumnConfig = { - columnVisible: false, componentConfig: { component: C.NTagCell, viewBuilder: V.buildTaskWaves, @@ -216,7 +209,6 @@ export const WAVES: ColumnConfig = { export const VALIDATION_TYPE: ColumnConfig = { - columnVisible: false, componentConfig: { component: C.BasicCell, viewBuilder: V.buildValidationType, diff --git a/site-config/hca-atlas-tracker/local/index/tasks/common/columns.ts b/site-config/hca-atlas-tracker/local/index/tasks/columns.ts similarity index 94% rename from site-config/hca-atlas-tracker/local/index/tasks/common/columns.ts rename to site-config/hca-atlas-tracker/local/index/tasks/columns.ts index 96b8d0cb..9a15a791 100644 --- a/site-config/hca-atlas-tracker/local/index/tasks/common/columns.ts +++ b/site-config/hca-atlas-tracker/local/index/tasks/columns.ts @@ -1,5 +1,5 @@ import { ColumnConfig } from "@databiosphere/findable-ui/lib/config/entities"; -import { HCAAtlasTrackerListValidationRecord } from "../../../../../../app/apis/catalog/hca-atlas-tracker/common/entities"; +import { HCAAtlasTrackerListValidationRecord } from "../../../../../app/apis/catalog/hca-atlas-tracker/common/entities"; import * as COLUMN from "./column"; export const COLUMNS: ColumnConfig[] = [ diff --git a/site-config/hca-atlas-tracker/local/index/tasks/savedFilters.ts b/site-config/hca-atlas-tracker/local/index/tasks/savedFilters.ts new file mode 100644 index 00000000..3f9f8242 --- /dev/null +++ b/site-config/hca-atlas-tracker/local/index/tasks/savedFilters.ts @@ -0,0 +1,147 @@ +import { + SavedFilter, + SORT_DIRECTION, +} from "@databiosphere/findable-ui/lib/config/entities"; +import { ColumnSort } from "@tanstack/react-table"; +import { VALIDATION_DESCRIPTION } from "../../../../../app/apis/catalog/hca-atlas-tracker/common/constants"; +import { + SYSTEM, + TASK_STATUS, +} from "../../../../../app/apis/catalog/hca-atlas-tracker/common/entities"; +import { HCA_ATLAS_TRACKER_CATEGORY_KEY } from "../../../category"; + +const SORTING: ColumnSort[] = [ + { + desc: SORT_DIRECTION.ASCENDING, + id: HCA_ATLAS_TRACKER_CATEGORY_KEY.TARGET_COMPLETION_DATE, + }, + { + desc: SORT_DIRECTION.ASCENDING, + id: HCA_ATLAS_TRACKER_CATEGORY_KEY.ATLAS_NAMES, + }, + { + desc: SORT_DIRECTION.ASCENDING, + id: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, + }, +]; + +const CAP_INGEST_BACKLOG: SavedFilter = { + filters: [ + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.DESCRIPTION, + value: [VALIDATION_DESCRIPTION.INGEST_SOURCE_STUDY], + }, + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, + value: [TASK_STATUS.TODO, TASK_STATUS.BLOCKED], + }, + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.SYSTEM, + value: [SYSTEM.CAP], + }, + ], + sorting: SORTING, + title: "CAP - Ingest backlog", +}; + +const CELLXGENE_INGEST_BACKLOG: SavedFilter = { + filters: [ + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.DESCRIPTION, + value: [VALIDATION_DESCRIPTION.INGEST_SOURCE_STUDY], + }, + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, + value: [TASK_STATUS.IN_PROGRESS, TASK_STATUS.TODO], + }, + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.SYSTEM, + value: [SYSTEM.CELLXGENE], + }, + ], + sorting: SORTING, + title: "CELLxGENE - Ingest backlog", +}; + +const COMPLETED_TASKS: SavedFilter = { + filters: [ + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, + value: [TASK_STATUS.DONE], + }, + ], + sorting: [ + { + desc: SORT_DIRECTION.DESCENDING, + id: HCA_ATLAS_TRACKER_CATEGORY_KEY.RESOLVED_AT, + }, + ], + title: "Completed Tasks", +}; + +const HCA_DATA_REPOSITORY_MISSING_NETWORK_OR_ATLAS: SavedFilter = { + filters: [ + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.DESCRIPTION, + value: [VALIDATION_DESCRIPTION.LINK_PROJECT_BIONETWORKS_AND_ATLASES], + }, + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, + value: [TASK_STATUS.TODO], + }, + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.SYSTEM, + value: [SYSTEM.HCA_DATA_REPOSITORY], + }, + ], + sorting: SORTING, + title: "HCA Data Repository - Missing Network or Atlas", +}; + +const HCA_DATA_REPOSITORY_NO_MATCHING_TITLE: SavedFilter = { + filters: [ + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.DESCRIPTION, + value: [VALIDATION_DESCRIPTION.UPDATE_TITLE_TO_MATCH_PUBLICATION], + }, + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, + value: [TASK_STATUS.TODO], + }, + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.SYSTEM, + value: [SYSTEM.HCA_DATA_REPOSITORY], + }, + ], + sorting: SORTING, + title: + "HCA Data Repository - project title does not match publication title", +}; + +const HCA_DATA_REPOSITORY_NO_PRIMARY_DATA: SavedFilter = { + filters: [ + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.DESCRIPTION, + value: [VALIDATION_DESCRIPTION.ADD_PRIMARY_DATA], + }, + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, + value: [TASK_STATUS.TODO], + }, + { + categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.SYSTEM, + value: [SYSTEM.HCA_DATA_REPOSITORY], + }, + ], + sorting: SORTING, + title: "HCA Data Repository - no primary data", +}; + +export const SAVED_FILTERS: SavedFilter[] = [ + CAP_INGEST_BACKLOG, + CELLXGENE_INGEST_BACKLOG, + COMPLETED_TASKS, + HCA_DATA_REPOSITORY_NO_PRIMARY_DATA, + HCA_DATA_REPOSITORY_NO_MATCHING_TITLE, + HCA_DATA_REPOSITORY_MISSING_NETWORK_OR_ATLAS, +]; diff --git a/site-config/hca-atlas-tracker/local/index/tasks/tableOptions.ts b/site-config/hca-atlas-tracker/local/index/tasks/tableOptions.ts new file mode 100644 index 00000000..0d00accb --- /dev/null +++ b/site-config/hca-atlas-tracker/local/index/tasks/tableOptions.ts @@ -0,0 +1,40 @@ +import { + ListConfig, + SORT_DIRECTION, +} from "@databiosphere/findable-ui/lib/config/entities"; +import { HCAAtlasTrackerListValidationRecord } from "../../../../../app/apis/catalog/hca-atlas-tracker/common/entities"; +import { HCA_ATLAS_TRACKER_CATEGORY_KEY } from "../../../category"; + +export const TABLE_OPTIONS: ListConfig["tableOptions"] = + { + enableExpanding: true, + enableGrouping: true, + enableMultiRowSelection: true, + enableRowPosition: true, + enableRowPreview: true, + enableRowSelection: (row) => !row.getIsGrouped(), + initialState: { + columnVisibility: { + [HCA_ATLAS_TRACKER_CATEGORY_KEY.ATLAS_VERSIONS]: false, + [HCA_ATLAS_TRACKER_CATEGORY_KEY.CREATED_AT]: false, + [HCA_ATLAS_TRACKER_CATEGORY_KEY.ENTITY_TITLE]: false, + [HCA_ATLAS_TRACKER_CATEGORY_KEY.ENTITY_TYPE]: false, + [HCA_ATLAS_TRACKER_CATEGORY_KEY.NETWORKS]: false, + [HCA_ATLAS_TRACKER_CATEGORY_KEY.UPDATED_AT]: false, + [HCA_ATLAS_TRACKER_CATEGORY_KEY.WAVES]: false, + [HCA_ATLAS_TRACKER_CATEGORY_KEY.VALIDATION_TYPE]: false, + }, + expanded: true, + grouping: [HCA_ATLAS_TRACKER_CATEGORY_KEY.TARGET_COMPLETION_DATE], + sorting: [ + { + desc: SORT_DIRECTION.ASCENDING, + id: HCA_ATLAS_TRACKER_CATEGORY_KEY.TARGET_COMPLETION_DATE, + }, + { + desc: SORT_DIRECTION.ASCENDING, + id: HCA_ATLAS_TRACKER_CATEGORY_KEY.ATLAS_NAMES, + }, + ], + }, + }; diff --git a/site-config/hca-atlas-tracker/local/index/tasks/tasksEntityConfig.ts b/site-config/hca-atlas-tracker/local/index/tasks/tasksEntityConfig.ts index 27f7866b..f0b3fcd0 100644 --- a/site-config/hca-atlas-tracker/local/index/tasks/tasksEntityConfig.ts +++ b/site-config/hca-atlas-tracker/local/index/tasks/tasksEntityConfig.ts @@ -2,21 +2,14 @@ import { ComponentConfig, EntityConfig, ListConfig, - SORT_DIRECTION, } from "@databiosphere/findable-ui/lib/config/entities"; import { EXPLORE_MODE } from "@databiosphere/findable-ui/lib/hooks/useExploreMode"; -import { VALIDATION_DESCRIPTION } from "../../../../../app/apis/catalog/hca-atlas-tracker/common/constants"; -import { - HCAAtlasTrackerListValidationRecord, - SYSTEM, - TASK_STATUS, -} from "../../../../../app/apis/catalog/hca-atlas-tracker/common/entities"; +import { HCAAtlasTrackerListValidationRecord } from "../../../../../app/apis/catalog/hca-atlas-tracker/common/entities"; import { getTaskId, taskInputMapper, } from "../../../../../app/apis/catalog/hca-atlas-tracker/common/utils"; import * as C from "../../../../../app/components"; -import { COLUMN_VISIBILITY } from "../../../../../app/components/Table/features/constants"; import { mapSelectCategoryValue } from "../../../../../app/config/utils"; import { formatDateToQuarterYear } from "../../../../../app/utils/date-fns"; import * as V from "../../../../../app/viewModelBuilders/catalog/hca-atlas-tracker/common/viewModelBuilders"; @@ -24,8 +17,9 @@ import { HCA_ATLAS_TRACKER_CATEGORY_KEY, HCA_ATLAS_TRACKER_CATEGORY_LABEL, } from "../../../category"; -import { SAVED_FILTERS_SORTING_TARGET_COMPLETION_DATE } from "../common/constants"; -import { COLUMNS, ROW_PREVIEW_COLUMNS } from "./common/columns"; +import { COLUMNS, ROW_PREVIEW_COLUMNS } from "./columns"; +import { SAVED_FILTERS } from "./savedFilters"; +import { TABLE_OPTIONS } from "./tableOptions"; /** * Entity config object responsible to config anything related to the /reports route. @@ -98,134 +92,7 @@ export const tasksEntityConfig: EntityConfig = { }, ], key: "tasks", - savedFilters: [ - { - filters: [ - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.DESCRIPTION, - value: [VALIDATION_DESCRIPTION.INGEST_SOURCE_STUDY], - }, - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, - value: [TASK_STATUS.TODO, TASK_STATUS.BLOCKED], - }, - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.SYSTEM, - value: [SYSTEM.CAP], - }, - ], - sorting: SAVED_FILTERS_SORTING_TARGET_COMPLETION_DATE, - title: "CAP - Ingest backlog", - }, - { - filters: [ - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.DESCRIPTION, - value: [VALIDATION_DESCRIPTION.INGEST_SOURCE_STUDY], - }, - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, - value: [TASK_STATUS.IN_PROGRESS, TASK_STATUS.TODO], - }, - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.SYSTEM, - value: [SYSTEM.CELLXGENE], - }, - ], - sorting: SAVED_FILTERS_SORTING_TARGET_COMPLETION_DATE, - title: "CELLxGENE - Ingest backlog", - }, - { - filters: [ - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, - value: [TASK_STATUS.DONE], - }, - ], - sorting: [ - { - desc: SORT_DIRECTION.DESCENDING, - id: HCA_ATLAS_TRACKER_CATEGORY_KEY.RESOLVED_AT, - }, - ], - title: "Completed Tasks", - }, - { - filters: [ - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.DESCRIPTION, - value: [VALIDATION_DESCRIPTION.INGEST_SOURCE_STUDY], - }, - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, - value: [TASK_STATUS.TODO], - }, - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.SYSTEM, - value: [SYSTEM.HCA_DATA_REPOSITORY], - }, - ], - sorting: SAVED_FILTERS_SORTING_TARGET_COMPLETION_DATE, - title: "HCA Data Repository - Ingest backlog", - }, - { - filters: [ - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.DESCRIPTION, - value: [VALIDATION_DESCRIPTION.ADD_PRIMARY_DATA], - }, - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, - value: [TASK_STATUS.TODO], - }, - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.SYSTEM, - value: [SYSTEM.HCA_DATA_REPOSITORY], - }, - ], - sorting: SAVED_FILTERS_SORTING_TARGET_COMPLETION_DATE, - title: "HCA Data Repository - no primary data", - }, - { - filters: [ - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.DESCRIPTION, - value: [VALIDATION_DESCRIPTION.UPDATE_TITLE_TO_MATCH_PUBLICATION], - }, - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, - value: [TASK_STATUS.TODO], - }, - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.SYSTEM, - value: [SYSTEM.HCA_DATA_REPOSITORY], - }, - ], - sorting: SAVED_FILTERS_SORTING_TARGET_COMPLETION_DATE, - title: - "HCA Data Repository - project title does not match publication title", - }, - { - filters: [ - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.DESCRIPTION, - value: [ - VALIDATION_DESCRIPTION.LINK_PROJECT_BIONETWORKS_AND_ATLASES, - ], - }, - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.TASK_STATUS, - value: [TASK_STATUS.TODO], - }, - { - categoryKey: HCA_ATLAS_TRACKER_CATEGORY_KEY.SYSTEM, - value: [SYSTEM.HCA_DATA_REPOSITORY], - }, - ], - sorting: SAVED_FILTERS_SORTING_TARGET_COMPLETION_DATE, - title: "HCA Data Repository - Missing Network or Atlas", - }, - ], + savedFilters: SAVED_FILTERS, }, detail: { detailOverviews: [], @@ -240,32 +107,11 @@ export const tasksEntityConfig: EntityConfig = { label: "Reports", list: { columns: COLUMNS, - tableOptions: { - enableExpanding: true, - enableGrouping: true, - enableMultiRowSelection: true, - enableRowSelection: (row) => !row.getIsGrouped(), - initialState: { - columnVisibility: COLUMN_VISIBILITY.ROW_POSITION, - expanded: true, - grouping: [HCA_ATLAS_TRACKER_CATEGORY_KEY.TARGET_COMPLETION_DATE], - sorting: [ - { - desc: SORT_DIRECTION.ASCENDING, - id: HCA_ATLAS_TRACKER_CATEGORY_KEY.TARGET_COMPLETION_DATE, - }, - { - desc: SORT_DIRECTION.ASCENDING, - id: HCA_ATLAS_TRACKER_CATEGORY_KEY.ATLAS_NAMES, - }, - ], - }, - }, + tableOptions: TABLE_OPTIONS, } as ListConfig, listView: { disablePagination: true, enableDownload: true, - enableRowPreview: true, enableTab: false, rowPreviewView: [ { diff --git a/site-config/hca-atlas-tracker/local/index/user/tableOptions.ts b/site-config/hca-atlas-tracker/local/index/user/tableOptions.ts new file mode 100644 index 00000000..1ca2af8b --- /dev/null +++ b/site-config/hca-atlas-tracker/local/index/user/tableOptions.ts @@ -0,0 +1,18 @@ +import { + ListConfig, + SORT_DIRECTION, +} from "@databiosphere/findable-ui/lib/config/entities"; +import { HCAAtlasTrackerUser } from "../../../../../app/apis/catalog/hca-atlas-tracker/common/entities"; +import { HCA_ATLAS_TRACKER_CATEGORY_KEY } from "../../../category"; + +export const TABLE_OPTIONS: ListConfig["tableOptions"] = { + enableRowPosition: true, + initialState: { + sorting: [ + { + desc: SORT_DIRECTION.ASCENDING, + id: HCA_ATLAS_TRACKER_CATEGORY_KEY.FULL_NAME, + }, + ], + }, +}; diff --git a/site-config/hca-atlas-tracker/local/index/userEntityConfig.ts b/site-config/hca-atlas-tracker/local/index/user/userEntityConfig.ts similarity index 83% rename from site-config/hca-atlas-tracker/local/index/userEntityConfig.ts rename to site-config/hca-atlas-tracker/local/index/user/userEntityConfig.ts index f361dde3..84887065 100644 --- a/site-config/hca-atlas-tracker/local/index/userEntityConfig.ts +++ b/site-config/hca-atlas-tracker/local/index/user/userEntityConfig.ts @@ -1,19 +1,18 @@ -import { ACCESSOR_KEYS } from "@databiosphere/findable-ui/lib/components/TableCreator/common/constants"; import { ComponentConfig, EntityConfig, ListConfig, - SORT_DIRECTION, } from "@databiosphere/findable-ui/lib/config/entities"; import { EXPLORE_MODE } from "@databiosphere/findable-ui/lib/hooks/useExploreMode"; -import { HCAAtlasTrackerUser } from "../../../../app/apis/catalog/hca-atlas-tracker/common/entities"; -import { getUserId } from "../../../../app/apis/catalog/hca-atlas-tracker/common/utils"; -import * as C from "../../../../app/components"; -import * as V from "../../../../app/viewModelBuilders/catalog/hca-atlas-tracker/common/viewModelBuilders"; +import { HCAAtlasTrackerUser } from "../../../../../app/apis/catalog/hca-atlas-tracker/common/entities"; +import { getUserId } from "../../../../../app/apis/catalog/hca-atlas-tracker/common/utils"; +import * as C from "../../../../../app/components"; +import * as V from "../../../../../app/viewModelBuilders/catalog/hca-atlas-tracker/common/viewModelBuilders"; import { HCA_ATLAS_TRACKER_CATEGORY_KEY, HCA_ATLAS_TRACKER_CATEGORY_LABEL, -} from "../../category"; +} from "../../../category"; +import { TABLE_OPTIONS } from "./tableOptions"; /** * Entity config object responsible to config anything related to the /users route. @@ -124,18 +123,7 @@ export const userEntityConfig: EntityConfig = { width: { max: "1fr", min: "160px" }, }, ], - defaultSort: { - desc: SORT_DIRECTION.ASCENDING, - id: HCA_ATLAS_TRACKER_CATEGORY_KEY.FULL_NAME, - }, - tableOptions: { - initialState: { - columnVisibility: { - [ACCESSOR_KEYS.ROW_POSITION]: true, - [ACCESSOR_KEYS.SELECT]: false, - }, - }, - }, + tableOptions: TABLE_OPTIONS, } as ListConfig, listView: { disablePagination: true,