Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update basic layer settings #107

Merged
merged 4 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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