mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
Added check for running query in the backend
This commit is contained in:
parent
8ea84bfacd
commit
4beaaaef91
7 changed files with 17 additions and 10 deletions
|
|
@ -215,6 +215,7 @@ export const createQueryPanelSlice = (set, get) => ({
|
||||||
selectedEnvironment,
|
selectedEnvironment,
|
||||||
isPublicAccess,
|
isPublicAccess,
|
||||||
currentVersionId,
|
currentVersionId,
|
||||||
|
currentMode,
|
||||||
} = get();
|
} = get();
|
||||||
const {
|
const {
|
||||||
queryPreviewData,
|
queryPreviewData,
|
||||||
|
|
@ -352,7 +353,8 @@ export const createQueryPanelSlice = (set, get) => ({
|
||||||
options,
|
options,
|
||||||
query?.options,
|
query?.options,
|
||||||
currentVersionId,
|
currentVersionId,
|
||||||
!isPublicAccess ? (currentAppEnvironmentId ?? environmentId) || selectedEnvironment?.id : undefined //TODO: currentAppEnvironmentId may no longer required. Need to check
|
!isPublicAccess ? (currentAppEnvironmentId ?? environmentId) || selectedEnvironment?.id : undefined, //TODO: currentAppEnvironmentId may no longer required. Need to check
|
||||||
|
currentMode
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ function del(id, versionId) {
|
||||||
return fetch(`${config.apiUrl}/data-queries/${id}/versions/${versionId}`, requestOptions).then(handleResponse);
|
return fetch(`${config.apiUrl}/data-queries/${id}/versions/${versionId}`, requestOptions).then(handleResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
function run(queryId, resolvedOptions, options, versionId, environmentId) {
|
function run(queryId, resolvedOptions, options, versionId, environmentId, mode) {
|
||||||
const body = {
|
const body = {
|
||||||
resolvedOptions: resolvedOptions,
|
resolvedOptions: resolvedOptions,
|
||||||
options: options,
|
options: options,
|
||||||
|
|
@ -80,7 +80,7 @@ function run(queryId, resolvedOptions, options, versionId, environmentId) {
|
||||||
|
|
||||||
let url = `${config.apiUrl}/data-queries/${queryId}/versions/${versionId}/run${
|
let url = `${config.apiUrl}/data-queries/${queryId}/versions/${versionId}/run${
|
||||||
environmentId && environmentId !== 'undefined' ? `/${environmentId}` : ''
|
environmentId && environmentId !== 'undefined' ? `/${environmentId}` : ''
|
||||||
}`;
|
}?mode=${mode}`;
|
||||||
|
|
||||||
//For public/released apps
|
//For public/released apps
|
||||||
if (!environmentId || !versionId) {
|
if (!environmentId || !versionId) {
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1b52eeeff52a99ee910431b5644859f2622439b7
|
Subproject commit 648a1c9e7959d7e47576bfc74645ac96200940af
|
||||||
|
|
@ -113,7 +113,8 @@ export class DataQueriesController implements IDataQueriesController {
|
||||||
@Body() updateDataQueryDto: UpdateDataQueryDto,
|
@Body() updateDataQueryDto: UpdateDataQueryDto,
|
||||||
@Ability() ability: AppAbility,
|
@Ability() ability: AppAbility,
|
||||||
@DataSource() dataSource: DataSourceEntity,
|
@DataSource() dataSource: DataSourceEntity,
|
||||||
@Res({ passthrough: true }) response: Response
|
@Res({ passthrough: true }) response: Response,
|
||||||
|
@Query('mode') mode?: string
|
||||||
) {
|
) {
|
||||||
return this.dataQueriesService.runQueryOnBuilder(
|
return this.dataQueriesService.runQueryOnBuilder(
|
||||||
user,
|
user,
|
||||||
|
|
@ -122,7 +123,8 @@ export class DataQueriesController implements IDataQueriesController {
|
||||||
updateDataQueryDto,
|
updateDataQueryDto,
|
||||||
ability,
|
ability,
|
||||||
dataSource,
|
dataSource,
|
||||||
response
|
response,
|
||||||
|
mode
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@ export interface IDataQueriesController {
|
||||||
updateDataQueryDto: UpdateDataQueryDto,
|
updateDataQueryDto: UpdateDataQueryDto,
|
||||||
ability: AppAbility,
|
ability: AppAbility,
|
||||||
dataSource: DataSourceEntity,
|
dataSource: DataSourceEntity,
|
||||||
response: Response
|
response: Response,
|
||||||
|
mode?: string
|
||||||
): Promise<object>;
|
): Promise<object>;
|
||||||
|
|
||||||
runQuery(
|
runQuery(
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ export interface IDataQueriesService {
|
||||||
updateDataQueryDto: UpdateDataQueryDto,
|
updateDataQueryDto: UpdateDataQueryDto,
|
||||||
ability: object,
|
ability: object,
|
||||||
dataSource: DataSource,
|
dataSource: DataSource,
|
||||||
response: Response
|
response: Response,
|
||||||
|
mode?: string
|
||||||
): Promise<object>;
|
): Promise<object>;
|
||||||
|
|
||||||
runQueryForApp(
|
runQueryForApp(
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,8 @@ export class DataQueriesService implements IDataQueriesService {
|
||||||
updateDataQueryDto: UpdateDataQueryDto,
|
updateDataQueryDto: UpdateDataQueryDto,
|
||||||
ability: AppAbility,
|
ability: AppAbility,
|
||||||
dataSource: DataSource,
|
dataSource: DataSource,
|
||||||
response: Response
|
response: Response,
|
||||||
|
mode?: string
|
||||||
) {
|
) {
|
||||||
const { options, resolvedOptions } = updateDataQueryDto;
|
const { options, resolvedOptions } = updateDataQueryDto;
|
||||||
|
|
||||||
|
|
@ -153,7 +154,7 @@ export class DataQueriesService implements IDataQueriesService {
|
||||||
return this.runAndGetResult(user, dataQuery, options, response, environmentId);
|
return this.runAndGetResult(user, dataQuery, options, response, environmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async runAndGetResult(
|
protected async runAndGetResult(
|
||||||
user: User,
|
user: User,
|
||||||
dataQuery: DataQuery,
|
dataQuery: DataQuery,
|
||||||
resolvedOptions: object,
|
resolvedOptions: object,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue