Fix: Fix bugs related to debugger errors (#5824)
This commit is contained in:
parent
95d5557749
commit
794ef1bbd6
|
|
@ -63,6 +63,8 @@ export interface LogActionPayload {
|
||||||
source?: SourceEntity;
|
source?: SourceEntity;
|
||||||
// Snapshot KV pair of scope variables or state associated with this event.
|
// Snapshot KV pair of scope variables or state associated with this event.
|
||||||
state?: Record<string, any>;
|
state?: Record<string, any>;
|
||||||
|
// Any other data required for analytics
|
||||||
|
analytics?: Record<string, any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Message extends LogActionPayload {
|
export interface Message extends LogActionPayload {
|
||||||
|
|
|
||||||
|
|
@ -345,7 +345,9 @@ export function* deleteActionSaga(
|
||||||
try {
|
try {
|
||||||
const id = actionPayload.payload.id;
|
const id = actionPayload.payload.id;
|
||||||
const name = actionPayload.payload.name;
|
const name = actionPayload.payload.name;
|
||||||
const action = yield select(getAction, id);
|
const action: Action | undefined = yield select(getAction, id);
|
||||||
|
|
||||||
|
if (!action) return;
|
||||||
|
|
||||||
const isApi = action.pluginType === PluginType.API;
|
const isApi = action.pluginType === PluginType.API;
|
||||||
const isQuery = action.pluginType === PluginType.DB;
|
const isQuery = action.pluginType === PluginType.DB;
|
||||||
|
|
@ -401,7 +403,11 @@ export function* deleteActionSaga(
|
||||||
name: response.data.name,
|
name: response.data.name,
|
||||||
id: response.data.id,
|
id: response.data.id,
|
||||||
},
|
},
|
||||||
|
analytics: {
|
||||||
|
pluginId: action.pluginId,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
yield put(deleteActionSuccess({ id }));
|
yield put(deleteActionSuccess({ id }));
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,11 @@ import {
|
||||||
} from "redux-saga/effects";
|
} from "redux-saga/effects";
|
||||||
import { get, set } from "lodash";
|
import { get, set } from "lodash";
|
||||||
import { getDebuggerErrors } from "selectors/debuggerSelectors";
|
import { getDebuggerErrors } from "selectors/debuggerSelectors";
|
||||||
import { getAction, getPlugin } from "selectors/entitiesSelector";
|
import {
|
||||||
|
getAction,
|
||||||
|
getPlugin,
|
||||||
|
getPluginNameFromId,
|
||||||
|
} from "selectors/entitiesSelector";
|
||||||
import { Action, PluginType } from "entities/Action";
|
import { Action, PluginType } from "entities/Action";
|
||||||
import LOG_TYPE from "entities/AppsmithConsole/logtype";
|
import LOG_TYPE from "entities/AppsmithConsole/logtype";
|
||||||
import { DataTree } from "entities/DataTree/dataTreeFactory";
|
import { DataTree } from "entities/DataTree/dataTreeFactory";
|
||||||
|
|
@ -81,8 +85,13 @@ function* onEntityDeleteSaga(payload: Message) {
|
||||||
yield put(debuggerLog(payload));
|
yield put(debuggerLog(payload));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const currentPageId = yield select(getCurrentPageId);
|
||||||
|
let pluginName: string = yield select(
|
||||||
|
getPluginNameFromId,
|
||||||
|
payload?.analytics?.pluginId,
|
||||||
|
);
|
||||||
|
|
||||||
const errors = yield select(getDebuggerErrors);
|
const errors: Record<string, Message> = yield select(getDebuggerErrors);
|
||||||
const errorIds = Object.keys(errors);
|
const errorIds = Object.keys(errors);
|
||||||
const updatedErrors: any = {};
|
const updatedErrors: any = {};
|
||||||
|
|
||||||
|
|
@ -91,6 +100,29 @@ function* onEntityDeleteSaga(payload: Message) {
|
||||||
|
|
||||||
if (!includes) {
|
if (!includes) {
|
||||||
updatedErrors[e] = errors[e];
|
updatedErrors[e] = errors[e];
|
||||||
|
} else {
|
||||||
|
// If the error is being removed here
|
||||||
|
// need to send an analytics event for the same
|
||||||
|
const error = errors[e];
|
||||||
|
pluginName = pluginName.replace(/ /g, "");
|
||||||
|
|
||||||
|
if (source.type === ENTITY_TYPE.ACTION) {
|
||||||
|
AnalyticsUtil.logEvent("DEBUGGER_RESOLVED_ERROR", {
|
||||||
|
entityType: pluginName,
|
||||||
|
propertyPath: `${pluginName}.${error.source?.propertyPath ?? ""}`,
|
||||||
|
errorMessages: error.messages,
|
||||||
|
pageId: currentPageId,
|
||||||
|
});
|
||||||
|
} else if (source.type === ENTITY_TYPE.WIDGET) {
|
||||||
|
const widgetType = error?.analytics?.widgetType;
|
||||||
|
|
||||||
|
AnalyticsUtil.logEvent("DEBUGGER_RESOLVED_ERROR", {
|
||||||
|
entityType: widgetType,
|
||||||
|
propertyPath: `${widgetType}.${error.source?.propertyPath ?? ""}`,
|
||||||
|
errorMessages: error.messages,
|
||||||
|
pageId: currentPageId,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,12 @@ function getLatestEvalPropertyErrors(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const analyticsData = isWidget(entity)
|
||||||
|
? {
|
||||||
|
widgetType: entity.type,
|
||||||
|
}
|
||||||
|
: {};
|
||||||
|
|
||||||
// Add or update
|
// Add or update
|
||||||
updatedDebuggerErrors[debuggerKey] = {
|
updatedDebuggerErrors[debuggerKey] = {
|
||||||
logType: LOG_TYPE.EVAL_ERROR,
|
logType: LOG_TYPE.EVAL_ERROR,
|
||||||
|
|
@ -147,6 +153,7 @@ function getLatestEvalPropertyErrors(
|
||||||
state: {
|
state: {
|
||||||
[propertyPath]: evaluatedValue,
|
[propertyPath]: evaluatedValue,
|
||||||
},
|
},
|
||||||
|
analytics: analyticsData,
|
||||||
};
|
};
|
||||||
} else if (debuggerKey in updatedDebuggerErrors) {
|
} else if (debuggerKey in updatedDebuggerErrors) {
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
|
|
|
||||||
|
|
@ -528,14 +528,16 @@ export function* deleteAllSelectedWidgetsSaga(
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (bulkDeleteKey) {
|
if (bulkDeleteKey) {
|
||||||
flushDeletedWidgets(bulkDeleteKey);
|
flushDeletedWidgets(bulkDeleteKey);
|
||||||
AppsmithConsole.info({
|
falttendedWidgets.map((widget: any) => {
|
||||||
logType: LOG_TYPE.ENTITY_DELETED,
|
AppsmithConsole.info({
|
||||||
text: `${selectedWidgets.length} were deleted`,
|
logType: LOG_TYPE.ENTITY_DELETED,
|
||||||
source: {
|
text: "Widget was deleted",
|
||||||
name: "Group Delete",
|
source: {
|
||||||
type: ENTITY_TYPE.WIDGET,
|
name: widget.widgetName,
|
||||||
id: bulkDeleteKey,
|
type: ENTITY_TYPE.WIDGET,
|
||||||
},
|
id: widget.widgetId,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, WIDGET_DELETE_UNDO_TIMEOUT);
|
}, WIDGET_DELETE_UNDO_TIMEOUT);
|
||||||
|
|
@ -575,7 +577,9 @@ export function* deleteSaga(deleteAction: ReduxAction<WidgetDelete>) {
|
||||||
const { disallowUndo, isShortcut } = deleteAction.payload;
|
const { disallowUndo, isShortcut } = deleteAction.payload;
|
||||||
|
|
||||||
if (!widgetId) {
|
if (!widgetId) {
|
||||||
const selectedWidget = yield select(getSelectedWidget);
|
const selectedWidget: FlattenedWidgetProps | undefined = yield select(
|
||||||
|
getSelectedWidget,
|
||||||
|
);
|
||||||
if (!selectedWidget) return;
|
if (!selectedWidget) return;
|
||||||
|
|
||||||
// if widget is not deletable, don't don anything
|
// if widget is not deletable, don't don anything
|
||||||
|
|
@ -588,7 +592,7 @@ export function* deleteSaga(deleteAction: ReduxAction<WidgetDelete>) {
|
||||||
if (widgetId && parentId) {
|
if (widgetId && parentId) {
|
||||||
const stateWidgets = yield select(getWidgets);
|
const stateWidgets = yield select(getWidgets);
|
||||||
const widgets = { ...stateWidgets };
|
const widgets = { ...stateWidgets };
|
||||||
const stateWidget = yield select(getWidget, widgetId);
|
const stateWidget: WidgetProps = yield select(getWidget, widgetId);
|
||||||
const widget = { ...stateWidget };
|
const widget = { ...stateWidget };
|
||||||
|
|
||||||
const stateParent: FlattenedWidgetProps = yield select(
|
const stateParent: FlattenedWidgetProps = yield select(
|
||||||
|
|
@ -641,17 +645,20 @@ export function* deleteSaga(deleteAction: ReduxAction<WidgetDelete>) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (widgetId) {
|
if (widgetId) {
|
||||||
flushDeletedWidgets(widgetId);
|
flushDeletedWidgets(widgetId);
|
||||||
AppsmithConsole.info({
|
otherWidgetsToDelete.map((widget) => {
|
||||||
logType: LOG_TYPE.ENTITY_DELETED,
|
AppsmithConsole.info({
|
||||||
text: "Widget was deleted",
|
logType: LOG_TYPE.ENTITY_DELETED,
|
||||||
source: {
|
text: "Widget was deleted",
|
||||||
name: widgetName,
|
source: {
|
||||||
type: ENTITY_TYPE.WIDGET,
|
name: widget.widgetName,
|
||||||
id: widgetId,
|
type: ENTITY_TYPE.WIDGET,
|
||||||
},
|
id: widget.widgetId,
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, WIDGET_DELETE_UNDO_TIMEOUT);
|
}, WIDGET_DELETE_UNDO_TIMEOUT);
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,10 @@ export const getPluginPackageFromDatasourceId = (
|
||||||
return plugin.packageName;
|
return plugin.packageName;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getPluginNameFromId = (state: AppState, pluginId: string) => {
|
export const getPluginNameFromId = (
|
||||||
|
state: AppState,
|
||||||
|
pluginId: string,
|
||||||
|
): string => {
|
||||||
const plugin = state.entities.plugins.list.find(
|
const plugin = state.entities.plugins.list.find(
|
||||||
(plugin) => plugin.id === pluginId,
|
(plugin) => plugin.id === pluginId,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user