2024-08-06 14:52:22 +00:00
|
|
|
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
|
chore: Import debugger fixes (#31080)
## Description
To add debugger error for import path for module instance on EE, this PR
enables code to be extended on EE
#### PR fixes following issue(s)
Fixes # (issue number)
> if no issue exists, please create an issue and ask the maintainers
about this first
>
>
#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
> Please delete options that are not relevant.
- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- Chore (housekeeping or task changes that don't impact user perception)
- This change requires a documentation update
>
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [ ] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Refactor**
- Updated import paths and references for `ENTITY_TYPE` to
`EntityTypeValue` across various components and utilities for improved
code consistency.
- Reorganized import statements related to `AppsmithConsole` utilities
and constants to enhance code maintainability.
- Adjusted usage of enums and types, specifically for entity and
platform error handling, to align with updated import paths.
- **New Features**
- Introduced utility functions for handling entity types and platform
errors in AppsmithConsole, including new constants and error retrieval
functions.
- Added a new enum value `MISSING_MODULE` to better categorize log types
in debugging scenarios.
- **Bug Fixes**
- Implemented changes to error logging and handling mechanisms,
including the addition of new case handling for
`LOG_TYPE.MISSING_MODULE` in debugger logs, to improve the debugging
experience.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-02-14 06:30:18 +00:00
|
|
|
import type { Log, Message, SourceEntity } from "entities/AppsmithConsole";
|
2024-08-06 14:52:22 +00:00
|
|
|
import type { ENTITY_TYPE } from "ee/entities/AppsmithConsole/utils";
|
2024-02-29 06:23:57 +00:00
|
|
|
import type {
|
|
|
|
|
CanvasDebuggerState,
|
|
|
|
|
DebuggerContext,
|
|
|
|
|
} from "reducers/uiReducers/debuggerReducer";
|
2024-08-06 14:52:22 +00:00
|
|
|
import type { EventName } from "ee/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
|
|
|
|
2024-04-11 06:06:48 +00:00
|
|
|
export type DeleteErrorLogPayload = {
|
|
|
|
|
id: string;
|
|
|
|
|
analytics?: Log["analytics"];
|
|
|
|
|
}[];
|
|
|
|
|
|
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
|
|
|
|
2024-04-11 06:06:48 +00:00
|
|
|
export const deleteErrorLogsInit = (payload: DeleteErrorLogPayload) => ({
|
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
|
|
|
};
|
|
|
|
|
};
|
2024-02-29 06:23:57 +00:00
|
|
|
|
|
|
|
|
export const setCanvasDebuggerState = (
|
|
|
|
|
payload: Partial<CanvasDebuggerState>,
|
|
|
|
|
) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_CANVAS_DEBUGGER_STATE,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|