Skip to content

Commit

Permalink
feat: show warning on non "dataset" tabs (#899) (#3609)
Browse files Browse the repository at this point in the history
Co-authored-by: Fran McDade <[email protected]>
  • Loading branch information
frano-m and Fran McDade authored Aug 11, 2023
1 parent b92ec50 commit 0a68ff2
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, never>,
viewContext: ViewContext
): React.ComponentProps<typeof C.Alert> => {
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -116,6 +117,9 @@ export const activitiesEntityConfig: EntityConfig<ActivitiesResponse> = {
id: ANVIL_CMG_CATEGORY_KEY.ACTIVITY_DOCUMENT_ID,
},
} as ListConfig<ActivitiesResponse>,
listView: {
listHero,
},
route: "activities",
staticLoad: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -106,6 +107,9 @@ export const biosamplesEntityConfig: EntityConfig<BioSamplesResponse> = {
id: ANVIL_CMG_CATEGORY_KEY.BIOSAMPLE_BIOSAMPLE_ID,
},
} as ListConfig<BioSamplesResponse>,
listView: {
listHero,
},
route: "biosamples",
staticLoad: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -86,6 +87,9 @@ export const donorsEntityConfig: EntityConfig<DonorsResponse> = {
id: ANVIL_CMG_CATEGORY_KEY.DONOR_DONOR_ID,
},
} as ListConfig<DonorsResponse>,
listView: {
listHero,
},
route: "donors",
staticLoad: false,
};
4 changes: 4 additions & 0 deletions explorer/site-config/anvil-cmg/dev/index/filesEntityConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -130,6 +131,9 @@ export const filesEntityConfig: EntityConfig<FilesResponse> = {
id: ANVIL_CMG_CATEGORY_KEY.FILE_FILE_NAME,
},
} as ListConfig<FilesResponse>,
listView: {
listHero,
},
route: "files",
staticLoad: false,
};
13 changes: 13 additions & 0 deletions explorer/site-config/anvil-cmg/dev/listView/listHero.ts
Original file line number Diff line number Diff line change
@@ -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<typeof C.Alert>,
];

0 comments on commit 0a68ff2

Please sign in to comment.