2021-08-27 09:25:28 +00:00
|
|
|
import { ActionResponse, PaginationField } from "api/ActionAPI";
|
2020-01-24 09:54:40 +00:00
|
|
|
import {
|
2021-08-27 09:25:28 +00:00
|
|
|
EvaluationReduxAction,
|
2022-02-17 04:31:59 +00:00
|
|
|
AnyReduxAction,
|
2020-01-24 09:54:40 +00:00
|
|
|
ReduxAction,
|
|
|
|
|
ReduxActionErrorTypes,
|
2021-08-27 09:25:28 +00:00
|
|
|
ReduxActionTypes,
|
2021-04-26 05:41:32 +00:00
|
|
|
ReduxActionWithoutPayload,
|
2020-01-24 09:54:40 +00:00
|
|
|
} from "constants/ReduxActionConstants";
|
2020-07-21 14:01:51 +00:00
|
|
|
import { Action } from "entities/Action";
|
2020-07-03 08:58:58 +00:00
|
|
|
import { batchAction } from "actions/batchActions";
|
2021-08-27 09:25:28 +00:00
|
|
|
import { ExecuteErrorPayload } from "constants/AppsmithActionConstants/ActionConstants";
|
2019-10-21 15:12:45 +00:00
|
|
|
|
2021-01-12 04:17:28 +00:00
|
|
|
export const createActionRequest = (payload: Partial<Action>) => {
|
2019-10-21 15:12:45 +00:00
|
|
|
return {
|
2019-10-25 05:35:20 +00:00
|
|
|
type: ReduxActionTypes.CREATE_ACTION_INIT,
|
2019-10-21 15:12:45 +00:00
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-06-04 13:49:22 +00:00
|
|
|
export const createActionSuccess = (payload: Action) => {
|
2019-10-21 15:12:45 +00:00
|
|
|
return {
|
2019-10-25 05:35:20 +00:00
|
|
|
type: ReduxActionTypes.CREATE_ACTION_SUCCESS,
|
|
|
|
|
payload,
|
2019-10-21 15:12:45 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2019-12-11 15:24:27 +00:00
|
|
|
export type FetchActionsPayload = {
|
2020-01-24 09:54:40 +00:00
|
|
|
applicationId: string;
|
2019-12-11 15:24:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const fetchActions = (
|
2021-10-18 14:03:44 +00:00
|
|
|
{ applicationId }: { applicationId: string },
|
2022-02-17 04:31:59 +00:00
|
|
|
postEvalActions: Array<AnyReduxAction>,
|
2021-04-26 05:41:32 +00:00
|
|
|
): EvaluationReduxAction<unknown> => {
|
2019-10-21 15:12:45 +00:00
|
|
|
return {
|
2019-10-25 05:35:20 +00:00
|
|
|
type: ReduxActionTypes.FETCH_ACTIONS_INIT,
|
2020-01-24 09:54:40 +00:00
|
|
|
payload: { applicationId },
|
2021-04-26 05:41:32 +00:00
|
|
|
postEvalActions,
|
2019-10-21 15:12:45 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-10-18 14:03:44 +00:00
|
|
|
export const fetchActionsForView = ({
|
|
|
|
|
applicationId,
|
|
|
|
|
}: {
|
|
|
|
|
applicationId: string;
|
|
|
|
|
}): ReduxAction<FetchActionsPayload> => {
|
2020-07-15 13:01:35 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_ACTIONS_VIEW_MODE_INIT,
|
|
|
|
|
payload: { applicationId },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-29 08:13:10 +00:00
|
|
|
export const fetchActionsForPage = (
|
|
|
|
|
pageId: string,
|
2022-02-17 04:31:59 +00:00
|
|
|
postEvalActions: Array<AnyReduxAction> = [],
|
2021-07-29 08:13:10 +00:00
|
|
|
): EvaluationReduxAction<unknown> => {
|
2020-02-21 12:16:49 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_ACTIONS_FOR_PAGE_INIT,
|
|
|
|
|
payload: { pageId },
|
2021-07-29 08:13:10 +00:00
|
|
|
postEvalActions,
|
2020-02-21 12:16:49 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-29 08:13:10 +00:00
|
|
|
export const fetchActionsForPageSuccess = (
|
|
|
|
|
actions: Action[],
|
2022-02-17 04:31:59 +00:00
|
|
|
postEvalActions?: Array<AnyReduxAction>,
|
2021-07-29 08:13:10 +00:00
|
|
|
): EvaluationReduxAction<unknown> => {
|
2020-02-21 12:16:49 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_ACTIONS_FOR_PAGE_SUCCESS,
|
|
|
|
|
payload: actions,
|
2021-07-29 08:13:10 +00:00
|
|
|
postEvalActions,
|
2020-02-21 12:16:49 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-31 15:40:21 +00:00
|
|
|
export const runActionViaShortcut = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.RUN_ACTION_SHORTCUT_REQUEST,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-03 08:58:58 +00:00
|
|
|
export const runAction = (id: string, paginationField?: PaginationField) => {
|
2019-10-21 15:12:45 +00:00
|
|
|
return {
|
2020-07-03 08:58:58 +00:00
|
|
|
type: ReduxActionTypes.RUN_ACTION_REQUEST,
|
2020-02-07 02:32:52 +00:00
|
|
|
payload: {
|
2020-07-03 08:58:58 +00:00
|
|
|
id,
|
|
|
|
|
paginationField,
|
2020-02-07 02:32:52 +00:00
|
|
|
},
|
2019-10-25 05:35:20 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-18 06:58:36 +00:00
|
|
|
export const showActionConfirmationModal = (show: boolean) => {
|
2020-08-27 15:39:16 +00:00
|
|
|
return {
|
2022-02-18 06:58:36 +00:00
|
|
|
type: ReduxActionTypes.SHOW_ACTION_MODAL,
|
2020-08-27 15:39:16 +00:00
|
|
|
payload: show,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-18 06:58:36 +00:00
|
|
|
export const cancelActionConfirmationModal = () => {
|
2020-08-27 15:39:16 +00:00
|
|
|
return {
|
2022-02-18 06:58:36 +00:00
|
|
|
type: ReduxActionTypes.CANCEL_ACTION_MODAL,
|
2020-08-27 15:39:16 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-02-18 06:58:36 +00:00
|
|
|
export const acceptActionConfirmationModal = () => {
|
2020-08-27 15:39:16 +00:00
|
|
|
return {
|
2022-02-18 06:58:36 +00:00
|
|
|
type: ReduxActionTypes.CONFIRM_ACTION_MODAL,
|
2020-08-27 15:39:16 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-06 13:35:31 +00:00
|
|
|
export const updateAction = (payload: { id: string }) => {
|
2020-07-28 10:41:51 +00:00
|
|
|
return batchAction({
|
2019-10-25 05:35:20 +00:00
|
|
|
type: ReduxActionTypes.UPDATE_ACTION_INIT,
|
|
|
|
|
payload,
|
2020-07-28 10:41:51 +00:00
|
|
|
});
|
2019-10-25 05:35:20 +00:00
|
|
|
};
|
|
|
|
|
|
2020-07-21 14:01:51 +00:00
|
|
|
export const updateActionSuccess = (payload: { data: Action }) => {
|
2019-10-25 05:35:20 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.UPDATE_ACTION_SUCCESS,
|
2019-10-21 15:12:45 +00:00
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-08-27 09:25:28 +00:00
|
|
|
export const clearActionResponse = (actionId: string) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.CLEAR_ACTION_RESPONSE,
|
|
|
|
|
payload: {
|
|
|
|
|
actionId,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-07 03:46:16 +00:00
|
|
|
export const deleteAction = (payload: {
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
onSuccess?: () => void;
|
|
|
|
|
}) => {
|
2019-10-21 15:12:45 +00:00
|
|
|
return {
|
2019-10-25 05:35:20 +00:00
|
|
|
type: ReduxActionTypes.DELETE_ACTION_INIT,
|
2019-10-21 15:12:45 +00:00
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-25 05:35:20 +00:00
|
|
|
export const deleteActionSuccess = (payload: { id: string }) => {
|
2019-10-21 15:12:45 +00:00
|
|
|
return {
|
2019-10-25 05:35:20 +00:00
|
|
|
type: ReduxActionTypes.DELETE_ACTION_SUCCESS,
|
2019-10-21 15:12:45 +00:00
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-01-24 09:54:40 +00:00
|
|
|
export const moveActionRequest = (payload: {
|
|
|
|
|
id: string;
|
|
|
|
|
destinationPageId: string;
|
|
|
|
|
originalPageId: string;
|
|
|
|
|
name: string;
|
|
|
|
|
}) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.MOVE_ACTION_INIT,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-21 14:01:51 +00:00
|
|
|
export const moveActionSuccess = (payload: Action) => {
|
2020-01-24 09:54:40 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.MOVE_ACTION_SUCCESS,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const moveActionError = (payload: {
|
|
|
|
|
id: string;
|
|
|
|
|
originalPageId: string;
|
|
|
|
|
}) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionErrorTypes.MOVE_ACTION_ERROR,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const copyActionRequest = (payload: {
|
|
|
|
|
id: string;
|
|
|
|
|
destinationPageId: string;
|
|
|
|
|
name: string;
|
|
|
|
|
}) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.COPY_ACTION_INIT,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-21 14:01:51 +00:00
|
|
|
export const copyActionSuccess = (payload: Action) => {
|
2020-01-24 09:54:40 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.COPY_ACTION_SUCCESS,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const copyActionError = (payload: {
|
|
|
|
|
id: string;
|
|
|
|
|
destinationPageId: string;
|
|
|
|
|
}) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionErrorTypes.COPY_ACTION_ERROR,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-08-27 09:25:28 +00:00
|
|
|
export const executePluginActionRequest = (payload: { id: string }) => ({
|
|
|
|
|
type: ReduxActionTypes.EXECUTE_PLUGIN_ACTION_REQUEST,
|
2020-02-18 10:41:52 +00:00
|
|
|
payload: payload,
|
|
|
|
|
});
|
|
|
|
|
|
2021-08-27 09:25:28 +00:00
|
|
|
export const executePluginActionSuccess = (payload: {
|
2020-02-18 10:41:52 +00:00
|
|
|
id: string;
|
|
|
|
|
response: ActionResponse;
|
2020-09-28 05:12:23 +00:00
|
|
|
isPageLoad?: boolean;
|
2020-02-18 10:41:52 +00:00
|
|
|
}) => ({
|
2021-08-27 09:25:28 +00:00
|
|
|
type: ReduxActionTypes.EXECUTE_PLUGIN_ACTION_SUCCESS,
|
2020-02-18 10:41:52 +00:00
|
|
|
payload: payload,
|
|
|
|
|
});
|
|
|
|
|
|
2021-08-27 09:25:28 +00:00
|
|
|
export const executePluginActionError = (
|
|
|
|
|
executeErrorPayload: ExecuteErrorPayload,
|
|
|
|
|
): ReduxAction<ExecuteErrorPayload> => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionErrorTypes.EXECUTE_PLUGIN_ACTION_ERROR,
|
|
|
|
|
payload: executeErrorPayload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
export const saveActionName = (payload: { id: string; name: string }) => ({
|
|
|
|
|
type: ReduxActionTypes.SAVE_ACTION_NAME_INIT,
|
2020-06-16 10:23:19 +00:00
|
|
|
payload: payload,
|
|
|
|
|
});
|
|
|
|
|
|
2020-07-03 08:58:58 +00:00
|
|
|
export type SetActionPropertyPayload = {
|
|
|
|
|
actionId: string;
|
|
|
|
|
propertyName: string;
|
2020-07-14 06:53:33 +00:00
|
|
|
value: any;
|
2021-12-07 09:45:18 +00:00
|
|
|
skipSave?: boolean;
|
2020-07-03 08:58:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const setActionProperty = (payload: SetActionPropertyPayload) => ({
|
|
|
|
|
type: ReduxActionTypes.SET_ACTION_PROPERTY,
|
|
|
|
|
payload,
|
2020-06-16 10:23:19 +00:00
|
|
|
});
|
|
|
|
|
|
2020-07-03 08:58:58 +00:00
|
|
|
export type UpdateActionPropertyActionPayload = {
|
|
|
|
|
id: string;
|
|
|
|
|
field: string;
|
|
|
|
|
value: any;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const updateActionProperty = (
|
|
|
|
|
payload: UpdateActionPropertyActionPayload,
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
) => {
|
|
|
|
|
return batchAction({
|
2020-07-03 08:58:58 +00:00
|
|
|
type: ReduxActionTypes.UPDATE_ACTION_PROPERTY,
|
|
|
|
|
payload,
|
|
|
|
|
});
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
};
|
2020-07-03 08:58:58 +00:00
|
|
|
|
2021-08-27 09:25:28 +00:00
|
|
|
export const executePageLoadActions = (): ReduxActionWithoutPayload => ({
|
|
|
|
|
type: ReduxActionTypes.EXECUTE_PAGE_LOAD_ACTIONS,
|
|
|
|
|
});
|
2021-05-18 11:51:32 +00:00
|
|
|
|
2021-02-15 16:13:44 +00:00
|
|
|
export const setActionsToExecuteOnPageLoad = (
|
|
|
|
|
actions: Array<{
|
|
|
|
|
executeOnLoad: boolean;
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
}>,
|
|
|
|
|
) => {
|
2020-08-27 15:39:16 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SET_ACTION_TO_EXECUTE_ON_PAGELOAD,
|
|
|
|
|
payload: actions,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-26 16:44:10 +00:00
|
|
|
export const bindDataOnCanvas = (payload: {
|
|
|
|
|
queryId: string;
|
|
|
|
|
applicationId: string;
|
|
|
|
|
pageId: string;
|
|
|
|
|
}) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.BIND_DATA_ON_CANVAS,
|
|
|
|
|
payload,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-21 15:12:45 +00:00
|
|
|
export default {
|
2019-10-29 12:02:58 +00:00
|
|
|
createAction: createActionRequest,
|
2019-10-21 15:12:45 +00:00
|
|
|
fetchActions,
|
2020-07-03 08:58:58 +00:00
|
|
|
runAction: runAction,
|
2019-10-21 15:12:45 +00:00
|
|
|
deleteAction,
|
2019-10-25 05:35:20 +00:00
|
|
|
deleteActionSuccess,
|
|
|
|
|
updateAction,
|
|
|
|
|
updateActionSuccess,
|
2021-07-26 16:44:10 +00:00
|
|
|
bindDataOnCanvas,
|
2019-10-21 15:12:45 +00:00
|
|
|
};
|