diff --git a/webapp/views/App/SideBar/Modules/utils.js b/webapp/views/App/SideBar/Modules/utils.js index af6afa38da..aee6fe6ac2 100644 --- a/webapp/views/App/SideBar/Modules/utils.js +++ b/webapp/views/App/SideBar/Modules/utils.js @@ -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, diff --git a/webapp/views/App/views/Analysis/Analysis.js b/webapp/views/App/views/Analysis/Analysis.js index add5042eb0..3d74d5e505 100644 --- a/webapp/views/App/views/Analysis/Analysis.js +++ b/webapp/views/App/views/Analysis/Analysis.js @@ -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' @@ -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 ( - navigate(appModuleUri(analysisModules.chains))}> + navigate(appModuleUri(analysisModules.chains))}> { path: `${analysisModules.category.path}/:categoryUuid`, props: { analysis: true }, }, - { - component: Instances, - path: analysisModules.instances.path, - }, + + ...(Survey.isPublished(surveyInfo) + ? [ + { + component: Instances, + path: analysisModules.instances.path, + }, + ] + : []), ]} />