Skip to content

Commit

Permalink
Merge pull request #1162 from merico-dev/1158-show-query-name-in-requ…
Browse files Browse the repository at this point in the history
…est-params

1158 show query name in request params
  • Loading branch information
GerilLeto authored Sep 5, 2023
2 parents 8dbbca3 + 34fac83 commit 24c6a5a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtable/api",
"version": "10.28.0",
"version": "10.29.0",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion dashboard/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtable/dashboard",
"version": "10.28.0",
"version": "10.29.0",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
Expand Down
11 changes: 6 additions & 5 deletions dashboard/src/api-caller/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ export type QueryFailureError = {
};

interface IQueryBySQL {
title: string;
name: string;
query: { type: DataSourceType; key: string; sql: string; pre_process: string; post_process: string };
payload: TPayloadForSQL;
}

export async function queryBySQL({ query, payload }: IQueryBySQL, signal: AbortSignal) {
export async function queryBySQL({ query, name, payload }: IQueryBySQL, signal: AbortSignal) {
if (!query.sql) {
return [];
}
const { type, key, sql, pre_process, post_process } = query;

const formattedSQL = formatSQL(sql, payload);
const finalSQL = preProcessSQLQuery({ sql: formattedSQL, pre_process });
let data = await APIClient.query(signal)({ type, key, query: finalSQL }, {});
let data = await APIClient.query(signal)({ type, key, query: finalSQL }, { params: { name } });
data = postProcessSQLQuery(post_process, data);
return data;
}
Expand All @@ -33,10 +33,11 @@ interface IQueryByHTTP {
type: DataSourceType;
key: string;
configString: string;
name: string;
}

export async function queryByHTTP({ type, key, configString }: IQueryByHTTP, signal: AbortSignal) {
const res = await APIClient.query(signal)({ type, key, query: configString }, {});
export async function queryByHTTP({ type, key, configString, name }: IQueryByHTTP, signal: AbortSignal) {
const res = await APIClient.query(signal)({ type, key, query: configString }, { params: { name } });
return res;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const QueryRenderModel = types
queryBySQL(
{
payload,
title: self.name,
name: self.name,
query: self.json,
},
self.controller.signal,
Expand Down Expand Up @@ -152,6 +152,7 @@ export const QueryRenderModel = types
type,
key,
configString: JSON.stringify(config),
name: self.name,
},
self.controller.signal,
),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtable/root",
"version": "10.28.0",
"version": "10.29.0",
"private": true,
"workspaces": [
"api",
Expand Down
2 changes: 1 addition & 1 deletion settings-form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@devtable/settings-form",
"version": "10.28.0",
"version": "10.29.0",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
Expand Down
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@devtable/website",
"private": true,
"license": "Apache-2.0",
"version": "10.28.0",
"version": "10.29.0",
"scripts": {
"dev": "vite",
"preview": "vite preview"
Expand Down

0 comments on commit 24c6a5a

Please sign in to comment.