2020-06-04 13:49:22 +00:00
|
|
|
import { PaginationField, ActionResponse } from "api/ActionAPI";
|
2020-01-24 09:54:40 +00:00
|
|
|
import {
|
|
|
|
|
ReduxActionTypes,
|
|
|
|
|
ReduxAction,
|
|
|
|
|
ReduxActionErrorTypes,
|
2021-04-26 05:41:32 +00:00
|
|
|
EvaluationReduxAction,
|
|
|
|
|
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";
|
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 = (
|
2020-01-24 09:54:40 +00:00
|
|
|
applicationId: string,
|
2021-04-26 05:41:32 +00:00
|
|
|
postEvalActions: Array<ReduxAction<unknown> | ReduxActionWithoutPayload>,
|
|
|
|
|
): 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
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-15 13:01:35 +00:00
|
|
|
export const fetchActionsForView = (
|
|
|
|
|
applicationId: string,
|
|
|
|
|
): ReduxAction<FetchActionsPayload> => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_ACTIONS_VIEW_MODE_INIT,
|
|
|
|
|
payload: { applicationId },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-21 12:16:49 +00:00
|
|
|
export const fetchActionsForPage = (pageId: string) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_ACTIONS_FOR_PAGE_INIT,
|
|
|
|
|
payload: { pageId },
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-21 14:01:51 +00:00
|
|
|
export const fetchActionsForPageSuccess = (actions: Action[]) => {
|
2020-02-21 12:16:49 +00:00
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.FETCH_ACTIONS_FOR_PAGE_SUCCESS,
|
|
|
|
|
payload: actions,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-08-27 15:39:16 +00:00
|
|
|
export const runActionInit = (
|
|
|
|
|
id: string,
|
|
|
|
|
paginationField?: PaginationField,
|
|
|
|
|
) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.RUN_ACTION_INIT,
|
|
|
|
|
payload: {
|
|
|
|
|
id,
|
|
|
|
|
paginationField,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const showRunActionConfirmModal = (show: boolean) => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.SHOW_RUN_ACTION_CONFIRM_MODAL,
|
|
|
|
|
payload: show,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const cancelRunActionConfirmModal = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.CANCEL_RUN_ACTION_CONFIRM_MODAL,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const acceptRunActionConfirmModal = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.ACCEPT_RUN_ACTION_CONFIRM_MODAL,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
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,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-03-06 04:59:24 +00:00
|
|
|
export const deleteAction = (payload: { id: string; name: string }) => {
|
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,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-18 10:41:52 +00:00
|
|
|
export const executeApiActionRequest = (payload: { id: string }) => ({
|
|
|
|
|
type: ReduxActionTypes.EXECUTE_API_ACTION_REQUEST,
|
|
|
|
|
payload: payload,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const executeApiActionSuccess = (payload: {
|
|
|
|
|
id: string;
|
|
|
|
|
response: ActionResponse;
|
2020-09-28 05:12:23 +00:00
|
|
|
isPageLoad?: boolean;
|
2020-02-18 10:41:52 +00:00
|
|
|
}) => ({
|
|
|
|
|
type: ReduxActionTypes.EXECUTE_API_ACTION_SUCCESS,
|
|
|
|
|
payload: 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
|
|
|
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;
|
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-05-18 11:51:32 +00:00
|
|
|
export const executePageLoadActionsComplete = () => {
|
|
|
|
|
return {
|
|
|
|
|
type: ReduxActionTypes.EXECUTE_PAGE_LOAD_ACTIONS_COMPLETE,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
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,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
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,
|
2019-10-21 15:12:45 +00:00
|
|
|
};
|