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
|
|
|
import { createReducer } from "utils/AppsmithUtils";
|
|
|
|
|
import {
|
|
|
|
|
ReduxAction,
|
|
|
|
|
ReduxActionTypes,
|
|
|
|
|
ReduxActionErrorTypes,
|
|
|
|
|
} from "constants/ReduxActionConstants";
|
|
|
|
|
|
|
|
|
|
export interface ExplorerReduxState {
|
|
|
|
|
updatingEntity?: string;
|
|
|
|
|
updateEntityError?: string;
|
|
|
|
|
editingEntityName?: string;
|
|
|
|
|
}
|
|
|
|
|
const initialState: ExplorerReduxState = {};
|
|
|
|
|
|
|
|
|
|
const setUpdatingEntity = (
|
|
|
|
|
state: ExplorerReduxState,
|
|
|
|
|
action: ReduxAction<{ id: string }>,
|
|
|
|
|
) => {
|
|
|
|
|
return { updatingEntity: action.payload.id, updateEntityError: undefined };
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const setEntityUpdateError = (state: ExplorerReduxState) => {
|
2020-08-27 10:35:15 +00:00
|
|
|
return { updatingEntity: undefined, updateEntityError: state.updatingEntity };
|
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
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const setEntityUpdateSuccess = () => {
|
|
|
|
|
return {};
|
|
|
|
|
};
|
|
|
|
|
|
2020-10-29 13:53:10 +00:00
|
|
|
const setUpdatingDatasourceEntity = (
|
|
|
|
|
state: ExplorerReduxState,
|
|
|
|
|
action: ReduxAction<{ id: string }>,
|
|
|
|
|
) => {
|
|
|
|
|
const pathParts = window.location.pathname.split("/");
|
|
|
|
|
const pageId = pathParts[pathParts.indexOf("pages") + 1];
|
|
|
|
|
|
|
|
|
|
if (!state.updatingEntity?.includes(action.payload.id)) {
|
|
|
|
|
return {
|
|
|
|
|
updatingEntity: `${action.payload.id}-${pageId}`,
|
|
|
|
|
updateEntityError: undefined,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return state;
|
|
|
|
|
};
|
|
|
|
|
|
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
|
|
|
const explorerReducer = createReducer(initialState, {
|
|
|
|
|
[ReduxActionTypes.FETCH_PAGE_INIT]: setUpdatingEntity,
|
|
|
|
|
[ReduxActionTypes.FETCH_PAGE_ERROR]: setEntityUpdateError,
|
|
|
|
|
[ReduxActionTypes.FETCH_PAGE_SUCCESS]: setEntityUpdateSuccess,
|
|
|
|
|
|
2020-08-22 03:10:22 +00:00
|
|
|
[ReduxActionTypes.CLONE_PAGE_INIT]: setUpdatingEntity,
|
|
|
|
|
[ReduxActionTypes.CLONE_PAGE_ERROR]: setEntityUpdateError,
|
|
|
|
|
[ReduxActionTypes.CLONE_PAGE_SUCCESS]: setEntityUpdateSuccess,
|
|
|
|
|
|
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
|
|
|
[ReduxActionTypes.MOVE_ACTION_INIT]: setUpdatingEntity,
|
|
|
|
|
[ReduxActionErrorTypes.MOVE_ACTION_ERROR]: setEntityUpdateError,
|
|
|
|
|
[ReduxActionTypes.MOVE_ACTION_SUCCESS]: setEntityUpdateSuccess,
|
|
|
|
|
|
|
|
|
|
[ReduxActionTypes.COPY_ACTION_INIT]: setUpdatingEntity,
|
|
|
|
|
[ReduxActionErrorTypes.COPY_ACTION_ERROR]: setEntityUpdateError,
|
|
|
|
|
[ReduxActionTypes.COPY_ACTION_SUCCESS]: setEntityUpdateSuccess,
|
|
|
|
|
|
|
|
|
|
[ReduxActionTypes.DELETE_ACTION_INIT]: setUpdatingEntity,
|
|
|
|
|
[ReduxActionErrorTypes.DELETE_ACTION_ERROR]: setEntityUpdateError,
|
|
|
|
|
[ReduxActionTypes.DELETE_ACTION_SUCCESS]: setEntityUpdateSuccess,
|
|
|
|
|
|
2020-10-29 13:53:10 +00:00
|
|
|
[ReduxActionTypes.DELETE_DATASOURCE_INIT]: setUpdatingDatasourceEntity,
|
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
|
|
|
[ReduxActionErrorTypes.DELETE_DATASOURCE_ERROR]: setEntityUpdateError,
|
|
|
|
|
[ReduxActionTypes.DELETE_DATASOURCE_SUCCESS]: setEntityUpdateSuccess,
|
|
|
|
|
|
2020-10-29 13:53:10 +00:00
|
|
|
[ReduxActionTypes.UPDATE_DATASOURCE_INIT]: setUpdatingDatasourceEntity,
|
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
|
|
|
[ReduxActionErrorTypes.UPDATE_DATASOURCE_ERROR]: setEntityUpdateError,
|
|
|
|
|
[ReduxActionTypes.UPDATE_DATASOURCE_SUCCESS]: setEntityUpdateSuccess,
|
|
|
|
|
|
2020-10-29 13:53:10 +00:00
|
|
|
[ReduxActionTypes.FETCH_DATASOURCE_STRUCTURE_INIT]: setUpdatingDatasourceEntity,
|
2020-09-21 09:11:42 +00:00
|
|
|
[ReduxActionErrorTypes.FETCH_DATASOURCE_STRUCTURE_ERROR]: setEntityUpdateError,
|
|
|
|
|
[ReduxActionTypes.FETCH_DATASOURCE_STRUCTURE_SUCCESS]: setEntityUpdateSuccess,
|
|
|
|
|
|
2020-10-29 13:53:10 +00:00
|
|
|
[ReduxActionTypes.REFRESH_DATASOURCE_STRUCTURE_INIT]: setUpdatingDatasourceEntity,
|
2020-09-29 04:17:25 +00:00
|
|
|
[ReduxActionErrorTypes.REFRESH_DATASOURCE_STRUCTURE_ERROR]: setEntityUpdateError,
|
|
|
|
|
[ReduxActionTypes.REFRESH_DATASOURCE_STRUCTURE_SUCCESS]: setEntityUpdateSuccess,
|
|
|
|
|
|
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
|
|
|
[ReduxActionTypes.UPDATE_PAGE_INIT]: setUpdatingEntity,
|
|
|
|
|
[ReduxActionErrorTypes.UPDATE_PAGE_ERROR]: setEntityUpdateError,
|
|
|
|
|
[ReduxActionTypes.UPDATE_PAGE_SUCCESS]: setEntityUpdateSuccess,
|
|
|
|
|
|
|
|
|
|
[ReduxActionTypes.SET_DEFAULT_APPLICATION_PAGE_INIT]: setUpdatingEntity,
|
|
|
|
|
[ReduxActionErrorTypes.SET_DEFAULT_APPLICATION_PAGE_ERROR]: setEntityUpdateError,
|
|
|
|
|
[ReduxActionTypes.SET_DEFAULT_APPLICATION_PAGE_SUCCESS]: setEntityUpdateSuccess,
|
|
|
|
|
|
|
|
|
|
[ReduxActionTypes.UPDATE_WIDGET_NAME_INIT]: setUpdatingEntity,
|
|
|
|
|
[ReduxActionErrorTypes.UPDATE_WIDGET_NAME_ERROR]: setEntityUpdateError,
|
|
|
|
|
[ReduxActionTypes.UPDATE_WIDGET_NAME_SUCCESS]: setEntityUpdateSuccess,
|
|
|
|
|
|
|
|
|
|
[ReduxActionTypes.SAVE_ACTION_NAME_INIT]: setUpdatingEntity,
|
|
|
|
|
[ReduxActionErrorTypes.SAVE_ACTION_NAME_ERROR]: setEntityUpdateError,
|
|
|
|
|
[ReduxActionTypes.SAVE_ACTION_NAME_SUCCESS]: setEntityUpdateSuccess,
|
|
|
|
|
|
|
|
|
|
[ReduxActionTypes.INIT_EXPLORER_ENTITY_NAME_EDIT]: (
|
|
|
|
|
state: ExplorerReduxState,
|
|
|
|
|
action: ReduxAction<{ id: string }>,
|
|
|
|
|
) => {
|
|
|
|
|
return { editingEntityName: action.payload.id };
|
|
|
|
|
},
|
2021-01-12 01:22:31 +00:00
|
|
|
[ReduxActionTypes.END_EXPLORER_ENTITY_NAME_EDIT]: () => {
|
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 {};
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default explorerReducer;
|