From b24353ddad61301d32dc78e430487ff9783681ac Mon Sep 17 00:00:00 2001 From: Junqiu Lei Date: Tue, 3 Jan 2023 09:32:35 -0800 Subject: [PATCH] Update name Signed-off-by: Junqiu Lei --- .../custom_map_config/custom_map_source.tsx | 30 +++++++++---------- .../public/model/customLayerFunctions.ts | 4 +-- maps_dashboards/public/model/mapLayerType.ts | 4 +-- .../public/utils/getIntialConfig.ts | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/maps_dashboards/public/components/layer_config/custom_map_config/custom_map_source.tsx b/maps_dashboards/public/components/layer_config/custom_map_config/custom_map_source.tsx index e7f89808..2a66b298 100644 --- a/maps_dashboards/public/components/layer_config/custom_map_config/custom_map_source.tsx +++ b/maps_dashboards/public/components/layer_config/custom_map_config/custom_map_source.tsx @@ -29,14 +29,14 @@ export const CustomMapSource = ({ setSelectedLayerConfig, setIsUpdateDisabled, }: Props) => { - const customMapProtocolOptions = [ + const customMapTypeOptions = [ { value: 'tms', text: 'Tile Map Service (TMS)' }, { value: 'wms', text: 'Web Map Service (WMS)' }, ]; const [customMapURL, setCustomMapURL] = useState(''); const [customMapAttribution, setCustomMapAttribution] = useState(''); - const [protocol, setProtocol] = useState(customMapProtocolOptions[1].value); + const [customType, setCustomType] = useState(customMapTypeOptions[1].value); const [WMSLayers, setWMSLayers] = useState(''); const [WMSVersion, setWMSVersion] = useState(''); const [WMSFormat, setWMSFormat] = useState(''); @@ -67,13 +67,13 @@ export const CustomMapSource = ({ }); }; - const onChangeProtocol = (e: any) => { - setProtocol(e.target.value); + const onChangeCustomType = (e: any) => { + setCustomType(e.target.value); setSelectedLayerConfig({ ...selectedLayerConfig, source: { ...selectedLayerConfig?.source, - protocol: e.target.value, + customType: e.target.value, }, }); }; @@ -156,9 +156,9 @@ export const CustomMapSource = ({ useEffect(() => { setCustomMapURL(selectedLayerConfig.source.url); - setProtocol(selectedLayerConfig.source.protocol); + setCustomType(selectedLayerConfig.source.customType); setCustomMapAttribution(selectedLayerConfig.source.attribution); - if (selectedLayerConfig.source.protocol === 'wms') { + if (selectedLayerConfig.source.customType === 'wms') { setWMSLayers(selectedLayerConfig.source.layers); setWMSVersion(selectedLayerConfig.source.version); setWMSFormat(selectedLayerConfig.source.format); @@ -173,7 +173,7 @@ export const CustomMapSource = ({ }, [selectedLayerConfig.source.attribution]); useEffect(() => { - if (protocol === 'wms') { + if (customType === 'wms') { setIsUpdateDisabled(isInvalidURL(customMapURL) || WMSLayers === '' || WMSVersion === ''); } else { setIsUpdateDisabled(isInvalidURL(customMapURL)); @@ -186,7 +186,7 @@ export const CustomMapSource = ({ WMSStyles, WMSVersion, customMapURL, - protocol, + customType, setIsUpdateDisabled, ]); @@ -196,16 +196,16 @@ export const CustomMapSource = ({ - Protocol + Custom type - {selectedLayerConfig.source.protocol === 'tms' && ( + {selectedLayerConfig.source.customType === 'tms' && ( <> TMS URL @@ -237,7 +237,7 @@ export const CustomMapSource = ({ )} - {selectedLayerConfig.source.protocol === 'wms' && ( + {selectedLayerConfig.source.customType === 'wms' && ( <> WMS URL diff --git a/maps_dashboards/public/model/customLayerFunctions.ts b/maps_dashboards/public/model/customLayerFunctions.ts index d318ce9f..66647317 100644 --- a/maps_dashboards/public/model/customLayerFunctions.ts +++ b/maps_dashboards/public/model/customLayerFunctions.ts @@ -76,9 +76,9 @@ const addNewLayer = ( const getCustomMapURL = (layerConfig: CustomLayerSpecification) => { const layerSource = layerConfig?.source; - if (layerSource?.protocol === 'tms') { + if (layerSource?.customType === 'tms') { return layerSource?.url; - } else if (layerSource?.protocol === 'wms') { + } else if (layerSource?.customType === 'wms') { const referenceSystemName = layerSource.version === '1.3.0' ? 'crs' : 'srs'; return `${layerSource?.url}?service=WMS&version=${layerSource.version}&request=GetMap&format=${layerSource.format}&transparent=true&layers=${layerSource?.layers}&styles=${layerSource.styles}&${referenceSystemName}=${layerSource.crs}&width=256&height=256&bbox={bbox-epsg-3857}`; } else { diff --git a/maps_dashboards/public/model/mapLayerType.ts b/maps_dashboards/public/model/mapLayerType.ts index 76e72899..e792c2f4 100644 --- a/maps_dashboards/public/model/mapLayerType.ts +++ b/maps_dashboards/public/model/mapLayerType.ts @@ -65,7 +65,7 @@ export type CustomTMSLayerSpecification = { visibility: string; source: { url: string; - protocol: 'tms'; + customType: 'tms'; attribution: string; }; }; @@ -80,7 +80,7 @@ export type CustomWMSLayerSpecification = { visibility: string; source: { url: string; - protocol: 'wms'; + customType: 'wms'; attribution: string; layers: string; styles: string; diff --git a/maps_dashboards/public/utils/getIntialConfig.ts b/maps_dashboards/public/utils/getIntialConfig.ts index 007e3788..6a05c892 100644 --- a/maps_dashboards/public/utils/getIntialConfig.ts +++ b/maps_dashboards/public/utils/getIntialConfig.ts @@ -71,7 +71,7 @@ export const getLayerConfigMap = () => ({ visibility: LAYER_VISIBILITY.VISIBLE, source: { url: '', - protocol: 'wms', + customType: 'wms', attribution: '', layers: '', styles: '',