Skip to content

Commit

Permalink
feat(vadc_sprint22): Added sanitize function for team project variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jarvisraymond-uchicago committed Nov 14, 2023
1 parent 597ab2e commit 612e7f2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
7 changes: 6 additions & 1 deletion src/Analysis/AnalysisApp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import GWASContainer from './GWASApp/GWASContainer';
import GWASResultsContainer from './GWASResults/GWASResultsContainer';
import CheckForTeamProjectApplication from './SharedUtils/TeamProject/Utils/CheckForTeamProjectApplication';
import TeamProjectHeader from './SharedUtils/TeamProject/TeamProjectHeader/TeamProjectHeader';
import SanitizeTeamProjectString from './SharedUtils/TeamProject/Utils/SanitizeTeamProjectString';
import './AnalysisApp.css';

const queryClient = new QueryClient();
Expand Down Expand Up @@ -150,7 +151,11 @@ class AnalysisApp extends React.Component {
frameBorder='0'
src={
this.state.app.title === 'OHDSI Atlas'
? `${this.state.app.applicationUrl}#/home?teamproject=${localStorage.getItem('teamProject')}`
? `${
this.state.app.applicationUrl
}#/home?teamproject=${SanitizeTeamProjectString(
localStorage.getItem('teamProject'),
)}`
: `${this.state.app.applicationUrl}`
}
onLoad={this.handleIframeApp}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const SanitizeTeamProjectString = (inputString) => {
// allow only alphanumeric and slashes
const regex = /[^a-zA-Z0-9/]/g;
return inputString.replace(regex, '');
};

export default SanitizeTeamProjectString;
15 changes: 6 additions & 9 deletions src/Workspace/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,12 @@ class Workspace extends React.Component {
))) {
workspaceLaunchStepsConfig.steps[2].description = 'Error';
workspaceLaunchStepsConfig.currentStepsStatus = 'error';
}
else
{
//If container states are available, display detailed pod statuses
} else {
// If container states are available, display detailed pod statuses
if (cs.length > 0) {
for (let i = 0; i < cs.length; i++) {
const j = i+1
workspaceLaunchStepsConfig.steps[2].description = workspaceLaunchStepsConfig.steps[2].description.concat(' \n Container ' + j + ' Ready: ' + cs[i].ready);
const j = i + 1;
workspaceLaunchStepsConfig.steps[2].description = workspaceLaunchStepsConfig.steps[2].description.concat(` \n Container ${j} Ready: ${cs[i].ready}`);
}
}
}
Expand All @@ -287,8 +285,7 @@ class Workspace extends React.Component {
workspaceLaunchStepsConfig.currentIndex = 2;
if (workspaceStatusData.status === 'Launching') {
workspaceLaunchStepsConfig.steps[2].description = 'ECS task pending';
}
else if (workspaceStatusData.status !== 'Active') {
} else if (workspaceStatusData.status !== 'Active') {
workspaceLaunchStepsConfig.steps[2].description = 'ECS task failed';
}
return workspaceLaunchStepsConfig;
Expand Down Expand Up @@ -658,7 +655,7 @@ class Workspace extends React.Component {
>
{(this.state.workspaceLaunchStepsConfig.steps.map((step) => (
<Step
classname = 'workspaceStep'
classname='workspaceStep'
key={step.title}
title={step.title}
description={step.description}
Expand Down

0 comments on commit 612e7f2

Please sign in to comment.