You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/05/15 01:51:55 UTC
(superset) 01/03: feat(glyph): consolidate deckgl Grid layer to defineChart()
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch feat/glyph-single-file
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 6a054f9170ff5046ecbc6019bd00a7da8ef469f5
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Thu May 14 18:47:52 2026 -0700
feat(glyph): consolidate deckgl Grid layer to defineChart()
Collapse multi-file plugin (buildQuery, controlPanel, transformProps,
index) into single index.tsx. Grid uses shared buildSpatialQuery /
transformSpatialProps. Grid.tsx component stays as sibling for Multi.
Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
.../src/layers/Grid/buildQuery.ts | 27 ----------
.../preset-chart-deckgl/src/layers/Grid/index.ts | 53 -------------------
.../src/layers/Grid/{controlPanel.ts => index.tsx} | 59 ++++++++++++++++++----
.../src/layers/Grid/transformProps.ts | 24 ---------
4 files changed, 48 insertions(+), 115 deletions(-)
diff --git a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/buildQuery.ts b/superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/buildQuery.ts
deleted file mode 100644
index fdd73b19649..00000000000
--- a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/buildQuery.ts
+++ /dev/null
@@ -1,27 +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 interface DeckGridFormData extends SpatialFormData {
- extruded?: boolean;
-}
-
-export default function buildQuery(formData: DeckGridFormData) {
- return buildSpatialQuery(formData);
-}
diff --git a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/index.ts b/superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/index.ts
deleted file mode 100644
index 8055b8b716c..00000000000
--- a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/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(
- 'Visualize geospatial data like 3D buildings, landscapes, or objects in grid view.',
- ),
- name: t('deck.gl Grid'),
- thumbnail,
- thumbnailDark,
- exampleGallery: [{ url: example, urlDark: exampleDark }],
- tags: [t('deckGL'), t('3D'), t('Comparison')],
- behaviors: [Behavior.InteractiveChart],
-});
-
-export default class GridChartPlugin extends ChartPlugin {
- constructor() {
- super({
- buildQuery,
- loadChart: () => import('./Grid'),
- controlPanel,
- metadata,
- transformProps,
- });
- }
-}
diff --git a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/controlPanel.ts b/superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/index.tsx
similarity index 53%
rename from superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/controlPanel.ts
rename to superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/index.tsx
index a6363ff5ef2..97737ce29aa 100644
--- a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/controlPanel.ts
+++ b/superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/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 GridComponent from './Grid';
+import {
+ SpatialFormData,
+ buildSpatialQuery,
+ transformSpatialProps,
+} from '../spatialUtils';
import {
filterNulls,
autozoom,
@@ -42,9 +46,37 @@ import {
generateDeckGLColorSchemeControls,
} 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';
+
+// ─── Types ───────────────────────────────────────────────────────────────────
+
+export interface DeckGridFormData extends SpatialFormData {
+ extruded?: boolean;
+}
-const config: ControlPanelConfig = {
- controlPanelSections: [
+// ─── Plugin definition ───────────────────────────────────────────────────────
+
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+export default defineChart<Record<string, never>, any>({
+ metadata: {
+ name: t('deck.gl Grid'),
+ description: t(
+ 'Visualize geospatial data like 3D buildings, landscapes, or objects in grid view.',
+ ),
+ category: t('Map'),
+ credits: ['https://uber.github.io/deck.gl'],
+ behaviors: [Behavior.InteractiveChart],
+ tags: [t('deckGL'), t('3D'), t('Comparison')],
+ thumbnail,
+ thumbnailDark,
+ exampleGallery: [{ url: example, urlDark: exampleDark }],
+ },
+ arguments: {},
+ suppressQuerySection: true,
+ prependSections: [
{
label: t('Query'),
expanded: true,
@@ -85,7 +117,7 @@ const config: ControlPanelConfig = {
],
},
],
- controlOverrides: {
+ additionalControlOverrides: {
size: {
label: t('Height'),
description: t('Metric used to control height'),
@@ -96,6 +128,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 DeckGridFormData),
+ transform: chartProps => transformSpatialProps(chartProps),
+ render: ({ transformedProps }) => (
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ <GridComponent {...(transformedProps as any)} />
+ ),
+});
diff --git a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/transformProps.ts b/superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/transformProps.ts
deleted file mode 100644
index 4b8f437d7fc..00000000000
--- a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Grid/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);
-}