PromucFlow_constructor/app/client/src/actions/jsPaneActions.ts
Apeksha Bhosale 79e165af96
feat: Settings js editor (#9984)
* POC

* Closing channels

* WIP

* v1

* get working with JS editor

* autocomplete

* added comments

* try removing an import

* different way of import

* dependency map added to body

* triggers can be part of js editor functions hence

* removed unwanted lines

* new flow chnages

* Resolve conflicts

* small css changes for empty state

* Fix prettier

* Fixes

* flow changes part 2

* Mock web worker for testing

* Throw errors during evaluation

* Action execution should be non blocking on the main thread to evaluation of further actions

* WIP

* Fix build issue

* Fix warnings

* Rename

* Refactor and add tests for worker util

* Fix response flow post refactor

* added settings icon for js editor

* WIP

* WIP

* WIP

* Tests for promises

* settings for each function of js object added

* Error handling

* Error handing action validation

* Update test

* Passing callback data in the eval trigger flow

* log triggers to be executed

* WIP

* confirm before execution

* Remove debugging

* Fix backwards compatibility

* Avoid passing trigger meta around

* fix button loading

* handle error callbacks

* fix tests

* tests

* fix console error when checking for async

* Fix async function check

* Fix async function check again

* fix bad commit

* Add some comments

* added clientSideExecution flag for js functions

* css changes for settings icon

* unsued code removed

* on page load PART 1

* onPageLoad rest iof changes

* corrected async badge

* removed duplicate test cases

* added confirm modal for js functions

* removed unused code

* small chnage

* dependency was not getting created

* Fix confirmation modal

* unused code removed

* replaced new confirmsaga

* confirmaton box changes

* Fixing JSEditor Run butn locator

* corrected property

* dependency map was failing

* changed key for confirmation box

Co-authored-by: hetunandu <hetu@appsmith.com>
Co-authored-by: Hetu Nandu <hetunandu@gmail.com>
Co-authored-by: Arpit Mohan <arpit@appsmith.com>
Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2022-03-17 17:35:17 +05:30

78 lines
1.9 KiB
TypeScript

import { ReduxAction, ReduxActionTypes } from "constants/ReduxActionConstants";
import { JSCollection, JSAction } from "entities/JSCollection";
import { RefactorAction, SetFunctionPropertyPayload } from "api/JSActionAPI";
export const createNewJSCollection = (
pageId: string,
): ReduxAction<{ pageId: string }> => ({
type: ReduxActionTypes.CREATE_NEW_JS_ACTION,
payload: { pageId },
});
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 executeJSFunction = (payload: {
collectionName: string;
action: JSAction;
collectionId: string;
}) => {
return {
type: ReduxActionTypes.EXECUTE_JS_FUNCTION_INIT,
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,
};
};