Skip to content

Commit

Permalink
revert change
Browse files Browse the repository at this point in the history
  • Loading branch information
urvi-occ committed Nov 7, 2024
1 parent c3e57f7 commit e66e793
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
3 changes: 1 addition & 2 deletions docs/portal_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,8 @@ Below is an example, with inline comments describing what each JSON block config
"enableDownloadManifest": true, // enables a button which allows user to download a manifest file for gen3 client
"downloadManifestButtonText": "Download Manifest", // text to be displayed on the download manifest button
"enableFillRequestForm" : true, // enables a button which opens a new form to request access to a resoruce
"enableCheckboxWithoutLogin" : true, // allow checkboxes in discovery portal without logging in
"fillRequestFormDisplayText": "Request Information", // text to be displayed on fill the request form
"fillRequestFormCheckField" : "_medical_sample_id", // field defiend in MDS which is related to checkbox, this fiels is use to validate if the entry in discovery portal have unique ids
"fillRequestFormCheckField" : "_medical_sample_id", // field defiend in MDS which is related to checkbox, this fiels is use to validate if the entry in discovery portal have unique¸
"fillRequestFormURL" : "https://URL/form", // URL to the new form which would be used to fill the form
"externalWebsiteName" : "", // Name of external website needed, this variable at development is used for showing an external website in a popover for chicagoland pandemic response commons, in commons this will be loaded only if enableFillRequestForm is true
"externalWebsiteURL" : "", // URL of external website needed, this variable is used with externalWebsiteName be loaded only if enableFillRequestForm is true
Expand Down
1 change: 0 additions & 1 deletion src/Discovery/DiscoveryConfig.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export interface DiscoveryConfig {
variableMetadataFieldName?: string
enableDownloadVariableMetadata?: boolean
enableFillRequestForm?: boolean
enableCheckboxWithoutLogin?: boolean
fillRequestFormCheckField?: string
fillRequestFormDisplayText?: string
fillRequestFormURL?: string
Expand Down
18 changes: 10 additions & 8 deletions src/Discovery/DiscoveryListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,19 @@ const DiscoveryListView: React.FunctionComponent<Props> = (props: Props) => {
disabled = (record[props.accessibleFieldName] !== AccessLevel.ACCESSIBLE) && (record[props.accessibleFieldName] !== AccessLevel.MIXED);
}

// Enable checkbox if enableFillRequestForm is true, allowing access without login
const enableCheckboxWithoutLogin = props.config.features.exportToWorkspace?.enableCheckboxWithoutLogin;
if (enableCheckboxWithoutLogin) {
if (props.config.features.exportToWorkspace?.enableFillRequestForm) {
disabled = false;
const fillRequestFormCheckField = props.config.features.exportToWorkspace?.fillRequestFormCheckField;
const fieldValue = fillRequestFormCheckField ? record[fillRequestFormCheckField] : null;

// Disable checkbox if the specified field is empty or missing in the record
if (!fieldValue || fieldValue.length === 0) {
disabled = true;
}
}



// If fillRequestFormCheckField is undefined or empty in record, disable checkbox
const fillRequestFormCheckField = props.config.features.exportToWorkspace?.fillRequestFormCheckField;
if (fillRequestFormCheckField && (!record[fillRequestFormCheckField] || record[fillRequestFormCheckField].length === 0)) {
disabled = true;
}

// disable checkbox if there's no manifest or git external file metadata (if metadata handoff is enabled) found for this study
const exportToWorkspaceConfig = props.config.features.exportToWorkspace;
Expand Down

0 comments on commit e66e793

Please sign in to comment.