diff --git a/src/common/store/layers.store.js b/src/common/store/layers.store.js index 30d4443..bf8ac92 100644 --- a/src/common/store/layers.store.js +++ b/src/common/store/layers.store.js @@ -37,7 +37,7 @@ export const useLayersStore = createWithEqualityFn( setCategoryLayer: categoryLayer => { set(prev => { const dwgLabels = - prev.textLayers.find(t => t.name === categoryLayer)?.textList?.map(t => t.value.toLowerCase().trim()) || []; + prev.textLayers.filter(t => t.name === categoryLayer).flatMap(t => t?.textList?.map(t => t.value.toLowerCase().trim())).filter(hasValueAndUnique) || []; const dwgMap = {}; dwgLabels.forEach(label => (dwgMap[label] = PLACES_PREVIEW.DEFAULT_IMDF_CATEGORY)); return { @@ -466,3 +466,7 @@ export function convertLayersFromManifestJson(layers, allowedTextLayerNames, all isDraft: true, }); } + +function hasValueAndUnique(value, index, array) { + return value !== undefined && array.indexOf(value) === index; +} diff --git a/src/common/store/response.store.js b/src/common/store/response.store.js index 1199999..951c261 100644 --- a/src/common/store/response.store.js +++ b/src/common/store/response.store.js @@ -285,9 +285,12 @@ export function parseManifestJson(json) { export const isValidManifestVersion = version => { const manifestVersion = parseInt(version); + const { isPlacesPreview } = getFeatureFlags(); if (version === PLACES_PREVIEW.VERSION) return true; - return manifestVersion >= 2; + if (!isPlacesPreview) return manifestVersion >= 2; + + return false; }; export function getFirstMeaningfulError({ error = {} }) { diff --git a/src/common/translations/en.js b/src/common/translations/en.js index c1da52b..bfad7b2 100644 --- a/src/common/translations/en.js +++ b/src/common/translations/en.js @@ -71,6 +71,8 @@ const en = { 'Feature class name must begin with an upper case or lower case character.', 'error.manifest.incorrect.version': 'Existing manifest provided is not supported. Only manifest version 2.0 or later is supported.', + 'error.manifest.places.incorrect.version': + 'The provided manifest is ignored due to invalid manifest version. Only manifest version "places-1.0" is supported.', 'error.manifest.invalid': 'Existing manifest provided is invalid.', 'error.network.issue.cors': 'Unable to process your request due to a network issue or CORS is enabled for your Azure Maps account and a rule needs to be added for this tool.', diff --git a/src/components/progress-bar/progress-bar.js b/src/components/progress-bar/progress-bar.js index 7f2e5de..da1d664 100644 --- a/src/components/progress-bar/progress-bar.js +++ b/src/components/progress-bar/progress-bar.js @@ -1,6 +1,7 @@ import { MessageBar, MessageBarType } from '@fluentui/react'; import { useCompletedSteps, useProgressBarSteps, useProgressBarStore } from 'common/store'; import { useEffect, useMemo } from 'react'; +import { getFeatureFlags } from 'utils'; import { useTranslation } from 'react-i18next'; import { useLocation } from 'react-router-dom'; import ProgressBarButton from './progress-bar-button'; @@ -18,6 +19,7 @@ const progressBarStoreSelector = s => [ export const ProgressBar = () => { const { t } = useTranslation(); const { pathname } = useLocation(); + const { isPlacesPreview } = getFeatureFlags(); const completedSteps = useCompletedSteps(); const [ isIncorrectManifestVersionErrorShown, @@ -48,11 +50,16 @@ export const ProgressBar = () => { return ( <>
- {isIncorrectManifestVersionErrorShown && ( + {isIncorrectManifestVersionErrorShown && !isPlacesPreview &&( {t('error.manifest.incorrect.version')} )} + {isIncorrectManifestVersionErrorShown && isPlacesPreview &&( + + {t('error.manifest.places.incorrect.version')} + + )} {isInvalidManifestErrorShown && ( {t('error.manifest.invalid')} diff --git a/src/pages/layers/units/index.js b/src/pages/layers/units/index.js index 04db093..5df5b4a 100644 --- a/src/pages/layers/units/index.js +++ b/src/pages/layers/units/index.js @@ -26,7 +26,7 @@ export const Units = () => { ]); const texts = useMemo(() => { - return textLayers.find(t => t.name === categoryLayer)?.textList?.map(t => t.value) || []; + return textLayers.filter(t => t.name === categoryLayer).flatMap(t => t?.textList?.map(t => t.value.toLowerCase().trim())).filter(t => t !== undefined) || []; }, [categoryLayer, textLayers]); useEffect(() => {