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

Sync MVP-2.0.0 (M2) into MVP-2.1.0 (M3) #244

Merged
merged 8 commits into from
Dec 15, 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
Binary file added src/assets/modelNavigator/CDS_Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions src/components/DataSubmissions/DataSubmissionUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useParams } from "react-router-dom";
import { LoadingButton } from "@mui/lab";
import {
AlertColor,
Button,
Stack,
Typography,
styled,
Expand All @@ -27,7 +28,7 @@ const StyledMetadataText = styled(StyledUploadTypeText)(() => ({
},
}));

const StyledUploadFilesButton = styled(LoadingButton)(() => ({
const StyledUploadFilesButton = styled(Button)(() => ({
display: "flex",
flexDirection: "column",
padding: "12px 20px",
Expand All @@ -50,7 +51,6 @@ const StyledUploadFilesButton = styled(LoadingButton)(() => ({
minWidth: "137px",
}
}));

const StyledChooseFilesButton = styled(LoadingButton)(() => ({
display: "flex",
flexDirection: "column",
Expand Down Expand Up @@ -331,13 +331,12 @@ const DataSubmissionUpload = ({ submitterID, readOnly, onUpload }: Props) => {
<StyledUploadFilesButton
variant="contained"
onClick={handleUploadFiles}
loading={isUploading}
disabled={readOnly || !selectedFiles?.length || !canUpload}
disabled={readOnly || !selectedFiles?.length || !canUpload || isUploading}
disableElevation
disableRipple
disableTouchRipple
>
Upload
{isUploading ? "Uploading..." : "Upload"}
</StyledUploadFilesButton>
</StyledUploadWrapper>
);
Expand Down
4 changes: 4 additions & 0 deletions src/config/DataCommons.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logo from "../assets/modelNavigator/Logo.jpg";
import CDSLogo from "../assets/modelNavigator/CDS_Logo.png";

/**
* The URL of the Data Commons Model Repo
Expand All @@ -19,6 +20,8 @@ export const DataCommons: DataCommon[] = [
name: "CDS",
assets: null,
configuration: {
pageTitle: "CDS Data Model",
titleIconSrc: CDSLogo,
pdfConfig: {
fileType: 'pdf',
prefix: 'CDS_',
Expand Down Expand Up @@ -122,6 +125,7 @@ export const DataCommons: DataCommon[] = [
name: "ICDC",
assets: null,
configuration: {
pageTitle: "ICDC Data Model",
pdfConfig: {
fileType: 'pdf',
prefix: 'ICDC_',
Expand Down
9 changes: 9 additions & 0 deletions src/content/modelNavigator/hooks/useBuildReduxStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ const useBuildReduxStore = (): [{ status: Status, store: Store }, () => void, (a
filterSections: datacommon.configuration.facetFilterSearchData.map((s) => s?.datafield),
filterOptions: buildFilterOptionsList(datacommon),
},
pageConfig: {
title: datacommon.configuration.pageTitle,
iconSrc: datacommon.configuration?.titleIconSrc,
},
readMeConfig: {
readMeUrl: assets.readme,
readMeTitle: datacommon.configuration?.readMeTitle || defaultReadMeTitle,
Expand All @@ -97,6 +101,11 @@ const useBuildReduxStore = (): [{ status: Status, store: Store }, () => void, (a
},
});

// MVP-2 M2 NOTE: This resets the search history to prevent the data models
// from overlapping on searches. A future improvement would be to isolate
// the localStorage history key to the data model based on a config option.
store.dispatch({ type: 'SEARCH_CLEAR_HISTORY' });

setStatus("success");
};

Expand Down
10 changes: 10 additions & 0 deletions src/types/DataModelNavigator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
* Only the options that are explicitly used by CRDC Hub are defined here.
*/
type ModelNavigatorConfig = {
/**
* The title of the Data Model Navigator page
*
* e.g. "CRDC Data Model Navigator"
*/
pageTitle: string,
/**
* The icon to display in the title of the Data Model Navigator page
*/
titleIconSrc?: string,
/**
* Provides a title to the README modal popup
*
Expand Down