From 0a68ff2bffdf9acdf34d86416de7560390548cf2 Mon Sep 17 00:00:00 2001 From: Fran McDade Date: Fri, 11 Aug 2023 16:11:33 +1000 Subject: [PATCH] feat: show warning on non "dataset" tabs (#899) (#3609) Co-authored-by: Fran McDade --- .../anvil-cmg/common/viewModelBuilders.ts | 20 +++++++++++++++++++ .../dev/index/activitiesEntityConfig.ts | 4 ++++ .../dev/index/biosamplesEntityConfig.ts | 4 ++++ .../anvil-cmg/dev/index/donorsEntityConfig.ts | 4 ++++ .../anvil-cmg/dev/index/filesEntityConfig.ts | 4 ++++ .../anvil-cmg/dev/listView/listHero.ts | 13 ++++++++++++ 6 files changed, 49 insertions(+) create mode 100644 explorer/site-config/anvil-cmg/dev/listView/listHero.ts diff --git a/explorer/app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts b/explorer/app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts index 5edb78d5a..5d372d3a5 100644 --- a/explorer/app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts +++ b/explorer/app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts @@ -542,6 +542,26 @@ export const buildLibraryId = ( }; }; +/** + * Build props for list view access warning Alert component. + * @param _ - Unused. + * @param viewContext - View context. + * @returns model to be used as props for the Alert component. + */ +export const buildListWarning = ( + _: Record, + viewContext: ViewContext +): React.ComponentProps => { + const { + entityConfig: { label }, + } = viewContext; + return { + severity: "warning", + title: `For datasets with a 'Required' access status, ${label} are not listed.`, + variant: "banner", + }; +}; + /** * Build props for organism type cell component from the given donors response. * @param response - Response model return from index/donors API endpoint. diff --git a/explorer/site-config/anvil-cmg/dev/index/activitiesEntityConfig.ts b/explorer/site-config/anvil-cmg/dev/index/activitiesEntityConfig.ts index 8886ff0cf..34798d828 100644 --- a/explorer/site-config/anvil-cmg/dev/index/activitiesEntityConfig.ts +++ b/explorer/site-config/anvil-cmg/dev/index/activitiesEntityConfig.ts @@ -11,6 +11,7 @@ import { ANVIL_CMG_CATEGORY_KEY, ANVIL_CMG_CATEGORY_LABEL, } from "../../category"; +import { listHero } from "../listView/listHero"; /** * Entity config object responsible for config related to the /explore/activities route. @@ -116,6 +117,9 @@ export const activitiesEntityConfig: EntityConfig = { id: ANVIL_CMG_CATEGORY_KEY.ACTIVITY_DOCUMENT_ID, }, } as ListConfig, + listView: { + listHero, + }, route: "activities", staticLoad: false, }; diff --git a/explorer/site-config/anvil-cmg/dev/index/biosamplesEntityConfig.ts b/explorer/site-config/anvil-cmg/dev/index/biosamplesEntityConfig.ts index d44b58be1..6dd5e2c39 100644 --- a/explorer/site-config/anvil-cmg/dev/index/biosamplesEntityConfig.ts +++ b/explorer/site-config/anvil-cmg/dev/index/biosamplesEntityConfig.ts @@ -11,6 +11,7 @@ import { ANVIL_CMG_CATEGORY_KEY, ANVIL_CMG_CATEGORY_LABEL, } from "../../category"; +import { listHero } from "../listView/listHero"; /** * Entity config object responsible for config related to the /explore/biosamples route. @@ -106,6 +107,9 @@ export const biosamplesEntityConfig: EntityConfig = { id: ANVIL_CMG_CATEGORY_KEY.BIOSAMPLE_BIOSAMPLE_ID, }, } as ListConfig, + listView: { + listHero, + }, route: "biosamples", staticLoad: false, }; diff --git a/explorer/site-config/anvil-cmg/dev/index/donorsEntityConfig.ts b/explorer/site-config/anvil-cmg/dev/index/donorsEntityConfig.ts index 5eaf4794d..e404c0e0c 100644 --- a/explorer/site-config/anvil-cmg/dev/index/donorsEntityConfig.ts +++ b/explorer/site-config/anvil-cmg/dev/index/donorsEntityConfig.ts @@ -11,6 +11,7 @@ import { ANVIL_CMG_CATEGORY_KEY, ANVIL_CMG_CATEGORY_LABEL, } from "../../category"; +import { listHero } from "../listView/listHero"; /** * Entity config object responsible for config related to the /explore/donors route. @@ -86,6 +87,9 @@ export const donorsEntityConfig: EntityConfig = { id: ANVIL_CMG_CATEGORY_KEY.DONOR_DONOR_ID, }, } as ListConfig, + listView: { + listHero, + }, route: "donors", staticLoad: false, }; diff --git a/explorer/site-config/anvil-cmg/dev/index/filesEntityConfig.ts b/explorer/site-config/anvil-cmg/dev/index/filesEntityConfig.ts index 2278a7c51..2f720eb46 100644 --- a/explorer/site-config/anvil-cmg/dev/index/filesEntityConfig.ts +++ b/explorer/site-config/anvil-cmg/dev/index/filesEntityConfig.ts @@ -12,6 +12,7 @@ import { ANVIL_CMG_CATEGORY_KEY, ANVIL_CMG_CATEGORY_LABEL, } from "../../category"; +import { listHero } from "../listView/listHero"; export const downloadColumn: ColumnConfig = { componentConfig: { @@ -130,6 +131,9 @@ export const filesEntityConfig: EntityConfig = { id: ANVIL_CMG_CATEGORY_KEY.FILE_FILE_NAME, }, } as ListConfig, + listView: { + listHero, + }, route: "files", staticLoad: false, }; diff --git a/explorer/site-config/anvil-cmg/dev/listView/listHero.ts b/explorer/site-config/anvil-cmg/dev/listView/listHero.ts new file mode 100644 index 000000000..7904da4db --- /dev/null +++ b/explorer/site-config/anvil-cmg/dev/listView/listHero.ts @@ -0,0 +1,13 @@ +import { + ComponentConfig, + ComponentsConfig, +} from "../../../../../../data-explorer/packages/data-explorer-ui/src/config/entities"; +import * as C from "../../../../app/components"; +import * as T from "../../../../app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders"; + +export const listHero: ComponentsConfig = [ + { + component: C.Alert, + viewBuilder: T.buildListWarning, + } as ComponentConfig, +];