Skip to content

Commit

Permalink
feat(feasability): add feature flag to disable feasability report button
Browse files Browse the repository at this point in the history
  • Loading branch information
pl-buiquang committed Feb 20, 2024
1 parent 01fa5ca commit 08bc1bb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
1 change: 1 addition & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ sed -i "s@{VITE_ODD_MEDICATION}@$VITE_ODD_MEDICATION@g" /app/build/assets/*.js
sed -i "s@{VITE_ODD_CONTACT}@$VITE_ODD_CONTACT@g" /app/build/assets/*.js
sed -i "s@{VITE_ODD_EXPORT}@$VITE_ODD_EXPORT@g" /app/build/assets/*.js
sed -i "s@{VITE_ODD_IMAGING}@$VITE_ODD_IMAGING@g" /app/build/assets/*.js
sed -i "s@{VITE_ODD_FEASABILITY_REPORT}@$VITE_ODD_FEASABILITY_REPORT@g" /app/build/assets/*.js

# Restart nginx to apply changes
service nginx restart
Expand Down
38 changes: 19 additions & 19 deletions src/components/CreationCohort/ControlPanel/ControlPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { CohortCreationCounterType, CurrentSnapshot, LoadingStatus, RequestType,
import useStyle from './styles'

import displayDigit from 'utils/displayDigit'
import { SHORT_COHORT_LIMIT } from '../../../constants'
import { ODD_FEASABILITY_REPORT, SHORT_COHORT_LIMIT } from '../../../constants'
import { JobStatus } from '../../../utils/constants'
import services from 'services/aphp'
import ValidationDialog from 'components/ui/ValidationDialog'
Expand Down Expand Up @@ -234,24 +234,24 @@ const ControlPanel: React.FC<{
<>Créer la cohorte</>
)}
</Button>

<Button
disabled={itLoads || typeof onExecute !== 'function' || maintenanceIsActive || count_outdated}
onClick={handleGenerateReport}
className={classes.requestExecution}
startIcon={<DescriptionIcon color="action" className={classes.iconBorder} />}
style={{ marginBottom: 12 }}
>
{itLoads ? (
<>
Veuillez patienter
<CircularProgress style={{ marginLeft: '15px' }} size={30} />
</>
) : (
<>Générer un rapport</>
)}
</Button>

{ODD_FEASABILITY_REPORT && (
<Button
disabled={itLoads || typeof onExecute !== 'function' || maintenanceIsActive || count_outdated}
onClick={handleGenerateReport}
className={classes.requestExecution}
startIcon={<DescriptionIcon color="action" className={classes.iconBorder} />}
style={{ marginBottom: 12 }}
>
{itLoads ? (
<>
Veuillez patienter
<CircularProgress style={{ marginLeft: '15px' }} size={30} />
</>
) : (
<>Générer un rapport</>
)}
</Button>
)}
<Button
className={classes.actionButton}
onClick={onUndo}
Expand Down
3 changes: 3 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ export const ODD_CONTACT = import.meta.env.DEV
export const ODD_EXPORT = import.meta.env.DEV
? import.meta.env.VITE_ODD_EXPORT == `${BOOLEANTRUE}`
: '{VITE_ODD_EXPORT}' == `${BOOLEANTRUE}`
export const ODD_FEASABILITY_REPORT = import.meta.env.DEV
? import.meta.env.VITE_ODD_FEASABILITY_REPORT == `${BOOLEANTRUE}`
: '{VITE_ODD_FEASABILITY_REPORT}' == `${BOOLEANTRUE}`

export const SESSION_TIMEOUT = import.meta.env.VITE_SESSION_TIMEOUT
? import.meta.env.VITE_SESSION_TIMEOUT
Expand Down

0 comments on commit 08bc1bb

Please sign in to comment.