You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ta...@apache.org on 2020/11/11 01:32:53 UTC

[incubator-superset] branch master updated: fix(saved-query): handle case where sql_tables in undefined (#11649)

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

tai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 329e728  fix(saved-query): handle case where sql_tables in undefined (#11649)
329e728 is described below

commit 329e72885c20d3a36f70dbe2909c4665f51ec92f
Author: ʈᵃᵢ <td...@gmail.com>
AuthorDate: Tue Nov 10 15:26:29 2020 -1000

    fix(saved-query): handle case where sql_tables in undefined (#11649)
---
 .../src/views/CRUD/data/savedquery/SavedQueryList.tsx    | 16 ++++++++++------
 superset-frontend/src/views/CRUD/types.ts                |  2 +-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx b/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx
index bfb4719..88ed015 100644
--- a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx
+++ b/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx
@@ -245,7 +245,7 @@ function SavedQueryList({
       {
         Cell: ({
           row: {
-            original: { sql_tables: tables },
+            original: { sql_tables: tables = [] },
           },
         }: any) => {
           const names = tables.map((table: any) => table.table);
@@ -385,9 +385,11 @@ function SavedQueryList({
           'saved_query',
           'database',
           createErrorHandler(errMsg =>
-            t(
-              'An error occurred while fetching dataset datasource values: %s',
-              errMsg,
+            addDangerToast(
+              t(
+                'An error occurred while fetching dataset datasource values: %s',
+                errMsg,
+              ),
             ),
           ),
         ),
@@ -403,7 +405,9 @@ function SavedQueryList({
           'saved_query',
           'schema',
           createErrorHandler(errMsg =>
-            t('An error occurred while fetching schema values: %s', errMsg),
+            addDangerToast(
+              t('An error occurred while fetching schema values: %s', errMsg),
+            ),
           ),
         ),
         paginate: true,
@@ -415,7 +419,7 @@ function SavedQueryList({
         operator: 'all_text',
       },
     ],
-    [],
+    [addDangerToast],
   );
 
   return (
diff --git a/superset-frontend/src/views/CRUD/types.ts b/superset-frontend/src/views/CRUD/types.ts
index 4ce5912..27e5f00 100644
--- a/superset-frontend/src/views/CRUD/types.ts
+++ b/superset-frontend/src/views/CRUD/types.ts
@@ -57,5 +57,5 @@ export type SavedQueryObject = {
   label: string;
   schema: string;
   sql: string;
-  sql_tables: Array<{ catalog?: string; schema: string; table: string }>;
+  sql_tables?: { catalog?: string; schema: string; table: string }[];
 };