diff --git a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/buildQuery.ts b/superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/buildQuery.ts deleted file mode 100644 index 94607704acf..00000000000 --- a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/buildQuery.ts +++ /dev/null @@ -1,23 +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 { SpatialFormData, buildSpatialQuery } from '../spatialUtils'; - -export default function buildQuery(formData: SpatialFormData) { - return buildSpatialQuery(formData); -} diff --git a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/index.ts b/superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/index.ts deleted file mode 100644 index 30c6d9d7f67..00000000000 --- a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/index.ts +++ /dev/null @@ -1,53 +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 '@apache-superset/core/translation'; -import { ChartMetadata, ChartPlugin, Behavior } from '@superset-ui/core'; -import thumbnail from './images/thumbnail.png'; -import thumbnailDark from './images/thumbnail-dark.png'; -import example from './images/example.png'; -import exampleDark from './images/example-dark.png'; -import buildQuery from './buildQuery'; -import transformProps from './transformProps'; -import controlPanel from './controlPanel'; - -const metadata = new ChartMetadata({ - category: t('Map'), - credits: ['https://uber.github.io/deck.gl'], - description: t( - 'Aggregates data within the boundary of grid cells and maps the aggregated values to a dynamic color scale', - ), - name: t('deck.gl Screen Grid'), - thumbnail, - thumbnailDark, - exampleGallery: [{ url: example, urlDark: exampleDark }], - tags: [t('deckGL'), t('Comparison'), t('Intensity'), t('Density')], - behaviors: [Behavior.InteractiveChart], -}); - -export default class ScreengridChartPlugin extends ChartPlugin { - constructor() { - super({ - buildQuery, - loadChart: () => import('./Screengrid'), - controlPanel, - metadata, - transformProps, - }); - } -} diff --git a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/controlPanel.ts b/superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/index.tsx similarity index 64% rename from superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/controlPanel.ts rename to superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/index.tsx index feaa07d1c03..3d2f08ed8e4 100644 --- a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/controlPanel.ts +++ b/superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/index.tsx @@ -16,12 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -import { - ControlPanelConfig, - getStandardizedControls, -} from '@superset-ui/chart-controls'; import { t } from '@apache-superset/core/translation'; -import { validateNonEmpty } from '@superset-ui/core'; +import { Behavior, validateNonEmpty } from '@superset-ui/core'; +import { getStandardizedControls } from '@superset-ui/chart-controls'; +import { defineChart } from '@superset-ui/glyph-core'; +import ScreengridComponent from './Screengrid'; +import { + SpatialFormData, + buildSpatialQuery, + transformSpatialProps, +} from '../spatialUtils'; import timeGrainSqlaAnimationOverrides from '../../utilities/controls'; import { filterNulls, @@ -43,9 +47,29 @@ import { tooltipTemplate, } from '../../utilities/Shared_DeckGL'; import { COLOR_SCHEME_TYPES } from '../../utilities/utils'; +import thumbnail from './images/thumbnail.png'; +import thumbnailDark from './images/thumbnail-dark.png'; +import example from './images/example.png'; +import exampleDark from './images/example-dark.png'; -const config: ControlPanelConfig = { - controlPanelSections: [ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export default defineChart, any>({ + metadata: { + name: t('deck.gl Screen Grid'), + description: t( + 'Aggregates data within the boundary of grid cells and maps the aggregated values to a dynamic color scale', + ), + category: t('Map'), + credits: ['https://uber.github.io/deck.gl'], + behaviors: [Behavior.InteractiveChart], + tags: [t('deckGL'), t('Comparison'), t('Intensity'), t('Density')], + thumbnail, + thumbnailDark, + exampleGallery: [{ url: example, urlDark: exampleDark }], + }, + arguments: {}, + suppressQuerySection: true, + prependSections: [ { label: t('Query'), expanded: true, @@ -104,7 +128,7 @@ const config: ControlPanelConfig = { ], }, ], - controlOverrides: { + additionalControlOverrides: { size: { label: t('Weight'), description: t("Metric used as a weight for the grid's coloring"), @@ -116,6 +140,11 @@ const config: ControlPanelConfig = { ...formData, size: getStandardizedControls().shiftMetric(), }), -}; - -export default config; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + buildQuery: (formData: any) => buildSpatialQuery(formData as SpatialFormData), + transform: chartProps => transformSpatialProps(chartProps), + render: ({ transformedProps }) => ( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + + ), +}); diff --git a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/transformProps.ts b/superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/transformProps.ts deleted file mode 100644 index 4b8f437d7fc..00000000000 --- a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Screengrid/transformProps.ts +++ /dev/null @@ -1,24 +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 { ChartProps } from '@superset-ui/core'; -import { transformSpatialProps } from '../spatialUtils'; - -export default function transformProps(chartProps: ChartProps) { - return transformSpatialProps(chartProps); -}