migrating unique controls (#9446)

This commit is contained in:
Evan Rusackas 2020-04-02 09:26:52 -07:00 committed by GitHub
parent e33f6c244d
commit c003189d0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 213 additions and 161 deletions

View File

@ -1118,7 +1118,6 @@ Note the `y_axis_format` is defined under various section for some charts.
| `contribution` | _N/A_ | |
| `country_fieldtype` | _N/A_ | |
| `date_filter` | _N/A_ | |
| `deck_slices` | _N/A_ | |
| `default_filters` | _N/A_ | |
| `dimension` | _N/A_ | |
| `end_spatial` | _N/A_ | |
@ -1141,7 +1140,6 @@ Note the `y_axis_format` is defined under various section for some charts.
| `grid_size` | _N/A_ | |
| `import_time` | _N/A_ | |
| `instant_filtering` | _N/A_ | |
| `js_agg_function` | _N/A_ | |
| `js_columns` | _N/A_ | |
| `label` | _N/A_ | |
| `labels_outside` | _N/A_ | |
@ -1160,14 +1158,11 @@ Note the `y_axis_format` is defined under various section for some charts.
| `marker_lines` | _N/A_ | |
| `markers` | _N/A_ | |
| `markup_type` | _N/A_ | |
| `max_radius` | _N/A_ | |
| `min_periods` | _N/A_ | |
| `min_radius` | _N/A_ | |
| `multiplier` | _N/A_ | |
| `new_dashboard_name` | _N/A_ | |
| `new_slice_name` | _N/A_ | |
| `normalize_across` | _N/A_ | |
| `num_buckets` | _N/A_ | |
| `num_period_compare` | _N/A_ | |
| `order_bars` | _N/A_ | |
| `order_desc` | _N/A_ | |
@ -1175,7 +1170,6 @@ Note the `y_axis_format` is defined under various section for some charts.
| `period_ratio_type` | _N/A_ | |
| `perm` | _N/A_ | |
| `point_radius_fixed` | _N/A_ | |
| `point_unit` | _N/A_ | |
| `prefix_metric_with_slice_name` | _N/A_ | |
| `range_labels` | _N/A_ | |
| `ranges` | _N/A_ | |
@ -1216,7 +1210,6 @@ Note the `y_axis_format` is defined under various section for some charts.
| `table_filter` | _N/A_ | |
| `time_compare` | _N/A_ | |
| `timed_refresh_immune_slices` | _N/A_ | |
| `toggle_polygons` | _N/A_ | |
| `url` | _N/A_ | |
| `userid` | _N/A_ | |
| `viewport` | _N/A_ | |

View File

@ -17,6 +17,9 @@
* under the License.
*/
import { t } from '@superset-ui/translation';
import { nonEmpty, integer } from '../validators';
import { formatSelectOptions } from '../../modules/utils';
import { columnChoices } from '../controls';
export default {
requiresTime: true,
@ -25,7 +28,21 @@ export default {
label: t('Query'),
expanded: true,
controlSetRows: [
['geojson', null],
[
{
name: 'geojson',
config: {
type: 'SelectControl',
label: t('GeoJson Column'),
validators: [nonEmpty],
description: t('Select the geojson column'),
mapStateToProps: state => ({
choices: columnChoices(state.datasource),
}),
},
},
null,
],
['row_limit', 'filter_nulls'],
['adhoc_filters'],
],
@ -43,7 +60,20 @@ export default {
['fill_color_picker', 'stroke_color_picker'],
['filled', 'stroked'],
['extruded', null],
['point_radius_scale', null],
[
{
name: 'point_radius_scale',
config: {
type: 'SelectControl',
freeForm: true,
label: t('Point Radius Scale'),
validators: [integer],
default: null,
choices: formatSelectOptions([0, 100, 200, 300, 500]),
},
},
null,
],
],
},
{

View File

@ -17,6 +17,10 @@
* under the License.
*/
import { t } from '@superset-ui/translation';
import {
formatSelectOptions,
formatSelectOptionsForRange,
} from '../../modules/utils';
export default {
requiresTime: true,
@ -36,7 +40,36 @@ export default {
['mapbox_style', 'viewport'],
['color_picker', 'autozoom'],
['grid_size', 'extruded'],
['js_agg_function', null],
[
{
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,
],
],
},
{

View File

@ -17,6 +17,7 @@
* under the License.
*/
import { t } from '@superset-ui/translation';
import { nonEmpty } from '../validators';
export default {
requiresTime: true,
@ -26,7 +27,35 @@ export default {
expanded: true,
controlSetRows: [
['mapbox_style', 'viewport'],
['deck_slices', null],
[
{
name: 'deck_slices',
config: {
type: 'SelectAsyncControl',
multi: true,
label: t('deck.gl charts'),
validators: [nonEmpty],
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,
],
],
},
{

View File

@ -18,6 +18,7 @@
*/
import { t } from '@superset-ui/translation';
import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides';
import { formatSelectOptions } from '../../modules/utils';
export default {
requiresTime: true,
@ -49,9 +50,66 @@ export default {
['filled', 'stroked'],
['extruded', 'multiplier'],
['line_width', null],
['linear_color_scheme', 'opacity'],
['num_buckets', 'break_points'],
['table_filter', 'toggle_polygons'],
[
'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,
},
},
],
[
'table_filter',
{
name: 'toggle_polygons',
config: {
type: 'CheckboxControl',
label: t('Multiple filtering'),
renderTrigger: true,
default: true,
description: t(
'Allow sending multiple polygons as a filter event',
),
},
},
],
['legend_position', 'legend_format'],
],
},

View File

@ -18,6 +18,7 @@
*/
import { t } from '@superset-ui/translation';
import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides';
import { nonEmpty } from '../validators';
export default {
requiresTime: true,
@ -53,8 +54,61 @@ export default {
{
label: t('Point Size'),
controlSetRows: [
['point_radius_fixed', 'point_unit'],
['min_radius', 'max_radius'],
[
'point_radius_fixed',
{
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: [nonEmpty],
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: [nonEmpty],
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],
],
},

View File

@ -607,16 +607,6 @@ export const controls = {
description: t('Whether to ignore locations that are null'),
},
geojson: {
type: 'SelectControl',
label: t('GeoJson Column'),
validators: [v.nonEmpty],
description: t('Select the geojson column'),
mapStateToProps: state => ({
choices: columnChoices(state.datasource),
}),
},
polygon: {
type: 'SelectControl',
label: t('Polygon Column'),
@ -629,15 +619,6 @@ export const controls = {
}),
},
point_radius_scale: {
type: 'SelectControl',
freeForm: true,
label: t('Point Radius Scale'),
validators: [v.integer],
default: null,
choices: formatSelectOptions([0, 100, 200, 300, 500]),
},
stroke_width: {
type: 'SelectControl',
freeForm: true,
@ -1187,29 +1168,6 @@ export const controls = {
),
},
js_agg_function: {
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',
]),
},
header_font_size: {
type: 'SelectControl',
label: t('Header Font Size'),
@ -1363,35 +1321,6 @@ export const controls = {
description: t('Send range filter events to other charts'),
},
toggle_polygons: {
type: 'CheckboxControl',
label: t('Multiple filtering'),
renderTrigger: true,
default: true,
description: t('Allow sending multiple polygons as a filter event'),
},
num_buckets: {
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,
},
break_points: {
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,
},
show_labels: {
type: 'CheckboxControl',
label: t('Show Labels'),
@ -1589,22 +1518,6 @@ export const controls = {
}),
},
point_unit: {
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'),
},
global_opacity: {
type: 'TextControl',
label: t('Opacity'),
@ -1615,17 +1528,6 @@ export const controls = {
),
},
opacity: {
type: 'SliderControl',
label: t('Opacity'),
default: 80,
step: 1,
min: 0,
max: 100,
renderTrigger: true,
description: t('Opacity, expects values between 0 and 100'),
},
viewport: {
type: 'ViewportControl',
label: t('Viewport'),
@ -1778,32 +1680,6 @@ export const controls = {
controlName: 'TimeSeriesColumnControl',
},
min_radius: {
type: 'TextControl',
label: t('Minimum Radius'),
isFloat: true,
validators: [v.nonEmpty],
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.',
),
},
max_radius: {
type: 'TextControl',
label: t('Maximum Radius'),
isFloat: true,
validators: [v.nonEmpty],
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.',
),
},
line_column: {
type: 'SelectControl',
label: t('Lines column'),
@ -1887,27 +1763,6 @@ export const controls = {
default: false,
},
deck_slices: {
type: 'SelectAsyncControl',
multi: true,
label: t('deck.gl charts'),
validators: [v.nonEmpty],
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 }));
},
},
js_data_mutator: jsFunctionControl(
t('Javascript data interceptor'),
t(