mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
fix: transformation lines on restapi
This commit is contained in:
parent
ba3f30bf06
commit
6f87d3890a
2 changed files with 18 additions and 12 deletions
|
|
@ -1103,15 +1103,15 @@ export const createEventsSlice = (set, get) => ({
|
|||
return executeAction(event, mode, {});
|
||||
};
|
||||
|
||||
const logInfo = (log) => {
|
||||
const logInfo = (log, isFromTransformation) => {
|
||||
const query = dataQuery.queries.modules['canvas'].find((query) => query.id == queryId);
|
||||
const error = new Error();
|
||||
const stackLine = error.stack.split('\n')[2];
|
||||
const stackLine = error.stack.split('\n')[isFromTransformation ? 3 : 2];
|
||||
const lineNumberMatch = stackLine.match(/:(\d+):\d+\)$/);
|
||||
const lineNumber = lineNumberMatch ? lineNumberMatch[1] : 'unknown';
|
||||
const event = {
|
||||
actionId: 'log-info',
|
||||
key: `${query.name}, Line ${lineNumber - 2}`,
|
||||
key: `${query.name}${isFromTransformation && ', transformation'}, line ${lineNumber - 2}`,
|
||||
description: log,
|
||||
eventType: 'customLog',
|
||||
query,
|
||||
|
|
@ -1119,15 +1119,15 @@ export const createEventsSlice = (set, get) => ({
|
|||
return executeAction(event, mode, {});
|
||||
};
|
||||
|
||||
const logError = (log) => {
|
||||
const logError = (log, isFromTransformation = false) => {
|
||||
const query = dataQuery.queries.modules['canvas'].find((query) => query.id == queryId);
|
||||
const error = new Error();
|
||||
const stackLine = error.stack.split('\n')[2];
|
||||
const stackLine = error.stack.split('\n')[isFromTransformation ? 3 : 2];
|
||||
const lineNumberMatch = stackLine.match(/:(\d+):\d+\)$/);
|
||||
const lineNumber = lineNumberMatch ? lineNumberMatch[1] : 'unknown';
|
||||
const event = {
|
||||
actionId: 'log-error',
|
||||
key: `${query.name}, Line ${lineNumber - 2}`,
|
||||
key: `${query.name}${isFromTransformation && ', transformation'}, line ${lineNumber - 2}`,
|
||||
description: log,
|
||||
eventType: 'customLog',
|
||||
query,
|
||||
|
|
@ -1135,15 +1135,15 @@ export const createEventsSlice = (set, get) => ({
|
|||
return executeAction(event, mode, {});
|
||||
};
|
||||
|
||||
const log = (log) => {
|
||||
const log = (log, isFromTransformation = false) => {
|
||||
const query = dataQuery.queries.modules['canvas'].find((query) => query.id == queryId);
|
||||
const error = new Error();
|
||||
const stackLine = error.stack.split('\n')[2];
|
||||
const stackLine = error.stack.split('\n')[isFromTransformation ? 3 : 2];
|
||||
const lineNumberMatch = stackLine.match(/:(\d+):\d+\)$/);
|
||||
const lineNumber = lineNumberMatch ? lineNumberMatch[1] : 'unknown';
|
||||
const event = {
|
||||
actionId: 'log',
|
||||
key: `${query.name}, Line ${lineNumber - 2}`,
|
||||
key: `${query.name}${isFromTransformation && ', transformation'}, line ${lineNumber - 2}`,
|
||||
description: log,
|
||||
eventType: 'customLog',
|
||||
query,
|
||||
|
|
|
|||
|
|
@ -787,9 +787,15 @@ export const createQueryPanelSlice = (set, get) => ({
|
|||
proxiedPage,
|
||||
proxiedConstants,
|
||||
{
|
||||
logError: actions.logError,
|
||||
logInfo: actions.logInfo,
|
||||
log: actions.log,
|
||||
logError: function (log) {
|
||||
return actions.logError.call(actions, log, true);
|
||||
},
|
||||
logInfo: function (log) {
|
||||
return actions.logInfo.call(actions, log, true);
|
||||
},
|
||||
log: function (log) {
|
||||
return actions.log.call(actions, log, true);
|
||||
},
|
||||
}
|
||||
);
|
||||
} catch (err) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue