/** * 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 '@expertbridge-ui/core'; import { ControlPanelConfig, ControlPanelsContainerProps, sections, columnChoices } from '@expertbridge-ui/chart-controls'; import { stateOptions } from './stateNames'; function isMetric(radiusType: any) { // console.log(radiusType, radiusType.value.type) if(radiusType.value.type === 'metric') return true; else return false; // return true; } const config: ControlPanelConfig = { controlPanelSections: [ sections.legacyRegularTime, { label: t('Query'), expanded: true, controlSetRows: [ [ { name: 'select_state', config: { type: 'SelectControl', label: t('Region'), default: null, choices: stateOptions, description: t('Which region to plot the map for?'), validators: [validateNonEmpty], }, }, ], [ { name: 'spatial', config: { type: 'SpatialControl', label: t('Longitude & Latitude'), validators: [validateNonEmpty], description: t('Point to your spatial columns'), mapStateToProps: state => ({ choices: columnChoices(state.datasource), }), }, } ], [ { name: 'point_radius_fixed', config: { type: 'FixedOrMetricControl', label: t('Point Size'), default: { type: 'fix', value: 10 }, description: t('Fixed point radius'), mapStateToProps: state => ({ datasource: state.datasource, }), }, } ], [ { name : 'point_bound', config:{ type: 'BoundsControl', label: t('Radius Bound'), default: [5, 15], description: t('Rescale the radius of point based on metric'), visibility: ({ controls }: ControlPanelsContainerProps) => // Boolean(controls?.point_radius_fixed?.default?.type === 'metric'), isMetric(controls?.point_radius_fixed), }, } ], ['adhoc_filters'], ['row_limit'], ] }, ], controlOverrides: { row_limit:{ default: 1000, }, }, }; export default config;