Skip to content

Commit

Permalink
Update basic layer settings (#107)
Browse files Browse the repository at this point in the history
* Add type to layer settings
* Add description to layer settings
* Update to Zoom levels

Signed-off-by: Vijayan Balasubramanian <[email protected]>
  • Loading branch information
VijayanB authored Dec 6, 2022
1 parent dfd17b8 commit 1a40ef5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
EuiFormRow,
EuiRange,
EuiFormLabel,
EuiTextArea,
} from '@elastic/eui';
import { MapLayerSpecification } from '../../model/mapLayerType';
import {
Expand All @@ -20,6 +21,7 @@ import {
MAP_LAYER_DEFAULT_MAX_OPACITY,
MAP_LAYER_DEFAULT_OPACITY_STEP,
} from '../../../common';
import { layersTypeNameMap } from '../../model/layersFunctions';

interface Props {
selectedLayerConfig: MapLayerSpecification;
Expand All @@ -39,12 +41,24 @@ export const LayerBasicSettings = ({ selectedLayerConfig, setSelectedLayerConfig
setSelectedLayerConfig({ ...selectedLayerConfig, name: String(e.target.value) });
};

const onDescriptionChange = (e: any) => {
setSelectedLayerConfig({ ...selectedLayerConfig, description: String(e.target.value) });
};

return (
<EuiForm>
<EuiFormRow label="Type">
<EuiFieldText name="layerType" value={layersTypeNameMap[selectedLayerConfig.type]} readOnly={true} />
</EuiFormRow>
<EuiFormRow label="Name">
<EuiFieldText name="layerName" value={selectedLayerConfig.name} onChange={onNameChange} />
</EuiFormRow>
<EuiFormRow label="Zoom">

<EuiFormRow label = "Description">
<EuiTextArea placeholder="Enter description" value={selectedLayerConfig.description} onChange={onDescriptionChange} />
</EuiFormRow>

<EuiFormRow label="Zoom levels">
<EuiDualRange
min={MAP_DEFAULT_MIN_ZOOM}
max={MAP_DEFAULT_MAX_ZOOM}
Expand Down
7 changes: 6 additions & 1 deletion maps_dashboards/public/model/layersFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { DASHBOARDS_MAPS_LAYER_TYPE } from '../../common';
import { DASHBOARDS_MAPS_LAYER_NAME, DASHBOARDS_MAPS_LAYER_TYPE } from '../../common';
import { OSMLayerFunctions } from './OSMLayerFunctions';
import { DocumentLayerFunctions } from './documentLayerFunctions';

export const layersFunctionMap: { [key: string]: any } = {
[DASHBOARDS_MAPS_LAYER_TYPE.OPENSEARCH_MAP]: OSMLayerFunctions,
[DASHBOARDS_MAPS_LAYER_TYPE.DOCUMENTS]: DocumentLayerFunctions,
};

export const layersTypeNameMap: { [key: string]: string } = {
[DASHBOARDS_MAPS_LAYER_TYPE.OPENSEARCH_MAP]: DASHBOARDS_MAPS_LAYER_NAME.OPENSEARCH_MAP,
[DASHBOARDS_MAPS_LAYER_TYPE.DOCUMENTS]: DASHBOARDS_MAPS_LAYER_NAME.DOCUMENTS,
};
2 changes: 2 additions & 0 deletions maps_dashboards/public/model/mapLayerType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type OSMLayerSpecification = {
name: string;
id: string;
type: 'opensearch_vector_tile_map';
description: string;
zoomRange: number[];
opacity: number;
visibility: string;
Expand All @@ -25,6 +26,7 @@ export type DocumentLayerSpecification = {
name: string;
id: string;
type: 'documents';
description: string;
zoomRange: number[];
opacity: number;
visibility: string;
Expand Down

0 comments on commit 1a40ef5

Please sign in to comment.