mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 00:48:25 +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,
|
||||
isPublicAccess,
|
||||
currentVersionId,
|
||||
currentMode,
|
||||
} = get();
|
||||
const {
|
||||
queryPreviewData,
|
||||
|
|
@ -352,7 +353,8 @@ export const createQueryPanelSlice = (set, get) => ({
|
|||
options,
|
||||
query?.options,
|
||||
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);
|
||||
}
|
||||
|
||||
function run(queryId, resolvedOptions, options, versionId, environmentId) {
|
||||
function run(queryId, resolvedOptions, options, versionId, environmentId, mode) {
|
||||
const body = {
|
||||
resolvedOptions: resolvedOptions,
|
||||
options: options,
|
||||
|
|
@ -80,7 +80,7 @@ function run(queryId, resolvedOptions, options, versionId, environmentId) {
|
|||
|
||||
let url = `${config.apiUrl}/data-queries/${queryId}/versions/${versionId}/run${
|
||||
environmentId && environmentId !== 'undefined' ? `/${environmentId}` : ''
|
||||
}`;
|
||||
}?mode=${mode}`;
|
||||
|
||||
//For public/released apps
|
||||
if (!environmentId || !versionId) {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 1b52eeeff52a99ee910431b5644859f2622439b7
|
||||
Subproject commit 648a1c9e7959d7e47576bfc74645ac96200940af
|
||||
|
|
@ -113,7 +113,8 @@ export class DataQueriesController implements IDataQueriesController {
|
|||
@Body() updateDataQueryDto: UpdateDataQueryDto,
|
||||
@Ability() ability: AppAbility,
|
||||
@DataSource() dataSource: DataSourceEntity,
|
||||
@Res({ passthrough: true }) response: Response
|
||||
@Res({ passthrough: true }) response: Response,
|
||||
@Query('mode') mode?: string
|
||||
) {
|
||||
return this.dataQueriesService.runQueryOnBuilder(
|
||||
user,
|
||||
|
|
@ -122,7 +123,8 @@ export class DataQueriesController implements IDataQueriesController {
|
|||
updateDataQueryDto,
|
||||
ability,
|
||||
dataSource,
|
||||
response
|
||||
response,
|
||||
mode
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ export interface IDataQueriesController {
|
|||
updateDataQueryDto: UpdateDataQueryDto,
|
||||
ability: AppAbility,
|
||||
dataSource: DataSourceEntity,
|
||||
response: Response
|
||||
response: Response,
|
||||
mode?: string
|
||||
): Promise<object>;
|
||||
|
||||
runQuery(
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ export interface IDataQueriesService {
|
|||
updateDataQueryDto: UpdateDataQueryDto,
|
||||
ability: object,
|
||||
dataSource: DataSource,
|
||||
response: Response
|
||||
response: Response,
|
||||
mode?: string
|
||||
): Promise<object>;
|
||||
|
||||
runQueryForApp(
|
||||
|
|
|
|||
|
|
@ -127,7 +127,8 @@ export class DataQueriesService implements IDataQueriesService {
|
|||
updateDataQueryDto: UpdateDataQueryDto,
|
||||
ability: AppAbility,
|
||||
dataSource: DataSource,
|
||||
response: Response
|
||||
response: Response,
|
||||
mode?: string
|
||||
) {
|
||||
const { options, resolvedOptions } = updateDataQueryDto;
|
||||
|
||||
|
|
@ -153,7 +154,7 @@ export class DataQueriesService implements IDataQueriesService {
|
|||
return this.runAndGetResult(user, dataQuery, options, response, environmentId);
|
||||
}
|
||||
|
||||
private async runAndGetResult(
|
||||
protected async runAndGetResult(
|
||||
user: User,
|
||||
dataQuery: DataQuery,
|
||||
resolvedOptions: object,
|
||||
|
|
|
|||
Loading…
Reference in a new issue