From 393f4a38b91c194806e4b0ba1721fa043f267488 Mon Sep 17 00:00:00 2001 From: Eliav-B <136171430+Eliav-B@users.noreply.github.com> Date: Fri, 20 Oct 2023 17:54:40 +0300 Subject: [PATCH] Added checkbox for cluster attribute (#810) * Added additional checkbox to set the cluster attribute when adding a GeoJson source * Fixed default source function in the 'geojson_json' case --------- Co-authored-by: shimon --- src/components/ModalSources.jsx | 1 + src/components/ModalSourcesTypeEditor.jsx | 39 +++++++++++++++-------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/components/ModalSources.jsx b/src/components/ModalSources.jsx index 022c47d..d6c1e78 100644 --- a/src/components/ModalSources.jsx +++ b/src/components/ModalSources.jsx @@ -128,6 +128,7 @@ class AddSource extends React.Component { } case 'geojson_json': return { type: 'geojson', + cluster: source.cluster || false, data: {} } case 'tilejson_vector': return { diff --git a/src/components/ModalSourcesTypeEditor.jsx b/src/components/ModalSourcesTypeEditor.jsx index 4b77f40..ba6ebf1 100644 --- a/src/components/ModalSourcesTypeEditor.jsx +++ b/src/components/ModalSourcesTypeEditor.jsx @@ -8,6 +8,7 @@ import FieldSelect from './FieldSelect' import FieldDynamicArray from './FieldDynamicArray' import FieldArray from './FieldArray' import FieldJson from './FieldJson' +import FieldCheckbox from './FieldCheckbox' class TileJSONSourceEditor extends React.Component { @@ -80,7 +81,7 @@ class TileURLSourceEditor extends React.Component { })} /> {this.props.children} - + } } @@ -205,23 +206,35 @@ class GeoJSONSourceFieldJsonEditor extends React.Component { } render() { - return - { + return
+ + { + this.props.onChange({ + ...this.props.source, + data, + }) + }} + /> + + { this.props.onChange({ ...this.props.source, - data, + cluster: cluster, }) }} /> - +
} }