mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
chore: cleaning out old deckgl controls (#11564)
This commit is contained in:
parent
d8373f2bb9
commit
d86117331d
@ -1,143 +0,0 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { t, validateNonEmpty, legacyValidateInteger } from '@superset-ui/core';
|
||||
import timeGrainSqlaAnimationOverrides from 'src/explore/controlPanels/timeGrainSqlaAnimationOverrides';
|
||||
import { columnChoices, PRIMARY_COLOR } from 'src/explore/controls';
|
||||
import { formatSelectOptions } from 'src/modules/utils';
|
||||
import {
|
||||
filterNulls,
|
||||
autozoom,
|
||||
dimension,
|
||||
jsColumns,
|
||||
jsDataMutator,
|
||||
jsTooltip,
|
||||
jsOnclickHref,
|
||||
legendFormat,
|
||||
legendPosition,
|
||||
viewport,
|
||||
mapboxStyle,
|
||||
} from './Shared_DeckGL';
|
||||
|
||||
export default {
|
||||
controlPanelSections: [
|
||||
{
|
||||
label: t('Query'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
[
|
||||
{
|
||||
name: 'start_spatial',
|
||||
config: {
|
||||
type: 'SpatialControl',
|
||||
label: t('Start Longitude & Latitude'),
|
||||
validators: [validateNonEmpty],
|
||||
description: t('Point to your spatial columns'),
|
||||
mapStateToProps: state => ({
|
||||
choices: columnChoices(state.datasource),
|
||||
}),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'end_spatial',
|
||||
config: {
|
||||
type: 'SpatialControl',
|
||||
label: t('End Longitude & Latitude'),
|
||||
validators: [validateNonEmpty],
|
||||
description: t('Point to your spatial columns'),
|
||||
mapStateToProps: state => ({
|
||||
choices: columnChoices(state.datasource),
|
||||
}),
|
||||
},
|
||||
},
|
||||
],
|
||||
['row_limit', filterNulls],
|
||||
['adhoc_filters'],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Map'),
|
||||
controlSetRows: [
|
||||
[mapboxStyle, viewport],
|
||||
[autozoom, null],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Arc'),
|
||||
controlSetRows: [
|
||||
[
|
||||
'color_picker',
|
||||
{
|
||||
name: 'target_color_picker',
|
||||
config: {
|
||||
label: t('Target Color'),
|
||||
description: t('Color of the target location'),
|
||||
type: 'ColorPickerControl',
|
||||
default: PRIMARY_COLOR,
|
||||
renderTrigger: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
name: 'dimension',
|
||||
config: {
|
||||
...dimension.config,
|
||||
label: t('Categorical Color'),
|
||||
description: t(
|
||||
'Pick a dimension from which categorical colors are defined',
|
||||
),
|
||||
},
|
||||
},
|
||||
],
|
||||
['color_scheme', 'label_colors'],
|
||||
[
|
||||
{
|
||||
name: 'stroke_width',
|
||||
color: {
|
||||
type: 'SelectControl',
|
||||
freeForm: true,
|
||||
label: t('Stroke Width'),
|
||||
validators: [legacyValidateInteger],
|
||||
default: null,
|
||||
renderTrigger: true,
|
||||
choices: formatSelectOptions([1, 2, 3, 4, 5]),
|
||||
},
|
||||
},
|
||||
legendPosition,
|
||||
],
|
||||
[legendFormat, null],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Advanced'),
|
||||
controlSetRows: [
|
||||
[jsColumns],
|
||||
[jsDataMutator],
|
||||
[jsTooltip],
|
||||
[jsOnclickHref],
|
||||
],
|
||||
},
|
||||
],
|
||||
controlOverrides: {
|
||||
size: {
|
||||
validators: [],
|
||||
},
|
||||
time_grain_sqla: timeGrainSqlaAnimationOverrides,
|
||||
},
|
||||
};
|
@ -1,101 +0,0 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { t, validateNonEmpty, legacyValidateInteger } from '@superset-ui/core';
|
||||
import { formatSelectOptions } from 'src/modules/utils';
|
||||
import { columnChoices } from 'src/explore/controls';
|
||||
import {
|
||||
filterNulls,
|
||||
jsColumns,
|
||||
jsDataMutator,
|
||||
jsTooltip,
|
||||
jsOnclickHref,
|
||||
fillColorPicker,
|
||||
strokeColorPicker,
|
||||
filled,
|
||||
stroked,
|
||||
extruded,
|
||||
viewport,
|
||||
mapboxStyle,
|
||||
} from './Shared_DeckGL';
|
||||
|
||||
export default {
|
||||
controlPanelSections: [
|
||||
{
|
||||
label: t('Query'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
[
|
||||
{
|
||||
name: 'geojson',
|
||||
config: {
|
||||
type: 'SelectControl',
|
||||
label: t('GeoJson Column'),
|
||||
validators: [validateNonEmpty],
|
||||
description: t('Select the geojson column'),
|
||||
mapStateToProps: state => ({
|
||||
choices: columnChoices(state.datasource),
|
||||
}),
|
||||
},
|
||||
},
|
||||
null,
|
||||
],
|
||||
['row_limit', filterNulls],
|
||||
['adhoc_filters'],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Map'),
|
||||
controlSetRows: [
|
||||
[mapboxStyle, viewport],
|
||||
// TODO [autozoom, null], // import { autozoom } from './Shared_DeckGL'
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('GeoJson Settings'),
|
||||
controlSetRows: [
|
||||
[fillColorPicker, strokeColorPicker],
|
||||
[filled, stroked],
|
||||
[extruded, null],
|
||||
[
|
||||
{
|
||||
name: 'point_radius_scale',
|
||||
config: {
|
||||
type: 'SelectControl',
|
||||
freeForm: true,
|
||||
label: t('Point Radius Scale'),
|
||||
validators: [legacyValidateInteger],
|
||||
default: null,
|
||||
choices: formatSelectOptions([0, 100, 200, 300, 500]),
|
||||
},
|
||||
},
|
||||
null,
|
||||
],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Advanced'),
|
||||
controlSetRows: [
|
||||
[jsColumns],
|
||||
[jsDataMutator],
|
||||
[jsTooltip],
|
||||
[jsOnclickHref],
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
@ -1,70 +0,0 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { t, validateNonEmpty } from '@superset-ui/core';
|
||||
import {
|
||||
filterNulls,
|
||||
autozoom,
|
||||
jsColumns,
|
||||
jsDataMutator,
|
||||
jsTooltip,
|
||||
jsOnclickHref,
|
||||
extruded,
|
||||
gridSize,
|
||||
viewport,
|
||||
spatial,
|
||||
mapboxStyle,
|
||||
} from './Shared_DeckGL';
|
||||
|
||||
export default {
|
||||
controlPanelSections: [
|
||||
{
|
||||
label: t('Query'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
[spatial, 'size'],
|
||||
['row_limit', filterNulls],
|
||||
['adhoc_filters'],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Map'),
|
||||
controlSetRows: [
|
||||
[mapboxStyle, viewport],
|
||||
['color_picker', autozoom],
|
||||
[gridSize, extruded],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Advanced'),
|
||||
controlSetRows: [
|
||||
[jsColumns],
|
||||
[jsDataMutator],
|
||||
[jsTooltip],
|
||||
[jsOnclickHref],
|
||||
],
|
||||
},
|
||||
],
|
||||
controlOverrides: {
|
||||
size: {
|
||||
label: t('Height'),
|
||||
description: t('Metric used to control height'),
|
||||
validators: [validateNonEmpty],
|
||||
},
|
||||
},
|
||||
};
|
@ -1,100 +0,0 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { t } from '@superset-ui/core';
|
||||
import { formatSelectOptions } from 'src/modules/utils';
|
||||
import {
|
||||
filterNulls,
|
||||
autozoom,
|
||||
jsColumns,
|
||||
jsDataMutator,
|
||||
jsTooltip,
|
||||
jsOnclickHref,
|
||||
extruded,
|
||||
gridSize,
|
||||
viewport,
|
||||
spatial,
|
||||
mapboxStyle,
|
||||
} from './Shared_DeckGL';
|
||||
|
||||
export default {
|
||||
controlPanelSections: [
|
||||
{
|
||||
label: t('Query'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
[spatial, 'size'],
|
||||
['row_limit', filterNulls],
|
||||
['adhoc_filters'],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Map'),
|
||||
controlSetRows: [
|
||||
[mapboxStyle, viewport],
|
||||
['color_picker', autozoom],
|
||||
[gridSize, extruded],
|
||||
[
|
||||
{
|
||||
name: 'js_agg_function',
|
||||
config: {
|
||||
type: 'SelectControl',
|
||||
label: t('Dynamic Aggregation Function'),
|
||||
description: t(
|
||||
'The function to use when aggregating points into groups',
|
||||
),
|
||||
default: 'sum',
|
||||
clearable: false,
|
||||
renderTrigger: true,
|
||||
choices: formatSelectOptions([
|
||||
'sum',
|
||||
'min',
|
||||
'max',
|
||||
'mean',
|
||||
'median',
|
||||
'count',
|
||||
'variance',
|
||||
'deviation',
|
||||
'p1',
|
||||
'p5',
|
||||
'p95',
|
||||
'p99',
|
||||
]),
|
||||
},
|
||||
},
|
||||
null,
|
||||
],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Advanced'),
|
||||
controlSetRows: [
|
||||
[jsColumns],
|
||||
[jsDataMutator],
|
||||
[jsTooltip],
|
||||
[jsOnclickHref],
|
||||
],
|
||||
},
|
||||
],
|
||||
controlOverrides: {
|
||||
size: {
|
||||
label: t('Height'),
|
||||
description: t('Metric used to control height'),
|
||||
},
|
||||
},
|
||||
};
|
@ -1,66 +0,0 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { t, validateNonEmpty } from '@superset-ui/core';
|
||||
import { viewport, mapboxStyle } from './Shared_DeckGL';
|
||||
|
||||
export default {
|
||||
controlPanelSections: [
|
||||
{
|
||||
label: t('Map'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
[mapboxStyle, viewport],
|
||||
[
|
||||
{
|
||||
name: 'deck_slices',
|
||||
config: {
|
||||
type: 'SelectAsyncControl',
|
||||
multi: true,
|
||||
label: t('deck.gl charts'),
|
||||
validators: [validateNonEmpty],
|
||||
default: [],
|
||||
description: t(
|
||||
'Pick a set of deck.gl charts to layer on top of one another',
|
||||
),
|
||||
dataEndpoint:
|
||||
'/sliceasync/api/read?_flt_0_viz_type=deck_&_flt_7_viz_type=deck_multi',
|
||||
placeholder: t('Select charts'),
|
||||
onAsyncErrorMessage: t('Error while fetching charts'),
|
||||
mutator: data => {
|
||||
if (!data || !data.result) {
|
||||
return [];
|
||||
}
|
||||
return data.result.map(o => ({
|
||||
value: o.id,
|
||||
label: o.slice_name,
|
||||
}));
|
||||
},
|
||||
},
|
||||
},
|
||||
null,
|
||||
],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Query'),
|
||||
expanded: true,
|
||||
controlSetRows: [['adhoc_filters']],
|
||||
},
|
||||
],
|
||||
};
|
@ -1,74 +0,0 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { t } from '@superset-ui/core';
|
||||
import {
|
||||
filterNulls,
|
||||
autozoom,
|
||||
jsColumns,
|
||||
jsDataMutator,
|
||||
jsTooltip,
|
||||
jsOnclickHref,
|
||||
lineColumn,
|
||||
viewport,
|
||||
lineWidth,
|
||||
lineType,
|
||||
reverseLongLat,
|
||||
mapboxStyle,
|
||||
} from './Shared_DeckGL';
|
||||
|
||||
export default {
|
||||
controlPanelSections: [
|
||||
{
|
||||
label: t('Query'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
[
|
||||
lineColumn,
|
||||
{
|
||||
...lineType,
|
||||
choices: [
|
||||
['polyline', 'Polyline'],
|
||||
['json', 'JSON'],
|
||||
],
|
||||
},
|
||||
],
|
||||
['row_limit', filterNulls],
|
||||
['adhoc_filters'],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Map'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
[mapboxStyle, viewport],
|
||||
['color_picker', lineWidth],
|
||||
[reverseLongLat, autozoom],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Advanced'),
|
||||
controlSetRows: [
|
||||
[jsColumns],
|
||||
[jsDataMutator],
|
||||
[jsTooltip],
|
||||
[jsOnclickHref],
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
@ -1,166 +0,0 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { t } from '@superset-ui/core';
|
||||
import { formatSelectOptions } from 'src/modules/utils';
|
||||
import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides';
|
||||
import {
|
||||
filterNulls,
|
||||
autozoom,
|
||||
jsColumns,
|
||||
jsDataMutator,
|
||||
jsTooltip,
|
||||
jsOnclickHref,
|
||||
legendFormat,
|
||||
legendPosition,
|
||||
lineColumn,
|
||||
fillColorPicker,
|
||||
strokeColorPicker,
|
||||
filled,
|
||||
stroked,
|
||||
extruded,
|
||||
viewport,
|
||||
pointRadiusFixed,
|
||||
multiplier,
|
||||
lineWidth,
|
||||
lineType,
|
||||
reverseLongLat,
|
||||
mapboxStyle,
|
||||
} from './Shared_DeckGL';
|
||||
|
||||
export default {
|
||||
controlPanelSections: [
|
||||
{
|
||||
label: t('Query'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
[
|
||||
{ ...lineColumn, label: t('Polygon Column') },
|
||||
{ ...lineType, label: t('Polygon Encoding') },
|
||||
],
|
||||
['adhoc_filters'],
|
||||
['metric', { ...pointRadiusFixed, label: t('Elevation') }],
|
||||
['row_limit', null],
|
||||
[reverseLongLat, filterNulls],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Map'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
[mapboxStyle, viewport],
|
||||
[autozoom, null],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Polygon Settings'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
[fillColorPicker, strokeColorPicker],
|
||||
[filled, stroked],
|
||||
[extruded, multiplier],
|
||||
[lineWidth, null],
|
||||
[
|
||||
'linear_color_scheme',
|
||||
{
|
||||
name: 'opacity',
|
||||
config: {
|
||||
type: 'SliderControl',
|
||||
label: t('Opacity'),
|
||||
default: 80,
|
||||
step: 1,
|
||||
min: 0,
|
||||
max: 100,
|
||||
renderTrigger: true,
|
||||
description: t('Opacity, expects values between 0 and 100'),
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
name: 'num_buckets',
|
||||
config: {
|
||||
type: 'SelectControl',
|
||||
multi: false,
|
||||
freeForm: true,
|
||||
label: t('Number of buckets to group data'),
|
||||
default: 5,
|
||||
choices: formatSelectOptions([2, 3, 5, 10]),
|
||||
description: t('How many buckets should the data be grouped in.'),
|
||||
renderTrigger: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'break_points',
|
||||
config: {
|
||||
type: 'SelectControl',
|
||||
multi: true,
|
||||
freeForm: true,
|
||||
label: t('Bucket break points'),
|
||||
choices: formatSelectOptions([]),
|
||||
description: t(
|
||||
'List of n+1 values for bucketing metric into n buckets.',
|
||||
),
|
||||
renderTrigger: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
name: 'table_filter',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Emit Filter Events'),
|
||||
renderTrigger: true,
|
||||
default: false,
|
||||
description: t('Whether to apply filter when items are clicked'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'toggle_polygons',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Multiple filtering'),
|
||||
renderTrigger: true,
|
||||
default: true,
|
||||
description: t(
|
||||
'Allow sending multiple polygons as a filter event',
|
||||
),
|
||||
},
|
||||
},
|
||||
],
|
||||
[legendPosition, legendFormat],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Advanced'),
|
||||
controlSetRows: [
|
||||
[jsColumns],
|
||||
[jsDataMutator],
|
||||
[jsTooltip],
|
||||
[jsOnclickHref],
|
||||
],
|
||||
},
|
||||
],
|
||||
controlOverrides: {
|
||||
metric: {
|
||||
validators: [],
|
||||
},
|
||||
time_grain_sqla: timeGrainSqlaAnimationOverrides,
|
||||
},
|
||||
};
|
@ -1,165 +0,0 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { t, validateNonEmpty } from '@superset-ui/core';
|
||||
import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides';
|
||||
import {
|
||||
filterNulls,
|
||||
autozoom,
|
||||
dimension,
|
||||
jsColumns,
|
||||
jsDataMutator,
|
||||
jsTooltip,
|
||||
jsOnclickHref,
|
||||
legendFormat,
|
||||
legendPosition,
|
||||
viewport,
|
||||
spatial,
|
||||
pointRadiusFixed,
|
||||
multiplier,
|
||||
mapboxStyle,
|
||||
} from './Shared_DeckGL';
|
||||
|
||||
export default {
|
||||
onInit: controlState => ({
|
||||
...controlState,
|
||||
time_grain_sqla: {
|
||||
...controlState.time_grain_sqla,
|
||||
value: null,
|
||||
},
|
||||
granularity: {
|
||||
...controlState.granularity,
|
||||
value: null,
|
||||
},
|
||||
}),
|
||||
controlPanelSections: [
|
||||
{
|
||||
label: t('Query'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
[spatial, null],
|
||||
['row_limit', filterNulls],
|
||||
['adhoc_filters'],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Map'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
[mapboxStyle, viewport],
|
||||
[autozoom, null],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Point Size'),
|
||||
controlSetRows: [
|
||||
[
|
||||
pointRadiusFixed,
|
||||
{
|
||||
name: 'point_unit',
|
||||
config: {
|
||||
type: 'SelectControl',
|
||||
label: t('Point Unit'),
|
||||
default: 'square_m',
|
||||
clearable: false,
|
||||
choices: [
|
||||
['square_m', 'Square meters'],
|
||||
['square_km', 'Square kilometers'],
|
||||
['square_miles', 'Square miles'],
|
||||
['radius_m', 'Radius in meters'],
|
||||
['radius_km', 'Radius in kilometers'],
|
||||
['radius_miles', 'Radius in miles'],
|
||||
],
|
||||
description: t(
|
||||
'The unit of measure for the specified point radius',
|
||||
),
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
name: 'min_radius',
|
||||
config: {
|
||||
type: 'TextControl',
|
||||
label: t('Minimum Radius'),
|
||||
isFloat: true,
|
||||
validators: [validateNonEmpty],
|
||||
renderTrigger: true,
|
||||
default: 2,
|
||||
description: t(
|
||||
'Minimum radius size of the circle, in pixels. As the zoom level changes, this ' +
|
||||
'insures that the circle respects this minimum radius.',
|
||||
),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'max_radius',
|
||||
config: {
|
||||
type: 'TextControl',
|
||||
label: t('Maximum Radius'),
|
||||
isFloat: true,
|
||||
validators: [validateNonEmpty],
|
||||
renderTrigger: true,
|
||||
default: 250,
|
||||
description: t(
|
||||
'Maxium radius size of the circle, in pixels. As the zoom level changes, this ' +
|
||||
'insures that the circle respects this maximum radius.',
|
||||
),
|
||||
},
|
||||
},
|
||||
],
|
||||
[multiplier, null],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Point Color'),
|
||||
controlSetRows: [
|
||||
['color_picker', legendPosition],
|
||||
[null, legendFormat],
|
||||
[
|
||||
{
|
||||
name: 'dimension',
|
||||
config: {
|
||||
...dimension.config,
|
||||
label: t('Categorical Color'),
|
||||
description: t(
|
||||
'Pick a dimension from which categorical colors are defined',
|
||||
),
|
||||
},
|
||||
},
|
||||
],
|
||||
['color_scheme', 'label_colors'],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Advanced'),
|
||||
controlSetRows: [
|
||||
[jsColumns],
|
||||
[jsDataMutator],
|
||||
[jsTooltip],
|
||||
[jsOnclickHref],
|
||||
],
|
||||
},
|
||||
],
|
||||
controlOverrides: {
|
||||
size: {
|
||||
validators: [],
|
||||
},
|
||||
time_grain_sqla: timeGrainSqlaAnimationOverrides,
|
||||
},
|
||||
};
|
@ -1,75 +0,0 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { t, validateNonEmpty } from '@superset-ui/core';
|
||||
import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides';
|
||||
import {
|
||||
filterNulls,
|
||||
autozoom,
|
||||
jsColumns,
|
||||
jsDataMutator,
|
||||
jsTooltip,
|
||||
jsOnclickHref,
|
||||
gridSize,
|
||||
viewport,
|
||||
spatial,
|
||||
mapboxStyle,
|
||||
} from './Shared_DeckGL';
|
||||
|
||||
export default {
|
||||
controlPanelSections: [
|
||||
{
|
||||
label: t('Query'),
|
||||
expanded: true,
|
||||
controlSetRows: [
|
||||
[spatial, 'size'],
|
||||
['row_limit', filterNulls],
|
||||
['adhoc_filters'],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Map'),
|
||||
controlSetRows: [
|
||||
[mapboxStyle, viewport],
|
||||
[autozoom, null],
|
||||
],
|
||||
},
|
||||
{
|
||||
label: t('Grid'),
|
||||
expanded: true,
|
||||
controlSetRows: [[gridSize, 'color_picker']],
|
||||
},
|
||||
{
|
||||
label: t('Advanced'),
|
||||
controlSetRows: [
|
||||
[jsColumns],
|
||||
[jsDataMutator],
|
||||
[jsTooltip],
|
||||
[jsOnclickHref],
|
||||
],
|
||||
},
|
||||
],
|
||||
controlOverrides: {
|
||||
size: {
|
||||
label: t('Weight'),
|
||||
description: t("Metric used as a weight for the grid's coloring"),
|
||||
validators: [validateNonEmpty],
|
||||
},
|
||||
time_grain_sqla: timeGrainSqlaAnimationOverrides,
|
||||
},
|
||||
};
|
@ -1,377 +0,0 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// These are control configurations that are shared ONLY within the DeckGL viz plugin repo.
|
||||
|
||||
import React from 'react';
|
||||
import { t, validateNonEmpty } from '@superset-ui/core';
|
||||
import {
|
||||
sharedControls,
|
||||
D3_FORMAT_OPTIONS,
|
||||
columnChoices,
|
||||
} from '@superset-ui/chart-controls';
|
||||
import { PRIMARY_COLOR } from '../controls';
|
||||
import { DEFAULT_VIEWPORT } from '../components/controls/ViewportControl';
|
||||
|
||||
const sandboxUrl =
|
||||
'https://github.com/apache/incubator-superset/' +
|
||||
'blob/master/superset-frontend/src/modules/sandbox.js';
|
||||
const jsFunctionInfo = (
|
||||
<div>
|
||||
{t(
|
||||
'For more information about objects are in context in the scope of this function, refer to the',
|
||||
)}
|
||||
<a href={sandboxUrl}>{t(" source code of Superset's sandboxed parser")}.</a>
|
||||
.
|
||||
</div>
|
||||
);
|
||||
|
||||
function jsFunctionControl(
|
||||
label,
|
||||
description,
|
||||
extraDescr = null,
|
||||
height = 100,
|
||||
defaultText = '',
|
||||
) {
|
||||
return {
|
||||
type: 'TextAreaControl',
|
||||
language: 'javascript',
|
||||
label,
|
||||
description,
|
||||
height,
|
||||
default: defaultText,
|
||||
aboveEditorSection: (
|
||||
<div>
|
||||
<p>{description}</p>
|
||||
<p>{jsFunctionInfo}</p>
|
||||
{extraDescr}
|
||||
</div>
|
||||
),
|
||||
mapStateToProps: state => ({
|
||||
warning: !state.common.conf.ENABLE_JAVASCRIPT_CONTROLS
|
||||
? t(
|
||||
'This functionality is disabled in your environment for security reasons.',
|
||||
)
|
||||
: null,
|
||||
readOnly: !state.common.conf.ENABLE_JAVASCRIPT_CONTROLS,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
export const filterNulls = {
|
||||
name: 'filter_nulls',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Ignore null locations'),
|
||||
default: true,
|
||||
description: t('Whether to ignore locations that are null'),
|
||||
},
|
||||
};
|
||||
|
||||
export const autozoom = {
|
||||
name: 'autozoom',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Auto Zoom'),
|
||||
default: true,
|
||||
renderTrigger: true,
|
||||
description: t(
|
||||
'When checked, the map will zoom to your data after each query',
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
export const dimension = {
|
||||
name: 'dimension',
|
||||
config: {
|
||||
...sharedControls.groupby,
|
||||
label: t('Dimension'),
|
||||
description: t('Select a dimension'),
|
||||
multi: false,
|
||||
default: null,
|
||||
},
|
||||
};
|
||||
|
||||
export const jsColumns = {
|
||||
name: 'js_columns',
|
||||
config: {
|
||||
...sharedControls.groupby,
|
||||
label: t('Extra data for JS'),
|
||||
default: [],
|
||||
description: t(
|
||||
'List of extra columns made available in Javascript functions',
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
export const jsDataMutator = {
|
||||
name: 'js_data_mutator',
|
||||
config: jsFunctionControl(
|
||||
t('Javascript data interceptor'),
|
||||
t(
|
||||
'Define a javascript function that receives the data array used in the visualization ' +
|
||||
'and is expected to return a modified version of that array. This can be used ' +
|
||||
'to alter properties of the data, filter, or enrich the array.',
|
||||
),
|
||||
),
|
||||
};
|
||||
|
||||
export const jsTooltip = {
|
||||
name: 'js_tooltip',
|
||||
config: jsFunctionControl(
|
||||
t('Javascript tooltip generator'),
|
||||
t(
|
||||
'Define a function that receives the input and outputs the content for a tooltip',
|
||||
),
|
||||
),
|
||||
};
|
||||
|
||||
export const jsOnclickHref = {
|
||||
name: 'js_onclick_href',
|
||||
config: jsFunctionControl(
|
||||
t('Javascript onClick href'),
|
||||
t('Define a function that returns a URL to navigate to when user clicks'),
|
||||
),
|
||||
};
|
||||
|
||||
export const legendFormat = {
|
||||
name: 'legend_format',
|
||||
config: {
|
||||
label: t('Legend Format'),
|
||||
description: t('Choose the format for legend values'),
|
||||
type: 'SelectControl',
|
||||
clearable: false,
|
||||
default: D3_FORMAT_OPTIONS[0],
|
||||
choices: D3_FORMAT_OPTIONS,
|
||||
renderTrigger: true,
|
||||
},
|
||||
};
|
||||
|
||||
export const legendPosition = {
|
||||
name: 'legend_position',
|
||||
config: {
|
||||
label: t('Legend Position'),
|
||||
description: t('Choose the position of the legend'),
|
||||
type: 'SelectControl',
|
||||
clearable: false,
|
||||
default: 'tr',
|
||||
choices: [
|
||||
[null, 'None'],
|
||||
['tl', 'Top left'],
|
||||
['tr', 'Top right'],
|
||||
['bl', 'Bottom left'],
|
||||
['br', 'Bottom right'],
|
||||
],
|
||||
renderTrigger: true,
|
||||
},
|
||||
};
|
||||
|
||||
export const lineColumn = {
|
||||
name: 'line_column',
|
||||
config: {
|
||||
type: 'SelectControl',
|
||||
label: t('Lines column'),
|
||||
default: null,
|
||||
description: t('The database columns that contains lines information'),
|
||||
mapStateToProps: state => ({
|
||||
choices: columnChoices(state.datasource),
|
||||
}),
|
||||
validators: [validateNonEmpty],
|
||||
},
|
||||
};
|
||||
|
||||
export const lineWidth = {
|
||||
name: 'line_width',
|
||||
config: {
|
||||
type: 'TextControl',
|
||||
label: t('Line width'),
|
||||
renderTrigger: true,
|
||||
isInt: true,
|
||||
default: 10,
|
||||
description: t('The width of the lines'),
|
||||
},
|
||||
};
|
||||
|
||||
export const fillColorPicker = {
|
||||
name: 'fill_color_picker',
|
||||
config: {
|
||||
label: t('Fill Color'),
|
||||
description: t(
|
||||
' Set the opacity to 0 if you do not want to override the color specified in the GeoJSON',
|
||||
),
|
||||
type: 'ColorPickerControl',
|
||||
default: PRIMARY_COLOR,
|
||||
renderTrigger: true,
|
||||
},
|
||||
};
|
||||
|
||||
export const strokeColorPicker = {
|
||||
name: 'stroke_color_picker',
|
||||
config: {
|
||||
label: t('Stroke Color'),
|
||||
description: t(
|
||||
' Set the opacity to 0 if you do not want to override the color specified in the GeoJSON',
|
||||
),
|
||||
type: 'ColorPickerControl',
|
||||
default: PRIMARY_COLOR,
|
||||
renderTrigger: true,
|
||||
},
|
||||
};
|
||||
|
||||
export const filled = {
|
||||
name: 'filled',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Filled'),
|
||||
renderTrigger: true,
|
||||
description: t('Whether to fill the objects'),
|
||||
default: true,
|
||||
},
|
||||
};
|
||||
|
||||
export const stroked = {
|
||||
name: 'stroked',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Stroked'),
|
||||
renderTrigger: true,
|
||||
description: t('Whether to display the stroke'),
|
||||
default: false,
|
||||
},
|
||||
};
|
||||
|
||||
export const extruded = {
|
||||
name: 'extruded',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Extruded'),
|
||||
renderTrigger: true,
|
||||
default: true,
|
||||
description: 'Whether to make the grid 3D',
|
||||
},
|
||||
};
|
||||
|
||||
export const gridSize = {
|
||||
name: 'grid_size',
|
||||
config: {
|
||||
type: 'TextControl',
|
||||
label: t('Grid Size'),
|
||||
renderTrigger: true,
|
||||
default: 20,
|
||||
isInt: true,
|
||||
description: t('Defines the grid size in pixels'),
|
||||
},
|
||||
};
|
||||
|
||||
export const viewport = {
|
||||
name: 'viewport',
|
||||
config: {
|
||||
type: 'ViewportControl',
|
||||
label: t('Viewport'),
|
||||
renderTrigger: false,
|
||||
description: t('Parameters related to the view and perspective on the map'),
|
||||
// default is whole world mostly centered
|
||||
default: DEFAULT_VIEWPORT,
|
||||
// Viewport changes shouldn't prompt user to re-run query
|
||||
dontRefreshOnChange: true,
|
||||
},
|
||||
};
|
||||
|
||||
export const spatial = {
|
||||
name: 'spatial',
|
||||
config: {
|
||||
type: 'SpatialControl',
|
||||
label: t('Longitude & Latitude'),
|
||||
validators: [validateNonEmpty],
|
||||
description: t('Point to your spatial columns'),
|
||||
mapStateToProps: state => ({
|
||||
choices: columnChoices(state.datasource),
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
export const pointRadiusFixed = {
|
||||
name: 'point_radius_fixed',
|
||||
config: {
|
||||
type: 'FixedOrMetricControl',
|
||||
label: t('Point Size'),
|
||||
default: { type: 'fix', value: 1000 },
|
||||
description: t('Fixed point radius'),
|
||||
mapStateToProps: state => ({
|
||||
datasource: state.datasource,
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
export const multiplier = {
|
||||
name: 'multiplier',
|
||||
config: {
|
||||
type: 'TextControl',
|
||||
label: t('Multiplier'),
|
||||
isFloat: true,
|
||||
renderTrigger: true,
|
||||
default: 1,
|
||||
description: t('Factor to multiply the metric by'),
|
||||
},
|
||||
};
|
||||
|
||||
export const lineType = {
|
||||
name: 'line_type',
|
||||
config: {
|
||||
type: 'SelectControl',
|
||||
label: t('Lines encoding'),
|
||||
clearable: false,
|
||||
default: 'json',
|
||||
description: t('The encoding format of the lines'),
|
||||
choices: [
|
||||
['polyline', 'Polyline'],
|
||||
['json', 'JSON'],
|
||||
['geohash', 'geohash (square)'],
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
export const reverseLongLat = {
|
||||
name: 'reverse_long_lat',
|
||||
config: {
|
||||
type: 'CheckboxControl',
|
||||
label: t('Reverse Lat & Long'),
|
||||
default: false,
|
||||
},
|
||||
};
|
||||
|
||||
export const mapboxStyle = {
|
||||
name: 'mapbox_style',
|
||||
config: {
|
||||
type: 'SelectControl',
|
||||
label: t('Map Style'),
|
||||
clearable: false,
|
||||
renderTrigger: true,
|
||||
choices: [
|
||||
['mapbox://styles/mapbox/streets-v9', 'Streets'],
|
||||
['mapbox://styles/mapbox/dark-v9', 'Dark'],
|
||||
['mapbox://styles/mapbox/light-v9', 'Light'],
|
||||
['mapbox://styles/mapbox/satellite-streets-v9', 'Satellite Streets'],
|
||||
['mapbox://styles/mapbox/satellite-v9', 'Satellite'],
|
||||
['mapbox://styles/mapbox/outdoors-v9', 'Outdoors'],
|
||||
],
|
||||
default: 'mapbox://styles/mapbox/light-v9',
|
||||
description: t('Base layer map style'),
|
||||
},
|
||||
};
|
@ -20,15 +20,6 @@ import { getChartControlPanelRegistry } from '@superset-ui/core';
|
||||
import MainPreset from '../visualizations/presets/MainPreset';
|
||||
import setupPluginsExtra from './setupPluginsExtra';
|
||||
|
||||
import DeckArc from '../explore/controlPanels/DeckArc';
|
||||
import DeckGeojson from '../explore/controlPanels/DeckGeojson';
|
||||
import DeckGrid from '../explore/controlPanels/DeckGrid';
|
||||
import DeckHex from '../explore/controlPanels/DeckHex';
|
||||
import DeckMulti from '../explore/controlPanels/DeckMulti';
|
||||
import DeckPath from '../explore/controlPanels/DeckPath';
|
||||
import DeckPolygon from '../explore/controlPanels/DeckPolygon';
|
||||
import DeckScatter from '../explore/controlPanels/DeckScatter';
|
||||
import DeckScreengrid from '../explore/controlPanels/DeckScreengrid';
|
||||
import Separator from '../explore/controlPanels/Separator';
|
||||
import TimeTable from '../explore/controlPanels/TimeTable';
|
||||
|
||||
@ -38,16 +29,7 @@ export default function setupPlugins() {
|
||||
// TODO: Remove these shims once the control panel configs are moved into the plugin package.
|
||||
getChartControlPanelRegistry()
|
||||
.registerValue('separator', Separator)
|
||||
.registerValue('time_table', TimeTable)
|
||||
.registerValue('deck_arc', DeckArc)
|
||||
.registerValue('deck_geojson', DeckGeojson)
|
||||
.registerValue('deck_grid', DeckGrid)
|
||||
.registerValue('deck_hex', DeckHex)
|
||||
.registerValue('deck_multi', DeckMulti)
|
||||
.registerValue('deck_path', DeckPath)
|
||||
.registerValue('deck_polygon', DeckPolygon)
|
||||
.registerValue('deck_scatter', DeckScatter)
|
||||
.registerValue('deck_screengrid', DeckScreengrid);
|
||||
.registerValue('time_table', TimeTable);
|
||||
|
||||
setupPluginsExtra();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user