Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show warning on non "dataset" tabs (#899) #3609

Merged
merged 1 commit into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>,
];