Skip to content

Commit

Permalink
fix gwas ui eslint errors (#1050)
Browse files Browse the repository at this point in the history
* fix(eslint): delete previous case control and quantitative

* fix(eslint): import/prop validation, camelcase, consistent returns

* fix(eslint): custom dichotomous removal

* fix(eslint): fix all current eslint errors, include cd removal

* fix(eslint): escape quotes
  • Loading branch information
alilahrime authored Aug 3, 2022
1 parent c321d10 commit 31c8ab6
Show file tree
Hide file tree
Showing 18 changed files with 269 additions and 2,111 deletions.
117 changes: 58 additions & 59 deletions src/Analysis/AnalysisApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import Select from 'react-select';
import { Spin } from 'antd';
import Button from '@gen3/ui-component/dist/components/Button';
import { QueryClient, QueryClientProvider } from 'react-query';
import { TourProvider } from '@reactour/tour';
import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
import BackLink from '../components/BackLink';
import HIVCohortFilter from '../HIVCohortFilter/HIVCohortFilter';
import ReduxGWASUIApp from './GWASUIApp/ReduxGWASUIApp';
import { analysisApps } from '../localconf';
import './AnalysisApp.css';
import sessionMonitor from '../SessionMonitor';
import GWASWorkflowList from './GWASUIApp/GWASWorkflowList';
import { TourProvider } from '@reactour/tour'
import { disableBodyScroll, enableBodyScroll } from "body-scroll-lock";

const queryClient = new QueryClient();

Expand Down Expand Up @@ -63,82 +63,81 @@ class AnalysisApp extends React.Component {
const pathArray = this.state.app.applicationUrl.split('/');
const protocol = pathArray[0];
const host = pathArray[2];
const applicationBaseUrl = protocol + '//' + host;
const applicationBaseUrl = `${protocol}//${host}`;

// ONLY process messages coming from the same domain as the app AND
// which contain the message "refresh token!":
if (event.origin === applicationBaseUrl &&
event.data === "refresh token!") {
//Call function to refresh session:
if (event.origin === applicationBaseUrl
&& event.data === 'refresh token!') {
// Call function to refresh session:
sessionMonitor.updateUserActivity();
}
}

getAppContent = (app) => {
switch (app) {
case 'vaGWAS':
return (
<React.Fragment>
<Select
value={this.state.jobInput}
placeholder='Select your organ'
options={analysisApps[app].options}
onChange={this.selectChange}
/>
<Button label='Run Analysis' buttonType='primary' onClick={this.onSubmitJob} isPending={this.isJobRunning()} />
</React.Fragment>
);
case 'ndhHIV':
return (
<HIVCohortFilter />
);
case 'ndhVirus':
return (
<React.Fragment>
<input className='text-input' type='text' placeholder='input data' name='input' />
<Button label='Run' buttonType='primary' onClick={this.onSubmitJob} isPending={this.isJobRunning()} />
</React.Fragment>
);
case 'GWASUIApp':
return (
<TourProvider
case 'vaGWAS':
return (
<React.Fragment>
<Select
value={this.state.jobInput}
placeholder='Select your organ'
options={analysisApps[app].options}
onChange={this.selectChange}
/>
<Button label='Run Analysis' buttonType='primary' onClick={this.onSubmitJob} isPending={this.isJobRunning()} />
</React.Fragment>
);
case 'ndhHIV':
return (
<HIVCohortFilter />
);
case 'ndhVirus':
return (
<React.Fragment>
<input className='text-input' type='text' placeholder='input data' name='input' />
<Button label='Run' buttonType='primary' onClick={this.onSubmitJob} isPending={this.isJobRunning()} />
</React.Fragment>
);
case 'GWASUIApp':
return (
<TourProvider
afterOpen={disableBody}
beforeClose={enableBody}
onClickClose={({ setCurrentStep, setIsOpen }) => {
setIsOpen(false);

setIsOpen(false)

setCurrentStep(0)
setCurrentStep(0);
}}
>
<QueryClientProvider client={queryClient} contextSharing>
<div className="analysis-app_flex_col">
<div className="analysis-app_flex_row">
>
<QueryClientProvider client={queryClient} contextSharing>
<div className='analysis-app_flex_col'>
<div className='analysis-app_flex_row'>
<GWASWorkflowList refreshWorkflows={this.refreshWorkflows} />
</div>
<div className="analysis-app_flex_row">
<div className='analysis-app_flex_row'>
<ReduxGWASUIApp refreshWorkflows={this.refreshWorkflows} />
</div>
</div>
</QueryClientProvider>
</TourProvider>
);
default:
// this will ensure the main window will process the app messages (if any):
window.addEventListener("message", this.processAppMessages);
return (
<React.Fragment>
<div className='analysis-app__iframe-wrapper'>
<iframe
className='analysis-app__iframe'
title='Analysis App'
frameBorder='0'
src={`${this.state.app.applicationUrl}`}
onLoad={this.handleIframeApp}
/>
</div>
</React.Fragment>
);
</QueryClientProvider>
</TourProvider>
);
default:
// this will ensure the main window will process the app messages (if any):
window.addEventListener('message', this.processAppMessages);
return (
<React.Fragment>
<div className='analysis-app__iframe-wrapper'>
<iframe
className='analysis-app__iframe'
title='Analysis App'
frameBorder='0'
src={`${this.state.app.applicationUrl}`}
onLoad={this.handleIframeApp}
/>
</div>
</React.Fragment>
);
}
}

Expand Down
Loading

0 comments on commit 31c8ab6

Please sign in to comment.