This is an automated email from the ASF dual-hosted git repository.
yjc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new c3f1873c43 fix(sqllab): Add templateParams on kv store (#22013)
c3f1873c43 is described below
commit c3f1873c4314ba19a508118a9876c345e50ab204
Author: JUST.in DO IT <[email protected]>
AuthorDate: Mon Nov 14 10:46:21 2022 -0800
fix(sqllab): Add templateParams on kv store (#22013)
---
superset-frontend/src/SqlLab/actions/sqlLab.js | 1 +
.../ShareSqlLabQuery/ShareSqlLabQuery.test.tsx | 1 +
.../src/SqlLab/components/ShareSqlLabQuery/index.tsx | 16 +++++++++++-----
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/superset-frontend/src/SqlLab/actions/sqlLab.js
b/superset-frontend/src/SqlLab/actions/sqlLab.js
index 0d20f06c92..a58630cda1 100644
--- a/superset-frontend/src/SqlLab/actions/sqlLab.js
+++ b/superset-frontend/src/SqlLab/actions/sqlLab.js
@@ -1365,6 +1365,7 @@ export function popStoredQuery(urlId) {
schema: json.schema ? json.schema : null,
autorun: json.autorun ? json.autorun : false,
sql: json.sql ? json.sql : 'SELECT ...',
+ templateParams: json.templateParams,
}),
),
)
diff --git
a/superset-frontend/src/SqlLab/components/ShareSqlLabQuery/ShareSqlLabQuery.test.tsx
b/superset-frontend/src/SqlLab/components/ShareSqlLabQuery/ShareSqlLabQuery.test.tsx
index 2c2038f5c4..6e9775c3a5 100644
---
a/superset-frontend/src/SqlLab/components/ShareSqlLabQuery/ShareSqlLabQuery.test.tsx
+++
b/superset-frontend/src/SqlLab/components/ShareSqlLabQuery/ShareSqlLabQuery.test.tsx
@@ -72,6 +72,7 @@ const unsavedQueryEditor = {
schema: 'query_schema_updated',
sql: 'SELECT * FROM Updated Limit 100',
autorun: true,
+ templateParams: '{ "my_value": "foo" }',
};
const standardProviderWithUnsaved: React.FC = ({ children }) => (
diff --git a/superset-frontend/src/SqlLab/components/ShareSqlLabQuery/index.tsx
b/superset-frontend/src/SqlLab/components/ShareSqlLabQuery/index.tsx
index f1e6d13c41..a7d88483ca 100644
--- a/superset-frontend/src/SqlLab/components/ShareSqlLabQuery/index.tsx
+++ b/superset-frontend/src/SqlLab/components/ShareSqlLabQuery/index.tsx
@@ -48,13 +48,19 @@ function ShareSqlLabQuery({
}: ShareSqlLabQueryPropTypes) {
const theme = useTheme();
- const { dbId, name, schema, autorun, sql, remoteId } = useQueryEditor(
- queryEditorId,
- ['dbId', 'name', 'schema', 'autorun', 'sql', 'remoteId'],
- );
+ const { dbId, name, schema, autorun, sql, remoteId, templateParams } =
+ useQueryEditor(queryEditorId, [
+ 'dbId',
+ 'name',
+ 'schema',
+ 'autorun',
+ 'sql',
+ 'remoteId',
+ 'templateParams',
+ ]);
const getCopyUrlForKvStore = (callback: Function) => {
- const sharedQuery = { dbId, name, schema, autorun, sql };
+ const sharedQuery = { dbId, name, schema, autorun, sql, templateParams };
return storeQuery(sharedQuery)
.then(shortUrl => {