Skip to content

Commit

Permalink
Fix [UI] Move analyses tabs to Demo mode in (#3002)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilan7empest authored Jan 13, 2025
1 parent a4f3327 commit 6e24fee
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 16 deletions.
6 changes: 4 additions & 2 deletions src/components/Datasets/Datasets.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { toggleYaml } from '../../reducers/appReducer'
import { transformSearchParams } from '../../utils/filter.util'
import { useFiltersFromSearchParams } from '../../hooks/useFiltersFromSearchParams.hook'
import { usePagination } from '../../hooks/usePagination.hook'
import { useMode } from '../../hooks/mode.hook'

import './datasets.scss'

Expand All @@ -74,6 +75,7 @@ const Datasets = ({ isAllVersions = false }) => {
const dispatch = useDispatch()
const location = useLocation()
const navigate = useNavigate()
const { isDemoMode } = useMode()
const params = useParams()
const paginationConfigDatasetsRef = useRef({})
const paginationConfigDatasetVersionsRef = useRef({})
Expand All @@ -85,8 +87,8 @@ const Datasets = ({ isAllVersions = false }) => {
const datasetsFilters = useFiltersFromSearchParams(filtersConfig)

const pageData = useMemo(
() => generatePageData(selectedDataset, viewMode, params),
[selectedDataset, viewMode, params]
() => generatePageData(selectedDataset, viewMode, params, false, isDemoMode),
[isDemoMode, selectedDataset, viewMode, params]
)

const detailsFormInitialValues = useMemo(
Expand Down
14 changes: 10 additions & 4 deletions src/components/Datasets/datasets.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const getFiltersConfig = isAllVersions => ({

export const registerDatasetTitle = 'Register dataset'

export const generateDataSetsDetailsMenu = selectedItem => [
export const generateDataSetsDetailsMenu = (selectedItem, isDemoMode) => [
{
label: 'overview',
id: 'overview'
Expand All @@ -113,14 +113,20 @@ export const generateDataSetsDetailsMenu = selectedItem => [
{
label: 'analysis',
id: 'analysis',
hidden: !selectedItem.extra_data
hidden: !isDemoMode || !selectedItem.extra_data
}
]

export const generatePageData = (selectedItem, viewMode, params, isDetailsPopUp = false) => ({
export const generatePageData = (
selectedItem,
viewMode,
params,
isDetailsPopUp = false,
isDemoMode
) => ({
page: DATASETS_PAGE,
details: {
menu: generateDataSetsDetailsMenu(selectedItem),
menu: generateDataSetsDetailsMenu(selectedItem, isDemoMode),
infoHeaders,
type: DATASETS_TAB,
hideBackBtn: viewMode === FULL_VIEW_MODE,
Expand Down
7 changes: 6 additions & 1 deletion src/components/FeatureStore/FeatureSets/FeatureSets.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { useVirtualization } from '../../../hooks/useVirtualization.hook'
import { useInitialTableFetch } from '../../../hooks/useInitialTableFetch.hook'
import { filtersConfig } from './featureSets.util'
import { useFiltersFromSearchParams } from '../../../hooks/useFiltersFromSearchParams.hook'
import { useMode } from '../../../hooks/mode.hook'

import cssVariables from './featureSets.scss'

Expand Down Expand Up @@ -86,6 +87,7 @@ const FeatureSets = ({
const navigate = useNavigate()
const location = useLocation()
const dispatch = useDispatch()
const { isDemoMode } = useMode()
const frontendSpec = useSelector(store => store.appStore.frontendSpec)
const detailsFormInitialValues = useMemo(
() => ({
Expand All @@ -99,7 +101,10 @@ const FeatureSets = ({
const { featureSetsPanelIsOpen, setFeatureSetsPanelIsOpen, toggleConvertedYaml } =
React.useContext(FeatureStoreContext)

const pageData = useMemo(() => generatePageData(selectedFeatureSet), [selectedFeatureSet])
const pageData = useMemo(
() => generatePageData(selectedFeatureSet, isDemoMode),
[isDemoMode, selectedFeatureSet]
)

const actionsMenu = useMemo(
() => generateActionsMenu(dispatch, selectedFeatureSet, toggleConvertedYaml),
Expand Down
9 changes: 5 additions & 4 deletions src/components/FeatureStore/FeatureSets/featureSets.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { showErrorNotification } from '../../../utils/notifications.util'

import { ReactComponent as Yaml } from 'igz-controls/images/yaml.svg'

export const generateFeatureSetsDetailsMenu = selectedItem => [
export const generateFeatureSetsDetailsMenu = (selectedItem, isDemoMode) => [
{
label: 'overview',
id: 'overview'
Expand All @@ -59,7 +59,8 @@ export const generateFeatureSetsDetailsMenu = selectedItem => [
},
{
label: 'analysis',
id: 'analysis'
id: 'analysis',
hidden: !isDemoMode
}
]

Expand All @@ -83,12 +84,12 @@ export const filtersConfig = {
[LABELS_FILTER]: { label: 'Labels:', initialValue: '', isModal: true }
}

export const generatePageData = selectedFeatureSet => {
export const generatePageData = (selectedFeatureSet, isDemoMode) => {
return {
page: FEATURE_STORE_PAGE,
details: {
type: FEATURE_SETS_TAB,
menu: generateFeatureSetsDetailsMenu(selectedFeatureSet),
menu: generateFeatureSetsDetailsMenu(selectedFeatureSet, isDemoMode),
infoHeaders: featureSetsInfoHeaders
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/components/FeatureStore/FeatureVectors/FeatureVectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import { sortListByDate } from '../../../utils'
import { isDetailsTabExists } from '../../../utils/link-helper.util'
import { filtersConfig } from './featureVectors.util'
import { useFiltersFromSearchParams } from '../../../hooks/useFiltersFromSearchParams.hook'
import { useMode } from '../../../hooks/mode.hook'

import cssVariables from './featureVectors.scss'

Expand Down Expand Up @@ -87,6 +88,7 @@ const FeatureVectors = ({
const navigate = useNavigate()
const location = useLocation()
const dispatch = useDispatch()
const { isDemoMode } = useMode()

const {
createVectorPopUpIsOpen,
Expand All @@ -95,7 +97,10 @@ const FeatureVectors = ({
toggleConvertedYaml
} = React.useContext(FeatureStoreContext)
const frontendSpec = useSelector(store => store.appStore.frontendSpec)
const pageData = useMemo(() => generatePageData(selectedFeatureVector), [selectedFeatureVector])
const pageData = useMemo(
() => generatePageData(selectedFeatureVector, isDemoMode),
[isDemoMode, selectedFeatureVector]
)

const detailsFormInitialValues = useMemo(
() => generateDetailsFormInitialValue(selectedFeatureVector, frontendSpec.internal_labels),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { parseChipsData } from '../../../utils/convertChipsData'
import { ReactComponent as Delete } from 'igz-controls/images/delete.svg'
import { ReactComponent as Yaml } from 'igz-controls/images/yaml.svg'

export const generateFeatureVectorsDetailsMenu = selectedItem => [
export const generateFeatureVectorsDetailsMenu = (selectedItem, isDemoMode) => [
{
label: 'overview',
id: 'overview'
Expand All @@ -60,7 +60,8 @@ export const generateFeatureVectorsDetailsMenu = selectedItem => [
},
{
label: 'analysis',
id: 'analysis'
id: 'analysis',
hidden: !isDemoMode
}
]

Expand All @@ -83,12 +84,12 @@ export const filtersConfig = {
[LABELS_FILTER]: { label: 'Labels:', initialValue: '', isModal: true }
}

export const generatePageData = selectedFeatureSet => {
export const generatePageData = (selectedFeatureSet, isDemoMode) => {
return {
page: FEATURE_STORE_PAGE,
details: {
type: FEATURE_VECTORS_TAB,
menu: generateFeatureVectorsDetailsMenu(selectedFeatureSet),
menu: generateFeatureVectorsDetailsMenu(selectedFeatureSet, isDemoMode),
infoHeaders: featureSetsInfoHeaders
}
}
Expand Down

0 comments on commit 6e24fee

Please sign in to comment.