Skip to content

Commit

Permalink
Chains: allow accessing chains even when survey is draft (#3212)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefano Ricci <[email protected]>
  • Loading branch information
SteRiccio and SteRiccio authored Dec 22, 2023
1 parent 7f669e4 commit 52734c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion webapp/views/App/SideBar/Modules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const getModulesHierarchy = (user, surveyInfo) => {
module: appModules.analysis,
children: [
analysisModules.chains,
analysisModules.instances,
...(Survey.isPublished(surveyInfo) ? [analysisModules.instances] : []),
// , analysisModules.entities
],
hidden: !canAnalyzeRecords,
Expand Down
19 changes: 14 additions & 5 deletions webapp/views/App/views/Analysis/Analysis.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react'
import { useNavigate } from 'react-router'

import * as Survey from '@core/survey/survey'

import { appModules, appModuleUri, analysisModules } from '@webapp/app/appModules'

import ModuleSwitch from '@webapp/components/moduleSwitch'
Expand All @@ -11,12 +13,14 @@ import SurveyDefsLoader from '@webapp/components/survey/SurveyDefsLoader'
import Chains from './Chains'
import Chain from './Chain'
import Instances from './Instances'
import { useSurveyInfo } from '@webapp/store/survey'
// import Entities from './Entities'

const Analysis = () => {
const navigate = useNavigate()
const surveyInfo = useSurveyInfo()
return (
<SurveyDefsLoader draft requirePublish onSurveyCycleUpdate={() => navigate(appModuleUri(analysisModules.chains))}>
<SurveyDefsLoader draft onSurveyCycleUpdate={() => navigate(appModuleUri(analysisModules.chains))}>
<ModuleSwitch
moduleRoot={appModules.analysis}
moduleDefault={analysisModules.chains}
Expand Down Expand Up @@ -46,10 +50,15 @@ const Analysis = () => {
path: `${analysisModules.category.path}/:categoryUuid`,
props: { analysis: true },
},
{
component: Instances,
path: analysisModules.instances.path,
},

...(Survey.isPublished(surveyInfo)
? [
{
component: Instances,
path: analysisModules.instances.path,
},
]
: []),
]}
/>
</SurveyDefsLoader>
Expand Down

0 comments on commit 52734c3

Please sign in to comment.