@itwin/map-layers 4.0.0-dev.2 → 4.0.0-dev.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -1
- package/lib/cjs/ui/MapFeatureInfoTool.d.ts.map +1 -1
- package/lib/cjs/ui/MapFeatureInfoTool.js +1 -1
- package/lib/cjs/ui/MapFeatureInfoTool.js.map +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js +8 -8
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/BasemapPanel.js +3 -3
- package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerDroppable.js +1 -1
- package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.js +4 -4
- package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/esm/ui/MapFeatureInfoTool.d.ts.map +1 -1
- package/lib/esm/ui/MapFeatureInfoTool.js +2 -2
- package/lib/esm/ui/MapFeatureInfoTool.js.map +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.js +9 -9
- package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/BasemapPanel.js +4 -4
- package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerDroppable.js +2 -2
- package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.js +5 -5
- package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
- package/package.json +27 -27
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
/* eslint-disable deprecation/deprecation */
|
|
6
6
|
// cSpell:ignore droppable Sublayer Basemap
|
|
7
|
-
import {
|
|
7
|
+
import { UiFramework } from "@itwin/appui-react";
|
|
8
8
|
import { BaseMapLayerSettings, ColorByName, ColorDef, ImageMapLayerSettings } from "@itwin/core-common";
|
|
9
9
|
import { WebFontIcon } from "@itwin/core-react";
|
|
10
10
|
import { ColorPickerDialog, ColorSwatch } from "@itwin/imodel-components-react";
|
|
@@ -87,7 +87,7 @@ export function BasemapPanel(props) {
|
|
|
87
87
|
return baseMapOptions[0];
|
|
88
88
|
}, [selectedBaseMap, baseMapOptions, baseIsMap]);
|
|
89
89
|
const handleBackgroundColorDialogOk = React.useCallback((bgColorDef) => {
|
|
90
|
-
|
|
90
|
+
UiFramework.dialogs.modal.close();
|
|
91
91
|
if (activeViewport) {
|
|
92
92
|
// change color and make sure previously set transparency is not lost.
|
|
93
93
|
const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;
|
|
@@ -97,11 +97,11 @@ export function BasemapPanel(props) {
|
|
|
97
97
|
}
|
|
98
98
|
}, [activeViewport]);
|
|
99
99
|
const handleBackgroundColorDialogCancel = React.useCallback(() => {
|
|
100
|
-
|
|
100
|
+
UiFramework.dialogs.modal.close();
|
|
101
101
|
}, []);
|
|
102
102
|
const handleBgColorClick = React.useCallback((newColor, e) => {
|
|
103
103
|
e.preventDefault();
|
|
104
|
-
|
|
104
|
+
UiFramework.dialogs.modal.open(React.createElement(ColorPickerDialog, { dialogTitle: colorDialogTitle, color: newColor, colorPresets: presetColors, colorInputType: "rgb", onOkResult: handleBackgroundColorDialogOk, onCancelResult: handleBackgroundColorDialogCancel }));
|
|
105
105
|
}, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
106
106
|
const handleBaseMapSelection = React.useCallback((value) => {
|
|
107
107
|
if (bases && activeViewport && value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasemapPanel.js","sourceRoot":"","sources":["../../../../src/ui/widget/BasemapPanel.tsx"],"names":[],"mappings":"AAAA;;;+FA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AQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,kBAAkB,GAAI;YAE9I,oBAAC,uBAAuB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,+BAA+B,GAAG,CAC/I,CACL,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable deprecation/deprecation */\r\n// cSpell:ignore droppable Sublayer Basemap\r\n\r\nimport { ModalDialogManager } from \"@itwin/appui-react\";\r\nimport { BaseMapLayerSettings, ColorByName, ColorDef, ImageMapLayerSettings, MapLayerProps } from \"@itwin/core-common\";\r\nimport { DisplayStyleState } from \"@itwin/core-frontend\";\r\nimport { WebFontIcon } from \"@itwin/core-react\";\r\nimport { ColorPickerDialog, ColorSwatch } from \"@itwin/imodel-components-react\";\r\nimport { Button, Select, SelectOption } from \"@itwin/itwinui-react\";\r\nimport * as React from \"react\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport \"./BasemapPanel.scss\";\r\nimport { useSourceMapContext } from \"./MapLayerManager\";\r\nimport { TransparencyPopupButton } from \"./TransparencyPopupButton\";\r\n\r\nfunction getBaseMapFromStyle(displayStyle: DisplayStyleState | undefined) {\r\n if (!displayStyle)\r\n return undefined;\r\n\r\n if (displayStyle.settings.mapImagery.backgroundBase instanceof ImageMapLayerSettings || displayStyle.settings.mapImagery.backgroundBase instanceof ColorDef)\r\n return displayStyle.settings.mapImagery.backgroundBase.toJSON();\r\n\r\n return undefined;\r\n}\r\n\r\ninterface BasemapPanelProps {\r\n disabled?: boolean;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function BasemapPanel(props: BasemapPanelProps) {\r\n const [useColorLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.ColorFill\"));\r\n const { activeViewport, bases } = useSourceMapContext();\r\n const [selectedBaseMap, setSelectedBaseMap] = React.useState<MapLayerProps | number | undefined>(getBaseMapFromStyle(activeViewport?.displayStyle));\r\n const [baseMapTransparencyValue, setBaseMapTransparencyValue] = React.useState(() => {\r\n if (activeViewport)\r\n return activeViewport.displayStyle.baseMapTransparency;\r\n return 0;\r\n });\r\n const [baseMapVisible, setBaseMapVisible] = React.useState(() => {\r\n if (activeViewport && activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\r\n return activeViewport.displayStyle.backgroundMapBase.visible;\r\n }\r\n return false;\r\n });\r\n\r\n // Monitor viewport updates, and refresh the widget accordingly.\r\n // Note: This is needed for multiple viewport applications.\r\n React.useEffect(() => {\r\n if (activeViewport) {\r\n setBaseMapTransparencyValue(activeViewport.displayStyle.baseMapTransparency);\r\n setSelectedBaseMap(getBaseMapFromStyle(activeViewport.displayStyle));\r\n if (activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\r\n setBaseMapVisible(activeViewport.displayStyle.backgroundMapBase.visible);\r\n }\r\n }\r\n }, [activeViewport]);\r\n\r\n const handleBasemapTransparencyChange = React.useCallback((transparency: number) => {\r\n if (activeViewport) {\r\n activeViewport.displayStyle.changeBaseMapTransparency(transparency);\r\n activeViewport.invalidateRenderPlan();\r\n setBaseMapTransparencyValue(transparency);\r\n }\r\n }, [activeViewport]);\r\n\r\n const baseMapOptions = React.useMemo<SelectOption<string>[]>(() => {\r\n const baseOptions: SelectOption<string>[] = [];\r\n\r\n baseOptions.push({ value: useColorLabel, label: useColorLabel });\r\n\r\n if (bases)\r\n baseOptions.push(...bases.map((value) => ({ value: value.name, label: value.name })));\r\n return baseOptions;\r\n }, [bases, useColorLabel]);\r\n\r\n const [presetColors] = React.useState([\r\n ColorDef.create(ColorByName.grey),\r\n ColorDef.create(ColorByName.lightGrey),\r\n ColorDef.create(ColorByName.darkGrey),\r\n ColorDef.create(ColorByName.lightBlue),\r\n ColorDef.create(ColorByName.lightGreen),\r\n ColorDef.create(ColorByName.darkGreen),\r\n ColorDef.create(ColorByName.tan),\r\n ColorDef.create(ColorByName.darkBrown),\r\n ]);\r\n\r\n const baseIsColor = React.useMemo(() => typeof selectedBaseMap === \"number\", [selectedBaseMap]);\r\n const baseIsMap = React.useMemo(() => !baseIsColor && (selectedBaseMap !== undefined), [baseIsColor, selectedBaseMap]);\r\n const bgColor = React.useMemo(() => baseIsColor ? selectedBaseMap as number : presetColors[0].toJSON(), [baseIsColor, selectedBaseMap, presetColors]);\r\n const [colorDialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:ColorDialog.Title\"));\r\n const selectedBaseMapValue = React.useMemo(() => {\r\n if (baseIsMap) {\r\n const mapName = (selectedBaseMap! as MapLayerProps).name;\r\n const foundItem = baseMapOptions.find((value) => value.label === mapName);\r\n if (foundItem)\r\n return foundItem;\r\n }\r\n return baseMapOptions[0];\r\n }, [selectedBaseMap, baseMapOptions, baseIsMap]);\r\n\r\n const handleBackgroundColorDialogOk = React.useCallback((bgColorDef: ColorDef) => {\r\n ModalDialogManager.closeDialog();\r\n if (activeViewport) {\r\n // change color and make sure previously set transparency is not lost.\r\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\r\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\r\n activeViewport.invalidateRenderPlan();\r\n setSelectedBaseMap(bgColorDef.toJSON());\r\n }\r\n }, [activeViewport]);\r\n\r\n const handleBackgroundColorDialogCancel = React.useCallback(() => {\r\n ModalDialogManager.closeDialog();\r\n }, []);\r\n\r\n const handleBgColorClick = React.useCallback((newColor: ColorDef, e: React.MouseEvent<Element, MouseEvent>) => {\r\n e.preventDefault();\r\n ModalDialogManager.openDialog(<ColorPickerDialog dialogTitle={colorDialogTitle} color={newColor} colorPresets={presetColors} colorInputType={\"rgb\"}\r\n onOkResult={handleBackgroundColorDialogOk} onCancelResult={handleBackgroundColorDialogCancel} />);\r\n }, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps\r\n\r\n const handleBaseMapSelection = React.useCallback((value: string) => {\r\n if (bases && activeViewport && value) {\r\n const baseMap = bases.find((map) => map.name === value);\r\n if (baseMap) {\r\n const baseProps: MapLayerProps = baseMap.toJSON();\r\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\r\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone(baseProps);\r\n } else {\r\n activeViewport.displayStyle.backgroundMapBase = BaseMapLayerSettings.fromJSON(baseProps);\r\n }\r\n activeViewport.invalidateRenderPlan();\r\n setSelectedBaseMap(baseProps);\r\n } else {\r\n const bgColorDef = ColorDef.fromJSON(bgColor);\r\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\r\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\r\n activeViewport.invalidateRenderPlan();\r\n setSelectedBaseMap(bgColorDef.toJSON());\r\n }\r\n }\r\n }, [bases, activeViewport, bgColor]);\r\n\r\n const handleVisibilityChange = React.useCallback(() => {\r\n if (activeViewport) {\r\n const newState = !baseMapVisible;\r\n // BaseMap visibility is only support when backgroundBase is an instance of BaseMapLayerSettings (i.e not a color)...\r\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\r\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({ visible: newState });\r\n activeViewport.invalidateRenderPlan();\r\n }\r\n setBaseMapVisible(newState);\r\n }\r\n }, [baseMapVisible, activeViewport]);\r\n\r\n const [baseLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseLayer\"));\r\n const [selectBaseMapLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.SelectBaseMap\"));\r\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\r\n\r\n return (\r\n <>\r\n <div className=\"map-manager-base-item\" >\r\n <Button size=\"small\" styleType=\"borderless\" title={toggleVisibility} onClick={handleVisibilityChange} disabled={props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings)}>\r\n <WebFontIcon iconName={baseMapVisible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\r\n </Button>\r\n <span className=\"map-manager-base-label\">{baseLayerLabel}</span>\r\n <Select className=\"map-manager-base-item-select\"\r\n options={baseMapOptions}\r\n placeholder={selectBaseMapLabel}\r\n value={selectedBaseMapValue.value}\r\n onChange={handleBaseMapSelection} size=\"small\"\r\n disabled={props.disabled}\r\n />\r\n {\r\n baseIsColor &&\r\n <ColorSwatch className=\"map-manager-base-item-color\" colorDef={ColorDef.fromJSON(bgColor)} round={false} onColorPick={handleBgColorClick} />\r\n }\r\n <TransparencyPopupButton disabled={props.disabled} transparency={baseMapTransparencyValue} onTransparencyChange={handleBasemapTransparencyChange}/>\r\n </div>\r\n </>\r\n );\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"BasemapPanel.js","sourceRoot":"","sources":["../../../../src/ui/widget/BasemapPanel.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,4CAA4C;AAC5C,2CAA2C;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,QAAQ,EAAE,qBAAqB,EAAiB,MAAM,oBAAoB,CAAC;AAEvH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM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B,GAAG,CAC/I,CACL,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/* eslint-disable deprecation/deprecation */\r\n// cSpell:ignore droppable Sublayer Basemap\r\n\r\nimport { UiFramework } from \"@itwin/appui-react\";\r\nimport { BaseMapLayerSettings, ColorByName, ColorDef, ImageMapLayerSettings, MapLayerProps } from \"@itwin/core-common\";\r\nimport { DisplayStyleState } from \"@itwin/core-frontend\";\r\nimport { WebFontIcon } from \"@itwin/core-react\";\r\nimport { ColorPickerDialog, ColorSwatch } from \"@itwin/imodel-components-react\";\r\nimport { Button, Select, SelectOption } from \"@itwin/itwinui-react\";\r\nimport * as React from \"react\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport \"./BasemapPanel.scss\";\r\nimport { useSourceMapContext } from \"./MapLayerManager\";\r\nimport { TransparencyPopupButton } from \"./TransparencyPopupButton\";\r\n\r\nfunction getBaseMapFromStyle(displayStyle: DisplayStyleState | undefined) {\r\n if (!displayStyle)\r\n return undefined;\r\n\r\n if (displayStyle.settings.mapImagery.backgroundBase instanceof ImageMapLayerSettings || displayStyle.settings.mapImagery.backgroundBase instanceof ColorDef)\r\n return displayStyle.settings.mapImagery.backgroundBase.toJSON();\r\n\r\n return undefined;\r\n}\r\n\r\ninterface BasemapPanelProps {\r\n disabled?: boolean;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function BasemapPanel(props: BasemapPanelProps) {\r\n const [useColorLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.ColorFill\"));\r\n const { activeViewport, bases } = useSourceMapContext();\r\n const [selectedBaseMap, setSelectedBaseMap] = React.useState<MapLayerProps | number | undefined>(getBaseMapFromStyle(activeViewport?.displayStyle));\r\n const [baseMapTransparencyValue, setBaseMapTransparencyValue] = React.useState(() => {\r\n if (activeViewport)\r\n return activeViewport.displayStyle.baseMapTransparency;\r\n return 0;\r\n });\r\n const [baseMapVisible, setBaseMapVisible] = React.useState(() => {\r\n if (activeViewport && activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\r\n return activeViewport.displayStyle.backgroundMapBase.visible;\r\n }\r\n return false;\r\n });\r\n\r\n // Monitor viewport updates, and refresh the widget accordingly.\r\n // Note: This is needed for multiple viewport applications.\r\n React.useEffect(() => {\r\n if (activeViewport) {\r\n setBaseMapTransparencyValue(activeViewport.displayStyle.baseMapTransparency);\r\n setSelectedBaseMap(getBaseMapFromStyle(activeViewport.displayStyle));\r\n if (activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings) {\r\n setBaseMapVisible(activeViewport.displayStyle.backgroundMapBase.visible);\r\n }\r\n }\r\n }, [activeViewport]);\r\n\r\n const handleBasemapTransparencyChange = React.useCallback((transparency: number) => {\r\n if (activeViewport) {\r\n activeViewport.displayStyle.changeBaseMapTransparency(transparency);\r\n activeViewport.invalidateRenderPlan();\r\n setBaseMapTransparencyValue(transparency);\r\n }\r\n }, [activeViewport]);\r\n\r\n const baseMapOptions = React.useMemo<SelectOption<string>[]>(() => {\r\n const baseOptions: SelectOption<string>[] = [];\r\n\r\n baseOptions.push({ value: useColorLabel, label: useColorLabel });\r\n\r\n if (bases)\r\n baseOptions.push(...bases.map((value) => ({ value: value.name, label: value.name })));\r\n return baseOptions;\r\n }, [bases, useColorLabel]);\r\n\r\n const [presetColors] = React.useState([\r\n ColorDef.create(ColorByName.grey),\r\n ColorDef.create(ColorByName.lightGrey),\r\n ColorDef.create(ColorByName.darkGrey),\r\n ColorDef.create(ColorByName.lightBlue),\r\n ColorDef.create(ColorByName.lightGreen),\r\n ColorDef.create(ColorByName.darkGreen),\r\n ColorDef.create(ColorByName.tan),\r\n ColorDef.create(ColorByName.darkBrown),\r\n ]);\r\n\r\n const baseIsColor = React.useMemo(() => typeof selectedBaseMap === \"number\", [selectedBaseMap]);\r\n const baseIsMap = React.useMemo(() => !baseIsColor && (selectedBaseMap !== undefined), [baseIsColor, selectedBaseMap]);\r\n const bgColor = React.useMemo(() => baseIsColor ? selectedBaseMap as number : presetColors[0].toJSON(), [baseIsColor, selectedBaseMap, presetColors]);\r\n const [colorDialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:ColorDialog.Title\"));\r\n const selectedBaseMapValue = React.useMemo(() => {\r\n if (baseIsMap) {\r\n const mapName = (selectedBaseMap! as MapLayerProps).name;\r\n const foundItem = baseMapOptions.find((value) => value.label === mapName);\r\n if (foundItem)\r\n return foundItem;\r\n }\r\n return baseMapOptions[0];\r\n }, [selectedBaseMap, baseMapOptions, baseIsMap]);\r\n\r\n const handleBackgroundColorDialogOk = React.useCallback((bgColorDef: ColorDef) => {\r\n UiFramework.dialogs.modal.close();\r\n if (activeViewport) {\r\n // change color and make sure previously set transparency is not lost.\r\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\r\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\r\n activeViewport.invalidateRenderPlan();\r\n setSelectedBaseMap(bgColorDef.toJSON());\r\n }\r\n }, [activeViewport]);\r\n\r\n const handleBackgroundColorDialogCancel = React.useCallback(() => {\r\n UiFramework.dialogs.modal.close();\r\n }, []);\r\n\r\n const handleBgColorClick = React.useCallback((newColor: ColorDef, e: React.MouseEvent<Element, MouseEvent>) => {\r\n e.preventDefault();\r\n UiFramework.dialogs.modal.open(<ColorPickerDialog dialogTitle={colorDialogTitle} color={newColor} colorPresets={presetColors} colorInputType={\"rgb\"}\r\n onOkResult={handleBackgroundColorDialogOk} onCancelResult={handleBackgroundColorDialogCancel} />);\r\n }, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps\r\n\r\n const handleBaseMapSelection = React.useCallback((value: string) => {\r\n if (bases && activeViewport && value) {\r\n const baseMap = bases.find((map) => map.name === value);\r\n if (baseMap) {\r\n const baseProps: MapLayerProps = baseMap.toJSON();\r\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\r\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone(baseProps);\r\n } else {\r\n activeViewport.displayStyle.backgroundMapBase = BaseMapLayerSettings.fromJSON(baseProps);\r\n }\r\n activeViewport.invalidateRenderPlan();\r\n setSelectedBaseMap(baseProps);\r\n } else {\r\n const bgColorDef = ColorDef.fromJSON(bgColor);\r\n const curTransparency = activeViewport.displayStyle.backgroundMapBase instanceof ColorDef ? activeViewport.displayStyle.backgroundMapBase.getTransparency() : 0;\r\n activeViewport.displayStyle.backgroundMapBase = bgColorDef.withTransparency(curTransparency);\r\n activeViewport.invalidateRenderPlan();\r\n setSelectedBaseMap(bgColorDef.toJSON());\r\n }\r\n }\r\n }, [bases, activeViewport, bgColor]);\r\n\r\n const handleVisibilityChange = React.useCallback(() => {\r\n if (activeViewport) {\r\n const newState = !baseMapVisible;\r\n // BaseMap visibility is only support when backgroundBase is an instance of BaseMapLayerSettings (i.e not a color)...\r\n if (activeViewport.displayStyle.backgroundMapBase instanceof BaseMapLayerSettings) {\r\n activeViewport.displayStyle.backgroundMapBase = activeViewport.displayStyle.backgroundMapBase.clone({ visible: newState });\r\n activeViewport.invalidateRenderPlan();\r\n }\r\n setBaseMapVisible(newState);\r\n }\r\n }, [baseMapVisible, activeViewport]);\r\n\r\n const [baseLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.BaseLayer\"));\r\n const [selectBaseMapLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Basemap.SelectBaseMap\"));\r\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\r\n\r\n return (\r\n <>\r\n <div className=\"map-manager-base-item\" >\r\n <Button size=\"small\" styleType=\"borderless\" title={toggleVisibility} onClick={handleVisibilityChange} disabled={props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof ImageMapLayerSettings)}>\r\n <WebFontIcon iconName={baseMapVisible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\r\n </Button>\r\n <span className=\"map-manager-base-label\">{baseLayerLabel}</span>\r\n <Select className=\"map-manager-base-item-select\"\r\n options={baseMapOptions}\r\n placeholder={selectBaseMapLabel}\r\n value={selectedBaseMapValue.value}\r\n onChange={handleBaseMapSelection} size=\"small\"\r\n disabled={props.disabled}\r\n />\r\n {\r\n baseIsColor &&\r\n <ColorSwatch className=\"map-manager-base-item-color\" colorDef={ColorDef.fromJSON(bgColor)} round={false} onColorPick={handleBgColorClick} />\r\n }\r\n <TransparencyPopupButton disabled={props.disabled} transparency={baseMapTransparencyValue} onTransparencyChange={handleBasemapTransparencyChange}/>\r\n </div>\r\n </>\r\n );\r\n}\r\n"]}
|
|
@@ -10,7 +10,7 @@ import { Draggable, Droppable } from "react-beautiful-dnd";
|
|
|
10
10
|
import { MapLayerImageryProviderStatus, MapTileTreeScaleRangeVisibility } from "@itwin/core-frontend";
|
|
11
11
|
import { Icon } from "@itwin/core-react";
|
|
12
12
|
import { assert } from "@itwin/core-bentley";
|
|
13
|
-
import {
|
|
13
|
+
import { UiFramework } from "@itwin/appui-react";
|
|
14
14
|
import { Button } from "@itwin/itwinui-react";
|
|
15
15
|
import { SubLayersPopupButton } from "./SubLayersPopupButton";
|
|
16
16
|
import { AttachLayerButtonType, AttachLayerPopupButton } from "./AttachLayerPopupButton";
|
|
@@ -48,7 +48,7 @@ export function MapLayerDroppable(props) {
|
|
|
48
48
|
if (indexInDisplayStyle !== undefined && indexInDisplayStyle >= 0) {
|
|
49
49
|
const layerSettings = props.activeViewport.displayStyle.mapLayerAtIndex(indexInDisplayStyle, activeLayer.isOverlay);
|
|
50
50
|
if (layerSettings instanceof ImageMapLayerSettings) {
|
|
51
|
-
|
|
51
|
+
UiFramework.dialogs.modal.open(React.createElement(MapUrlDialog, { activeViewport: props.activeViewport, isOverlay: props.isOverlay, layerRequiringCredentials: layerSettings === null || layerSettings === void 0 ? void 0 : layerSettings.toJSON(), onOkResult: props.onItemEdited, mapTypesOptions: props.mapTypesOptions }));
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}, title: requireAuthTooltip },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapLayerDroppable.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerDroppable.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,2CAA2C;AAE3C,oEAAoE;AACpE,sDAAsD;AAEtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAuB,SAAS,EAA6C,MAAM,qBAAqB,CAAC;AAC3H,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAkB,MAAM,sBAAsB,CAAC;AACtH,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAe3D,gBAAgB;AAChB,gEAAgE;AAChE,MA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ED,OAAO,CACL,oBAAC,SAAS,IACR,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,UAAU,EACvB,oBAAoB,EAAE,KAAK,CAAC,oBAA2B,IAEtD,eAAe,CACN,CACb,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// cSpell:ignore droppable Sublayer Basemap\r\n\r\n// the following quiet warning caused by react-beautiful-dnd package\r\n/* eslint-disable @typescript-eslint/unbound-method */\r\n\r\nimport * as React from \"react\";\r\nimport { Draggable, DraggableChildrenFn, Droppable, DroppableProvided, DroppableStateSnapshot } from \"react-beautiful-dnd\";\r\nimport { MapLayerImageryProviderStatus, MapTileTreeScaleRangeVisibility, ScreenViewport } from \"@itwin/core-frontend\";\r\nimport { Icon } from \"@itwin/core-react\";\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { ModalDialogManager } from \"@itwin/appui-react\";\r\nimport { Button } from \"@itwin/itwinui-react\";\r\nimport { SubLayersPopupButton } from \"./SubLayersPopupButton\";\r\nimport { AttachLayerButtonType, AttachLayerPopupButton } from \"./AttachLayerPopupButton\";\r\nimport { MapTypesOptions, StyleMapLayerSettings } from \"../Interfaces\";\r\nimport { MapLayerSettingsMenu } from \"./MapLayerSettingsMenu\";\r\nimport { MapUrlDialog } from \"./MapUrlDialog\";\r\nimport \"./MapLayerManager.scss\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\r\n\r\n/** @internal */\r\ninterface MapLayerDroppableProps {\r\n isOverlay: boolean;\r\n layersList?: StyleMapLayerSettings[];\r\n mapTypesOptions?: MapTypesOptions;\r\n getContainerForClone: () => HTMLElement;\r\n activeViewport: ScreenViewport;\r\n onMenuItemSelected: (action: string, mapLayerSettings: StyleMapLayerSettings) => void;\r\n onItemVisibilityToggleClicked: (mapLayerSettings: StyleMapLayerSettings) => void;\r\n onItemEdited: () => void;\r\n disabled?: boolean;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapLayerDroppable(props: MapLayerDroppableProps) {\r\n const containsLayer = props.layersList && props.layersList.length > 0;\r\n const droppableId = props.isOverlay ? \"overlayMapLayers\" : \"backgroundMapLayers\";\r\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\r\n const [requireAuthTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.RequireAuthTooltip\"));\r\n const [noBackgroundMapsSpecifiedLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.NoBackgroundLayers\"));\r\n const [noUnderlaysSpecifiedLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.NoOverlayLayers\"));\r\n const [dropLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.DropLayerLabel\"));\r\n const [outOfRangeTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.layerOutOfRange\"));\r\n\r\n const renderItem: DraggableChildrenFn = (dragProvided, _, rubric) => {\r\n assert(props.layersList !== undefined);\r\n const activeLayer = props.layersList[rubric.source.index];\r\n const outOfRange = activeLayer.treeVisibility === MapTileTreeScaleRangeVisibility.Hidden;\r\n\r\n return (\r\n <div className=\"map-manager-source-item\" data-id={rubric.source.index} key={activeLayer.name}\r\n {...dragProvided.draggableProps}\r\n ref={dragProvided.innerRef} >\r\n {/* Visibility icon */}\r\n <Button disabled={props.disabled} size=\"small\" styleType=\"borderless\" className=\"map-manager-item-visibility\" title={toggleVisibility} onClick={() => { props.onItemVisibilityToggleClicked(activeLayer); }}>\r\n <Icon iconSpec={activeLayer.visible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\r\n </Button>\r\n {/* Label */}\r\n <span className={props.disabled||outOfRange ? \"map-manager-item-label-disabled\" : \"map-manager-item-label\"}\r\n title = {outOfRange ? outOfRangeTitle : undefined }\r\n {...dragProvided.dragHandleProps}\r\n\r\n >\r\n {activeLayer.name}\r\n </span>\r\n <div className=\"map-manager-item-sub-layer-container\">\r\n {activeLayer.subLayers && activeLayer.subLayers.length > 1 &&\r\n <SubLayersPopupButton mapLayerSettings={activeLayer} activeViewport={props.activeViewport} />\r\n }\r\n </div>\r\n {activeLayer.provider?.status === MapLayerImageryProviderStatus.RequireAuth &&\r\n <Button\r\n disabled={props.disabled}\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n onClick={() => {\r\n const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(activeLayer.name, activeLayer.source, activeLayer.isOverlay);\r\n if (indexInDisplayStyle !== undefined && indexInDisplayStyle >= 0) {\r\n const layerSettings = props.activeViewport.displayStyle.mapLayerAtIndex(indexInDisplayStyle, activeLayer.isOverlay);\r\n if (layerSettings instanceof ImageMapLayerSettings) {\r\n ModalDialogManager.openDialog(<MapUrlDialog activeViewport={props.activeViewport}\r\n isOverlay={props.isOverlay}\r\n layerRequiringCredentials={layerSettings?.toJSON()}\r\n onOkResult={props.onItemEdited}\r\n mapTypesOptions={props.mapTypesOptions}></MapUrlDialog>);\r\n }\r\n }\r\n\r\n }}\r\n title={requireAuthTooltip}\r\n >\r\n <Icon className=\"map-layer-source-item-warnMessage-icon\" iconSpec=\"icon-status-warning\" />\r\n </Button>\r\n }\r\n <MapLayerSettingsMenu activeViewport={props.activeViewport} mapLayerSettings={activeLayer} onMenuItemSelection={props.onMenuItemSelected} disabled={props.disabled} />\r\n </div>\r\n );\r\n };\r\n\r\n function renderDraggableContent(snapshot: DroppableStateSnapshot): React.ReactNode {\r\n let node: React.ReactNode;\r\n if (containsLayer) {\r\n // Render a <Draggable>\r\n node = (props.layersList?.map((mapLayerSettings, i) =>\r\n <Draggable isDragDisabled={props.disabled} key={mapLayerSettings.name} draggableId={mapLayerSettings.name} index={i}>\r\n {renderItem}\r\n </Draggable>));\r\n } else {\r\n // Render a label that provide a 'Drop here' hint\r\n const label = props.isOverlay ? noUnderlaysSpecifiedLabel : noBackgroundMapsSpecifiedLabel;\r\n node =\r\n <div title={label} className=\"map-manager-no-layers-container\">\r\n {snapshot.isDraggingOver ?\r\n <span className=\"map-manager-no-layers-label\">{dropLayerLabel}</span>\r\n :\r\n <>\r\n <span className=\"map-manager-no-layers-label\">{label}</span>\r\n <AttachLayerPopupButton disabled={props.disabled} buttonType={AttachLayerButtonType.Blue} isOverlay={props.isOverlay} />\r\n </>\r\n }\r\n </div>;\r\n }\r\n return node;\r\n }\r\n\r\n function renderDraggable(dropProvided: DroppableProvided, dropSnapshot: DroppableStateSnapshot): React.ReactElement<HTMLElement> {\r\n return (\r\n <div className={`map-manager-attachments${dropSnapshot.isDraggingOver && containsLayer ? \" is-dragging-map-over\" : \"\"}`} ref={dropProvided.innerRef} {...dropProvided.droppableProps} >\r\n\r\n {renderDraggableContent(dropSnapshot)}\r\n\r\n {\r\n /* We don't want a placeholder when displaying the 'Drop here' message\r\n Unfortunately, if don't add it, 'react-beautiful-dnd' show an error message in the console.\r\n So I simply make it hidden. See https://github.com/atlassian/react-beautiful-dnd/issues/518 */\r\n }\r\n <div style={containsLayer ? undefined : { display: \"none\" }}>{dropProvided.placeholder}</div>\r\n </div>);\r\n }\r\n\r\n return (\r\n <Droppable\r\n droppableId={droppableId}\r\n renderClone={renderItem}\r\n getContainerForClone={props.getContainerForClone as any}\r\n >\r\n {renderDraggable}\r\n </Droppable>\r\n );\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"MapLayerDroppable.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapLayerDroppable.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,2CAA2C;AAE3C,oEAAoE;AACpE,sDAAsD;AAEtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,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AAC,6BAA6B,IAAE,cAAc,CAAQ;oBACrE,CAAC;wBACD;4BACE,8BAAM,SAAS,EAAC,6BAA6B,IAAE,KAAK,CAAQ;4BAC5D,oBAAC,sBAAsB,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,UAAU,EAAE,qBAAqB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,GAAI,CACvH,CAED,CAAC;SACV;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,eAAe,CAAC,YAA+B,EAAE,YAAoC;QAC5F,OAAO,CACL,6BAAK,SAAS,EAAE,0BAA0B,YAAY,CAAC,cAAc,IAAI,aAAa,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,YAAY,CAAC,QAAQ,KAAM,YAAY,CAAC,cAAc;YAEjL,sBAAsB,CAAC,YAAY,CAAC;YAOrC,6BAAK,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAG,YAAY,CAAC,WAAW,CAAO,CACzF,CAAC,CAAC;IACZ,CAAC;IAED,OAAO,CACL,oBAAC,SAAS,IACR,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,UAAU,EACvB,oBAAoB,EAAE,KAAK,CAAC,oBAA2B,IAEtD,eAAe,CACN,CACb,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// cSpell:ignore droppable Sublayer Basemap\r\n\r\n// the following quiet warning caused by react-beautiful-dnd package\r\n/* eslint-disable @typescript-eslint/unbound-method */\r\n\r\nimport * as React from \"react\";\r\nimport { Draggable, DraggableChildrenFn, Droppable, DroppableProvided, DroppableStateSnapshot } from \"react-beautiful-dnd\";\r\nimport { MapLayerImageryProviderStatus, MapTileTreeScaleRangeVisibility, ScreenViewport } from \"@itwin/core-frontend\";\r\nimport { Icon } from \"@itwin/core-react\";\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { UiFramework } from \"@itwin/appui-react\";\r\nimport { Button } from \"@itwin/itwinui-react\";\r\nimport { SubLayersPopupButton } from \"./SubLayersPopupButton\";\r\nimport { AttachLayerButtonType, AttachLayerPopupButton } from \"./AttachLayerPopupButton\";\r\nimport { MapTypesOptions, StyleMapLayerSettings } from \"../Interfaces\";\r\nimport { MapLayerSettingsMenu } from \"./MapLayerSettingsMenu\";\r\nimport { MapUrlDialog } from \"./MapUrlDialog\";\r\nimport \"./MapLayerManager.scss\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\r\n\r\n/** @internal */\r\ninterface MapLayerDroppableProps {\r\n isOverlay: boolean;\r\n layersList?: StyleMapLayerSettings[];\r\n mapTypesOptions?: MapTypesOptions;\r\n getContainerForClone: () => HTMLElement;\r\n activeViewport: ScreenViewport;\r\n onMenuItemSelected: (action: string, mapLayerSettings: StyleMapLayerSettings) => void;\r\n onItemVisibilityToggleClicked: (mapLayerSettings: StyleMapLayerSettings) => void;\r\n onItemEdited: () => void;\r\n disabled?: boolean;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapLayerDroppable(props: MapLayerDroppableProps) {\r\n const containsLayer = props.layersList && props.layersList.length > 0;\r\n const droppableId = props.isOverlay ? \"overlayMapLayers\" : \"backgroundMapLayers\";\r\n const [toggleVisibility] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.ToggleVisibility\"));\r\n const [requireAuthTooltip] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.RequireAuthTooltip\"));\r\n const [noBackgroundMapsSpecifiedLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.NoBackgroundLayers\"));\r\n const [noUnderlaysSpecifiedLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.NoOverlayLayers\"));\r\n const [dropLayerLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.DropLayerLabel\"));\r\n const [outOfRangeTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.layerOutOfRange\"));\r\n\r\n const renderItem: DraggableChildrenFn = (dragProvided, _, rubric) => {\r\n assert(props.layersList !== undefined);\r\n const activeLayer = props.layersList[rubric.source.index];\r\n const outOfRange = activeLayer.treeVisibility === MapTileTreeScaleRangeVisibility.Hidden;\r\n\r\n return (\r\n <div className=\"map-manager-source-item\" data-id={rubric.source.index} key={activeLayer.name}\r\n {...dragProvided.draggableProps}\r\n ref={dragProvided.innerRef} >\r\n {/* Visibility icon */}\r\n <Button disabled={props.disabled} size=\"small\" styleType=\"borderless\" className=\"map-manager-item-visibility\" title={toggleVisibility} onClick={() => { props.onItemVisibilityToggleClicked(activeLayer); }}>\r\n <Icon iconSpec={activeLayer.visible ? \"icon-visibility\" : \"icon-visibility-hide-2\"} />\r\n </Button>\r\n {/* Label */}\r\n <span className={props.disabled||outOfRange ? \"map-manager-item-label-disabled\" : \"map-manager-item-label\"}\r\n title = {outOfRange ? outOfRangeTitle : undefined }\r\n {...dragProvided.dragHandleProps}\r\n\r\n >\r\n {activeLayer.name}\r\n </span>\r\n <div className=\"map-manager-item-sub-layer-container\">\r\n {activeLayer.subLayers && activeLayer.subLayers.length > 1 &&\r\n <SubLayersPopupButton mapLayerSettings={activeLayer} activeViewport={props.activeViewport} />\r\n }\r\n </div>\r\n {activeLayer.provider?.status === MapLayerImageryProviderStatus.RequireAuth &&\r\n <Button\r\n disabled={props.disabled}\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n onClick={() => {\r\n const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(activeLayer.name, activeLayer.source, activeLayer.isOverlay);\r\n if (indexInDisplayStyle !== undefined && indexInDisplayStyle >= 0) {\r\n const layerSettings = props.activeViewport.displayStyle.mapLayerAtIndex(indexInDisplayStyle, activeLayer.isOverlay);\r\n if (layerSettings instanceof ImageMapLayerSettings) {\r\n UiFramework.dialogs.modal.open(<MapUrlDialog activeViewport={props.activeViewport}\r\n isOverlay={props.isOverlay}\r\n layerRequiringCredentials={layerSettings?.toJSON()}\r\n onOkResult={props.onItemEdited}\r\n mapTypesOptions={props.mapTypesOptions}></MapUrlDialog>);\r\n }\r\n }\r\n\r\n }}\r\n title={requireAuthTooltip}\r\n >\r\n <Icon className=\"map-layer-source-item-warnMessage-icon\" iconSpec=\"icon-status-warning\" />\r\n </Button>\r\n }\r\n <MapLayerSettingsMenu activeViewport={props.activeViewport} mapLayerSettings={activeLayer} onMenuItemSelection={props.onMenuItemSelected} disabled={props.disabled} />\r\n </div>\r\n );\r\n };\r\n\r\n function renderDraggableContent(snapshot: DroppableStateSnapshot): React.ReactNode {\r\n let node: React.ReactNode;\r\n if (containsLayer) {\r\n // Render a <Draggable>\r\n node = (props.layersList?.map((mapLayerSettings, i) =>\r\n <Draggable isDragDisabled={props.disabled} key={mapLayerSettings.name} draggableId={mapLayerSettings.name} index={i}>\r\n {renderItem}\r\n </Draggable>));\r\n } else {\r\n // Render a label that provide a 'Drop here' hint\r\n const label = props.isOverlay ? noUnderlaysSpecifiedLabel : noBackgroundMapsSpecifiedLabel;\r\n node =\r\n <div title={label} className=\"map-manager-no-layers-container\">\r\n {snapshot.isDraggingOver ?\r\n <span className=\"map-manager-no-layers-label\">{dropLayerLabel}</span>\r\n :\r\n <>\r\n <span className=\"map-manager-no-layers-label\">{label}</span>\r\n <AttachLayerPopupButton disabled={props.disabled} buttonType={AttachLayerButtonType.Blue} isOverlay={props.isOverlay} />\r\n </>\r\n }\r\n </div>;\r\n }\r\n return node;\r\n }\r\n\r\n function renderDraggable(dropProvided: DroppableProvided, dropSnapshot: DroppableStateSnapshot): React.ReactElement<HTMLElement> {\r\n return (\r\n <div className={`map-manager-attachments${dropSnapshot.isDraggingOver && containsLayer ? \" is-dragging-map-over\" : \"\"}`} ref={dropProvided.innerRef} {...dropProvided.droppableProps} >\r\n\r\n {renderDraggableContent(dropSnapshot)}\r\n\r\n {\r\n /* We don't want a placeholder when displaying the 'Drop here' message\r\n Unfortunately, if don't add it, 'react-beautiful-dnd' show an error message in the console.\r\n So I simply make it hidden. See https://github.com/atlassian/react-beautiful-dnd/issues/518 */\r\n }\r\n <div style={containsLayer ? undefined : { display: \"none\" }}>{dropProvided.placeholder}</div>\r\n </div>);\r\n }\r\n\r\n return (\r\n <Droppable\r\n droppableId={droppableId}\r\n renderClone={renderItem}\r\n getContainerForClone={props.getContainerForClone as any}\r\n >\r\n {renderDraggable}\r\n </Droppable>\r\n );\r\n}\r\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
// cSpell:ignore Modeless WMTS
|
|
6
6
|
import { DialogButtonType, SpecialKey } from "@itwin/appui-abstract";
|
|
7
|
-
import {
|
|
7
|
+
import { UiFramework } from "@itwin/appui-react";
|
|
8
8
|
import { Button, Input, LabeledInput, ProgressLinear, Radio } from "@itwin/itwinui-react";
|
|
9
9
|
import { IModelApp, MapLayerSource, MapLayerSourceStatus, NotifyMessageDetails, OutputMessagePriority, } from "@itwin/core-frontend";
|
|
10
10
|
import { Dialog, Icon, useCrossOriginPopup } from "@itwin/core-react";
|
|
@@ -126,7 +126,7 @@ export function MapUrlDialog(props) {
|
|
|
126
126
|
props.onCancelResult();
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
UiFramework.dialogs.modal.close();
|
|
130
130
|
}, [props]);
|
|
131
131
|
const onUsernameChange = React.useCallback((event) => {
|
|
132
132
|
setUserName(event.target.value);
|
|
@@ -295,7 +295,7 @@ export function MapUrlDialog(props) {
|
|
|
295
295
|
const handleOk = React.useCallback(() => {
|
|
296
296
|
const source = createSource();
|
|
297
297
|
if (source === undefined || props.mapLayerSourceToEdit) {
|
|
298
|
-
|
|
298
|
+
UiFramework.dialogs.modal.close();
|
|
299
299
|
onOkResult();
|
|
300
300
|
if (source === undefined) {
|
|
301
301
|
// Close the dialog and inform end user something went wrong.
|
|
@@ -334,13 +334,13 @@ export function MapUrlDialog(props) {
|
|
|
334
334
|
// In theory the modal dialog should always get closed by the parent
|
|
335
335
|
// AttachLayerPanel's 'onOkResult' handler. We close it here just in case.
|
|
336
336
|
if (closeDialog) {
|
|
337
|
-
|
|
337
|
+
UiFramework.dialogs.modal.close();
|
|
338
338
|
onOkResult();
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
catch (_error) {
|
|
342
342
|
onOkResult();
|
|
343
|
-
|
|
343
|
+
UiFramework.dialogs.modal.close();
|
|
344
344
|
}
|
|
345
345
|
})();
|
|
346
346
|
}, [createSource, props.mapLayerSourceToEdit, props.activeViewport, onOkResult, mapUrl, isSettingsStorageAvailable, attemptAttachSource]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapUrlDialog.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapUrlDialog.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,8BAA8B;AAE9B,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE1F,OAAO,EAAE,SAAS,EAAwB,cAAc,EACtD,oBAAoB,EAA4B,oBAAoB,EAAE,qBAAqB,GAC5F,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,KAAK,MAAM,OAAO,CA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AiB,EAAC,KAAK,EAAC,OAAO,EACpC,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,KAAK,OAAO,EAC/D,QAAQ,EAAE,aAAa,GAAI,CACzB,CACF,CACF,CACF;YAGL,oBAAoB,EAAE;YAGtB,CAAC,kBAAkB,IAAI,gBAAgB,CAAC;gBACvC,6BAAK,SAAS,EAAC,8BAA8B;oBAC3C,oBAAC,cAAc,IAAC,aAAa,SAAG,CAC5B,CAED,CACJ,CACR,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// cSpell:ignore Modeless WMTS\r\n\r\nimport { DialogButtonType, SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { ModalDialogManager } from \"@itwin/appui-react\";\r\nimport { Button, Input, LabeledInput, ProgressLinear, Radio } from \"@itwin/itwinui-react\";\r\nimport { ImageMapLayerProps } from \"@itwin/core-common\";\r\nimport { IModelApp, MapLayerAccessClient, MapLayerSource,\r\n MapLayerSourceStatus, MapLayerSourceValidation, NotifyMessageDetails, OutputMessagePriority, ScreenViewport,\r\n} from \"@itwin/core-frontend\";\r\nimport { Dialog, Icon, useCrossOriginPopup } from \"@itwin/core-react\";\r\nimport * as React from \"react\";\r\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { MapTypesOptions } from \"../Interfaces\";\r\nimport \"./MapUrlDialog.scss\";\r\nimport { BeEvent, Guid } from \"@itwin/core-bentley\";\r\nimport { SelectMapFormat } from \"./SelectMapFormat\";\r\n\r\nexport const MAP_TYPES = {\r\n wms: \"WMS\",\r\n arcGis: \"ArcGIS\",\r\n wmts: \"WMTS\",\r\n tileUrl: \"TileURL\",\r\n arcGisFeature: \"ArcGISFeature\",\r\n};\r\n\r\ninterface MapUrlDialogProps {\r\n activeViewport?: ScreenViewport;\r\n isOverlay: boolean;\r\n onOkResult: () => void;\r\n onCancelResult?: () => void;\r\n mapTypesOptions?: MapTypesOptions;\r\n\r\n // An optional layer definition can be provide to enable the edit mode\r\n layerRequiringCredentials?: ImageMapLayerProps;\r\n\r\n mapLayerSourceToEdit?: MapLayerSource;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapUrlDialog(props: MapUrlDialogProps) {\r\n const { isOverlay, onOkResult, mapTypesOptions } = props;\r\n\r\n const getMapUrlFromProps = React.useCallback(() => {\r\n if (props.mapLayerSourceToEdit) {\r\n return props.mapLayerSourceToEdit.url;\r\n } else if (props.layerRequiringCredentials?.url) {\r\n return props.layerRequiringCredentials.url;\r\n }\r\n return \"\";\r\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\r\n\r\n const getMapNameFromProps = React.useCallback(() => {\r\n if (props.mapLayerSourceToEdit) {\r\n return props.mapLayerSourceToEdit.name;\r\n } else if (props.layerRequiringCredentials?.name) {\r\n return props.layerRequiringCredentials.name;\r\n }\r\n return \"\";\r\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\r\n\r\n const getFormatFromProps = React.useCallback(() => {\r\n if (props.mapLayerSourceToEdit) {\r\n return props.mapLayerSourceToEdit.formatId;\r\n } else if (props.layerRequiringCredentials?.formatId) {\r\n return props.layerRequiringCredentials.formatId;\r\n }\r\n return undefined;\r\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\r\n\r\n const [dialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(props.layerRequiringCredentials || props.mapLayerSourceToEdit ? \"mapLayers:CustomAttach.EditCustomLayer\" : \"mapLayers:CustomAttach.AttachCustomLayer\"));\r\n const [typeLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Type\"));\r\n const [nameLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Name\"));\r\n const [nameInputPlaceHolder] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.NameInputPlaceHolder\"));\r\n const [urlLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.URL\"));\r\n const [urlInputPlaceHolder] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.UrlInputPlaceHolder\"));\r\n const [iTwinSettingsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.StoreOnITwinSettings\"));\r\n const [modelSettingsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.StoreOnModelSettings\"));\r\n const [missingCredentialsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.MissingCredentials\"));\r\n const [invalidCredentialsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.InvalidCredentials\"));\r\n const [externalLoginTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLogin\"));\r\n const [externalLoginFailedMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginFailed\"));\r\n const [externalLoginSucceededMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginSucceeded\"));\r\n const [externalLoginWaitingMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginWaiting\"));\r\n const [externalLoginTryAgainLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginTryAgain\"));\r\n const [serverRequireCredentials, setServerRequireCredentials] = React.useState(false);\r\n const [invalidCredentialsProvided, setInvalidCredentialsProvided] = React.useState(false);\r\n const [layerAttachPending, setLayerAttachPending] = React.useState(false);\r\n const [layerAuthPending, setLayerAuthPending] = React.useState(false);\r\n const [mapUrl, setMapUrl] = React.useState(getMapUrlFromProps());\r\n const [mapName, setMapName] = React.useState(getMapNameFromProps());\r\n const [userName, setUserName] = React.useState(\"\");\r\n const [password, setPassword] = React.useState(\"\");\r\n const [noSaveSettingsWarning] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.NoSaveSettingsWarning\"));\r\n const [passwordLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.Password\"));\r\n const [passwordRequiredLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.PasswordRequired\"));\r\n const [userNameLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.Username\"));\r\n const [userNameRequiredLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.UsernameRequired\"));\r\n const [settingsStorage, setSettingsStorageRadio] = React.useState(\"iTwin\");\r\n const [oauthProcessSucceeded, setOAuthProcessSucceeded] = React.useState<undefined|boolean>(undefined);\r\n const [showOauthPopup, setShowOauthPopup] = React.useState(false);\r\n const [externalLoginUrl, setExternalLoginUrl] = React.useState<string|undefined>();\r\n const [onOauthProcessEnd] = React.useState(new BeEvent());\r\n const [accessClient, setAccessClient] = React.useState<MapLayerAccessClient | undefined>();\r\n const [isAccessClientInitialized, setAccessClientInitialized] = React.useState(false);\r\n\r\n const [mapType, setMapType] = React.useState(getFormatFromProps() ?? \"ArcGIS\");\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n }, []);\r\n\r\n const [isSettingsStorageAvailable] = React.useState(MapLayersUI.iTwinConfig && props?.activeViewport?.iModel?.iTwinId);\r\n const [hasImodelContext] = React.useState (\r\n props?.activeViewport?.iModel?.iTwinId !== undefined\r\n && props.activeViewport.iModel.iTwinId !== Guid.empty\r\n && props?.activeViewport?.iModel?.iModelId !== undefined\r\n && props?.activeViewport.iModel.iModelId !== Guid.empty);\r\n\r\n // Even though the settings storage is available,\r\n // we don't always want to enable it in the UI.\r\n const [settingsStorageDisabled] = React.useState(!isSettingsStorageAvailable || props.mapLayerSourceToEdit !== undefined || props.layerRequiringCredentials !== undefined);\r\n\r\n const [layerRequiringCredentialsIdx] = React.useState((): number | undefined => {\r\n if (props.layerRequiringCredentials === undefined || !props.layerRequiringCredentials.name || !props.layerRequiringCredentials.url) {\r\n return undefined;\r\n }\r\n\r\n const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(props.layerRequiringCredentials.name, props.layerRequiringCredentials.url, isOverlay);\r\n if (indexInDisplayStyle === undefined || indexInDisplayStyle < 0) {\r\n return undefined;\r\n } else {\r\n return indexInDisplayStyle;\r\n }\r\n });\r\n\r\n const handleCancel = React.useCallback(() => {\r\n if (props.onCancelResult) {\r\n props.onCancelResult();\r\n return;\r\n }\r\n ModalDialogManager.closeDialog();\r\n }, [props]);\r\n\r\n const onUsernameChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setUserName(event.target.value);\r\n if (invalidCredentialsProvided)\r\n setInvalidCredentialsProvided(false);\r\n }, [setUserName, invalidCredentialsProvided, setInvalidCredentialsProvided]);\r\n\r\n const onPasswordChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setPassword(event.target.value);\r\n if (invalidCredentialsProvided)\r\n setInvalidCredentialsProvided(false);\r\n }, [setPassword, invalidCredentialsProvided, setInvalidCredentialsProvided]);\r\n\r\n const handleArcGisLogin = React.useCallback(() => {\r\n setLayerAuthPending(true);\r\n setShowOauthPopup(true);\r\n if (oauthProcessSucceeded === false) {\r\n setOAuthProcessSucceeded(undefined);\r\n }\r\n\r\n }, [oauthProcessSucceeded]);\r\n\r\n // return true if authorization is needed\r\n const updateAuthState = React.useCallback(async (source: MapLayerSource, sourceValidation: MapLayerSourceValidation) => {\r\n const sourceRequireAuth = (sourceValidation.status === MapLayerSourceStatus.RequireAuth);\r\n const invalidCredentials = (sourceValidation.status === MapLayerSourceStatus.InvalidCredentials);\r\n if (sourceRequireAuth) {\r\n const settings = source.toLayerSettings();\r\n\r\n if (accessClient !== undefined && accessClient.getTokenServiceEndPoint !== undefined && settings !== undefined) {\r\n try {\r\n const tokenEndpoint = await accessClient.getTokenServiceEndPoint(settings.url);\r\n if (tokenEndpoint !== undefined) {\r\n const loginUrl = tokenEndpoint.getLoginUrl();\r\n setExternalLoginUrl(loginUrl);\r\n }\r\n\r\n } catch (_error){\r\n\r\n }\r\n }\r\n\r\n }\r\n setServerRequireCredentials(sourceRequireAuth || invalidCredentials);\r\n if (invalidCredentials) {\r\n setInvalidCredentialsProvided(true);\r\n } else if (invalidCredentialsProvided) {\r\n setInvalidCredentialsProvided(false); // flag reset\r\n }\r\n\r\n return sourceRequireAuth || invalidCredentials;\r\n }, [accessClient, invalidCredentialsProvided]);\r\n\r\n const updateAttachedLayer = React.useCallback(async (source: MapLayerSource, validation: MapLayerSourceValidation) => {\r\n const vp = props?.activeViewport;\r\n if (vp === undefined || source === undefined || layerRequiringCredentialsIdx === undefined) {\r\n const error = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachMissingViewOrSource\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n }\r\n\r\n // Layer is already attached,\r\n vp.displayStyle.changeMapLayerProps({\r\n subLayers: validation.subLayers,\r\n }, layerRequiringCredentialsIdx, isOverlay);\r\n vp.displayStyle.changeMapLayerCredentials(layerRequiringCredentialsIdx, isOverlay, source.userName, source.password);\r\n\r\n // Either initial attach/initialize failed or the layer failed to load at least one tile\r\n // because of an invalid token; in both cases tile tree needs to be fully reset\r\n const provider = vp.getMapLayerImageryProvider(layerRequiringCredentialsIdx, isOverlay);\r\n provider?.resetStatus();\r\n vp.resetMapLayer(layerRequiringCredentialsIdx, isOverlay);\r\n vp.invalidateRenderPlan();\r\n\r\n // This handler will close the layer source handler, and therefore the MapUrl dialog.\r\n // don't call it if the dialog needs to remains open.\r\n onOkResult();\r\n\r\n return true;\r\n }, [isOverlay, layerRequiringCredentialsIdx, onOkResult, props.activeViewport]);\r\n\r\n // Returns true if no further input is needed from end-user.\r\n const doAttach = React.useCallback(async (source: MapLayerSource, validation: MapLayerSourceValidation): Promise<boolean> => {\r\n const vp = props?.activeViewport;\r\n if (vp === undefined || source === undefined) {\r\n const error = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachMissingViewOrSource\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n }\r\n\r\n // Update service settings if storage is available and we are not prompting user for credentials\r\n if (!settingsStorageDisabled && !props.layerRequiringCredentials) {\r\n \tconst storeOnIModel = (hasImodelContext ? \"Model\" === settingsStorage : undefined);\r\n if (vp.iModel.iTwinId && !(await MapLayerPreferences.storeSource(source, vp.iModel.iTwinId, vp.iModel.iModelId, storeOnIModel))) {\r\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerPreferencesStoreFailed\");\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msgError));\r\n\t }\r\n }\r\n const settings = source.toLayerSettings(validation.subLayers);\r\n if (settings) {\r\n vp.displayStyle.attachMapLayer({settings, isOverlay});\r\n\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: source.name, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n } else {\r\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerLayerSettingsConversionError\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.MapLayerAttachError\", { error: msgError, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n\r\n vp.invalidateRenderPlan();\r\n\r\n // This handler will close the layer source handler, and therefore the MapUrl dialog.\r\n // don't call it if the dialog needs to remains open.\r\n onOkResult();\r\n\r\n return true;\r\n }, [hasImodelContext, isOverlay, onOkResult, props?.activeViewport, props.layerRequiringCredentials, settingsStorage, settingsStorageDisabled]);\r\n\r\n // Validate the layer source and attempt to attach (or update) the layer.\r\n // Returns true if no further input is needed from end-user (i.e. close the dialog)\r\n const attemptAttachSource = React.useCallback(async (source: MapLayerSource): Promise<boolean> => {\r\n try {\r\n const validation = await source.validateSource(true);\r\n\r\n if (validation.status === MapLayerSourceStatus.Valid) {\r\n if (layerRequiringCredentialsIdx === undefined ) {\r\n return await doAttach(source, validation);\r\n } else {\r\n return await updateAttachedLayer(source, validation);\r\n }\r\n } else if (validation.status === MapLayerSourceStatus.InvalidCoordinateSystem){\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.InvalidCoordinateSystem\");\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n } else {\r\n const authNeeded = await updateAuthState(source, validation);\r\n if (authNeeded) {\r\n return false;\r\n } else {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ValidationError\");\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, `${msg} ${source.url}`));\r\n return true;\r\n }\r\n }\r\n return false;\r\n } catch (error) {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n }\r\n\r\n }, [updateAuthState, doAttach, layerRequiringCredentialsIdx, updateAttachedLayer]);\r\n\r\n const onNameChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setMapName(event.target.value);\r\n }, [setMapName]);\r\n\r\n const onRadioChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setSettingsStorageRadio(event.target.value);\r\n }, [setSettingsStorageRadio]);\r\n\r\n const onUrlChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setMapUrl(event.target.value);\r\n }, [setMapUrl]);\r\n\r\n const createSource = React.useCallback(() => {\r\n let source: MapLayerSource | undefined;\r\n if (mapUrl && mapName) {\r\n source = MapLayerSource.fromJSON({\r\n url: mapUrl,\r\n name: mapName,\r\n formatId: mapType});\r\n\r\n // Set credentials separately since they are not part of JSON\r\n if (source) {\r\n source.userName = userName||undefined; // When there is no value, empty string is always returned, in this case force it to undefined,\r\n source.password = password||undefined;\r\n }\r\n\r\n }\r\n return source;\r\n }, [mapName, mapType, mapUrl, password, userName]);\r\n\r\n const handleOk = React.useCallback(() => {\r\n const source = createSource();\r\n if (source === undefined || props.mapLayerSourceToEdit) {\r\n\r\n ModalDialogManager.closeDialog();\r\n onOkResult();\r\n\r\n if (source === undefined) {\r\n // Close the dialog and inform end user something went wrong.\r\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerLayerSourceCreationFailed\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: msgError, sourceUrl: mapUrl });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return;\r\n }\r\n\r\n // Simply change the source definition in the setting service\r\n if (props.mapLayerSourceToEdit !== undefined) {\r\n const vp = props.activeViewport;\r\n void (async () => {\r\n if (isSettingsStorageAvailable && vp?.iModel?.iTwinId) {\r\n try {\r\n await MapLayerPreferences.replaceSource(props.mapLayerSourceToEdit!, source, vp.iModel.iTwinId, vp?.iModel.iModelId);\r\n } catch (err: any) {\r\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerEditError\", { layerName: props.mapLayerSourceToEdit?.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\r\n return;\r\n }\r\n }\r\n })();\r\n return;\r\n }\r\n }\r\n\r\n setLayerAttachPending(true);\r\n\r\n // Attach source asynchronously.\r\n void (async () => {\r\n try {\r\n const closeDialog = await attemptAttachSource(source);\r\n if (isMounted.current) {\r\n setLayerAttachPending(false);\r\n }\r\n\r\n // In theory the modal dialog should always get closed by the parent\r\n // AttachLayerPanel's 'onOkResult' handler. We close it here just in case.\r\n if (closeDialog) {\r\n ModalDialogManager.closeDialog();\r\n onOkResult();\r\n }\r\n } catch (_error) {\r\n onOkResult();\r\n ModalDialogManager.closeDialog();\r\n }\r\n })();\r\n\r\n }, [createSource, props.mapLayerSourceToEdit, props.activeViewport, onOkResult, mapUrl, isSettingsStorageAvailable, attemptAttachSource]);\r\n\r\n React.useEffect(() => {\r\n const handleOAuthProcessEnd = (success: boolean, _state: any ) => {\r\n onOauthProcessEnd.raiseEvent(success, _state);\r\n };\r\n\r\n // Currently only arcgis support AccessClient\r\n\r\n const ac = IModelApp.mapLayerFormatRegistry.getAccessClient(MAP_TYPES.arcGis);\r\n if (ac?.onOAuthProcessEnd) {\r\n setAccessClient(ac); // cache it, so we dont need to make another lookup;\r\n ac.onOAuthProcessEnd.addListener(handleOAuthProcessEnd);\r\n }\r\n setAccessClientInitialized(true);\r\n return () => {\r\n if (ac?.onOAuthProcessEnd) {\r\n ac.onOAuthProcessEnd.removeListener(handleOAuthProcessEnd);\r\n }\r\n\r\n setAccessClient(undefined);\r\n setAccessClientInitialized(false);\r\n };\r\n }, [mapType, onOauthProcessEnd, setAccessClient]);\r\n\r\n // After a map type change, make sure the different Oauth states are reset.\r\n React.useEffect(() => {\r\n // Reset few states\r\n setServerRequireCredentials(false);\r\n setInvalidCredentialsProvided(false);\r\n setShowOauthPopup(false);\r\n setOAuthProcessSucceeded(undefined);\r\n setExternalLoginUrl(undefined);\r\n\r\n }, [mapType]);\r\n\r\n // The first time the dialog is loaded and we already know the layer requires auth. (i.e ImageryProvider already made an attempt)\r\n // makes a request to discover the authentification types and adjust UI accordingly (i.e. username/password fields, Oauth popup)\r\n // Without this effect, user would have to manually click the 'OK' button in order to trigger the layer connection.\r\n React.useEffect(() => {\r\n // Attach source asynchronously.\r\n void (async () => {\r\n if (isAccessClientInitialized && props.layerRequiringCredentials?.url !== undefined && props.layerRequiringCredentials?.name !== undefined) {\r\n try {\r\n const source = MapLayerSource.fromJSON({\r\n url: props.layerRequiringCredentials.url,\r\n name: props.layerRequiringCredentials.name,\r\n formatId: props.layerRequiringCredentials.formatId});\r\n\r\n if (source !== undefined) {\r\n setLayerAttachPending(true);\r\n const validation = await source.validateSource(true);\r\n if (isMounted.current) {\r\n setLayerAttachPending(false);\r\n }\r\n await updateAuthState(source, validation);\r\n }\r\n } catch (_error) {}\r\n }\r\n })();\r\n\r\n }, [isAccessClientInitialized,\r\n props.layerRequiringCredentials?.formatId,\r\n props.layerRequiringCredentials?.name,\r\n props.layerRequiringCredentials?.url,\r\n updateAuthState]);\r\n\r\n const dialogContainer = React.useRef<HTMLDivElement>(null);\r\n\r\n const readyToSave = React.useCallback(() => {\r\n const credentialsSet = !!userName && !!password;\r\n return (!!mapUrl && !!mapName)\r\n && !layerAttachPending\r\n && (!serverRequireCredentials || credentialsSet)\r\n && !invalidCredentialsProvided\r\n && (externalLoginUrl === undefined || (externalLoginUrl !== undefined && oauthProcessSucceeded));\r\n }, [userName, password, mapUrl, mapName, serverRequireCredentials, layerAttachPending, invalidCredentialsProvided, externalLoginUrl, oauthProcessSucceeded]);\r\n\r\n const buttonCluster = React.useMemo(() => [\r\n { type: DialogButtonType.OK, onClick: handleOk, disabled: !readyToSave() },\r\n { type: DialogButtonType.Cancel, onClick: handleCancel },\r\n ], [readyToSave, handleCancel, handleOk]);\r\n\r\n const handleOnKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\r\n if (event.key === SpecialKey.Enter) {\r\n if (readyToSave())\r\n handleOk();\r\n }\r\n }, [handleOk, readyToSave]);\r\n\r\n // onOauthProcessEnd events handler\r\n React.useEffect(() => {\r\n const handleOauthProcess = (success: boolean, _state: any ) => {\r\n setLayerAuthPending(false);\r\n if (success) {\r\n setOAuthProcessSucceeded(true);\r\n setShowOauthPopup(false);\r\n setLayerAttachPending(false);\r\n handleOk(); // Add the layer the same way the user would do by clicking 'ok'\r\n } else {\r\n setShowOauthPopup(false);\r\n setLayerAttachPending(false);\r\n setOAuthProcessSucceeded(false);\r\n }\r\n };\r\n\r\n onOauthProcessEnd.addListener(handleOauthProcess);\r\n return () => {\r\n onOauthProcessEnd.removeListener(handleOauthProcess);\r\n };\r\n }, [handleOk, onOauthProcessEnd]);\r\n\r\n //\r\n // Monitors authentication method changes\r\n React.useEffect(() => {\r\n\r\n if (serverRequireCredentials && oauthProcessSucceeded === undefined && externalLoginUrl !== undefined) {\r\n handleArcGisLogin();\r\n }\r\n }, [oauthProcessSucceeded, externalLoginUrl, handleArcGisLogin, serverRequireCredentials]);\r\n\r\n // Monitors Oauth2 popup was closed\r\n const handleOAuthPopupClose = React.useCallback(() => {\r\n setShowOauthPopup(false);\r\n setLayerAuthPending(false);\r\n if (oauthProcessSucceeded === undefined)\r\n setOAuthProcessSucceeded(false); // indicates there was a failed attempt\r\n }, [oauthProcessSucceeded]);\r\n\r\n // Utility function to get warning message section\r\n function renderWarningMessage(): React.ReactNode {\r\n let node: React.ReactNode;\r\n let warningMessage: string|undefined;\r\n\r\n // Get the proper warning message\r\n if (showOauthPopup) {\r\n warningMessage = externalLoginWaitingMsg;\r\n } else if (oauthProcessSucceeded === false) {\r\n warningMessage = externalLoginFailedMsg;\r\n } else if (oauthProcessSucceeded === true) {\r\n warningMessage = externalLoginSucceededMsg;\r\n }else if (invalidCredentialsProvided) {\r\n warningMessage = invalidCredentialsLabel;\r\n } else if (serverRequireCredentials && (!userName || !password)) {\r\n warningMessage = missingCredentialsLabel;\r\n }\r\n\r\n // Sometimes we want to add an extra node, such as a button\r\n let extraNode: React.ReactNode;\r\n if (oauthProcessSucceeded === false) {\r\n extraNode = <div>\r\n <Button onClick={handleArcGisLogin}>{externalLoginTryAgainLabel}</Button>\r\n </div>;\r\n }\r\n\r\n if (warningMessage !== undefined) {\r\n return(\r\n <div className=\"map-layer-source-warnMessage\">\r\n <Icon className=\"map-layer-source-warnMessage-icon\" iconSpec=\"icon-status-warning\" />\r\n <span className=\"map-layer-source-warnMessage-label\">{warningMessage}</span >\r\n {extraNode}\r\n </div>);\r\n } else {\r\n return (<span className=\"map-layer-source-placeholder\"> </span>);\r\n }\r\n return node;\r\n }\r\n\r\n // Use a hook to display the popup.\r\n // The display of the popup is controlled by the 'showOauthPopup' state variable.\r\n useCrossOriginPopup(showOauthPopup, externalLoginUrl, externalLoginTitle, 450, 450, handleOAuthPopupClose);\r\n return (\r\n <div ref={dialogContainer}>\r\n <Dialog\r\n className=\"map-layer-url-dialog\"\r\n title={dialogTitle}\r\n opened={true}\r\n resizable={true}\r\n movable={true}\r\n modal={true}\r\n buttonCluster={buttonCluster}\r\n onClose={handleCancel}\r\n onEscape={handleCancel}\r\n minHeight={120}\r\n maxWidth={600}\r\n titleStyle={{paddingLeft: \"10px\"}}\r\n footerStyle={{paddingBottom: \"10px\", paddingRight: \"10px\"}}\r\n trapFocus={false}\r\n >\r\n <div className=\"map-layer-url-dialog-content\">\r\n <div className=\"map-layer-source-url\">\r\n <span className=\"map-layer-source-label\">{typeLabel}</span>\r\n <SelectMapFormat\r\n value={mapType}\r\n disabled={props.layerRequiringCredentials !== undefined || props.mapLayerSourceToEdit !== undefined || layerAttachPending || layerAuthPending}\r\n onChange={setMapType}\r\n mapTypesOptions={mapTypesOptions}\r\n />\r\n <span className=\"map-layer-source-label\">{nameLabel}</span>\r\n <Input className=\"map-layer-source-input\" placeholder={nameInputPlaceHolder} onChange={onNameChange} value={mapName} disabled={props.layerRequiringCredentials !== undefined || layerAttachPending || layerAuthPending} />\r\n <span className=\"map-layer-source-label\">{urlLabel}</span>\r\n <Input className=\"map-layer-source-input\" placeholder={urlInputPlaceHolder} onKeyPress={handleOnKeyDown} onChange={onUrlChange} disabled={props.mapLayerSourceToEdit !== undefined || layerAttachPending || layerAuthPending} value={mapUrl} />\r\n {serverRequireCredentials\r\n && externalLoginUrl === undefined // external login is handled in popup\r\n && props.mapLayerSourceToEdit === undefined &&\r\n <>\r\n <span className=\"map-layer-source-label\">{userNameLabel}</span>\r\n <LabeledInput className=\"map-layer-source-input\"\r\n displayStyle=\"inline\"\r\n placeholder={serverRequireCredentials ? userNameRequiredLabel : userNameLabel}\r\n status={(!userName && serverRequireCredentials) || invalidCredentialsProvided ? \"warning\" : undefined}\r\n disabled={layerAttachPending || layerAuthPending}\r\n onChange={onUsernameChange}\r\n value={userName}\r\n size=\"small\" />\r\n\r\n <span className=\"map-layer-source-label\">{passwordLabel}</span>\r\n <LabeledInput className=\"map-layer-source-input\"\r\n\r\n displayStyle=\"inline\"\r\n type=\"password\" placeholder={serverRequireCredentials ? passwordRequiredLabel : passwordLabel}\r\n status={(!password && serverRequireCredentials) || invalidCredentialsProvided? \"warning\" : undefined}\r\n disabled={layerAttachPending || layerAuthPending}\r\n onChange={onPasswordChange}\r\n onKeyPress={handleOnKeyDown}\r\n value={password}\r\n size=\"small\" />\r\n\r\n </>\r\n }\r\n\r\n {/* Store settings options, not shown when editing a layer */}\r\n {isSettingsStorageAvailable &&\r\n <div title={settingsStorageDisabled ? noSaveSettingsWarning : \"\"}>\r\n {hasImodelContext &&\r\n <div>\r\n <Radio disabled={settingsStorageDisabled}\r\n name=\"settingsStorage\" value=\"iTwin\"\r\n label={iTwinSettingsLabel} checked={settingsStorage === \"iTwin\"}\r\n onChange={onRadioChange} />\r\n <Radio disabled={settingsStorageDisabled}\r\n name=\"settingsStorage\" value=\"Model\"\r\n label={modelSettingsLabel} checked={settingsStorage === \"Model\"}\r\n onChange={onRadioChange} />\r\n </div> }\r\n </div>}\r\n </div>\r\n </div>\r\n\r\n {/* Warning message */}\r\n {renderWarningMessage()}\r\n\r\n {/* Progress bar */}\r\n {(layerAttachPending || layerAuthPending) &&\r\n <div className=\"map-layer-source-progressBar\">\r\n <ProgressLinear indeterminate />\r\n </div>\r\n }\r\n </Dialog>\r\n </div >\r\n );\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"MapUrlDialog.js","sourceRoot":"","sources":["../../../../src/ui/widget/MapUrlDialog.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,8BAA8B;AAE9B,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE1F,OAAO,EAAE,SAAS,EAAwB,cAAc,EACtD,oBAAoB,EAA4B,oBAAoB,EAAE,qBAAqB,GAC5F,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM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Aa,SAAG,CAC5B,CAED,CACJ,CACR,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n// cSpell:ignore Modeless WMTS\r\n\r\nimport { DialogButtonType, SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { UiFramework } from \"@itwin/appui-react\";\r\nimport { Button, Input, LabeledInput, ProgressLinear, Radio } from \"@itwin/itwinui-react\";\r\nimport { ImageMapLayerProps } from \"@itwin/core-common\";\r\nimport { IModelApp, MapLayerAccessClient, MapLayerSource,\r\n MapLayerSourceStatus, MapLayerSourceValidation, NotifyMessageDetails, OutputMessagePriority, ScreenViewport,\r\n} from \"@itwin/core-frontend\";\r\nimport { Dialog, Icon, useCrossOriginPopup } from \"@itwin/core-react\";\r\nimport * as React from \"react\";\r\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { MapTypesOptions } from \"../Interfaces\";\r\nimport \"./MapUrlDialog.scss\";\r\nimport { BeEvent, Guid } from \"@itwin/core-bentley\";\r\nimport { SelectMapFormat } from \"./SelectMapFormat\";\r\n\r\nexport const MAP_TYPES = {\r\n wms: \"WMS\",\r\n arcGis: \"ArcGIS\",\r\n wmts: \"WMTS\",\r\n tileUrl: \"TileURL\",\r\n arcGisFeature: \"ArcGISFeature\",\r\n};\r\n\r\ninterface MapUrlDialogProps {\r\n activeViewport?: ScreenViewport;\r\n isOverlay: boolean;\r\n onOkResult: () => void;\r\n onCancelResult?: () => void;\r\n mapTypesOptions?: MapTypesOptions;\r\n\r\n // An optional layer definition can be provide to enable the edit mode\r\n layerRequiringCredentials?: ImageMapLayerProps;\r\n\r\n mapLayerSourceToEdit?: MapLayerSource;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function MapUrlDialog(props: MapUrlDialogProps) {\r\n const { isOverlay, onOkResult, mapTypesOptions } = props;\r\n\r\n const getMapUrlFromProps = React.useCallback(() => {\r\n if (props.mapLayerSourceToEdit) {\r\n return props.mapLayerSourceToEdit.url;\r\n } else if (props.layerRequiringCredentials?.url) {\r\n return props.layerRequiringCredentials.url;\r\n }\r\n return \"\";\r\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\r\n\r\n const getMapNameFromProps = React.useCallback(() => {\r\n if (props.mapLayerSourceToEdit) {\r\n return props.mapLayerSourceToEdit.name;\r\n } else if (props.layerRequiringCredentials?.name) {\r\n return props.layerRequiringCredentials.name;\r\n }\r\n return \"\";\r\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\r\n\r\n const getFormatFromProps = React.useCallback(() => {\r\n if (props.mapLayerSourceToEdit) {\r\n return props.mapLayerSourceToEdit.formatId;\r\n } else if (props.layerRequiringCredentials?.formatId) {\r\n return props.layerRequiringCredentials.formatId;\r\n }\r\n return undefined;\r\n }, [props.layerRequiringCredentials, props.mapLayerSourceToEdit]);\r\n\r\n const [dialogTitle] = React.useState(MapLayersUI.localization.getLocalizedString(props.layerRequiringCredentials || props.mapLayerSourceToEdit ? \"mapLayers:CustomAttach.EditCustomLayer\" : \"mapLayers:CustomAttach.AttachCustomLayer\"));\r\n const [typeLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Type\"));\r\n const [nameLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Name\"));\r\n const [nameInputPlaceHolder] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.NameInputPlaceHolder\"));\r\n const [urlLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.URL\"));\r\n const [urlInputPlaceHolder] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.UrlInputPlaceHolder\"));\r\n const [iTwinSettingsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.StoreOnITwinSettings\"));\r\n const [modelSettingsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.StoreOnModelSettings\"));\r\n const [missingCredentialsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.MissingCredentials\"));\r\n const [invalidCredentialsLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.InvalidCredentials\"));\r\n const [externalLoginTitle] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLogin\"));\r\n const [externalLoginFailedMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginFailed\"));\r\n const [externalLoginSucceededMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginSucceeded\"));\r\n const [externalLoginWaitingMsg] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginWaiting\"));\r\n const [externalLoginTryAgainLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ExternalLoginTryAgain\"));\r\n const [serverRequireCredentials, setServerRequireCredentials] = React.useState(false);\r\n const [invalidCredentialsProvided, setInvalidCredentialsProvided] = React.useState(false);\r\n const [layerAttachPending, setLayerAttachPending] = React.useState(false);\r\n const [layerAuthPending, setLayerAuthPending] = React.useState(false);\r\n const [mapUrl, setMapUrl] = React.useState(getMapUrlFromProps());\r\n const [mapName, setMapName] = React.useState(getMapNameFromProps());\r\n const [userName, setUserName] = React.useState(\"\");\r\n const [password, setPassword] = React.useState(\"\");\r\n const [noSaveSettingsWarning] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.NoSaveSettingsWarning\"));\r\n const [passwordLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.Password\"));\r\n const [passwordRequiredLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.PasswordRequired\"));\r\n const [userNameLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.Username\"));\r\n const [userNameRequiredLabel] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:AuthenticationInputs.UsernameRequired\"));\r\n const [settingsStorage, setSettingsStorageRadio] = React.useState(\"iTwin\");\r\n const [oauthProcessSucceeded, setOAuthProcessSucceeded] = React.useState<undefined|boolean>(undefined);\r\n const [showOauthPopup, setShowOauthPopup] = React.useState(false);\r\n const [externalLoginUrl, setExternalLoginUrl] = React.useState<string|undefined>();\r\n const [onOauthProcessEnd] = React.useState(new BeEvent());\r\n const [accessClient, setAccessClient] = React.useState<MapLayerAccessClient | undefined>();\r\n const [isAccessClientInitialized, setAccessClientInitialized] = React.useState(false);\r\n\r\n const [mapType, setMapType] = React.useState(getFormatFromProps() ?? \"ArcGIS\");\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n }, []);\r\n\r\n const [isSettingsStorageAvailable] = React.useState(MapLayersUI.iTwinConfig && props?.activeViewport?.iModel?.iTwinId);\r\n const [hasImodelContext] = React.useState (\r\n props?.activeViewport?.iModel?.iTwinId !== undefined\r\n && props.activeViewport.iModel.iTwinId !== Guid.empty\r\n && props?.activeViewport?.iModel?.iModelId !== undefined\r\n && props?.activeViewport.iModel.iModelId !== Guid.empty);\r\n\r\n // Even though the settings storage is available,\r\n // we don't always want to enable it in the UI.\r\n const [settingsStorageDisabled] = React.useState(!isSettingsStorageAvailable || props.mapLayerSourceToEdit !== undefined || props.layerRequiringCredentials !== undefined);\r\n\r\n const [layerRequiringCredentialsIdx] = React.useState((): number | undefined => {\r\n if (props.layerRequiringCredentials === undefined || !props.layerRequiringCredentials.name || !props.layerRequiringCredentials.url) {\r\n return undefined;\r\n }\r\n\r\n const indexInDisplayStyle = props.activeViewport?.displayStyle.findMapLayerIndexByNameAndSource(props.layerRequiringCredentials.name, props.layerRequiringCredentials.url, isOverlay);\r\n if (indexInDisplayStyle === undefined || indexInDisplayStyle < 0) {\r\n return undefined;\r\n } else {\r\n return indexInDisplayStyle;\r\n }\r\n });\r\n\r\n const handleCancel = React.useCallback(() => {\r\n if (props.onCancelResult) {\r\n props.onCancelResult();\r\n return;\r\n }\r\n UiFramework.dialogs.modal.close();\r\n }, [props]);\r\n\r\n const onUsernameChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setUserName(event.target.value);\r\n if (invalidCredentialsProvided)\r\n setInvalidCredentialsProvided(false);\r\n }, [setUserName, invalidCredentialsProvided, setInvalidCredentialsProvided]);\r\n\r\n const onPasswordChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setPassword(event.target.value);\r\n if (invalidCredentialsProvided)\r\n setInvalidCredentialsProvided(false);\r\n }, [setPassword, invalidCredentialsProvided, setInvalidCredentialsProvided]);\r\n\r\n const handleArcGisLogin = React.useCallback(() => {\r\n setLayerAuthPending(true);\r\n setShowOauthPopup(true);\r\n if (oauthProcessSucceeded === false) {\r\n setOAuthProcessSucceeded(undefined);\r\n }\r\n\r\n }, [oauthProcessSucceeded]);\r\n\r\n // return true if authorization is needed\r\n const updateAuthState = React.useCallback(async (source: MapLayerSource, sourceValidation: MapLayerSourceValidation) => {\r\n const sourceRequireAuth = (sourceValidation.status === MapLayerSourceStatus.RequireAuth);\r\n const invalidCredentials = (sourceValidation.status === MapLayerSourceStatus.InvalidCredentials);\r\n if (sourceRequireAuth) {\r\n const settings = source.toLayerSettings();\r\n\r\n if (accessClient !== undefined && accessClient.getTokenServiceEndPoint !== undefined && settings !== undefined) {\r\n try {\r\n const tokenEndpoint = await accessClient.getTokenServiceEndPoint(settings.url);\r\n if (tokenEndpoint !== undefined) {\r\n const loginUrl = tokenEndpoint.getLoginUrl();\r\n setExternalLoginUrl(loginUrl);\r\n }\r\n\r\n } catch (_error){\r\n\r\n }\r\n }\r\n\r\n }\r\n setServerRequireCredentials(sourceRequireAuth || invalidCredentials);\r\n if (invalidCredentials) {\r\n setInvalidCredentialsProvided(true);\r\n } else if (invalidCredentialsProvided) {\r\n setInvalidCredentialsProvided(false); // flag reset\r\n }\r\n\r\n return sourceRequireAuth || invalidCredentials;\r\n }, [accessClient, invalidCredentialsProvided]);\r\n\r\n const updateAttachedLayer = React.useCallback(async (source: MapLayerSource, validation: MapLayerSourceValidation) => {\r\n const vp = props?.activeViewport;\r\n if (vp === undefined || source === undefined || layerRequiringCredentialsIdx === undefined) {\r\n const error = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachMissingViewOrSource\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n }\r\n\r\n // Layer is already attached,\r\n vp.displayStyle.changeMapLayerProps({\r\n subLayers: validation.subLayers,\r\n }, layerRequiringCredentialsIdx, isOverlay);\r\n vp.displayStyle.changeMapLayerCredentials(layerRequiringCredentialsIdx, isOverlay, source.userName, source.password);\r\n\r\n // Either initial attach/initialize failed or the layer failed to load at least one tile\r\n // because of an invalid token; in both cases tile tree needs to be fully reset\r\n const provider = vp.getMapLayerImageryProvider(layerRequiringCredentialsIdx, isOverlay);\r\n provider?.resetStatus();\r\n vp.resetMapLayer(layerRequiringCredentialsIdx, isOverlay);\r\n vp.invalidateRenderPlan();\r\n\r\n // This handler will close the layer source handler, and therefore the MapUrl dialog.\r\n // don't call it if the dialog needs to remains open.\r\n onOkResult();\r\n\r\n return true;\r\n }, [isOverlay, layerRequiringCredentialsIdx, onOkResult, props.activeViewport]);\r\n\r\n // Returns true if no further input is needed from end-user.\r\n const doAttach = React.useCallback(async (source: MapLayerSource, validation: MapLayerSourceValidation): Promise<boolean> => {\r\n const vp = props?.activeViewport;\r\n if (vp === undefined || source === undefined) {\r\n const error = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachMissingViewOrSource\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n }\r\n\r\n // Update service settings if storage is available and we are not prompting user for credentials\r\n if (!settingsStorageDisabled && !props.layerRequiringCredentials) {\r\n \tconst storeOnIModel = (hasImodelContext ? \"Model\" === settingsStorage : undefined);\r\n if (vp.iModel.iTwinId && !(await MapLayerPreferences.storeSource(source, vp.iModel.iTwinId, vp.iModel.iModelId, storeOnIModel))) {\r\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerPreferencesStoreFailed\");\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msgError));\r\n\t }\r\n }\r\n const settings = source.toLayerSettings(validation.subLayers);\r\n if (settings) {\r\n vp.displayStyle.attachMapLayer({settings, isOverlay});\r\n\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: source.name, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n } else {\r\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerLayerSettingsConversionError\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.MapLayerAttachError\", { error: msgError, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n\r\n vp.invalidateRenderPlan();\r\n\r\n // This handler will close the layer source handler, and therefore the MapUrl dialog.\r\n // don't call it if the dialog needs to remains open.\r\n onOkResult();\r\n\r\n return true;\r\n }, [hasImodelContext, isOverlay, onOkResult, props?.activeViewport, props.layerRequiringCredentials, settingsStorage, settingsStorageDisabled]);\r\n\r\n // Validate the layer source and attempt to attach (or update) the layer.\r\n // Returns true if no further input is needed from end-user (i.e. close the dialog)\r\n const attemptAttachSource = React.useCallback(async (source: MapLayerSource): Promise<boolean> => {\r\n try {\r\n const validation = await source.validateSource(true);\r\n\r\n if (validation.status === MapLayerSourceStatus.Valid) {\r\n if (layerRequiringCredentialsIdx === undefined ) {\r\n return await doAttach(source, validation);\r\n } else {\r\n return await updateAttachedLayer(source, validation);\r\n }\r\n } else if (validation.status === MapLayerSourceStatus.InvalidCoordinateSystem){\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.InvalidCoordinateSystem\");\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n } else {\r\n const authNeeded = await updateAuthState(source, validation);\r\n if (authNeeded) {\r\n return false;\r\n } else {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.ValidationError\");\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, `${msg} ${source.url}`));\r\n return true;\r\n }\r\n }\r\n return false;\r\n } catch (error) {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error, sourceUrl: source.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return true;\r\n }\r\n\r\n }, [updateAuthState, doAttach, layerRequiringCredentialsIdx, updateAttachedLayer]);\r\n\r\n const onNameChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setMapName(event.target.value);\r\n }, [setMapName]);\r\n\r\n const onRadioChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setSettingsStorageRadio(event.target.value);\r\n }, [setSettingsStorageRadio]);\r\n\r\n const onUrlChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setMapUrl(event.target.value);\r\n }, [setMapUrl]);\r\n\r\n const createSource = React.useCallback(() => {\r\n let source: MapLayerSource | undefined;\r\n if (mapUrl && mapName) {\r\n source = MapLayerSource.fromJSON({\r\n url: mapUrl,\r\n name: mapName,\r\n formatId: mapType});\r\n\r\n // Set credentials separately since they are not part of JSON\r\n if (source) {\r\n source.userName = userName||undefined; // When there is no value, empty string is always returned, in this case force it to undefined,\r\n source.password = password||undefined;\r\n }\r\n\r\n }\r\n return source;\r\n }, [mapName, mapType, mapUrl, password, userName]);\r\n\r\n const handleOk = React.useCallback(() => {\r\n const source = createSource();\r\n if (source === undefined || props.mapLayerSourceToEdit) {\r\n\r\n UiFramework.dialogs.modal.close();\r\n onOkResult();\r\n\r\n if (source === undefined) {\r\n // Close the dialog and inform end user something went wrong.\r\n const msgError = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerLayerSourceCreationFailed\");\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: msgError, sourceUrl: mapUrl });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n return;\r\n }\r\n\r\n // Simply change the source definition in the setting service\r\n if (props.mapLayerSourceToEdit !== undefined) {\r\n const vp = props.activeViewport;\r\n void (async () => {\r\n if (isSettingsStorageAvailable && vp?.iModel?.iTwinId) {\r\n try {\r\n await MapLayerPreferences.replaceSource(props.mapLayerSourceToEdit!, source, vp.iModel.iTwinId, vp?.iModel.iModelId);\r\n } catch (err: any) {\r\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerEditError\", { layerName: props.mapLayerSourceToEdit?.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\r\n return;\r\n }\r\n }\r\n })();\r\n return;\r\n }\r\n }\r\n\r\n setLayerAttachPending(true);\r\n\r\n // Attach source asynchronously.\r\n void (async () => {\r\n try {\r\n const closeDialog = await attemptAttachSource(source);\r\n if (isMounted.current) {\r\n setLayerAttachPending(false);\r\n }\r\n\r\n // In theory the modal dialog should always get closed by the parent\r\n // AttachLayerPanel's 'onOkResult' handler. We close it here just in case.\r\n if (closeDialog) {\r\n UiFramework.dialogs.modal.close();\r\n onOkResult();\r\n }\r\n } catch (_error) {\r\n onOkResult();\r\n UiFramework.dialogs.modal.close();\r\n }\r\n })();\r\n\r\n }, [createSource, props.mapLayerSourceToEdit, props.activeViewport, onOkResult, mapUrl, isSettingsStorageAvailable, attemptAttachSource]);\r\n\r\n React.useEffect(() => {\r\n const handleOAuthProcessEnd = (success: boolean, _state: any ) => {\r\n onOauthProcessEnd.raiseEvent(success, _state);\r\n };\r\n\r\n // Currently only arcgis support AccessClient\r\n\r\n const ac = IModelApp.mapLayerFormatRegistry.getAccessClient(MAP_TYPES.arcGis);\r\n if (ac?.onOAuthProcessEnd) {\r\n setAccessClient(ac); // cache it, so we dont need to make another lookup;\r\n ac.onOAuthProcessEnd.addListener(handleOAuthProcessEnd);\r\n }\r\n setAccessClientInitialized(true);\r\n return () => {\r\n if (ac?.onOAuthProcessEnd) {\r\n ac.onOAuthProcessEnd.removeListener(handleOAuthProcessEnd);\r\n }\r\n\r\n setAccessClient(undefined);\r\n setAccessClientInitialized(false);\r\n };\r\n }, [mapType, onOauthProcessEnd, setAccessClient]);\r\n\r\n // After a map type change, make sure the different Oauth states are reset.\r\n React.useEffect(() => {\r\n // Reset few states\r\n setServerRequireCredentials(false);\r\n setInvalidCredentialsProvided(false);\r\n setShowOauthPopup(false);\r\n setOAuthProcessSucceeded(undefined);\r\n setExternalLoginUrl(undefined);\r\n\r\n }, [mapType]);\r\n\r\n // The first time the dialog is loaded and we already know the layer requires auth. (i.e ImageryProvider already made an attempt)\r\n // makes a request to discover the authentification types and adjust UI accordingly (i.e. username/password fields, Oauth popup)\r\n // Without this effect, user would have to manually click the 'OK' button in order to trigger the layer connection.\r\n React.useEffect(() => {\r\n // Attach source asynchronously.\r\n void (async () => {\r\n if (isAccessClientInitialized && props.layerRequiringCredentials?.url !== undefined && props.layerRequiringCredentials?.name !== undefined) {\r\n try {\r\n const source = MapLayerSource.fromJSON({\r\n url: props.layerRequiringCredentials.url,\r\n name: props.layerRequiringCredentials.name,\r\n formatId: props.layerRequiringCredentials.formatId});\r\n\r\n if (source !== undefined) {\r\n setLayerAttachPending(true);\r\n const validation = await source.validateSource(true);\r\n if (isMounted.current) {\r\n setLayerAttachPending(false);\r\n }\r\n await updateAuthState(source, validation);\r\n }\r\n } catch (_error) {}\r\n }\r\n })();\r\n\r\n }, [isAccessClientInitialized,\r\n props.layerRequiringCredentials?.formatId,\r\n props.layerRequiringCredentials?.name,\r\n props.layerRequiringCredentials?.url,\r\n updateAuthState]);\r\n\r\n const dialogContainer = React.useRef<HTMLDivElement>(null);\r\n\r\n const readyToSave = React.useCallback(() => {\r\n const credentialsSet = !!userName && !!password;\r\n return (!!mapUrl && !!mapName)\r\n && !layerAttachPending\r\n && (!serverRequireCredentials || credentialsSet)\r\n && !invalidCredentialsProvided\r\n && (externalLoginUrl === undefined || (externalLoginUrl !== undefined && oauthProcessSucceeded));\r\n }, [userName, password, mapUrl, mapName, serverRequireCredentials, layerAttachPending, invalidCredentialsProvided, externalLoginUrl, oauthProcessSucceeded]);\r\n\r\n const buttonCluster = React.useMemo(() => [\r\n { type: DialogButtonType.OK, onClick: handleOk, disabled: !readyToSave() },\r\n { type: DialogButtonType.Cancel, onClick: handleCancel },\r\n ], [readyToSave, handleCancel, handleOk]);\r\n\r\n const handleOnKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\r\n if (event.key === SpecialKey.Enter) {\r\n if (readyToSave())\r\n handleOk();\r\n }\r\n }, [handleOk, readyToSave]);\r\n\r\n // onOauthProcessEnd events handler\r\n React.useEffect(() => {\r\n const handleOauthProcess = (success: boolean, _state: any ) => {\r\n setLayerAuthPending(false);\r\n if (success) {\r\n setOAuthProcessSucceeded(true);\r\n setShowOauthPopup(false);\r\n setLayerAttachPending(false);\r\n handleOk(); // Add the layer the same way the user would do by clicking 'ok'\r\n } else {\r\n setShowOauthPopup(false);\r\n setLayerAttachPending(false);\r\n setOAuthProcessSucceeded(false);\r\n }\r\n };\r\n\r\n onOauthProcessEnd.addListener(handleOauthProcess);\r\n return () => {\r\n onOauthProcessEnd.removeListener(handleOauthProcess);\r\n };\r\n }, [handleOk, onOauthProcessEnd]);\r\n\r\n //\r\n // Monitors authentication method changes\r\n React.useEffect(() => {\r\n\r\n if (serverRequireCredentials && oauthProcessSucceeded === undefined && externalLoginUrl !== undefined) {\r\n handleArcGisLogin();\r\n }\r\n }, [oauthProcessSucceeded, externalLoginUrl, handleArcGisLogin, serverRequireCredentials]);\r\n\r\n // Monitors Oauth2 popup was closed\r\n const handleOAuthPopupClose = React.useCallback(() => {\r\n setShowOauthPopup(false);\r\n setLayerAuthPending(false);\r\n if (oauthProcessSucceeded === undefined)\r\n setOAuthProcessSucceeded(false); // indicates there was a failed attempt\r\n }, [oauthProcessSucceeded]);\r\n\r\n // Utility function to get warning message section\r\n function renderWarningMessage(): React.ReactNode {\r\n let node: React.ReactNode;\r\n let warningMessage: string|undefined;\r\n\r\n // Get the proper warning message\r\n if (showOauthPopup) {\r\n warningMessage = externalLoginWaitingMsg;\r\n } else if (oauthProcessSucceeded === false) {\r\n warningMessage = externalLoginFailedMsg;\r\n } else if (oauthProcessSucceeded === true) {\r\n warningMessage = externalLoginSucceededMsg;\r\n }else if (invalidCredentialsProvided) {\r\n warningMessage = invalidCredentialsLabel;\r\n } else if (serverRequireCredentials && (!userName || !password)) {\r\n warningMessage = missingCredentialsLabel;\r\n }\r\n\r\n // Sometimes we want to add an extra node, such as a button\r\n let extraNode: React.ReactNode;\r\n if (oauthProcessSucceeded === false) {\r\n extraNode = <div>\r\n <Button onClick={handleArcGisLogin}>{externalLoginTryAgainLabel}</Button>\r\n </div>;\r\n }\r\n\r\n if (warningMessage !== undefined) {\r\n return(\r\n <div className=\"map-layer-source-warnMessage\">\r\n <Icon className=\"map-layer-source-warnMessage-icon\" iconSpec=\"icon-status-warning\" />\r\n <span className=\"map-layer-source-warnMessage-label\">{warningMessage}</span >\r\n {extraNode}\r\n </div>);\r\n } else {\r\n return (<span className=\"map-layer-source-placeholder\"> </span>);\r\n }\r\n return node;\r\n }\r\n\r\n // Use a hook to display the popup.\r\n // The display of the popup is controlled by the 'showOauthPopup' state variable.\r\n useCrossOriginPopup(showOauthPopup, externalLoginUrl, externalLoginTitle, 450, 450, handleOAuthPopupClose);\r\n return (\r\n <div ref={dialogContainer}>\r\n <Dialog\r\n className=\"map-layer-url-dialog\"\r\n title={dialogTitle}\r\n opened={true}\r\n resizable={true}\r\n movable={true}\r\n modal={true}\r\n buttonCluster={buttonCluster}\r\n onClose={handleCancel}\r\n onEscape={handleCancel}\r\n minHeight={120}\r\n maxWidth={600}\r\n titleStyle={{paddingLeft: \"10px\"}}\r\n footerStyle={{paddingBottom: \"10px\", paddingRight: \"10px\"}}\r\n trapFocus={false}\r\n >\r\n <div className=\"map-layer-url-dialog-content\">\r\n <div className=\"map-layer-source-url\">\r\n <span className=\"map-layer-source-label\">{typeLabel}</span>\r\n <SelectMapFormat\r\n value={mapType}\r\n disabled={props.layerRequiringCredentials !== undefined || props.mapLayerSourceToEdit !== undefined || layerAttachPending || layerAuthPending}\r\n onChange={setMapType}\r\n mapTypesOptions={mapTypesOptions}\r\n />\r\n <span className=\"map-layer-source-label\">{nameLabel}</span>\r\n <Input className=\"map-layer-source-input\" placeholder={nameInputPlaceHolder} onChange={onNameChange} value={mapName} disabled={props.layerRequiringCredentials !== undefined || layerAttachPending || layerAuthPending} />\r\n <span className=\"map-layer-source-label\">{urlLabel}</span>\r\n <Input className=\"map-layer-source-input\" placeholder={urlInputPlaceHolder} onKeyPress={handleOnKeyDown} onChange={onUrlChange} disabled={props.mapLayerSourceToEdit !== undefined || layerAttachPending || layerAuthPending} value={mapUrl} />\r\n {serverRequireCredentials\r\n && externalLoginUrl === undefined // external login is handled in popup\r\n && props.mapLayerSourceToEdit === undefined &&\r\n <>\r\n <span className=\"map-layer-source-label\">{userNameLabel}</span>\r\n <LabeledInput className=\"map-layer-source-input\"\r\n displayStyle=\"inline\"\r\n placeholder={serverRequireCredentials ? userNameRequiredLabel : userNameLabel}\r\n status={(!userName && serverRequireCredentials) || invalidCredentialsProvided ? \"warning\" : undefined}\r\n disabled={layerAttachPending || layerAuthPending}\r\n onChange={onUsernameChange}\r\n value={userName}\r\n size=\"small\" />\r\n\r\n <span className=\"map-layer-source-label\">{passwordLabel}</span>\r\n <LabeledInput className=\"map-layer-source-input\"\r\n\r\n displayStyle=\"inline\"\r\n type=\"password\" placeholder={serverRequireCredentials ? passwordRequiredLabel : passwordLabel}\r\n status={(!password && serverRequireCredentials) || invalidCredentialsProvided? \"warning\" : undefined}\r\n disabled={layerAttachPending || layerAuthPending}\r\n onChange={onPasswordChange}\r\n onKeyPress={handleOnKeyDown}\r\n value={password}\r\n size=\"small\" />\r\n\r\n </>\r\n }\r\n\r\n {/* Store settings options, not shown when editing a layer */}\r\n {isSettingsStorageAvailable &&\r\n <div title={settingsStorageDisabled ? noSaveSettingsWarning : \"\"}>\r\n {hasImodelContext &&\r\n <div>\r\n <Radio disabled={settingsStorageDisabled}\r\n name=\"settingsStorage\" value=\"iTwin\"\r\n label={iTwinSettingsLabel} checked={settingsStorage === \"iTwin\"}\r\n onChange={onRadioChange} />\r\n <Radio disabled={settingsStorageDisabled}\r\n name=\"settingsStorage\" value=\"Model\"\r\n label={modelSettingsLabel} checked={settingsStorage === \"Model\"}\r\n onChange={onRadioChange} />\r\n </div> }\r\n </div>}\r\n </div>\r\n </div>\r\n\r\n {/* Warning message */}\r\n {renderWarningMessage()}\r\n\r\n {/* Progress bar */}\r\n {(layerAttachPending || layerAuthPending) &&\r\n <div className=\"map-layer-source-progressBar\">\r\n <ProgressLinear indeterminate />\r\n </div>\r\n }\r\n </Dialog>\r\n </div >\r\n );\r\n}\r\n"]}
|