From 38c57f45ac93ae43cfd29ac5de9edfdb062fd372 Mon Sep 17 00:00:00 2001 From: Phillip Kelley-Dotson Date: Mon, 18 May 2020 12:48:51 -0700 Subject: [PATCH] feat: partitionchart controls migration (#9768) * fix lint error * fix: import lint error * pull in latests code * delete control from plugin registry * fixing again... * another fix with rebase... * commit change * update packages and fix test * fix: add ignore to lint error * fix mr * fix lint * fix imports Co-authored-by: Phillip Kelley-Dotson --- superset-frontend/package-lock.json | 25 +- superset-frontend/package.json | 4 +- .../components/ColumnOption_spec.jsx | 2 +- .../javascripts/components/FormRow_spec.jsx | 2 +- .../components/MetricOption_spec.jsx | 2 +- .../components/OptionDescription_spec.jsx | 48 ---- .../components/ControlPanelSection_spec.jsx | 4 +- .../components/ExploreCtasResultsButton.jsx | 3 +- .../components/ExploreResultsButton.jsx | 2 +- .../components/TemplateParamsEditor.jsx | 2 +- .../src/components/ActionMenuItem.jsx | 2 +- .../src/components/ColumnOption.jsx | 2 +- superset-frontend/src/components/FormRow.jsx | 2 +- .../src/components/InfoTooltipWithTrigger.jsx | 77 ------ .../src/components/ListView/LegacyFilters.tsx | 3 + .../src/components/ListView/ListView.tsx | 1 + .../src/components/MetricOption.jsx | 2 +- .../src/components/OptionDescription.jsx | 45 ---- .../src/components/PopoverSection.jsx | 2 +- .../explore/components/AdhocFilterOption.jsx | 2 +- .../src/explore/components/ControlHeader.jsx | 2 +- .../components/ControlPanelSection.jsx | 2 +- .../explore/components/PropertiesModal.tsx | 3 + .../controls/AnnotationLayerControl.jsx | 2 +- .../components/controls/CollectionControl.jsx | 2 +- .../controls/FilterBoxItemControl.jsx | 2 +- .../controls/TimeSeriesColumnControl.jsx | 2 +- .../src/explore/controlPanels/Partition.jsx | 233 ------------------ superset-frontend/src/setup/setupPlugins.ts | 2 - .../visualizations/TimeTable/TimeTable.jsx | 2 +- .../components/ExploreCtasResultsButton.jsx | 2 +- 31 files changed, 50 insertions(+), 436 deletions(-) delete mode 100644 superset-frontend/spec/javascripts/components/OptionDescription_spec.jsx delete mode 100644 superset-frontend/src/components/InfoTooltipWithTrigger.jsx delete mode 100644 superset-frontend/src/components/OptionDescription.jsx delete mode 100644 superset-frontend/src/explore/controlPanels/Partition.jsx diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json index 61b06cd30e..ccd71fa18d 100644 --- a/superset-frontend/package-lock.json +++ b/superset-frontend/package-lock.json @@ -6575,9 +6575,14 @@ } }, "@superset-ui/control-utils": { - "version": "0.13.3", - "resolved": "https://registry.npmjs.org/@superset-ui/control-utils/-/control-utils-0.13.3.tgz", - "integrity": "sha512-I9eMrqZRB5PbSWygGoptxOdu9t8X8LU3+VTo7OjAEcn3EYAQHIRmuMudq1KDnrGt+rKCBOHaWm5JMbMIj2GodA==" + "version": "0.13.9", + "resolved": "https://registry.npmjs.org/@superset-ui/control-utils/-/control-utils-0.13.9.tgz", + "integrity": "sha512-R8BkUqd5WaDfFB7LiGfNBD3kfFsoqwRzIUDNvZxVzBJsmYTgF0pPVV9OB9pKZ/fImEqd/WqPb5PyB7FMtRj5Ug==", + "requires": { + "@types/react-bootstrap": "0.32.21", + "lodash": "^4.17.15", + "react-bootstrap": "^0.33.1" + } }, "@superset-ui/core": { "version": "0.13.5", @@ -6820,9 +6825,9 @@ } }, "@superset-ui/legacy-plugin-chart-partition": { - "version": "0.13.5", - "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-partition/-/legacy-plugin-chart-partition-0.13.5.tgz", - "integrity": "sha512-YsgbAqj/sQKEWUmI0XXy6rJvGsWSPwfekmtWpa55CF19A+TJEuCCHmIGDPupgZsIqgJBZArwYT3HNnn7a8TfxA==", + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/@superset-ui/legacy-plugin-chart-partition/-/legacy-plugin-chart-partition-0.13.11.tgz", + "integrity": "sha512-z49rqBLWQ7GRf1MCz3QdYz+8HRmK8UJo1kHRKBnqah4NQB4jemgWnOznNHuPXxOCIct1ZejvUmaf5EAg/24dMQ==", "requires": { "d3": "^3.5.17", "d3-hierarchy": "^1.1.8", @@ -7511,6 +7516,14 @@ "csstype": "^2.2.0" } }, + "@types/react-bootstrap": { + "version": "0.32.21", + "resolved": "https://registry.npmjs.org/@types/react-bootstrap/-/react-bootstrap-0.32.21.tgz", + "integrity": "sha512-AV/6cMUBbKArEQcjXEzpoHexHi6hJL0cH3Vcw9qI4Ob2g/XFRvyTAFdMlGlp8HZmOHXL35PdF0K75Z31Po87qg==", + "requires": { + "@types/react": "*" + } + }, "@types/react-dom": { "version": "16.9.5", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-16.9.5.tgz", diff --git a/superset-frontend/package.json b/superset-frontend/package.json index 4b3c2b526f..b089bf8146 100644 --- a/superset-frontend/package.json +++ b/superset-frontend/package.json @@ -63,7 +63,7 @@ "@superset-ui/chart-composition": "^0.13.5", "@superset-ui/color": "^0.13.3", "@superset-ui/connection": "^0.13.5", - "@superset-ui/control-utils": "^0.13.3", + "@superset-ui/control-utils": "^0.13.9", "@superset-ui/core": "^0.13.5", "@superset-ui/dimension": "^0.13.3", "@superset-ui/legacy-plugin-chart-calendar": "^0.13.6", @@ -79,7 +79,7 @@ "@superset-ui/legacy-plugin-chart-markup": "^0.13.3", "@superset-ui/legacy-plugin-chart-paired-t-test": "^0.13.5", "@superset-ui/legacy-plugin-chart-parallel-coordinates": "^0.13.3", - "@superset-ui/legacy-plugin-chart-partition": "^0.13.5", + "@superset-ui/legacy-plugin-chart-partition": "^0.13.11", "@superset-ui/legacy-plugin-chart-pivot-table": "^0.13.10", "@superset-ui/legacy-plugin-chart-rose": "^0.13.10", "@superset-ui/legacy-plugin-chart-sankey": "^0.13.10", diff --git a/superset-frontend/spec/javascripts/components/ColumnOption_spec.jsx b/superset-frontend/spec/javascripts/components/ColumnOption_spec.jsx index 6e780b33a1..8375ba6c16 100644 --- a/superset-frontend/spec/javascripts/components/ColumnOption_spec.jsx +++ b/superset-frontend/spec/javascripts/components/ColumnOption_spec.jsx @@ -19,9 +19,9 @@ import React from 'react'; import { shallow } from 'enzyme'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import ColumnOption from 'src/components/ColumnOption'; import ColumnTypeLabel from 'src/components/ColumnTypeLabel'; -import InfoTooltipWithTrigger from 'src/components/InfoTooltipWithTrigger'; describe('ColumnOption', () => { const defaultProps = { diff --git a/superset-frontend/spec/javascripts/components/FormRow_spec.jsx b/superset-frontend/spec/javascripts/components/FormRow_spec.jsx index cd53bd667a..631658ded3 100644 --- a/superset-frontend/spec/javascripts/components/FormRow_spec.jsx +++ b/superset-frontend/spec/javascripts/components/FormRow_spec.jsx @@ -19,9 +19,9 @@ import React from 'react'; import { shallow } from 'enzyme'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import { Col, Row } from 'react-bootstrap'; import TextControl from 'src/explore/components/controls/TextControl'; -import InfoTooltipWithTrigger from 'src/components/InfoTooltipWithTrigger'; import FormRow from 'src/components/FormRow'; const defaultProps = { diff --git a/superset-frontend/spec/javascripts/components/MetricOption_spec.jsx b/superset-frontend/spec/javascripts/components/MetricOption_spec.jsx index c78af99d26..1ab8314d17 100644 --- a/superset-frontend/spec/javascripts/components/MetricOption_spec.jsx +++ b/superset-frontend/spec/javascripts/components/MetricOption_spec.jsx @@ -18,10 +18,10 @@ */ import React from 'react'; import { shallow } from 'enzyme'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import MetricOption from 'src/components/MetricOption'; import ColumnTypeLabel from 'src/components/ColumnTypeLabel'; -import InfoTooltipWithTrigger from 'src/components/InfoTooltipWithTrigger'; describe('MetricOption', () => { const defaultProps = { diff --git a/superset-frontend/spec/javascripts/components/OptionDescription_spec.jsx b/superset-frontend/spec/javascripts/components/OptionDescription_spec.jsx deleted file mode 100644 index 3b847d4fa1..0000000000 --- a/superset-frontend/spec/javascripts/components/OptionDescription_spec.jsx +++ /dev/null @@ -1,48 +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 React from 'react'; -import { shallow } from 'enzyme'; - -import InfoTooltipWithTrigger from 'src/components/InfoTooltipWithTrigger'; -import OptionDescription from 'src/components/OptionDescription'; - -const defaultProps = { - option: { - label: 'Some option', - description: 'Description for some option', - }, -}; - -describe('OptionDescription', () => { - let wrapper; - let props; - - beforeEach(() => { - props = { option: { ...defaultProps.option } }; - wrapper = shallow(); - }); - - it('renders an InfoTooltipWithTrigger', () => { - expect(wrapper.find(InfoTooltipWithTrigger)).toHaveLength(1); - }); - - it('renders a span with the label', () => { - expect(wrapper.find('.option-label').text()).toBe('Some option'); - }); -}); diff --git a/superset-frontend/spec/javascripts/explore/components/ControlPanelSection_spec.jsx b/superset-frontend/spec/javascripts/explore/components/ControlPanelSection_spec.jsx index e2839fdb46..4e30807707 100644 --- a/superset-frontend/spec/javascripts/explore/components/ControlPanelSection_spec.jsx +++ b/superset-frontend/spec/javascripts/explore/components/ControlPanelSection_spec.jsx @@ -19,9 +19,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { Panel } from 'react-bootstrap'; - -import InfoTooltipWithTrigger from 'src/components/InfoTooltipWithTrigger'; - +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import ControlPanelSection from 'src/explore/components/ControlPanelSection'; const defaultProps = { diff --git a/superset-frontend/src/SqlLab/components/ExploreCtasResultsButton.jsx b/superset-frontend/src/SqlLab/components/ExploreCtasResultsButton.jsx index b90d351b31..7f72a85a69 100644 --- a/superset-frontend/src/SqlLab/components/ExploreCtasResultsButton.jsx +++ b/superset-frontend/src/SqlLab/components/ExploreCtasResultsButton.jsx @@ -22,10 +22,10 @@ import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import Dialog from 'react-bootstrap-dialog'; import { t } from '@superset-ui/translation'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import { exportChart } from '../../explore/exploreUtils'; import * as actions from '../actions/sqlLab'; -import InfoTooltipWithTrigger from '../../components/InfoTooltipWithTrigger'; import Button from '../../components/Button'; const propTypes = { @@ -36,6 +36,7 @@ const propTypes = { errorMessage: PropTypes.string, templateParams: PropTypes.string, }; + const defaultProps = { vizRequest: {}, }; diff --git a/superset-frontend/src/SqlLab/components/ExploreResultsButton.jsx b/superset-frontend/src/SqlLab/components/ExploreResultsButton.jsx index 2e8746448c..bf2fd55d7f 100644 --- a/superset-frontend/src/SqlLab/components/ExploreResultsButton.jsx +++ b/superset-frontend/src/SqlLab/components/ExploreResultsButton.jsx @@ -24,11 +24,11 @@ import { connect } from 'react-redux'; import { Alert } from 'react-bootstrap'; import Dialog from 'react-bootstrap-dialog'; import { t } from '@superset-ui/translation'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import shortid from 'shortid'; import { exportChart } from '../../explore/exploreUtils'; import * as actions from '../actions/sqlLab'; -import InfoTooltipWithTrigger from '../../components/InfoTooltipWithTrigger'; import Button from '../../components/Button'; const propTypes = { diff --git a/superset-frontend/src/SqlLab/components/TemplateParamsEditor.jsx b/superset-frontend/src/SqlLab/components/TemplateParamsEditor.jsx index c907ce26a1..41413733e0 100644 --- a/superset-frontend/src/SqlLab/components/TemplateParamsEditor.jsx +++ b/superset-frontend/src/SqlLab/components/TemplateParamsEditor.jsx @@ -27,9 +27,9 @@ import 'brace/mode/markdown'; import 'brace/theme/textmate'; import { t } from '@superset-ui/translation'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import ModalTrigger from '../../components/ModalTrigger'; -import InfoTooltipWithTrigger from '../../components/InfoTooltipWithTrigger'; import Button from '../../components/Button'; const propTypes = { diff --git a/superset-frontend/src/components/ActionMenuItem.jsx b/superset-frontend/src/components/ActionMenuItem.jsx index dbb5d519c8..23eff70486 100644 --- a/superset-frontend/src/components/ActionMenuItem.jsx +++ b/superset-frontend/src/components/ActionMenuItem.jsx @@ -20,7 +20,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { MenuItem } from 'react-bootstrap'; -import InfoTooltipWithTrigger from './InfoTooltipWithTrigger'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; export function MenuItemContent({ faIcon, text, tooltip, children }) { return ( diff --git a/superset-frontend/src/components/ColumnOption.jsx b/superset-frontend/src/components/ColumnOption.jsx index 6196006747..0fed0b2710 100644 --- a/superset-frontend/src/components/ColumnOption.jsx +++ b/superset-frontend/src/components/ColumnOption.jsx @@ -19,8 +19,8 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import ColumnTypeLabel from './ColumnTypeLabel'; -import InfoTooltipWithTrigger from './InfoTooltipWithTrigger'; const propTypes = { column: PropTypes.object.isRequired, diff --git a/superset-frontend/src/components/FormRow.jsx b/superset-frontend/src/components/FormRow.jsx index 1581271a0d..9e2f5f4a12 100644 --- a/superset-frontend/src/components/FormRow.jsx +++ b/superset-frontend/src/components/FormRow.jsx @@ -20,7 +20,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Row, Col } from 'react-bootstrap'; -import InfoTooltipWithTrigger from './InfoTooltipWithTrigger'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; const STYLE_ROW = { marginTop: '5px', minHeight: '30px' }; const STYLE_RALIGN = { textAlign: 'right' }; diff --git a/superset-frontend/src/components/InfoTooltipWithTrigger.jsx b/superset-frontend/src/components/InfoTooltipWithTrigger.jsx deleted file mode 100644 index 518137c879..0000000000 --- a/superset-frontend/src/components/InfoTooltipWithTrigger.jsx +++ /dev/null @@ -1,77 +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 React from 'react'; -import PropTypes from 'prop-types'; -import { kebabCase } from 'lodash'; -import { Tooltip, OverlayTrigger } from 'react-bootstrap'; - -const propTypes = { - label: PropTypes.string.isRequired, - tooltip: PropTypes.string, - icon: PropTypes.string, - className: PropTypes.string, - onClick: PropTypes.func, - placement: PropTypes.string, - bsStyle: PropTypes.string, -}; -const defaultProps = { - icon: 'info-circle', - className: 'text-muted', - placement: 'right', -}; -const tooltipStyle = { wordWrap: 'break-word' }; - -export default function InfoTooltipWithTrigger({ - label, - tooltip, - icon, - className, - onClick, - placement, - bsStyle, -}) { - const iconClass = `fa fa-${icon} ${className} ${ - bsStyle ? `text-${bsStyle}` : '' - }`; - const iconEl = ( - - ); - if (!tooltip) { - return iconEl; - } - return ( - - {tooltip} - - } - > - {iconEl} - - ); -} - -InfoTooltipWithTrigger.propTypes = propTypes; -InfoTooltipWithTrigger.defaultProps = defaultProps; diff --git a/superset-frontend/src/components/ListView/LegacyFilters.tsx b/superset-frontend/src/components/ListView/LegacyFilters.tsx index 6c493bc636..1b0d40b31c 100644 --- a/superset-frontend/src/components/ListView/LegacyFilters.tsx +++ b/superset-frontend/src/components/ListView/LegacyFilters.tsx @@ -67,6 +67,7 @@ export const FilterMenu = ({ setInternalFilters([...internalFilters, fltr]) } @@ -112,6 +113,7 @@ export const FilterInputs = ({ bsSize="small" value={ft.operator} placeholder={filter ? getDefaultFilterOperator(filter) : ''} + // @ts-ignore onChange={(e: React.ChangeEvent) => { updateInternalFilter(i, { operator: e.currentTarget.value, @@ -146,6 +148,7 @@ export const FilterInputs = ({ /> )} {filter.input !== 'select' && ( + // @ts-ignore = ({ } > {bulkActions.map(action => ( + // @ts-ignore - {option.label} - {option.description && ( - - )} - - ); -} -OptionDescription.propTypes = propTypes; diff --git a/superset-frontend/src/components/PopoverSection.jsx b/superset-frontend/src/components/PopoverSection.jsx index 955594e21d..dac05a9b26 100644 --- a/superset-frontend/src/components/PopoverSection.jsx +++ b/superset-frontend/src/components/PopoverSection.jsx @@ -18,7 +18,7 @@ */ import React from 'react'; import PropTypes from 'prop-types'; -import InfoTooltipWithTrigger from './InfoTooltipWithTrigger'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; const propTypes = { title: PropTypes.string.isRequired, diff --git a/superset-frontend/src/explore/components/AdhocFilterOption.jsx b/superset-frontend/src/explore/components/AdhocFilterOption.jsx index ea17315b85..0245920f96 100644 --- a/superset-frontend/src/explore/components/AdhocFilterOption.jsx +++ b/superset-frontend/src/explore/components/AdhocFilterOption.jsx @@ -20,12 +20,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Label, OverlayTrigger } from 'react-bootstrap'; import { t } from '@superset-ui/translation'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import AdhocFilterEditPopover from './AdhocFilterEditPopover'; import AdhocFilter from '../AdhocFilter'; import columnType from '../propTypes/columnType'; import adhocMetricType from '../propTypes/adhocMetricType'; -import InfoTooltipWithTrigger from '../../components/InfoTooltipWithTrigger'; const propTypes = { adhocFilter: PropTypes.instanceOf(AdhocFilter).isRequired, diff --git a/superset-frontend/src/explore/components/ControlHeader.jsx b/superset-frontend/src/explore/components/ControlHeader.jsx index d0d0050f8a..6a51306a21 100644 --- a/superset-frontend/src/explore/components/ControlHeader.jsx +++ b/superset-frontend/src/explore/components/ControlHeader.jsx @@ -20,7 +20,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { t } from '@superset-ui/translation'; import { ControlLabel, OverlayTrigger, Tooltip } from 'react-bootstrap'; -import InfoTooltipWithTrigger from '../../components/InfoTooltipWithTrigger'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; const propTypes = { name: PropTypes.string, diff --git a/superset-frontend/src/explore/components/ControlPanelSection.jsx b/superset-frontend/src/explore/components/ControlPanelSection.jsx index 772fb6b293..1f8ca53c07 100644 --- a/superset-frontend/src/explore/components/ControlPanelSection.jsx +++ b/superset-frontend/src/explore/components/ControlPanelSection.jsx @@ -19,7 +19,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Panel } from 'react-bootstrap'; -import InfoTooltipWithTrigger from '../../components/InfoTooltipWithTrigger'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; const propTypes = { label: PropTypes.string, diff --git a/superset-frontend/src/explore/components/PropertiesModal.tsx b/superset-frontend/src/explore/components/PropertiesModal.tsx index 56ab36c04f..5418371c5f 100644 --- a/superset-frontend/src/explore/components/PropertiesModal.tsx +++ b/superset-frontend/src/explore/components/PropertiesModal.tsx @@ -183,6 +183,7 @@ function PropertiesModal({ slice, onHide, onSave }: InternalProps) { type="text" bsSize="sm" value={name} + // @ts-ignore onChange={(event: React.ChangeEvent) => setName(event.target.value) } @@ -198,6 +199,7 @@ function PropertiesModal({ slice, onHide, onSave }: InternalProps) { componentClass="textarea" bsSize="sm" value={description} + // @ts-ignore onChange={(event: React.ChangeEvent) => setDescription(event.target.value) } @@ -221,6 +223,7 @@ function PropertiesModal({ slice, onHide, onSave }: InternalProps) { type="text" bsSize="sm" value={cacheTimeout} + // @ts-ignore onChange={(event: React.ChangeEvent) => setCacheTimeout(event.target.value.replace(/[^0-9]/, '')) } diff --git a/superset-frontend/src/explore/components/controls/AnnotationLayerControl.jsx b/superset-frontend/src/explore/components/controls/AnnotationLayerControl.jsx index 7339c1223c..340a192a07 100644 --- a/superset-frontend/src/explore/components/controls/AnnotationLayerControl.jsx +++ b/superset-frontend/src/explore/components/controls/AnnotationLayerControl.jsx @@ -26,9 +26,9 @@ import { } from 'react-bootstrap'; import { connect } from 'react-redux'; import { t } from '@superset-ui/translation'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import { getChartKey } from '../../exploreUtils'; import { runAnnotationQuery } from '../../../chart/chartAction'; -import InfoTooltipWithTrigger from '../../../components/InfoTooltipWithTrigger'; import AnnotationLayer from './AnnotationLayer'; diff --git a/superset-frontend/src/explore/components/controls/CollectionControl.jsx b/superset-frontend/src/explore/components/controls/CollectionControl.jsx index 1a74e2ce34..55c0ff2b75 100644 --- a/superset-frontend/src/explore/components/controls/CollectionControl.jsx +++ b/superset-frontend/src/explore/components/controls/CollectionControl.jsx @@ -27,7 +27,7 @@ import { arrayMove, } from 'react-sortable-hoc'; -import InfoTooltipWithTrigger from '../../../components/InfoTooltipWithTrigger'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import ControlHeader from '../ControlHeader'; import controlMap from './'; import './CollectionControl.less'; diff --git a/superset-frontend/src/explore/components/controls/FilterBoxItemControl.jsx b/superset-frontend/src/explore/components/controls/FilterBoxItemControl.jsx index eec348ec27..2928dca2b2 100644 --- a/superset-frontend/src/explore/components/controls/FilterBoxItemControl.jsx +++ b/superset-frontend/src/explore/components/controls/FilterBoxItemControl.jsx @@ -21,7 +21,7 @@ import PropTypes from 'prop-types'; import { OverlayTrigger, Popover } from 'react-bootstrap'; import { t } from '@superset-ui/translation'; -import InfoTooltipWithTrigger from '../../../components/InfoTooltipWithTrigger'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import FormRow from '../../../components/FormRow'; import SelectControl from './SelectControl'; import CheckboxControl from './CheckboxControl'; diff --git a/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl.jsx b/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl.jsx index c1e6724f21..fd1b79b90a 100644 --- a/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl.jsx +++ b/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl.jsx @@ -28,7 +28,7 @@ import { import Select from 'react-select'; import { t } from '@superset-ui/translation'; -import InfoTooltipWithTrigger from '../../../components/InfoTooltipWithTrigger'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import BoundsControl from './BoundsControl'; import CheckboxControl from './CheckboxControl'; diff --git a/superset-frontend/src/explore/controlPanels/Partition.jsx b/superset-frontend/src/explore/controlPanels/Partition.jsx deleted file mode 100644 index cb01bc7904..0000000000 --- a/superset-frontend/src/explore/controlPanels/Partition.jsx +++ /dev/null @@ -1,233 +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 React from 'react'; -import { t } from '@superset-ui/translation'; -import { validateNonEmpty } from '@superset-ui/validator'; -import OptionDescription from '../../components/OptionDescription'; -import { NVD3TimeSeries } from './sections'; -import { - D3_TIME_FORMAT_OPTIONS, - D3_FORMAT_DOCS, - D3_FORMAT_OPTIONS, -} from '../controls'; - -export default { - controlPanelSections: [ - { - label: t('Query'), - expanded: true, - controlSetRows: [ - ['metrics'], - ['adhoc_filters'], - ['groupby'], - ['limit', 'timeseries_limit_metric'], - [ - { - name: 'order_desc', - config: { - type: 'CheckboxControl', - label: t('Sort Descending'), - default: true, - description: t('Whether to sort descending or ascending'), - }, - }, - { - name: 'contribution', - config: { - type: 'CheckboxControl', - label: t('Contribution'), - default: false, - description: t('Compute the contribution to the total'), - }, - }, - ], - ['row_limit', null], - ], - }, - { - label: t('Time Series Options'), - expanded: true, - controlSetRows: [ - [ - { - name: 'time_series_option', - config: { - type: 'SelectControl', - label: t('Options'), - validators: [validateNonEmpty], - default: 'not_time', - valueKey: 'value', - options: [ - { - label: t('Not Time Series'), - value: 'not_time', - description: t('Ignore time'), - }, - { - label: t('Time Series'), - value: 'time_series', - description: t('Standard time series'), - }, - { - label: t('Aggregate Mean'), - value: 'agg_mean', - description: t('Mean of values over specified period'), - }, - { - label: t('Aggregate Sum'), - value: 'agg_sum', - description: t('Sum of values over specified period'), - }, - { - label: t('Difference'), - value: 'point_diff', - description: t( - 'Metric change in value from `since` to `until`', - ), - }, - { - label: t('Percent Change'), - value: 'point_percent', - description: t( - 'Metric percent change in value from `since` to `until`', - ), - }, - { - label: t('Factor'), - value: 'point_factor', - description: t( - 'Metric factor change from `since` to `until`', - ), - }, - { - label: t('Advanced Analytics'), - value: 'adv_anal', - description: t('Use the Advanced Analytics options below'), - }, - ], - optionRenderer: op => , - valueRenderer: op => , - description: t('Settings for time series'), - }, - }, - ], - ], - }, - { - label: t('Chart Options'), - expanded: true, - controlSetRows: [ - ['color_scheme', 'label_colors'], - [ - { - name: 'number_format', - config: { - type: 'SelectControl', - freeForm: true, - label: t('Number format'), - renderTrigger: true, - default: 'SMART_NUMBER', - choices: D3_FORMAT_OPTIONS, - description: D3_FORMAT_DOCS, - }, - }, - { - name: 'date_time_format', - config: { - type: 'SelectControl', - freeForm: true, - label: t('Date Time Format'), - renderTrigger: true, - default: 'smart_date', - choices: D3_TIME_FORMAT_OPTIONS, - description: D3_FORMAT_DOCS, - }, - }, - ], - [ - { - name: 'partition_limit', - config: { - type: 'TextControl', - label: t('Partition Limit'), - isInt: true, - default: '5', - description: t( - 'The maximum number of subdivisions of each group; ' + - 'lower values are pruned first', - ), - }, - }, - { - name: 'partition_threshold', - config: { - type: 'TextControl', - label: t('Partition Threshold'), - isFloat: true, - default: '0.05', - description: t( - 'Partitions whose height to parent height proportions are ' + - 'below this value are pruned', - ), - }, - }, - ], - [ - { - name: 'log_scale', - config: { - type: 'CheckboxControl', - label: t('Log Scale'), - default: false, - renderTrigger: true, - description: t('Use a log scale'), - }, - }, - { - name: 'equal_date_size', - config: { - type: 'CheckboxControl', - label: t('Equal Date Sizes'), - default: true, - renderTrigger: true, - description: t( - 'Check to force date partitions to have the same height', - ), - }, - }, - ], - [ - { - name: 'rich_tooltip', - config: { - type: 'CheckboxControl', - label: t('Rich Tooltip'), - renderTrigger: true, - default: true, - description: t( - 'The rich tooltip shows a list of all series for that point in time', - ), - }, - }, - ], - ], - }, - NVD3TimeSeries[1], - ], -}; diff --git a/superset-frontend/src/setup/setupPlugins.ts b/superset-frontend/src/setup/setupPlugins.ts index a94fc2e91b..b98e8c9984 100644 --- a/superset-frontend/src/setup/setupPlugins.ts +++ b/superset-frontend/src/setup/setupPlugins.ts @@ -41,7 +41,6 @@ import Mapbox from '../explore/controlPanels/Mapbox'; import Markup from '../explore/controlPanels/Markup'; import PairedTtest from '../explore/controlPanels/PairedTtest'; import Para from '../explore/controlPanels/Para'; -import Partition from '../explore/controlPanels/Partition'; import Separator from '../explore/controlPanels/Separator'; import Table from '../explore/controlPanels/Table'; import TimeTable from '../explore/controlPanels/TimeTable'; @@ -63,7 +62,6 @@ export default function setupPlugins() { .registerValue('markup', Markup) .registerValue('paired_ttest', PairedTtest) .registerValue('para', Para) - .registerValue('partition', Partition) .registerValue('separator', Separator) .registerValue('table', Table) .registerValue('time_table', TimeTable) diff --git a/superset-frontend/src/visualizations/TimeTable/TimeTable.jsx b/superset-frontend/src/visualizations/TimeTable/TimeTable.jsx index a82e46af82..866dc7a51e 100644 --- a/superset-frontend/src/visualizations/TimeTable/TimeTable.jsx +++ b/superset-frontend/src/visualizations/TimeTable/TimeTable.jsx @@ -24,9 +24,9 @@ import { Table, Thead, Th, Tr, Td } from 'reactable-arc'; import { formatNumber } from '@superset-ui/number-format'; import { formatTime } from '@superset-ui/time-format'; import moment from 'moment'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import MetricOption from '../../components/MetricOption'; -import InfoTooltipWithTrigger from '../../components/InfoTooltipWithTrigger'; import FormattedNumber from './FormattedNumber'; import SparklineCell from './SparklineCell'; import './TimeTable.less'; diff --git a/superset/assets/src/SqlLab/components/ExploreCtasResultsButton.jsx b/superset/assets/src/SqlLab/components/ExploreCtasResultsButton.jsx index b90d351b31..254e723088 100644 --- a/superset/assets/src/SqlLab/components/ExploreCtasResultsButton.jsx +++ b/superset/assets/src/SqlLab/components/ExploreCtasResultsButton.jsx @@ -22,10 +22,10 @@ import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import Dialog from 'react-bootstrap-dialog'; import { t } from '@superset-ui/translation'; +import { InfoTooltipWithTrigger } from '@superset-ui/control-utils'; import { exportChart } from '../../explore/exploreUtils'; import * as actions from '../actions/sqlLab'; -import InfoTooltipWithTrigger from '../../components/InfoTooltipWithTrigger'; import Button from '../../components/Button'; const propTypes = {