Skip to content

Commit 0a68ff2

Browse files
frano-mFran McDade
andauthored
feat: show warning on non "dataset" tabs (#899) (#3609)
Co-authored-by: Fran McDade <franmcdade@Frans-MacBook-Pro.local>
1 parent b92ec50 commit 0a68ff2

File tree

6 files changed

+49
-0
lines changed

6 files changed

+49
-0
lines changed

explorer/app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,26 @@ export const buildLibraryId = (
542542
};
543543
};
544544

545+
/**
546+
* Build props for list view access warning Alert component.
547+
* @param _ - Unused.
548+
* @param viewContext - View context.
549+
* @returns model to be used as props for the Alert component.
550+
*/
551+
export const buildListWarning = (
552+
_: Record<string, never>,
553+
viewContext: ViewContext
554+
): React.ComponentProps<typeof C.Alert> => {
555+
const {
556+
entityConfig: { label },
557+
} = viewContext;
558+
return {
559+
severity: "warning",
560+
title: `For datasets with a 'Required' access status, ${label} are not listed.`,
561+
variant: "banner",
562+
};
563+
};
564+
545565
/**
546566
* Build props for organism type cell component from the given donors response.
547567
* @param response - Response model return from index/donors API endpoint.

explorer/site-config/anvil-cmg/dev/index/activitiesEntityConfig.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
ANVIL_CMG_CATEGORY_KEY,
1212
ANVIL_CMG_CATEGORY_LABEL,
1313
} from "../../category";
14+
import { listHero } from "../listView/listHero";
1415

1516
/**
1617
* Entity config object responsible for config related to the /explore/activities route.
@@ -116,6 +117,9 @@ export const activitiesEntityConfig: EntityConfig<ActivitiesResponse> = {
116117
id: ANVIL_CMG_CATEGORY_KEY.ACTIVITY_DOCUMENT_ID,
117118
},
118119
} as ListConfig<ActivitiesResponse>,
120+
listView: {
121+
listHero,
122+
},
119123
route: "activities",
120124
staticLoad: false,
121125
};

explorer/site-config/anvil-cmg/dev/index/biosamplesEntityConfig.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
ANVIL_CMG_CATEGORY_KEY,
1212
ANVIL_CMG_CATEGORY_LABEL,
1313
} from "../../category";
14+
import { listHero } from "../listView/listHero";
1415

1516
/**
1617
* Entity config object responsible for config related to the /explore/biosamples route.
@@ -106,6 +107,9 @@ export const biosamplesEntityConfig: EntityConfig<BioSamplesResponse> = {
106107
id: ANVIL_CMG_CATEGORY_KEY.BIOSAMPLE_BIOSAMPLE_ID,
107108
},
108109
} as ListConfig<BioSamplesResponse>,
110+
listView: {
111+
listHero,
112+
},
109113
route: "biosamples",
110114
staticLoad: false,
111115
};

explorer/site-config/anvil-cmg/dev/index/donorsEntityConfig.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
ANVIL_CMG_CATEGORY_KEY,
1212
ANVIL_CMG_CATEGORY_LABEL,
1313
} from "../../category";
14+
import { listHero } from "../listView/listHero";
1415

1516
/**
1617
* Entity config object responsible for config related to the /explore/donors route.
@@ -86,6 +87,9 @@ export const donorsEntityConfig: EntityConfig<DonorsResponse> = {
8687
id: ANVIL_CMG_CATEGORY_KEY.DONOR_DONOR_ID,
8788
},
8889
} as ListConfig<DonorsResponse>,
90+
listView: {
91+
listHero,
92+
},
8993
route: "donors",
9094
staticLoad: false,
9195
};

explorer/site-config/anvil-cmg/dev/index/filesEntityConfig.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
ANVIL_CMG_CATEGORY_KEY,
1313
ANVIL_CMG_CATEGORY_LABEL,
1414
} from "../../category";
15+
import { listHero } from "../listView/listHero";
1516

1617
export const downloadColumn: ColumnConfig = {
1718
componentConfig: {
@@ -130,6 +131,9 @@ export const filesEntityConfig: EntityConfig<FilesResponse> = {
130131
id: ANVIL_CMG_CATEGORY_KEY.FILE_FILE_NAME,
131132
},
132133
} as ListConfig<FilesResponse>,
134+
listView: {
135+
listHero,
136+
},
133137
route: "files",
134138
staticLoad: false,
135139
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import {
2+
ComponentConfig,
3+
ComponentsConfig,
4+
} from "../../../../../../data-explorer/packages/data-explorer-ui/src/config/entities";
5+
import * as C from "../../../../app/components";
6+
import * as T from "../../../../app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders";
7+
8+
export const listHero: ComponentsConfig = [
9+
{
10+
component: C.Alert,
11+
viewBuilder: T.buildListWarning,
12+
} as ComponentConfig<typeof C.Alert>,
13+
];

0 commit comments

Comments
 (0)