Skip to content

Commit

Permalink
Merge pull request #499 from CIMAC-CIDC/master
Browse files Browse the repository at this point in the history
data freeze (#498)
  • Loading branch information
crouchcd authored Aug 16, 2023
2 parents bac2582 + ec4ff28 commit 536b8f4
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 387 deletions.
1 change: 1 addition & 0 deletions .env.prod
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
EXTEND_ESLINT=true
# Prod config
#
# Note: the contents of this file must be copied to .env for
Expand Down
1 change: 1 addition & 0 deletions .env.staging
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
EXTEND_ESLINT=true
# Staging config
#
# Note: the contents of this file must be copied to .env for
Expand Down
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,11 @@
">0.2%",
"not ie <= 11",
"not op_mini all"
]
],
"eslintConfig": {
"extends": "react-app",
"rules": {
"@typescript-eslint/no-unused-vars": "off"
}
}
}
7 changes: 7 additions & 0 deletions src/components/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { Person } from "@material-ui/icons";
import { ORGANIZATION_NAME_MAP } from "../../util/constants";
import { AuthContext, login, logout } from "../identity/AuthProvider";
import FadeInOnMount from "../generic/FadeInOnMount";
import { Alert } from "@material-ui/lab";

const ENV = process.env.REACT_APP_ENV;

Expand Down Expand Up @@ -214,6 +215,12 @@ const Header: React.FunctionComponent<RouteComponentProps> = props => {

return (
<div data-testid="header">
<Card square>
<Alert severity="warning">
This site is currently under migration. Some features will
not be available during this time.
</Alert>
</Card>
<EnvBanner />
<div className={classes.tabs}>
<Grid
Expand Down
2 changes: 1 addition & 1 deletion src/components/identity/Register.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ it("renders nothing when no auth data has loaded", () => {
expect(queryByText(/sign up for the cidc portal/i)).not.toBeInTheDocument();
});

it("works as expected when auth data is provided", async () => {
it.skip("works as expected when auth data is provided", async () => {
const idToken = "test-token";
const user = {
first_n: "John",
Expand Down
109 changes: 1 addition & 108 deletions src/components/identity/Register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,114 +99,7 @@ const Register: React.FC<RouteComponentProps> = ({ history }) => {
return (
<Box margin="auto" width={600}>
<Card>
<CardHeader title="Sign up for the CIMAC-CIDC Portal" />
<CardContent>
<Grid container spacing={2} direction="column">
<Grid item>
<Typography>
If you are interested in accessing the
CIMAC-CIDC Portal, please complete your account
request below.
</Typography>
</Grid>
<Grid item>
<TextField
label="Contact Email"
value={state.email}
disabled
fullWidth
margin="normal"
variant="outlined"
/>
</Grid>
<Grid item>
<TextField
label="First Name"
fullWidth
value={state.first_n}
onChange={e => handleChange("first_n", e)}
margin="normal"
variant="outlined"
required
error={state.firstNameError}
/>
</Grid>
<Grid item>
<TextField
label="Last Name"
fullWidth
value={state.last_n}
onChange={e => handleChange("last_n", e)}
margin="normal"
variant="outlined"
required
error={state.lastNameError}
/>
</Grid>
<Grid item>
<FormControl
variant="outlined"
fullWidth
required
margin="normal"
error={state.organizationError}
style={{ minWidth: 420 }}
>
<InputLabel>Organization</InputLabel>
<Select
value={state.organization}
onChange={e =>
handleChange("organization", e)
}
input={<OutlinedInput labelWidth={100} />}
>
<MenuItem value="EMPTY">
Please select
</MenuItem>
<MenuItem value="DFCI">
{ORGANIZATION_NAME_MAP.DFCI}
</MenuItem>
<MenuItem value="CIDC">
{ORGANIZATION_NAME_MAP.CIDC}
</MenuItem>
<MenuItem value="ICAHN">
{ORGANIZATION_NAME_MAP.ICAHN}
</MenuItem>
<MenuItem value="STANFORD">
{ORGANIZATION_NAME_MAP.STANFORD}
</MenuItem>
<MenuItem value="ANDERSON">
{ORGANIZATION_NAME_MAP.ANDERSON}
</MenuItem>
<MenuItem value="N/A">
{ORGANIZATION_NAME_MAP["N/A"]}
</MenuItem>
</Select>
</FormControl>
</Grid>
<Grid item>
<Grid container justify="space-between">
<Grid item>
<Button
variant="contained"
onClick={() => logout()}
>
Cancel
</Button>
</Grid>
<Grid item>
<Button
variant="contained"
color="primary"
onClick={() => handleClick()}
>
Register
</Button>
</Grid>
</Grid>
</Grid>
</Grid>
</CardContent>
<CardHeader title="Registration has been temporarily disabled" />
</Card>
</Box>
);
Expand Down
4 changes: 2 additions & 2 deletions src/components/manifests/ManifestUpload.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function renderWithMockedAuthContext() {
);
}

test("manifest validation", async () => {
test.skip("manifest validation", async () => {
const renderResult = renderWithMockedAuthContext();
const {
queryByTestId,
Expand Down Expand Up @@ -90,7 +90,7 @@ test("manifest validation", async () => {
expect(submitButton.disabled).toBe(false);
});

test("manifest submission", async () => {
test.skip("manifest submission", async () => {
const renderResult = renderWithMockedAuthContext();
const {
findByTestId,
Expand Down
105 changes: 2 additions & 103 deletions src/components/manifests/ManifestUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,112 +158,11 @@ const ManifestUpload: React.FunctionComponent<{ token: string }> = ({
avatar={<CloudUpload />}
title={
<Typography variant="h6">
Upload a shipping / receiving manifest
Uploading a shipping / receiving manifest has been
temporarily disabled
</Typography>
}
/>
<CardContent>
<form onSubmit={onSubmit}>
<Grid
container
direction="row"
justify="space-evenly"
alignItems="center"
>
<Grid item xs={3}>
<FormControl fullWidth>
<FormLabel component="legend">
Manifest Type
</FormLabel>
<RadioGroup
name="manifestType"
value={manifestType || ""}
onChange={(e: any) =>
onValueChange(setManifestType)(e)
}
row
>
{info &&
info.supportedTemplates.manifests.map(
name => (
<FormControlLabel
key={name}
label={name.toUpperCase()}
value={name}
control={<Radio />}
disabled={
status === "loading"
}
data-testid={`radio-${name}`}
/>
)
)}
</RadioGroup>
</FormControl>
</Grid>
<Grid item xs={3}>
<FormControl fullWidth>
<FormLabel component="legend">
Select a manifest to upload
</FormLabel>
<Input
id="uploadInput"
onClick={() => {
// Clear the file input onClick to ensure onChange
// fires on every selection, even if the same file
// is selected twice.
if (fileInput.current) {
fileInput.current.value = "";
}
// Also, reset the form state.
setStatus("unset");
setErrors([]);
setFile(undefined);
}}
disabled={
!manifestType ||
manifestType === "" ||
status === "loading"
}
onChange={() => {
if (fileInput.current) {
const files =
fileInput.current.files;
if (files && files.length > 0) {
setFile(files[0]);
}
}
}}
inputProps={{
ref: fileInput,
accept: XLSX_MIMETYPE,
"data-testid": "manifest-file-input"
}}
type="file"
/>
</FormControl>
</Grid>
<Grid item xs={2}>
<Button
fullWidth
type="submit"
variant="contained"
color="primary"
disabled={status !== "validationSuccess"}
data-testid="submit-button"
>
Upload
</Button>
</Grid>
</Grid>
</form>
<Divider />
<div style={{ margin: "1em" }}>
<Grid container direction="row" alignItems="center">
{feedbackDisplay[status]}
</Grid>
</div>
</CardContent>
</Card>
);
};
Expand Down
8 changes: 4 additions & 4 deletions src/components/profile/AdminTrialManager.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ it("renders available trials and trial creation button", async () => {
expect(queryByText(/test-trial-1/i)).toBeInTheDocument();
});

it("handles trial creation", async () => {
it.skip("handles trial creation", async () => {
const newTrialId = "new-trial-name";
apiCreate
.mockRejectedValueOnce({
Expand Down Expand Up @@ -136,7 +136,7 @@ it("handles trial creation", async () => {
expect(apiFetch.mock.calls.length).toBeGreaterThan(1);
});

it("handles trial editing and updates", async () => {
it.skip("handles trial editing and updates", async () => {
mockFetch([trial1]);
const updatedTrial = {
...trial1,
Expand Down Expand Up @@ -216,7 +216,7 @@ it("handles trial editing and updates", async () => {
expect(ongoingRadio.checked).toBe(true);
});

it("handles discarding trial edits", async () => {
it.skip("handles discarding trial edits", async () => {
mockFetch([trial1]);

const {
Expand Down Expand Up @@ -261,7 +261,7 @@ it("handles discarding trial edits", async () => {
expect(discardButton).not.toBeInTheDocument();
});

it("displays API errors produced while editing trials", async () => {
it.skip("displays API errors produced while editing trials", async () => {
mockFetch([trial1]);
const errorMessage = "uh oh";
apiUpdate.mockRejectedValue({ response: { data: errorMessage } });
Expand Down
8 changes: 7 additions & 1 deletion src/components/profile/AdminTrialManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ const CreateNewTrial = withIdToken<ICreateNewTrialProps>(
color="primary"
startIcon={<Add />}
onClick={() => setIsCreating(true)}
disabled
>
create a new trial
</Button>
Expand All @@ -438,7 +439,12 @@ const TrialManager: React.FC<{ token: string }> = ({ token }) => {
<Card>
<CardHeader
avatar={<LibraryAdd />}
title={<Typography variant="h6">Manage Trials</Typography>}
title={
<Typography variant="h6">
Manage Trials{" "}
<i>(creating/editing has been temporarily disabled)</i>
</Typography>
}
/>
<CardContent>
<Grid container direction="column" spacing={1}>
Expand Down
5 changes: 4 additions & 1 deletion src/components/profile/AdminUserManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,10 @@ const AdminUserManager: React.FC<{ token: string }> = ({ token }) => {
avatar={<SupervisorAccount />}
title={
<Grid container justify="space-between" alignItems="center">
<Typography variant="h6">Manage Users</Typography>
<Typography variant="h6">
Manage Users (
<i>Editing has been temporarily disabled</i>)
</Typography>
<Grid item></Grid>
<Grid item>
<DataAccessReportDownloadButton />
Expand Down
Loading

0 comments on commit 536b8f4

Please sign in to comment.