PromucFlow_constructor/app/client/src/actions/jsPaneActions.ts
ashit-rath 5a227f9933
chore: refactor jsobject response & settings (#29475)
## Description
Refactor the JSObject response view and the settings to accept new
columns


#### PR fixes following issue(s)
Fixes for PR https://github.com/appsmithorg/appsmith-ee/pull/3060
> 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

- **New Features**
- Users can now opt to open the debugger when executing JavaScript
functions within the app.

- **Enhancements**
- Improved JavaScript function execution flow with additional debugging
options.
- Enhanced JavaScript editor form to better handle JavaScript collection
configurations.

- **Bug Fixes**
- Fixed issues related to JavaScript collection data retrieval and
management.

- **Refactor**
- Streamlined JavaScript function settings with additional columns and
headings for better clarity.
- Updated state management to align with the new JavaScript collection
data structure.

- **Style**
- Removed the bottom border from the `TabbedViewContainer` for a cleaner
UI appearance.

- **Documentation**
- Updated documentation to reflect changes in JavaScript pane actions
and selectors.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-09 20:24:43 +05:30

114 lines
2.8 KiB
TypeScript

import type { ReduxAction } from "@appsmith/constants/ReduxActionConstants";
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import type { JSCollection, JSAction } from "entities/JSCollection";
import type {
RefactorAction,
SetFunctionPropertyPayload,
} from "@appsmith/api/JSActionAPI";
import type { EventLocation } from "@appsmith/utils/analyticsUtilTypes";
import type { JSEditorTab } from "reducers/uiReducers/jsPaneReducer";
export const createNewJSCollection = (
pageId: string,
from: EventLocation,
): ReduxAction<{ pageId: string; from: EventLocation }> => ({
type: ReduxActionTypes.CREATE_NEW_JS_ACTION,
payload: { pageId: pageId, from: from },
});
export const updateJSCollection = (
body: string,
id: string,
): ReduxAction<{ body: string; id: string }> => ({
type: ReduxActionTypes.UPDATE_JS_ACTION_INIT,
payload: { body, id },
});
export const updateJSCollectionBody = (
body: string,
id: string,
isReplay = false,
): ReduxAction<{ body: string; id: string; isReplay?: boolean }> => ({
type: ReduxActionTypes.UPDATE_JS_ACTION_BODY_INIT,
payload: { body, id, isReplay },
});
export const updateJSCollectionSuccess = (payload: { data: JSCollection }) => {
return {
type: ReduxActionTypes.UPDATE_JS_ACTION_SUCCESS,
payload,
};
};
export const updateJSCollectionBodySuccess = (payload: {
data: JSCollection;
}) => {
return {
type: ReduxActionTypes.UPDATE_JS_ACTION_BODY_SUCCESS,
payload,
};
};
export const refactorJSCollectionAction = (payload: {
refactorAction: RefactorAction;
actionCollection: JSCollection;
}) => {
return {
type: ReduxActionTypes.REFACTOR_JS_ACTION_NAME,
payload,
};
};
export const executeJSFunctionInit = (payload: {
collection: JSCollection;
action: JSAction;
}) => {
return {
type: ReduxActionTypes.EXECUTE_JS_FUNCTION_INIT,
payload,
};
};
export const startExecutingJSFunction = (payload: {
action: JSAction;
collection: JSCollection;
from: EventLocation;
openDebugger?: boolean;
}) => {
return {
type: ReduxActionTypes.START_EXECUTE_JS_FUNCTION,
payload,
};
};
export const updateFunctionProperty = (payload: SetFunctionPropertyPayload) => {
return {
type: ReduxActionTypes.SET_FUNCTION_PROPERTY,
payload,
};
};
export const updateJSFunction = (payload: SetFunctionPropertyPayload) => {
return {
type: ReduxActionTypes.UPDATE_JS_FUNCTION_PROPERTY_INIT,
payload,
};
};
export const setActiveJSAction = (payload: {
jsCollectionId: string;
jsActionId: string;
}) => {
return {
type: ReduxActionTypes.SET_ACTIVE_JS_ACTION,
payload,
};
};
export const setJsPaneConfigSelectedTab: (
payload: JSEditorTab,
) => ReduxAction<{ selectedTab: JSEditorTab }> = (payload: JSEditorTab) => ({
type: ReduxActionTypes.SET_JS_PANE_CONFIG_SELECTED_TAB,
payload: { selectedTab: payload },
});