Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1158 show query name in request params #1162

Merged
merged 2 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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