2022-04-12 10:50:01 +00:00
|
|
|
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
|
2023-10-16 03:52:11 +00:00
|
|
|
import type {
|
|
|
|
|
ENTITY_TYPE,
|
|
|
|
|
Log,
|
|
|
|
|
Message,
|
|
|
|
|
SourceEntity,
|
|
|
|
|
} from "entities/AppsmithConsole";
|
2023-04-10 12:59:14 +00:00
|
|
|
import type { DebuggerContext } from "reducers/uiReducers/debuggerReducer";
|
2023-08-09 09:45:01 +00:00
|
|
|
import type { EventName } from "@appsmith/utils/analyticsUtilTypes";
|
2023-09-13 11:31:37 +00:00
|
|
|
import type { APP_MODE } from "entities/App";
|
2021-07-08 05:31:08 +00:00
|
|
|
|
|
|
|
|
export interface LogDebuggerErrorAnalyticsPayload {
|
|
|
|
|
entityName: string;
|
|
|
|
|
entityId: string;
|
|
|
|
|
entityType: ENTITY_TYPE;
|
|
|
|
|
eventName: EventName;
|
|
|
|
|
propertyPath: string;
|
2023-04-13 15:28:29 +00:00
|
|
|
errorId?: string;
|
2021-08-16 11:03:27 +00:00
|
|
|
errorMessages?: Message[];
|
|
|
|
|
errorMessage?: Message["message"];
|
|
|
|
|
errorType?: Message["type"];
|
2021-08-23 13:47:17 +00:00
|
|
|
errorSubType?: Message["subType"];
|
2021-08-16 11:03:27 +00:00
|
|
|
analytics?: Log["analytics"];
|
2023-09-13 11:31:37 +00:00
|
|
|
appMode: APP_MODE;
|
2023-10-16 03:52:11 +00:00
|
|
|
source: SourceEntity;
|
|
|
|
|
logId: string;
|
|
|
|
|
environmentId?: string;
|
|
|
|
|
environmentName?: string;
|
2021-07-08 05:31:08 +00:00
|
|
|
}
|
2021-04-23 13:50:55 +00:00
|
|
|
|
2022-12-07 10:28:29 +00:00
|
|
|
export const debuggerLogInit = (payload: Log[]) => ({
|
2021-04-23 13:50:55 +00:00
|
|
|
type: ReduxActionTypes.DEBUGGER_LOG_INIT,
|
|
|
|
|
payload,
|
|
|
|
|
});
|
|
|
|
|
|
2022-09-08 08:16:28 +00:00
|
|
|
export const debuggerLog = (payload: Log[]) => ({
|
2021-04-23 13:50:55 +00:00
|
|
|
type: ReduxActionTypes.DEBUGGER_LOG,
|
|
|
|
|
payload,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const clearLogs = () => ({
|
|
|
|
|
type: ReduxActionTypes.CLEAR_DEBUGGER_LOGS,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const showDebugger = (payload?: boolean) => ({
|
|
|
|
|
type: ReduxActionTypes.SHOW_DEBUGGER,
|
|
|
|
|
payload,
|
|
|
|
|
});
|
|
|
|
|
|
2021-08-16 11:03:27 +00:00
|
|
|
// Add an error
|
2022-12-07 10:28:29 +00:00
|
|
|
export const addErrorLogInit = (payload: Log[]) => ({
|
2021-08-16 11:03:27 +00:00
|
|
|
type: ReduxActionTypes.DEBUGGER_ADD_ERROR_LOG_INIT,
|
2021-04-23 13:50:55 +00:00
|
|
|
payload,
|
|
|
|
|
});
|
|
|
|
|
|
2022-12-07 10:28:29 +00:00
|
|
|
export const addErrorLogs = (payload: Log[]) => ({
|
|
|
|
|
type: ReduxActionTypes.DEBUGGER_ADD_ERROR_LOGS,
|
2021-04-23 13:50:55 +00:00
|
|
|
payload,
|
|
|
|
|
});
|
2021-07-08 05:31:08 +00:00
|
|
|
|
2022-12-07 10:28:29 +00:00
|
|
|
export const deleteErrorLogsInit = (
|
|
|
|
|
payload: { id: string; analytics?: Log["analytics"] }[],
|
2021-08-16 11:03:27 +00:00
|
|
|
) => ({
|
|
|
|
|
type: ReduxActionTypes.DEBUGGER_DELETE_ERROR_LOG_INIT,
|
2022-12-07 10:28:29 +00:00
|
|
|
payload,
|
2021-08-16 11:03:27 +00:00
|
|
|
});
|
|
|
|
|
|
2022-12-07 10:28:29 +00:00
|
|
|
export const deleteErrorLog = (ids: string[]) => ({
|
2021-08-16 11:03:27 +00:00
|
|
|
type: ReduxActionTypes.DEBUGGER_DELETE_ERROR_LOG,
|
2022-12-07 10:28:29 +00:00
|
|
|
payload: ids,
|
2021-08-16 11:03:27 +00:00
|
|
|
});
|
|
|
|
|
|
2021-08-25 04:34:42 +00:00
|
|
|
export const hideDebuggerErrors = (payload: boolean) => ({
|
|
|
|
|
type: ReduxActionTypes.HIDE_DEBUGGER_ERRORS,
|
|
|
|
|
payload,
|
|
|
|
|
});
|
2021-09-20 11:20:22 +00:00
|
|
|
|
2023-04-10 12:59:14 +00:00
|
|
|
// set the selected tab in the debugger.
|
|
|
|
|
export const setDebuggerSelectedTab = (selectedTab: string) => {
|
2022-10-17 15:16:38 +00:00
|
|
|
return {
|
2023-04-10 12:59:14 +00:00
|
|
|
type: ReduxActionTypes.SET_DEBUGGER_SELECTED_TAB,
|
|
|
|
|
selectedTab,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2023-08-09 09:49:32 +00:00
|
|
|
// set the selected filter in the debugger.
|
|
|
|
|
export const setDebuggerSelectedFilter = (selectedFilter: string) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_DEBUGGER_SELECTED_FILTER,
|
|
|
|
|
selectedFilter,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2023-04-10 12:59:14 +00:00
|
|
|
// set the height of the response pane in the debugger.
|
|
|
|
|
export const setResponsePaneHeight = (height: number) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_RESPONSE_PANE_HEIGHT,
|
|
|
|
|
height,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// set the height of the response pane in the debugger.
|
|
|
|
|
export const setErrorCount = (count: number) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_ERROR_COUNT,
|
|
|
|
|
count,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// set the height of the response pane in the debugger.
|
|
|
|
|
export const setResponsePaneScrollPosition = (position: number) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_RESPONSE_PANE_SCROLL_POSITION,
|
|
|
|
|
position,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//toggle expand error log item state.
|
|
|
|
|
export const toggleExpandErrorLogItem = (id: string, isExpanded: boolean) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.TOGGLE_EXPAND_ERROR_LOG_ITEM,
|
|
|
|
|
payload: { id, isExpanded },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//set the debugger context in store.
|
|
|
|
|
export const setDebuggerContext = (context: DebuggerContext) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_DEBUGGER_CONTEXT,
|
|
|
|
|
payload: { context },
|
2022-10-17 15:16:38 +00:00
|
|
|
};
|
|
|
|
|
};
|