This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch semantic-layer-feature
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/semantic-layer-feature by this 
push:
     new 955d8bc205c Frontend support
955d8bc205c is described below

commit 955d8bc205cfbedf98e2c23c41f80fd80563f2d8
Author: Beto Dealmeida <[email protected]>
AuthorDate: Fri Feb 6 19:02:51 2026 -0500

    Frontend support
---
 .../superset-ui-core/src/query/DatasourceKey.ts    | 17 +++++++++----
 .../superset-ui-core/src/query/types/Datasource.ts |  3 ++-
 .../superset-ui-core/src/query/types/Query.ts      |  2 +-
 .../src/components/Chart/DrillBy/DrillByModal.tsx  |  8 +++++--
 superset-frontend/src/dashboard/types.ts           |  2 +-
 .../src/explore/actions/saveModalActions.ts        |  5 ++--
 .../src/explore/exploreUtils/formData.ts           |  8 +++----
 superset/static/service-worker.js                  | 28 +---------------------
 8 files changed, 31 insertions(+), 42 deletions(-)

diff --git 
a/superset-frontend/packages/superset-ui-core/src/query/DatasourceKey.ts 
b/superset-frontend/packages/superset-ui-core/src/query/DatasourceKey.ts
index 38a38e10b13..170f09331b9 100644
--- a/superset-frontend/packages/superset-ui-core/src/query/DatasourceKey.ts
+++ b/superset-frontend/packages/superset-ui-core/src/query/DatasourceKey.ts
@@ -19,16 +19,25 @@
 
 import { DatasourceType } from './types/Datasource';
 
+const DATASOURCE_TYPE_MAP: Record<string, DatasourceType> = {
+  table: DatasourceType.Table,
+  query: DatasourceType.Query,
+  dataset: DatasourceType.Dataset,
+  sl_table: DatasourceType.SlTable,
+  saved_query: DatasourceType.SavedQuery,
+  semantic_view: DatasourceType.SemanticView,
+};
+
 export default class DatasourceKey {
-  readonly id: number;
+  readonly id: number | string;
 
   readonly type: DatasourceType;
 
   constructor(key: string) {
     const [idStr, typeStr] = key.split('__');
-    this.id = parseInt(idStr, 10);
-    this.type = DatasourceType.Table; // default to SqlaTable model
-    this.type = typeStr === 'query' ? DatasourceType.Query : this.type;
+    const isNumeric = /^\d+$/.test(idStr);
+    this.id = isNumeric ? parseInt(idStr, 10) : idStr;
+    this.type = DATASOURCE_TYPE_MAP[typeStr] ?? DatasourceType.Table;
   }
 
   public toString() {
diff --git 
a/superset-frontend/packages/superset-ui-core/src/query/types/Datasource.ts 
b/superset-frontend/packages/superset-ui-core/src/query/types/Datasource.ts
index 47902cf07ae..8fbf63aa4b3 100644
--- a/superset-frontend/packages/superset-ui-core/src/query/types/Datasource.ts
+++ b/superset-frontend/packages/superset-ui-core/src/query/types/Datasource.ts
@@ -26,6 +26,7 @@ export enum DatasourceType {
   Dataset = 'dataset',
   SlTable = 'sl_table',
   SavedQuery = 'saved_query',
+  SemanticView = 'semantic_view',
 }
 
 export interface Currency {
@@ -37,7 +38,7 @@ export interface Currency {
  * Datasource metadata.
  */
 export interface Datasource {
-  id: number;
+  id: number | string;
   name: string;
   type: DatasourceType;
   columns: Column[];
diff --git 
a/superset-frontend/packages/superset-ui-core/src/query/types/Query.ts 
b/superset-frontend/packages/superset-ui-core/src/query/types/Query.ts
index 14d4e2273b2..c1ecc99fae5 100644
--- a/superset-frontend/packages/superset-ui-core/src/query/types/Query.ts
+++ b/superset-frontend/packages/superset-ui-core/src/query/types/Query.ts
@@ -159,7 +159,7 @@ export interface QueryObject
 
 export interface QueryContext {
   datasource: {
-    id: number;
+    id: number | string;
     type: DatasourceType;
   };
   /** Force refresh of all queries */
diff --git a/superset-frontend/src/components/Chart/DrillBy/DrillByModal.tsx 
b/superset-frontend/src/components/Chart/DrillBy/DrillByModal.tsx
index 6245945de45..978277931e2 100644
--- a/superset-frontend/src/components/Chart/DrillBy/DrillByModal.tsx
+++ b/superset-frontend/src/components/Chart/DrillBy/DrillByModal.tsx
@@ -90,11 +90,15 @@ const ModalFooter = ({ formData, closeModal }: 
ModalFooterProps) => {
     findPermission('can_explore', 'Superset', state.user?.roles),
   );
 
-  const [datasource_id, datasource_type] = formData.datasource.split('__');
+  const [datasourceIdStr, datasource_type] = formData.datasource.split('__');
+  const isNumeric = /^\d+$/.test(datasourceIdStr);
+  const datasource_id = isNumeric
+    ? parseInt(datasourceIdStr, 10)
+    : datasourceIdStr;
   useEffect(() => {
     // short circuit if the user is embedded as explore is not available
     if (isEmbedded()) return;
-    postFormData(Number(datasource_id), datasource_type, formData, 0)
+    postFormData(datasource_id, datasource_type, formData, 0)
       .then(key => {
         setUrl(
           
`/explore/?form_data_key=${key}&dashboard_page_id=${dashboardPageId}`,
diff --git a/superset-frontend/src/dashboard/types.ts 
b/superset-frontend/src/dashboard/types.ts
index b2bde968368..162031c695c 100644
--- a/superset-frontend/src/dashboard/types.ts
+++ b/superset-frontend/src/dashboard/types.ts
@@ -272,7 +272,7 @@ export type Slice = {
   changed_on: number;
   changed_on_humanized: string;
   modified: string;
-  datasource_id: number;
+  datasource_id: number | string;
   datasource_type: DatasourceType;
   datasource_url: string;
   datasource_name: string;
diff --git a/superset-frontend/src/explore/actions/saveModalActions.ts 
b/superset-frontend/src/explore/actions/saveModalActions.ts
index 978c5cb09ba..ed1d13fa93b 100644
--- a/superset-frontend/src/explore/actions/saveModalActions.ts
+++ b/superset-frontend/src/explore/actions/saveModalActions.ts
@@ -144,12 +144,13 @@ export const getSlicePayload = async (
     ...adhocFilters,
     dashboards,
   };
-  let datasourceId = 0;
+  let datasourceId: number | string = 0;
   let datasourceType: DatasourceType = DatasourceType.Table;
 
   if (formData.datasource) {
     const [id, typeString] = formData.datasource.split('__');
-    datasourceId = parseInt(id, 10);
+    const isNumeric = /^\d+$/.test(id);
+    datasourceId = isNumeric ? parseInt(id, 10) : id;
 
     const formattedTypeString =
       typeString.charAt(0).toUpperCase() + typeString.slice(1);
diff --git a/superset-frontend/src/explore/exploreUtils/formData.ts 
b/superset-frontend/src/explore/exploreUtils/formData.ts
index 9a83d8fd8da..994b7f0b4c5 100644
--- a/superset-frontend/src/explore/exploreUtils/formData.ts
+++ b/superset-frontend/src/explore/exploreUtils/formData.ts
@@ -20,7 +20,7 @@ import { SupersetClient, JsonObject, JsonResponse } from 
'@superset-ui/core';
 import { sanitizeFormData } from 'src/utils/sanitizeFormData';
 
 type Payload = {
-  datasource_id: number;
+  datasource_id: number | string;
   datasource_type: string;
   form_data: string;
   chart_id?: number;
@@ -36,7 +36,7 @@ const assembleEndpoint = (key?: string, tabId?: string) => {
 };
 
 const assemblePayload = (
-  datasourceId: number,
+  datasourceId: number | string,
   datasourceType: string,
   formData: JsonObject,
   chartId?: number,
@@ -53,7 +53,7 @@ const assemblePayload = (
 };
 
 export const postFormData = (
-  datasourceId: number,
+  datasourceId: number | string,
   datasourceType: string,
   formData: JsonObject,
   chartId?: number,
@@ -70,7 +70,7 @@ export const postFormData = (
   }).then((r: JsonResponse) => r.json.key);
 
 export const putFormData = (
-  datasourceId: number,
+  datasourceId: number | string,
   datasourceType: string,
   key: string,
   formData: JsonObject,
diff --git a/superset/static/service-worker.js 
b/superset/static/service-worker.js
index 43cb14a4894..394fa207693 100644
--- a/superset/static/service-worker.js
+++ b/superset/static/service-worker.js
@@ -1,27 +1 @@
-/**
- * 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.
- */
-
-// Minimal service worker for PWA file handling support
-self.addEventListener('install', event => {
-  event.waitUntil(self.skipWaiting());
-});
-
-self.addEventListener('activate', event => {
-  event.waitUntil(self.clients.claim());
-});
+(()=>{"use strict";let e;var 
r,t,n,o,a,i,f,u,l,s,d,p,c,v,h,g,y={55725(){self.addEventListener("install",e=>{e.waitUntil(self.skipWaiting())}),self.addEventListener("activate",e=>{e.waitUntil(self.clients.claim())})}},b={};function
 m(e){var r=b[e];if(void 0!==r)return r.exports;var 
t=b[e]={id:e,loaded:!1,exports:{}};return 
y[e].call(t.exports,t,t.exports,m),t.loaded=!0,t.exports}m.m=y,m.c=b,r=[],m.O=(e,t,n,o)=>{if(t){o=o||0;for(var
 a=r.length;a>0&&r[a-1][2]>o;a--)r[a]=r[a-1];r[a]=[t,n,o]; [...]

Reply via email to