mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
refactor(sqllab): migrate share queries via kv by permalink (#29163)
This commit is contained in:
@@ -1167,9 +1167,31 @@ export function persistEditorHeight(queryEditor, northPercent, southPercent) {
|
||||
};
|
||||
}
|
||||
|
||||
export function popPermalink(key) {
|
||||
return function (dispatch) {
|
||||
return SupersetClient.get({ endpoint: `/api/v1/sqllab/permalink/${key}` })
|
||||
.then(({ json }) =>
|
||||
dispatch(
|
||||
addQueryEditor({
|
||||
name: json.name ? json.name : t('Shared query'),
|
||||
dbId: json.dbId ? parseInt(json.dbId, 10) : null,
|
||||
catalog: json.catalog ? json.catalog : null,
|
||||
schema: json.schema ? json.schema : null,
|
||||
autorun: json.autorun ? json.autorun : false,
|
||||
sql: json.sql ? json.sql : 'SELECT ...',
|
||||
templateParams: json.templateParams,
|
||||
}),
|
||||
),
|
||||
)
|
||||
.catch(() => dispatch(addDangerToast(ERR_MSG_CANT_LOAD_QUERY)));
|
||||
};
|
||||
}
|
||||
|
||||
export function popStoredQuery(urlId) {
|
||||
return function (dispatch) {
|
||||
return SupersetClient.get({ endpoint: `/kv/${urlId}` })
|
||||
return SupersetClient.get({
|
||||
endpoint: `/api/v1/sqllab/permalink/kv:${urlId}`,
|
||||
})
|
||||
.then(({ json }) =>
|
||||
dispatch(
|
||||
addQueryEditor({
|
||||
|
||||
Reference in New Issue
Block a user