Skip to content

Commit

Permalink
🗺️ #2724 Remove Regions (#2753)
Browse files Browse the repository at this point in the history
* Remove all references to regions

* Fix Localhost Date Bug

* Remove region header from Create Program

* Revert "Fix Localhost Date Bug"

This reverts commit a8844bd.
  • Loading branch information
demariadaniel authored Feb 13, 2024
1 parent 6218ff8 commit 1b5220d
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export const createProgramSummaryData = (programSummaryQuery: ProgramSummaryQuer
''
),
Institutions: programSummaryQuery?.institutions?.join(', ') || '',
'Processing Regions': programSummaryQuery?.regions?.join(', ') || '',
'Cancer Types': programSummaryQuery?.cancerTypes?.join(', ') || '',
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const PROGRAM_SUMMARY_QUERY = gql`
website
institutions
countries
regions
cancerTypes
primarySites
}
Expand Down
1 change: 0 additions & 1 deletion components/pages/program-entity/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export type ProgramSummaryQuery = {
website: string;
institutions: string[];
countries: string[];
regions: string[];
cancerTypes: string[];
primarySites: string[];
};
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const createProgramInput = (formData) => ({
website: formData.website,
institutions: formData.institutions,
countries: formData.countries,
regions: Array.from(formData.processingRegions),
membershipType: formData.membershipType,
admins: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const PROGRAM_VALUES_QUERY = gql`
cancerTypes
primarySites
institutions
regions
countries
}
}
Expand Down
33 changes: 0 additions & 33 deletions components/pages/submission-system/program-form/ProgramForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export default function CreateProgramForm({
membershipType?: string;
website?: string;
description?: string;
regions?: string[];
};
onSubmit: (data: any) => any;
}) {
Expand All @@ -96,7 +95,6 @@ export default function CreateProgramForm({
membershipType: string;
website: string;
description: string;
processingRegions: string[];
adminFirstName?: string;
adminLastName?: string;
adminEmail?: string;
Expand All @@ -111,7 +109,6 @@ export default function CreateProgramForm({
membershipType: program.membershipType || '',
website: program.website || '',
description: program.description || '',
processingRegions: program.regions || [],
adminFirstName: '',
adminLastName: '',
adminEmail: '',
Expand All @@ -136,8 +133,6 @@ export default function CreateProgramForm({

const { data: { programOptions = undefined } = {}, loading } = useQuery(PROGRAM_VALUES_QUERY);

const regionOptions = get(programOptions, 'regions', []);

/* ****************** *
* On Change Handlers
* ****************** */
Expand Down Expand Up @@ -403,34 +398,6 @@ export default function CreateProgramForm({
</Row>
</FormControl>

<Row>
<Col>
<SectionTitle>Processing Region</SectionTitle>
</Col>
</Row>

<FormControl error={validationErrors.processingRegions} required={true}>
<Row>
<Col>
<InputLabel htmlFor="Processing Region">
Please indicate the region where data can be processed.
</InputLabel>
<Select
aria-label="Processing Region"
id="checkbox-group-processing-region"
options={regionOptions.map((name) => ({ content: name, value: name }))}
onChange={(val) => setData({ key: 'processingRegions', val: [val] })}
onBlur={handleInputBlur('processingRegion')}
value={form.processingRegions[0] || ''}
size="lg"
/>
<ErrorText error={validationErrors.processingRegions} />
</Col>
</Row>
<Row>
<Col />
</Row>
</FormControl>
{!isEditing && (
<>
<Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const baseValidations: yup.ObjectSchema<any> = yup.object({
.required(),
website: yup.string().label('Website').trim().url(),
description: yup.string().label('Description').trim(),
processingRegions: yup.array().of(yup.string()).label('Processing Regions').required(),
});

const adminValidations = yup.object().shape({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ const createUpdateProgramInput = (formData) => ({
website: formData.website,
institutions: formData.institutions,
countries: formData.countries,
regions: Array.from(formData.processingRegions),
membershipType: formData.membershipType,
cancerTypes: formData.cancerTypes,
primarySites: formData.primarySites,
Expand Down
55 changes: 0 additions & 55 deletions components/pages/submission-system/program-management/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import join from 'lodash/join';
import replace from 'lodash/replace';
import { Col, Row } from 'react-grid-system';

const REGIONS = ['Africa', 'North America', 'Asia', 'Europe', 'Oceania', 'South America'];

const MISSING_ENTRY_TEXT = '--';

const arrayToText = (array) => (isEmpty(array) ? MISSING_ENTRY_TEXT : join(array, ', '));
Expand All @@ -40,7 +38,6 @@ type Program = {
membershipType?: string;
description?: string;
institutions?: string;
regions?: string;
};
function ProfileView({ program = {} as Program }) {
const theme = useTheme();
Expand Down Expand Up @@ -160,58 +157,6 @@ function ProfileView({ program = {} as Program }) {
</Left>
<Right>{arrayToText(program.institutions)}</Right>
</Row>

<SectionTitle>Processing Regions</SectionTitle>
<Row>
<Col
css={css`
padding: 7px 0;
`}
>
<InputLabel>
The data for this program CAN be processed in the following regions:
</InputLabel>
</Col>
</Row>
<Row>
<Col
css={css`
padding: 7px 0;
`}
>
<Icon width="15px" height="15px" name="checkmark" fill="success_dark" />
&nbsp;{replace(program.regions, ',(?! )', ', ')}
</Col>
</Row>

<Row>
<Col
css={css`
padding: 7px 0;
`}
>
<InputLabel>
The data for this program CANNOT be processed in the following regions:
</InputLabel>
</Col>
</Row>
<Row>
<Col
css={css`
padding: 7px 0;
`}
>
<Icon width="15px" height="15px" name="times" fill="error_dark" />
&nbsp;
{program.regions &&
join(
filter(REGIONS, (region) => {
return !program.regions.includes(region);
}),
', ',
)}
</Col>
</Row>
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const PROGRAM_QUERY = gql`
website
institutions
countries
regions
membershipType
cancerTypes
primarySites
Expand Down
6 changes: 1 addition & 5 deletions generated/gql_types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ export type Mutation = {
createJiraTicketWithReCaptcha: TicketCreationResponse;
/**
* Create new program
* For lists (Cancer Type, Primary Site, Institution, Regions, Countries) the entire new value must be provided, not just values being added.
* For lists (Cancer Type, Primary Site, Institution, Countries) the entire new value must be provided, not just values being added.
* Returns Program object details of created program
*/
createProgram?: Maybe<Program>;
Expand Down Expand Up @@ -854,7 +854,6 @@ export type Program = {
membershipType?: Maybe<MembershipType>;
name?: Maybe<Scalars['String']>;
primarySites?: Maybe<Array<Maybe<Scalars['String']>>>;
regions?: Maybe<Array<Maybe<Scalars['String']>>>;
shortName: Scalars['String'];
submittedDonors?: Maybe<Scalars['Int']>;
users?: Maybe<Array<Maybe<ProgramUser>>>;
Expand Down Expand Up @@ -1061,7 +1060,6 @@ export type ProgramInput = {
membershipType: MembershipType;
name: Scalars['String'];
primarySites: Array<InputMaybe<Scalars['String']>>;
regions: Array<Scalars['String']>;
shortName: Scalars['String'];
website: Scalars['String'];
};
Expand All @@ -1072,7 +1070,6 @@ export type ProgramOptions = {
countries: Array<Maybe<Scalars['String']>>;
institutions: Array<Maybe<Scalars['String']>>;
primarySites: Array<Maybe<Scalars['String']>>;
regions: Array<Maybe<Scalars['String']>>;
};

export type ProgramUser = {
Expand Down Expand Up @@ -1320,7 +1317,6 @@ export type UpdateProgramInput = {
membershipType?: InputMaybe<MembershipType>;
name?: InputMaybe<Scalars['String']>;
primarySites?: InputMaybe<Array<InputMaybe<Scalars['String']>>>;
regions?: InputMaybe<Array<InputMaybe<Scalars['String']>>>;
website?: InputMaybe<Scalars['String']>;
};

Expand Down

0 comments on commit 1b5220d

Please sign in to comment.