2019-11-25 05:07:27 +00:00
|
|
|
import CanvasWidgetsNormalizer from "normalizers/CanvasWidgetsNormalizer";
|
2020-02-21 07:19:10 +00:00
|
|
|
import { AppState } from "reducers";
|
2019-09-16 08:08:03 +00:00
|
|
|
import {
|
2020-11-04 11:40:59 +00:00
|
|
|
Page,
|
2020-08-14 07:43:01 +00:00
|
|
|
PageListPayload,
|
2019-09-16 08:08:03 +00:00
|
|
|
ReduxAction,
|
2020-08-14 07:43:01 +00:00
|
|
|
ReduxActionErrorTypes,
|
|
|
|
|
ReduxActionTypes,
|
2019-09-24 12:36:03 +00:00
|
|
|
UpdateCanvasPayload,
|
2019-11-25 05:07:27 +00:00
|
|
|
} from "constants/ReduxActionConstants";
|
2019-11-22 14:02:55 +00:00
|
|
|
import {
|
2020-08-22 03:10:22 +00:00
|
|
|
clonePageSuccess,
|
[API breaking change : Automated Tests Will Fail] Page And Action Refactor (#549)
* Introduced new page which stores the published and unpublished pages as separate.
* Mid level commit to save the state.
* Parity of new page repository with old page repository (custom functions)
* WIP : Delete a page. This requires changes across application structure as well.
* Added publishedPages construct inside application to store the pages in the deployed view as well as isDefault so that the same changes (delete or isDefault) in unpublished view doesn't alter these fields for the published application
* Parity reached with PageService.
* Minor ActionService refactor to remove unnecessary code.
ApplicationPageService, LayoutActionService, LayoutService use the new page service to fetch the pages
Minor corrections in fetching the page from new page service in tests
* New save function which sets the PageDTO for unpublished page and then saves the new page into repository.
* Migration of page service functions to new page service functions across other services/tests/controller
* Finished migrating all the page service functions to the new page service functions
* Application Service Tests have been fixed.
* All the existing test cases are working now.
* Publish application implemented to store published pages as well. Added a basic test case to check that published pages is being set and that page's publishedPageDTO is being set accordingly.
* Minor TODOs added to add test cases for published application.
* A few tests to ascertain that published application page fields (deleted, isDefault) does not get changed when these statuses are changed for a page in edit mode.
* Added a new controller end point to fetch application in view mode.
* Added new endpoint for fetching an application in view mode on the client.
* Bug fix where get application in view mode API was not getting called.
* Fixed the get page names by application & archive pages which have been deleted in edit mode during publishing of application.
* During delete page, if a page was never published and it was deleted during edit, delete the entire page instead of just deleting the unpublished PageDTO
* Minor formatting.
* Non working client side code to fetch page list using view mode.
* revert unnecassary changes and streamlined view and edit actions
* Fix missed import
* Fixed a bug where if a page is not published, it should not be returned in view mode in list of page names api.
* Fixed update for a page which was not working in integration test.
* ActionDTO added.
* Solidified the new action structure.
* Migration added for NewAction index creation and NewAction per Action insertion in the database.
* Basic file structure added the new repository, custom repository, service, etc.
* Delete OldPage.java
* Repo functions added - TODO : Haven;t handled the published/edited views
* Helper functions added to convert Action to NewAction and vice-versa. Removed unused currentUserMono usage.
* Create & update action functionality added.
* Execute Action refactored. Removed dry run specific code.
* Repository migrated to handle new data structure. Execute action refactored to no longer support dry runs of actions.
* TODO added for special handling of change view of application to handle edge cases of pages/actions which either exist in published mode but don't exist in unpublished mode or vice versa.
* Migrated finding on load actions from spring repository to custom repository.
* In view mode, now actions are being fetched by application id directly instead of first fetching application and then using the page ids, fetching the actions. This reduces the db calls from 2 to 1 per fetch actions in view mode api call.
* Delete action and get all actions (used in edit mode on the client side) implemented.
* Updated CollectionService and ActionCollectionService to use the new action service instead of the old one.
* LayoutActionService refactored to now use the new service functions.
* ActionController now no longer used ActionService. The remaining service functions have been migrated to the new action service.
* Refactor across ACL code for addition/removal of policies during addition/removal of users to organization, making app public, refactor for services like policy utils, item service, etc.
* Removed the last of action repository and action service and replaced with new action repo and new action service.
* Compile and run time issues fixed. The server is coming up without any spring dependency errors.
* WIP in fixing fetching actions by page id.
* Finally!!! Fixed the fetch actions (both published and unpublished actions) by page id repository function.
* Fixed create action bug where null datasource in published actiondto (inside newly created action) leads to error.
* Fixed the execute action issues :
1. Removed the dry runs from the tests
2. Fixed the null pointer error in variable substituted action and datasource configurations.
* 1. Fixed the custom action repository field names.
2. Fixed the data structures used in ExamplesOrganizationClonerTests
* Fixed countByDatasourceId repository function which was querying the actions incorrectly.
* Fixed the clone example organization error where the id of the action was not getting updated in the page correctly. Yay!
* Fixed post merge compilation failure.
* Fixed more compilation time failures in ActionServiceTest
* Fixed failing test case for fetching actions in view mode.
* Minor changes to resolve merge changes and incorporate in the new refactored code.
* 1. Fixed compile time errors on Client code.
2. Fixed fetching of actions in view mode by application id. The repository function did not need name parameter. Removed the same.
* [Integration Testing Error Fix] : Added a new test case for refactor action name.
* Instead of fetching actions in the page, mistakenly used the base service which was fetching all the actions in the repository, barring none which led to the name refactor being blocked even though no action in the current page exists with the new proposed name,
* Added delete functionality to action service.
* Minor code cleanup
* Adding viewMode to action execution
* Replacing action with actionId.
* 1. Bug fix for deletion of unpublished action. In case of never published action, the entire action should be deleted. In case an action was published, only the unpublished action should be deleted.
2. In case of DB actions (external datasources), only the bare minimum fields should be stored inside the action (datasource id and datasource plugin id). The other fields should not be duplicated across code.
* Fixed yarn build compilation issues.
* Update app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ActionController.java
Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
* Changed the API path for GET applications in view mode. Some minor code formatting.
* Incorporated review comments.
* Some more unnecessary code removed.
* Instead of returning Page, now the interface object between client and server for Pages is PageDTO
* Migrated Page and Action to PageDTO and ActionDTO
Fixed the compilation issues.
TODO : Fix the test compilation issues.
* Fixed compilation time issues with all the tests by migrating Page and Action to PageDTO and ActionDTO respectively
* Action Controller and Page Controller no longer extend Base Controller. All the required functions have now been implemented and no base line API end points are being re-used from the base.
* Test case fixes.
* Bug Fix : Updating an action was not updating execute on load. Fixed the data flow leading to the error.
* Deprecating Page and Action domain objects. This is to ensure no new code is written with these till we remove this old code.
* Cloned example applications are now published before returning. This is to ensure that the applications are in ready to view mode when the new user signs up.
* Added a function comment to expand on the usage of new param introduced.
* When cloning a page, new actions were not being stored. Added that. Also updated the clonePage test to assert that the actions are also cloned when the pages are cloned.
* Updated a Api call
* removed extra slash
Co-authored-by: Hetu Nandu <hetunandu@gmail.com>
Co-authored-by: Satbir Singh <satbir121@gmail.com>
Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
Co-authored-by: nandan.anantharamu <nandan@thinkify.io>
2020-10-26 12:34:23 +00:00
|
|
|
deletePageSuccess,
|
|
|
|
|
FetchPageListPayload,
|
2020-08-14 07:43:01 +00:00
|
|
|
fetchPageSuccess,
|
2020-03-19 03:25:52 +00:00
|
|
|
fetchPublishedPageSuccess,
|
2020-08-14 07:43:01 +00:00
|
|
|
savePageSuccess,
|
2020-08-07 14:24:26 +00:00
|
|
|
setUrlData,
|
2021-01-25 08:57:26 +00:00
|
|
|
initCanvasLayout,
|
2020-08-14 07:43:01 +00:00
|
|
|
updateCurrentPage,
|
|
|
|
|
updateWidgetNameSuccess,
|
2021-02-01 13:17:55 +00:00
|
|
|
updateAndSaveLayout,
|
2019-11-25 05:07:27 +00:00
|
|
|
} from "actions/pageActions";
|
2019-09-17 15:09:55 +00:00
|
|
|
import PageApi, {
|
[API breaking change : Automated Tests Will Fail] Page And Action Refactor (#549)
* Introduced new page which stores the published and unpublished pages as separate.
* Mid level commit to save the state.
* Parity of new page repository with old page repository (custom functions)
* WIP : Delete a page. This requires changes across application structure as well.
* Added publishedPages construct inside application to store the pages in the deployed view as well as isDefault so that the same changes (delete or isDefault) in unpublished view doesn't alter these fields for the published application
* Parity reached with PageService.
* Minor ActionService refactor to remove unnecessary code.
ApplicationPageService, LayoutActionService, LayoutService use the new page service to fetch the pages
Minor corrections in fetching the page from new page service in tests
* New save function which sets the PageDTO for unpublished page and then saves the new page into repository.
* Migration of page service functions to new page service functions across other services/tests/controller
* Finished migrating all the page service functions to the new page service functions
* Application Service Tests have been fixed.
* All the existing test cases are working now.
* Publish application implemented to store published pages as well. Added a basic test case to check that published pages is being set and that page's publishedPageDTO is being set accordingly.
* Minor TODOs added to add test cases for published application.
* A few tests to ascertain that published application page fields (deleted, isDefault) does not get changed when these statuses are changed for a page in edit mode.
* Added a new controller end point to fetch application in view mode.
* Added new endpoint for fetching an application in view mode on the client.
* Bug fix where get application in view mode API was not getting called.
* Fixed the get page names by application & archive pages which have been deleted in edit mode during publishing of application.
* During delete page, if a page was never published and it was deleted during edit, delete the entire page instead of just deleting the unpublished PageDTO
* Minor formatting.
* Non working client side code to fetch page list using view mode.
* revert unnecassary changes and streamlined view and edit actions
* Fix missed import
* Fixed a bug where if a page is not published, it should not be returned in view mode in list of page names api.
* Fixed update for a page which was not working in integration test.
* ActionDTO added.
* Solidified the new action structure.
* Migration added for NewAction index creation and NewAction per Action insertion in the database.
* Basic file structure added the new repository, custom repository, service, etc.
* Delete OldPage.java
* Repo functions added - TODO : Haven;t handled the published/edited views
* Helper functions added to convert Action to NewAction and vice-versa. Removed unused currentUserMono usage.
* Create & update action functionality added.
* Execute Action refactored. Removed dry run specific code.
* Repository migrated to handle new data structure. Execute action refactored to no longer support dry runs of actions.
* TODO added for special handling of change view of application to handle edge cases of pages/actions which either exist in published mode but don't exist in unpublished mode or vice versa.
* Migrated finding on load actions from spring repository to custom repository.
* In view mode, now actions are being fetched by application id directly instead of first fetching application and then using the page ids, fetching the actions. This reduces the db calls from 2 to 1 per fetch actions in view mode api call.
* Delete action and get all actions (used in edit mode on the client side) implemented.
* Updated CollectionService and ActionCollectionService to use the new action service instead of the old one.
* LayoutActionService refactored to now use the new service functions.
* ActionController now no longer used ActionService. The remaining service functions have been migrated to the new action service.
* Refactor across ACL code for addition/removal of policies during addition/removal of users to organization, making app public, refactor for services like policy utils, item service, etc.
* Removed the last of action repository and action service and replaced with new action repo and new action service.
* Compile and run time issues fixed. The server is coming up without any spring dependency errors.
* WIP in fixing fetching actions by page id.
* Finally!!! Fixed the fetch actions (both published and unpublished actions) by page id repository function.
* Fixed create action bug where null datasource in published actiondto (inside newly created action) leads to error.
* Fixed the execute action issues :
1. Removed the dry runs from the tests
2. Fixed the null pointer error in variable substituted action and datasource configurations.
* 1. Fixed the custom action repository field names.
2. Fixed the data structures used in ExamplesOrganizationClonerTests
* Fixed countByDatasourceId repository function which was querying the actions incorrectly.
* Fixed the clone example organization error where the id of the action was not getting updated in the page correctly. Yay!
* Fixed post merge compilation failure.
* Fixed more compilation time failures in ActionServiceTest
* Fixed failing test case for fetching actions in view mode.
* Minor changes to resolve merge changes and incorporate in the new refactored code.
* 1. Fixed compile time errors on Client code.
2. Fixed fetching of actions in view mode by application id. The repository function did not need name parameter. Removed the same.
* [Integration Testing Error Fix] : Added a new test case for refactor action name.
* Instead of fetching actions in the page, mistakenly used the base service which was fetching all the actions in the repository, barring none which led to the name refactor being blocked even though no action in the current page exists with the new proposed name,
* Added delete functionality to action service.
* Minor code cleanup
* Adding viewMode to action execution
* Replacing action with actionId.
* 1. Bug fix for deletion of unpublished action. In case of never published action, the entire action should be deleted. In case an action was published, only the unpublished action should be deleted.
2. In case of DB actions (external datasources), only the bare minimum fields should be stored inside the action (datasource id and datasource plugin id). The other fields should not be duplicated across code.
* Fixed yarn build compilation issues.
* Update app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ActionController.java
Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
* Changed the API path for GET applications in view mode. Some minor code formatting.
* Incorporated review comments.
* Some more unnecessary code removed.
* Instead of returning Page, now the interface object between client and server for Pages is PageDTO
* Migrated Page and Action to PageDTO and ActionDTO
Fixed the compilation issues.
TODO : Fix the test compilation issues.
* Fixed compilation time issues with all the tests by migrating Page and Action to PageDTO and ActionDTO respectively
* Action Controller and Page Controller no longer extend Base Controller. All the required functions have now been implemented and no base line API end points are being re-used from the base.
* Test case fixes.
* Bug Fix : Updating an action was not updating execute on load. Fixed the data flow leading to the error.
* Deprecating Page and Action domain objects. This is to ensure no new code is written with these till we remove this old code.
* Cloned example applications are now published before returning. This is to ensure that the applications are in ready to view mode when the new user signs up.
* Added a function comment to expand on the usage of new param introduced.
* When cloning a page, new actions were not being stored. Added that. Also updated the clonePage test to assert that the actions are also cloned when the pages are cloned.
* Updated a Api call
* removed extra slash
Co-authored-by: Hetu Nandu <hetunandu@gmail.com>
Co-authored-by: Satbir Singh <satbir121@gmail.com>
Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
Co-authored-by: nandan.anantharamu <nandan@thinkify.io>
2020-10-26 12:34:23 +00:00
|
|
|
ClonePageRequest,
|
2020-08-14 07:43:01 +00:00
|
|
|
CreatePageRequest,
|
|
|
|
|
DeletePageRequest,
|
|
|
|
|
FetchPageListResponse,
|
2019-09-17 15:09:55 +00:00
|
|
|
FetchPageRequest,
|
2020-08-14 07:43:01 +00:00
|
|
|
FetchPageResponse,
|
2019-10-24 07:03:59 +00:00
|
|
|
FetchPublishedPageRequest,
|
|
|
|
|
FetchPublishedPageResponse,
|
2020-08-14 07:43:01 +00:00
|
|
|
PageLayout,
|
|
|
|
|
SavePageResponse,
|
2020-01-27 08:24:58 +00:00
|
|
|
UpdatePageRequest,
|
2020-02-21 12:16:49 +00:00
|
|
|
UpdateWidgetNameRequest,
|
|
|
|
|
UpdateWidgetNameResponse,
|
2019-11-25 05:07:27 +00:00
|
|
|
} from "api/PageApi";
|
|
|
|
|
import { FlattenedWidgetProps } from "reducers/entityReducers/canvasWidgetsReducer";
|
2019-09-22 20:25:05 +00:00
|
|
|
import {
|
2020-08-14 07:43:01 +00:00
|
|
|
all,
|
2019-09-22 20:25:05 +00:00
|
|
|
call,
|
2020-08-14 07:43:01 +00:00
|
|
|
debounce,
|
2019-09-22 20:25:05 +00:00
|
|
|
put,
|
2020-08-14 07:43:01 +00:00
|
|
|
select,
|
2019-09-22 20:25:05 +00:00
|
|
|
takeLatest,
|
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
|
|
|
takeLeading,
|
2019-09-22 20:25:05 +00:00
|
|
|
} from "redux-saga/effects";
|
2020-02-21 07:19:10 +00:00
|
|
|
import history from "utils/history";
|
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 { BUILDER_PAGE_URL } from "constants/routes";
|
2020-11-23 09:27:00 +00:00
|
|
|
import { isNameValid } from "utils/helpers";
|
2019-11-25 05:07:27 +00:00
|
|
|
import { extractCurrentDSL } from "utils/WidgetPropsUtils";
|
2020-08-14 07:43:01 +00:00
|
|
|
import {
|
|
|
|
|
getAllPageIds,
|
|
|
|
|
getEditorConfigs,
|
|
|
|
|
getExistingPageNames,
|
|
|
|
|
getWidgets,
|
|
|
|
|
} from "./selectors";
|
2020-11-23 09:27:00 +00:00
|
|
|
import { getDataTree } from "selectors/dataTreeSelectors";
|
2021-03-04 05:24:47 +00:00
|
|
|
import { IncorrectBindingError, validateResponse } from "./ErrorSagas";
|
2019-12-11 15:24:27 +00:00
|
|
|
import { executePageLoadActions } from "actions/widgetActions";
|
2020-01-27 08:24:58 +00:00
|
|
|
import { ApiResponse } from "api/ApiResponses";
|
2020-02-21 12:16:49 +00:00
|
|
|
import {
|
|
|
|
|
getCurrentApplicationId,
|
2020-08-14 07:43:01 +00:00
|
|
|
getCurrentLayoutId,
|
|
|
|
|
getCurrentPageId,
|
2020-02-21 12:16:49 +00:00
|
|
|
getCurrentPageName,
|
|
|
|
|
} from "selectors/editorSelectors";
|
2020-08-27 15:39:16 +00:00
|
|
|
import {
|
|
|
|
|
fetchActionsForPage,
|
|
|
|
|
setActionsToExecuteOnPageLoad,
|
|
|
|
|
} from "actions/actionActions";
|
[API breaking change : Automated Tests Will Fail] Page And Action Refactor (#549)
* Introduced new page which stores the published and unpublished pages as separate.
* Mid level commit to save the state.
* Parity of new page repository with old page repository (custom functions)
* WIP : Delete a page. This requires changes across application structure as well.
* Added publishedPages construct inside application to store the pages in the deployed view as well as isDefault so that the same changes (delete or isDefault) in unpublished view doesn't alter these fields for the published application
* Parity reached with PageService.
* Minor ActionService refactor to remove unnecessary code.
ApplicationPageService, LayoutActionService, LayoutService use the new page service to fetch the pages
Minor corrections in fetching the page from new page service in tests
* New save function which sets the PageDTO for unpublished page and then saves the new page into repository.
* Migration of page service functions to new page service functions across other services/tests/controller
* Finished migrating all the page service functions to the new page service functions
* Application Service Tests have been fixed.
* All the existing test cases are working now.
* Publish application implemented to store published pages as well. Added a basic test case to check that published pages is being set and that page's publishedPageDTO is being set accordingly.
* Minor TODOs added to add test cases for published application.
* A few tests to ascertain that published application page fields (deleted, isDefault) does not get changed when these statuses are changed for a page in edit mode.
* Added a new controller end point to fetch application in view mode.
* Added new endpoint for fetching an application in view mode on the client.
* Bug fix where get application in view mode API was not getting called.
* Fixed the get page names by application & archive pages which have been deleted in edit mode during publishing of application.
* During delete page, if a page was never published and it was deleted during edit, delete the entire page instead of just deleting the unpublished PageDTO
* Minor formatting.
* Non working client side code to fetch page list using view mode.
* revert unnecassary changes and streamlined view and edit actions
* Fix missed import
* Fixed a bug where if a page is not published, it should not be returned in view mode in list of page names api.
* Fixed update for a page which was not working in integration test.
* ActionDTO added.
* Solidified the new action structure.
* Migration added for NewAction index creation and NewAction per Action insertion in the database.
* Basic file structure added the new repository, custom repository, service, etc.
* Delete OldPage.java
* Repo functions added - TODO : Haven;t handled the published/edited views
* Helper functions added to convert Action to NewAction and vice-versa. Removed unused currentUserMono usage.
* Create & update action functionality added.
* Execute Action refactored. Removed dry run specific code.
* Repository migrated to handle new data structure. Execute action refactored to no longer support dry runs of actions.
* TODO added for special handling of change view of application to handle edge cases of pages/actions which either exist in published mode but don't exist in unpublished mode or vice versa.
* Migrated finding on load actions from spring repository to custom repository.
* In view mode, now actions are being fetched by application id directly instead of first fetching application and then using the page ids, fetching the actions. This reduces the db calls from 2 to 1 per fetch actions in view mode api call.
* Delete action and get all actions (used in edit mode on the client side) implemented.
* Updated CollectionService and ActionCollectionService to use the new action service instead of the old one.
* LayoutActionService refactored to now use the new service functions.
* ActionController now no longer used ActionService. The remaining service functions have been migrated to the new action service.
* Refactor across ACL code for addition/removal of policies during addition/removal of users to organization, making app public, refactor for services like policy utils, item service, etc.
* Removed the last of action repository and action service and replaced with new action repo and new action service.
* Compile and run time issues fixed. The server is coming up without any spring dependency errors.
* WIP in fixing fetching actions by page id.
* Finally!!! Fixed the fetch actions (both published and unpublished actions) by page id repository function.
* Fixed create action bug where null datasource in published actiondto (inside newly created action) leads to error.
* Fixed the execute action issues :
1. Removed the dry runs from the tests
2. Fixed the null pointer error in variable substituted action and datasource configurations.
* 1. Fixed the custom action repository field names.
2. Fixed the data structures used in ExamplesOrganizationClonerTests
* Fixed countByDatasourceId repository function which was querying the actions incorrectly.
* Fixed the clone example organization error where the id of the action was not getting updated in the page correctly. Yay!
* Fixed post merge compilation failure.
* Fixed more compilation time failures in ActionServiceTest
* Fixed failing test case for fetching actions in view mode.
* Minor changes to resolve merge changes and incorporate in the new refactored code.
* 1. Fixed compile time errors on Client code.
2. Fixed fetching of actions in view mode by application id. The repository function did not need name parameter. Removed the same.
* [Integration Testing Error Fix] : Added a new test case for refactor action name.
* Instead of fetching actions in the page, mistakenly used the base service which was fetching all the actions in the repository, barring none which led to the name refactor being blocked even though no action in the current page exists with the new proposed name,
* Added delete functionality to action service.
* Minor code cleanup
* Adding viewMode to action execution
* Replacing action with actionId.
* 1. Bug fix for deletion of unpublished action. In case of never published action, the entire action should be deleted. In case an action was published, only the unpublished action should be deleted.
2. In case of DB actions (external datasources), only the bare minimum fields should be stored inside the action (datasource id and datasource plugin id). The other fields should not be duplicated across code.
* Fixed yarn build compilation issues.
* Update app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ActionController.java
Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
* Changed the API path for GET applications in view mode. Some minor code formatting.
* Incorporated review comments.
* Some more unnecessary code removed.
* Instead of returning Page, now the interface object between client and server for Pages is PageDTO
* Migrated Page and Action to PageDTO and ActionDTO
Fixed the compilation issues.
TODO : Fix the test compilation issues.
* Fixed compilation time issues with all the tests by migrating Page and Action to PageDTO and ActionDTO respectively
* Action Controller and Page Controller no longer extend Base Controller. All the required functions have now been implemented and no base line API end points are being re-used from the base.
* Test case fixes.
* Bug Fix : Updating an action was not updating execute on load. Fixed the data flow leading to the error.
* Deprecating Page and Action domain objects. This is to ensure no new code is written with these till we remove this old code.
* Cloned example applications are now published before returning. This is to ensure that the applications are in ready to view mode when the new user signs up.
* Added a function comment to expand on the usage of new param introduced.
* When cloning a page, new actions were not being stored. Added that. Also updated the clonePage test to assert that the actions are also cloned when the pages are cloned.
* Updated a Api call
* removed extra slash
Co-authored-by: Hetu Nandu <hetunandu@gmail.com>
Co-authored-by: Satbir Singh <satbir121@gmail.com>
Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
Co-authored-by: nandan.anantharamu <nandan@thinkify.io>
2020-10-26 12:34:23 +00:00
|
|
|
import { APP_MODE, UrlDataState } from "reducers/entityReducers/appReducer";
|
2021-01-04 10:16:08 +00:00
|
|
|
import { clearEvalCache } from "./EvaluationsSaga";
|
2020-08-19 09:21:32 +00:00
|
|
|
import { getQueryParams } from "utils/AppsmithUtils";
|
2020-09-28 05:12:23 +00:00
|
|
|
import PerformanceTracker, {
|
|
|
|
|
PerformanceTransactionName,
|
|
|
|
|
} from "utils/PerformanceTracker";
|
2021-02-01 13:17:55 +00:00
|
|
|
import { WidgetTypes } from "constants/WidgetConstants";
|
2021-02-15 16:13:44 +00:00
|
|
|
import { Toaster } from "components/ads/Toast";
|
|
|
|
|
import { Variant } from "components/ads/common";
|
2021-03-04 05:24:47 +00:00
|
|
|
import { migrateIncorrectDynamicBindingPathLists } from "utils/migrations/IncorrectDynamicBindingPathLists";
|
|
|
|
|
import * as Sentry from "@sentry/react";
|
|
|
|
|
import { ERROR_CODES } from "constants/ApiConstants";
|
2020-02-21 12:16:49 +00:00
|
|
|
|
|
|
|
|
const getWidgetName = (state: AppState, widgetId: string) =>
|
|
|
|
|
state.entities.canvasWidgets[widgetId];
|
2019-03-30 12:30:42 +00:00
|
|
|
|
2019-11-22 14:02:55 +00:00
|
|
|
export function* fetchPageListSaga(
|
|
|
|
|
fetchPageListAction: ReduxAction<FetchPageListPayload>,
|
|
|
|
|
) {
|
2020-09-28 05:12:23 +00:00
|
|
|
PerformanceTracker.startAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.FETCH_PAGE_LIST_API,
|
|
|
|
|
);
|
2019-10-31 08:36:04 +00:00
|
|
|
try {
|
[API breaking change : Automated Tests Will Fail] Page And Action Refactor (#549)
* Introduced new page which stores the published and unpublished pages as separate.
* Mid level commit to save the state.
* Parity of new page repository with old page repository (custom functions)
* WIP : Delete a page. This requires changes across application structure as well.
* Added publishedPages construct inside application to store the pages in the deployed view as well as isDefault so that the same changes (delete or isDefault) in unpublished view doesn't alter these fields for the published application
* Parity reached with PageService.
* Minor ActionService refactor to remove unnecessary code.
ApplicationPageService, LayoutActionService, LayoutService use the new page service to fetch the pages
Minor corrections in fetching the page from new page service in tests
* New save function which sets the PageDTO for unpublished page and then saves the new page into repository.
* Migration of page service functions to new page service functions across other services/tests/controller
* Finished migrating all the page service functions to the new page service functions
* Application Service Tests have been fixed.
* All the existing test cases are working now.
* Publish application implemented to store published pages as well. Added a basic test case to check that published pages is being set and that page's publishedPageDTO is being set accordingly.
* Minor TODOs added to add test cases for published application.
* A few tests to ascertain that published application page fields (deleted, isDefault) does not get changed when these statuses are changed for a page in edit mode.
* Added a new controller end point to fetch application in view mode.
* Added new endpoint for fetching an application in view mode on the client.
* Bug fix where get application in view mode API was not getting called.
* Fixed the get page names by application & archive pages which have been deleted in edit mode during publishing of application.
* During delete page, if a page was never published and it was deleted during edit, delete the entire page instead of just deleting the unpublished PageDTO
* Minor formatting.
* Non working client side code to fetch page list using view mode.
* revert unnecassary changes and streamlined view and edit actions
* Fix missed import
* Fixed a bug where if a page is not published, it should not be returned in view mode in list of page names api.
* Fixed update for a page which was not working in integration test.
* ActionDTO added.
* Solidified the new action structure.
* Migration added for NewAction index creation and NewAction per Action insertion in the database.
* Basic file structure added the new repository, custom repository, service, etc.
* Delete OldPage.java
* Repo functions added - TODO : Haven;t handled the published/edited views
* Helper functions added to convert Action to NewAction and vice-versa. Removed unused currentUserMono usage.
* Create & update action functionality added.
* Execute Action refactored. Removed dry run specific code.
* Repository migrated to handle new data structure. Execute action refactored to no longer support dry runs of actions.
* TODO added for special handling of change view of application to handle edge cases of pages/actions which either exist in published mode but don't exist in unpublished mode or vice versa.
* Migrated finding on load actions from spring repository to custom repository.
* In view mode, now actions are being fetched by application id directly instead of first fetching application and then using the page ids, fetching the actions. This reduces the db calls from 2 to 1 per fetch actions in view mode api call.
* Delete action and get all actions (used in edit mode on the client side) implemented.
* Updated CollectionService and ActionCollectionService to use the new action service instead of the old one.
* LayoutActionService refactored to now use the new service functions.
* ActionController now no longer used ActionService. The remaining service functions have been migrated to the new action service.
* Refactor across ACL code for addition/removal of policies during addition/removal of users to organization, making app public, refactor for services like policy utils, item service, etc.
* Removed the last of action repository and action service and replaced with new action repo and new action service.
* Compile and run time issues fixed. The server is coming up without any spring dependency errors.
* WIP in fixing fetching actions by page id.
* Finally!!! Fixed the fetch actions (both published and unpublished actions) by page id repository function.
* Fixed create action bug where null datasource in published actiondto (inside newly created action) leads to error.
* Fixed the execute action issues :
1. Removed the dry runs from the tests
2. Fixed the null pointer error in variable substituted action and datasource configurations.
* 1. Fixed the custom action repository field names.
2. Fixed the data structures used in ExamplesOrganizationClonerTests
* Fixed countByDatasourceId repository function which was querying the actions incorrectly.
* Fixed the clone example organization error where the id of the action was not getting updated in the page correctly. Yay!
* Fixed post merge compilation failure.
* Fixed more compilation time failures in ActionServiceTest
* Fixed failing test case for fetching actions in view mode.
* Minor changes to resolve merge changes and incorporate in the new refactored code.
* 1. Fixed compile time errors on Client code.
2. Fixed fetching of actions in view mode by application id. The repository function did not need name parameter. Removed the same.
* [Integration Testing Error Fix] : Added a new test case for refactor action name.
* Instead of fetching actions in the page, mistakenly used the base service which was fetching all the actions in the repository, barring none which led to the name refactor being blocked even though no action in the current page exists with the new proposed name,
* Added delete functionality to action service.
* Minor code cleanup
* Adding viewMode to action execution
* Replacing action with actionId.
* 1. Bug fix for deletion of unpublished action. In case of never published action, the entire action should be deleted. In case an action was published, only the unpublished action should be deleted.
2. In case of DB actions (external datasources), only the bare minimum fields should be stored inside the action (datasource id and datasource plugin id). The other fields should not be duplicated across code.
* Fixed yarn build compilation issues.
* Update app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ActionController.java
Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
* Changed the API path for GET applications in view mode. Some minor code formatting.
* Incorporated review comments.
* Some more unnecessary code removed.
* Instead of returning Page, now the interface object between client and server for Pages is PageDTO
* Migrated Page and Action to PageDTO and ActionDTO
Fixed the compilation issues.
TODO : Fix the test compilation issues.
* Fixed compilation time issues with all the tests by migrating Page and Action to PageDTO and ActionDTO respectively
* Action Controller and Page Controller no longer extend Base Controller. All the required functions have now been implemented and no base line API end points are being re-used from the base.
* Test case fixes.
* Bug Fix : Updating an action was not updating execute on load. Fixed the data flow leading to the error.
* Deprecating Page and Action domain objects. This is to ensure no new code is written with these till we remove this old code.
* Cloned example applications are now published before returning. This is to ensure that the applications are in ready to view mode when the new user signs up.
* Added a function comment to expand on the usage of new param introduced.
* When cloning a page, new actions were not being stored. Added that. Also updated the clonePage test to assert that the actions are also cloned when the pages are cloned.
* Updated a Api call
* removed extra slash
Co-authored-by: Hetu Nandu <hetunandu@gmail.com>
Co-authored-by: Satbir Singh <satbir121@gmail.com>
Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
Co-authored-by: nandan.anantharamu <nandan@thinkify.io>
2020-10-26 12:34:23 +00:00
|
|
|
const { applicationId, mode } = fetchPageListAction.payload;
|
|
|
|
|
const apiCall =
|
|
|
|
|
mode === APP_MODE.EDIT
|
|
|
|
|
? PageApi.fetchPageList
|
|
|
|
|
: PageApi.fetchPageListViewMode;
|
|
|
|
|
const response: FetchPageListResponse = yield call(apiCall, applicationId);
|
2019-10-31 08:36:04 +00:00
|
|
|
const isValidResponse = yield validateResponse(response);
|
|
|
|
|
if (isValidResponse) {
|
2020-06-17 10:19:56 +00:00
|
|
|
const orgId = response.data.organizationId;
|
2020-12-24 04:32:25 +00:00
|
|
|
const pages: PageListPayload = response.data.pages.map((page) => ({
|
2019-10-31 08:36:04 +00:00
|
|
|
pageName: page.name,
|
|
|
|
|
pageId: page.id,
|
2020-01-27 08:24:58 +00:00
|
|
|
isDefault: page.isDefault,
|
2021-02-24 13:47:37 +00:00
|
|
|
isHidden: !!page.isHidden,
|
2019-10-31 08:36:04 +00:00
|
|
|
}));
|
|
|
|
|
yield put({
|
2020-08-26 13:22:10 +00:00
|
|
|
type: ReduxActionTypes.SET_CURRENT_ORG_ID,
|
2019-11-22 14:02:55 +00:00
|
|
|
payload: {
|
2020-08-26 13:22:10 +00:00
|
|
|
orgId,
|
2019-11-22 14:02:55 +00:00
|
|
|
},
|
2019-10-31 08:36:04 +00:00
|
|
|
});
|
2020-06-17 10:19:56 +00:00
|
|
|
yield put({
|
2020-08-26 13:22:10 +00:00
|
|
|
type: ReduxActionTypes.FETCH_PAGE_LIST_SUCCESS,
|
2020-06-17 10:19:56 +00:00
|
|
|
payload: {
|
2020-08-26 13:22:10 +00:00
|
|
|
pages,
|
|
|
|
|
applicationId,
|
2020-06-17 10:19:56 +00:00
|
|
|
},
|
|
|
|
|
});
|
2020-09-28 05:12:23 +00:00
|
|
|
PerformanceTracker.stopAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.FETCH_PAGE_LIST_API,
|
|
|
|
|
);
|
2020-11-04 11:40:59 +00:00
|
|
|
} else {
|
|
|
|
|
PerformanceTracker.stopAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.FETCH_PAGE_LIST_API,
|
|
|
|
|
);
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.FETCH_PAGE_LIST_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
error: response.responseMeta.error,
|
|
|
|
|
},
|
|
|
|
|
});
|
2019-10-31 08:36:04 +00:00
|
|
|
}
|
|
|
|
|
} catch (error) {
|
2020-09-28 05:12:23 +00:00
|
|
|
PerformanceTracker.stopAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.FETCH_PAGE_LIST_API,
|
|
|
|
|
{ failed: true },
|
|
|
|
|
);
|
2019-10-31 08:36:04 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.FETCH_PAGE_LIST_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
error,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-08 11:02:00 +00:00
|
|
|
|
2019-10-31 08:36:04 +00:00
|
|
|
const getCanvasWidgetsPayload = (
|
|
|
|
|
pageResponse: FetchPageResponse,
|
|
|
|
|
): UpdateCanvasPayload => {
|
|
|
|
|
const normalizedResponse = CanvasWidgetsNormalizer.normalize(
|
2020-03-06 09:33:20 +00:00
|
|
|
extractCurrentDSL(pageResponse),
|
2019-10-31 08:36:04 +00:00
|
|
|
);
|
|
|
|
|
return {
|
|
|
|
|
pageWidgetId: normalizedResponse.result,
|
|
|
|
|
currentPageName: pageResponse.data.name,
|
|
|
|
|
currentPageId: pageResponse.data.id,
|
|
|
|
|
widgets: normalizedResponse.entities.canvasWidgets,
|
|
|
|
|
currentLayoutId: pageResponse.data.layouts[0].id, // TODO(abhinav): Handle for multiple layouts
|
|
|
|
|
currentApplicationId: pageResponse.data.applicationId,
|
2019-12-11 15:24:27 +00:00
|
|
|
pageActions: pageResponse.data.layouts[0].layoutOnLoadActions || [],
|
2019-10-31 08:36:04 +00:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2019-09-19 22:25:37 +00:00
|
|
|
export function* fetchPageSaga(
|
2020-03-06 09:33:20 +00:00
|
|
|
pageRequestAction: ReduxAction<FetchPageRequest>,
|
2019-09-19 22:25:37 +00:00
|
|
|
) {
|
2019-08-26 12:41:21 +00:00
|
|
|
try {
|
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 { id } = pageRequestAction.payload;
|
2020-09-28 05:12:23 +00:00
|
|
|
PerformanceTracker.startAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.FETCH_PAGE_API,
|
|
|
|
|
{ pageId: id },
|
|
|
|
|
);
|
2020-02-13 09:32:24 +00:00
|
|
|
const fetchPageResponse: FetchPageResponse = yield call(PageApi.fetchPage, {
|
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
|
|
|
id,
|
2020-02-13 09:32:24 +00:00
|
|
|
});
|
2019-09-27 16:05:33 +00:00
|
|
|
const isValidResponse = yield validateResponse(fetchPageResponse);
|
|
|
|
|
if (isValidResponse) {
|
2020-04-17 16:15:09 +00:00
|
|
|
// Clear any existing caches
|
2020-10-21 04:25:32 +00:00
|
|
|
yield call(clearEvalCache);
|
2020-08-07 14:24:26 +00:00
|
|
|
// Set url params
|
|
|
|
|
yield call(setDataUrl);
|
2019-12-11 15:24:27 +00:00
|
|
|
// Get Canvas payload
|
2020-03-06 09:33:20 +00:00
|
|
|
const canvasWidgetsPayload = getCanvasWidgetsPayload(fetchPageResponse);
|
2019-12-11 15:24:27 +00:00
|
|
|
// Update the canvas
|
2021-01-25 08:57:26 +00:00
|
|
|
yield put(initCanvasLayout(canvasWidgetsPayload));
|
2020-03-19 03:25:52 +00:00
|
|
|
// set current page
|
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
|
|
|
yield put(updateCurrentPage(id));
|
2019-12-11 15:24:27 +00:00
|
|
|
// dispatch fetch page success
|
2020-11-03 10:16:11 +00:00
|
|
|
yield put(
|
|
|
|
|
fetchPageSuccess([
|
|
|
|
|
// Execute page load actions after evaluation of fetch page
|
|
|
|
|
executePageLoadActions(canvasWidgetsPayload.pageActions),
|
|
|
|
|
]),
|
|
|
|
|
);
|
2020-08-31 05:56:52 +00:00
|
|
|
|
|
|
|
|
yield put({
|
2020-11-03 13:05:40 +00:00
|
|
|
type: ReduxActionTypes.UPDATE_CANVAS_STRUCTURE,
|
|
|
|
|
payload: extractCurrentDSL(fetchPageResponse),
|
2020-08-31 05:56:52 +00:00
|
|
|
});
|
2020-11-03 13:05:40 +00:00
|
|
|
|
2020-09-28 05:12:23 +00:00
|
|
|
PerformanceTracker.stopAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.FETCH_PAGE_API,
|
|
|
|
|
);
|
2019-03-30 12:30:42 +00:00
|
|
|
}
|
2019-09-23 10:27:45 +00:00
|
|
|
} catch (error) {
|
2020-03-27 09:02:11 +00:00
|
|
|
console.log(error);
|
2020-09-28 05:12:23 +00:00
|
|
|
PerformanceTracker.stopAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.FETCH_PAGE_API,
|
|
|
|
|
{
|
|
|
|
|
failed: true,
|
|
|
|
|
},
|
|
|
|
|
);
|
2019-09-27 16:05:33 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.FETCH_PAGE_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
error,
|
|
|
|
|
},
|
|
|
|
|
});
|
2019-03-30 12:30:42 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-24 07:03:59 +00:00
|
|
|
export function* fetchPublishedPageSaga(
|
2020-05-05 12:16:51 +00:00
|
|
|
pageRequestAction: ReduxAction<{ pageId: string; bustCache: boolean }>,
|
2019-10-24 07:03:59 +00:00
|
|
|
) {
|
|
|
|
|
try {
|
2020-05-05 12:16:51 +00:00
|
|
|
const { pageId, bustCache } = pageRequestAction.payload;
|
2020-09-28 05:12:23 +00:00
|
|
|
PerformanceTracker.startAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.FETCH_PAGE_API,
|
|
|
|
|
{ pageId: pageId, published: true },
|
|
|
|
|
);
|
2019-10-31 08:36:04 +00:00
|
|
|
const request: FetchPublishedPageRequest = {
|
|
|
|
|
pageId,
|
2020-05-05 12:16:51 +00:00
|
|
|
bustCache,
|
2019-10-31 08:36:04 +00:00
|
|
|
};
|
2019-10-24 09:23:50 +00:00
|
|
|
const response: FetchPublishedPageResponse = yield call(
|
2019-10-24 07:03:59 +00:00
|
|
|
PageApi.fetchPublishedPage,
|
2019-10-24 09:23:50 +00:00
|
|
|
request,
|
2019-10-24 07:03:59 +00:00
|
|
|
);
|
2019-10-24 09:23:50 +00:00
|
|
|
const isValidResponse = yield validateResponse(response);
|
2019-10-24 07:03:59 +00:00
|
|
|
if (isValidResponse) {
|
2020-04-17 16:15:09 +00:00
|
|
|
// Clear any existing caches
|
2020-10-21 04:25:32 +00:00
|
|
|
yield call(clearEvalCache);
|
2020-08-07 14:24:26 +00:00
|
|
|
// Set url params
|
|
|
|
|
yield call(setDataUrl);
|
|
|
|
|
// Get Canvas payload
|
2020-03-06 09:33:20 +00:00
|
|
|
const canvasWidgetsPayload = getCanvasWidgetsPayload(response);
|
2020-08-07 14:24:26 +00:00
|
|
|
// Update the canvas
|
2021-01-25 08:57:26 +00:00
|
|
|
yield put(initCanvasLayout(canvasWidgetsPayload));
|
2020-08-07 14:24:26 +00:00
|
|
|
// set current page
|
2020-03-19 03:25:52 +00:00
|
|
|
yield put(updateCurrentPage(pageId));
|
2020-08-07 14:24:26 +00:00
|
|
|
// dispatch fetch page success
|
2020-03-19 03:25:52 +00:00
|
|
|
yield put(
|
2020-11-03 10:16:11 +00:00
|
|
|
fetchPublishedPageSuccess(
|
|
|
|
|
// Execute page load actions post published page eval
|
|
|
|
|
[executePageLoadActions(canvasWidgetsPayload.pageActions)],
|
|
|
|
|
),
|
2020-03-19 03:25:52 +00:00
|
|
|
);
|
2020-09-28 05:12:23 +00:00
|
|
|
PerformanceTracker.stopAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.FETCH_PAGE_API,
|
|
|
|
|
);
|
2019-10-24 07:03:59 +00:00
|
|
|
}
|
|
|
|
|
} catch (error) {
|
2020-09-28 05:12:23 +00:00
|
|
|
PerformanceTracker.stopAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.FETCH_PAGE_API,
|
|
|
|
|
{
|
|
|
|
|
failed: true,
|
|
|
|
|
},
|
|
|
|
|
);
|
2019-10-24 07:03:59 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.FETCH_PUBLISHED_PAGE_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
error,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-05 12:16:51 +00:00
|
|
|
export function* fetchAllPublishedPagesSaga() {
|
|
|
|
|
try {
|
|
|
|
|
const pageIds = yield select(getAllPageIds);
|
|
|
|
|
yield all(
|
|
|
|
|
pageIds.map((pageId: string) => {
|
|
|
|
|
return call(PageApi.fetchPublishedPage, { pageId });
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.log({ error });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-04 05:24:47 +00:00
|
|
|
function* savePageSaga(action: ReduxAction<{ isRetry?: boolean }>) {
|
2020-04-13 14:00:50 +00:00
|
|
|
const widgets = yield select(getWidgets);
|
|
|
|
|
const editorConfigs = yield select(getEditorConfigs) as any;
|
|
|
|
|
const savePageRequest = getLayoutSavePayload(widgets, editorConfigs);
|
2020-09-28 05:12:23 +00:00
|
|
|
PerformanceTracker.startAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.SAVE_PAGE_API,
|
|
|
|
|
{
|
|
|
|
|
pageId: savePageRequest.pageId,
|
|
|
|
|
},
|
|
|
|
|
);
|
2019-09-17 15:09:55 +00:00
|
|
|
try {
|
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
|
|
|
// Store the updated DSL in the pageDSLs reducer
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_PAGE_DSL_SUCCESS,
|
|
|
|
|
payload: {
|
|
|
|
|
pageId: savePageRequest.pageId,
|
|
|
|
|
dsl: savePageRequest.dsl,
|
|
|
|
|
},
|
|
|
|
|
});
|
2020-11-03 13:05:40 +00:00
|
|
|
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.UPDATE_CANVAS_STRUCTURE,
|
|
|
|
|
payload: savePageRequest.dsl,
|
|
|
|
|
});
|
|
|
|
|
|
2019-09-17 15:09:55 +00:00
|
|
|
const savePageResponse: SavePageResponse = yield call(
|
|
|
|
|
PageApi.savePage,
|
|
|
|
|
savePageRequest,
|
|
|
|
|
);
|
2020-04-05 06:34:14 +00:00
|
|
|
const isValidResponse = yield validateResponse(savePageResponse);
|
2019-09-27 16:05:33 +00:00
|
|
|
if (isValidResponse) {
|
2021-02-15 16:13:44 +00:00
|
|
|
const { messages, actionUpdates } = savePageResponse.data;
|
|
|
|
|
// Show toast messages from the server
|
|
|
|
|
if (messages && messages.length) {
|
|
|
|
|
savePageResponse.data.messages.forEach((message) => {
|
|
|
|
|
Toaster.show({
|
|
|
|
|
text: message,
|
|
|
|
|
type: Variant.info,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// Update actions
|
|
|
|
|
if (actionUpdates && actionUpdates.length > 0) {
|
|
|
|
|
yield put(setActionsToExecuteOnPageLoad(actionUpdates));
|
2020-08-27 15:39:16 +00:00
|
|
|
}
|
2019-09-27 16:05:33 +00:00
|
|
|
yield put(savePageSuccess(savePageResponse));
|
2020-09-28 05:12:23 +00:00
|
|
|
PerformanceTracker.stopAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.SAVE_PAGE_API,
|
|
|
|
|
);
|
2019-09-27 16:05:33 +00:00
|
|
|
}
|
|
|
|
|
} catch (error) {
|
2020-09-28 05:12:23 +00:00
|
|
|
PerformanceTracker.stopAsyncTracking(
|
|
|
|
|
PerformanceTransactionName.SAVE_PAGE_API,
|
|
|
|
|
{
|
|
|
|
|
failed: true,
|
|
|
|
|
},
|
|
|
|
|
);
|
2021-01-11 05:28:10 +00:00
|
|
|
|
2019-09-27 16:05:33 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.SAVE_PAGE_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
error,
|
2020-10-15 15:28:54 +00:00
|
|
|
show: false,
|
2019-09-27 16:05:33 +00:00
|
|
|
},
|
|
|
|
|
});
|
2021-03-04 05:24:47 +00:00
|
|
|
|
|
|
|
|
if (error instanceof IncorrectBindingError) {
|
|
|
|
|
const { isRetry } = action.payload;
|
|
|
|
|
const incorrectBindingError = JSON.parse(error.message);
|
|
|
|
|
const { widgetId, message } = incorrectBindingError;
|
|
|
|
|
if (isRetry) {
|
|
|
|
|
Sentry.captureException(new Error("Failed to correct binding paths"));
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.FAILED_CORRECTING_BINDING_PATHS,
|
|
|
|
|
payload: {
|
|
|
|
|
error: {
|
|
|
|
|
message,
|
|
|
|
|
code: ERROR_CODES.FAILED_TO_CORRECT_BINDING,
|
|
|
|
|
crash: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
const correctWidget = migrateIncorrectDynamicBindingPathLists(
|
|
|
|
|
widgets[widgetId],
|
|
|
|
|
);
|
|
|
|
|
yield put(
|
|
|
|
|
updateAndSaveLayout({ ...widgets, [widgetId]: correctWidget }, true),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-09-17 15:09:55 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Property Pane Controls
- Fixes #121, #122, #123, #124, #90, #46, #65, #100, #101, #68, #102
2019-10-24 05:24:45 +00:00
|
|
|
function getLayoutSavePayload(
|
|
|
|
|
widgets: {
|
|
|
|
|
[widgetId: string]: FlattenedWidgetProps;
|
|
|
|
|
},
|
|
|
|
|
editorConfigs: any,
|
|
|
|
|
) {
|
|
|
|
|
const denormalizedDSL = CanvasWidgetsNormalizer.denormalize(
|
|
|
|
|
Object.keys(widgets)[0],
|
|
|
|
|
{ canvasWidgets: widgets },
|
|
|
|
|
);
|
|
|
|
|
return {
|
|
|
|
|
...editorConfigs,
|
|
|
|
|
dsl: denormalizedDSL,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-04 05:24:47 +00:00
|
|
|
export function* saveLayoutSaga(action: ReduxAction<{ isRetry?: boolean }>) {
|
2019-09-19 22:25:37 +00:00
|
|
|
try {
|
2019-09-22 20:25:05 +00:00
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.SAVE_PAGE_INIT,
|
2021-03-04 05:24:47 +00:00
|
|
|
payload: action.payload,
|
2019-09-22 20:25:05 +00:00
|
|
|
});
|
2019-11-07 04:59:40 +00:00
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.SAVE_PAGE_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
error,
|
|
|
|
|
},
|
|
|
|
|
});
|
2019-09-19 22:25:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-31 08:36:04 +00:00
|
|
|
export function* createPageSaga(
|
|
|
|
|
createPageAction: ReduxAction<CreatePageRequest>,
|
|
|
|
|
) {
|
|
|
|
|
try {
|
|
|
|
|
const request: CreatePageRequest = createPageAction.payload;
|
|
|
|
|
const response: FetchPageResponse = yield call(PageApi.createPage, request);
|
|
|
|
|
const isValidResponse = yield validateResponse(response);
|
|
|
|
|
if (isValidResponse) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.CREATE_PAGE_SUCCESS,
|
|
|
|
|
payload: {
|
|
|
|
|
pageId: response.data.id,
|
|
|
|
|
pageName: response.data.name,
|
|
|
|
|
layoutId: response.data.layouts[0].id,
|
|
|
|
|
},
|
|
|
|
|
});
|
2020-11-03 13:05:40 +00:00
|
|
|
// Add this to the page DSLs for entity explorer
|
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
|
|
|
yield put({
|
2020-11-03 13:05:40 +00:00
|
|
|
type: ReduxActionTypes.FETCH_PAGE_DSL_SUCCESS,
|
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
|
|
|
payload: {
|
|
|
|
|
pageId: response.data.id,
|
2020-11-03 13:05:40 +00:00
|
|
|
dsl: extractCurrentDSL(response),
|
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
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
history.push(
|
|
|
|
|
BUILDER_PAGE_URL(
|
|
|
|
|
createPageAction.payload.applicationId,
|
|
|
|
|
response.data.id,
|
|
|
|
|
),
|
|
|
|
|
);
|
2019-10-31 08:36:04 +00:00
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.CREATE_PAGE_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
error,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-27 08:24:58 +00:00
|
|
|
export function* updatePageSaga(action: ReduxAction<UpdatePageRequest>) {
|
|
|
|
|
try {
|
|
|
|
|
const request: UpdatePageRequest = action.payload;
|
|
|
|
|
const response: ApiResponse = yield call(PageApi.updatePage, request);
|
|
|
|
|
const isValidResponse = yield validateResponse(response);
|
|
|
|
|
if (isValidResponse) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.UPDATE_PAGE_SUCCESS,
|
2020-04-29 09:41:30 +00:00
|
|
|
payload: action.payload,
|
2020-01-27 08:24:58 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.UPDATE_PAGE_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
error,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function* deletePageSaga(action: ReduxAction<DeletePageRequest>) {
|
|
|
|
|
try {
|
|
|
|
|
const request: DeletePageRequest = action.payload;
|
2020-02-21 07:19:10 +00:00
|
|
|
const defaultPageId = yield select(
|
|
|
|
|
(state: AppState) => state.entities.pageList.defaultPageId,
|
|
|
|
|
);
|
|
|
|
|
const applicationId = yield select(
|
|
|
|
|
(state: AppState) => state.entities.pageList.applicationId,
|
|
|
|
|
);
|
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
|
|
|
if (defaultPageId === request.id) {
|
2020-02-21 07:19:10 +00:00
|
|
|
throw Error("Cannot delete the home page.");
|
|
|
|
|
} else {
|
|
|
|
|
const response: ApiResponse = yield call(PageApi.deletePage, request);
|
|
|
|
|
const isValidResponse = yield validateResponse(response);
|
|
|
|
|
if (isValidResponse) {
|
|
|
|
|
yield put(deletePageSuccess());
|
|
|
|
|
}
|
2020-11-03 13:05:40 +00:00
|
|
|
// Remove this page from page DSLs
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_PAGE_DSL_SUCCESS,
|
|
|
|
|
payload: {
|
|
|
|
|
pageId: request.id,
|
|
|
|
|
dsl: undefined,
|
|
|
|
|
},
|
|
|
|
|
});
|
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 currentPageId = yield select(
|
|
|
|
|
(state: AppState) => state.entities.pageList.currentPageId,
|
|
|
|
|
);
|
|
|
|
|
if (currentPageId === action.payload.id)
|
|
|
|
|
history.push(BUILDER_PAGE_URL(applicationId, defaultPageId));
|
2020-01-27 08:24:58 +00:00
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.DELETE_PAGE_ERROR,
|
|
|
|
|
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
|
|
|
error: { message: error.message, show: true },
|
|
|
|
|
show: true,
|
2020-01-27 08:24:58 +00:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-22 03:10:22 +00:00
|
|
|
export function* clonePageSaga(clonePageAction: ReduxAction<ClonePageRequest>) {
|
|
|
|
|
try {
|
|
|
|
|
const request: ClonePageRequest = clonePageAction.payload;
|
|
|
|
|
const response: FetchPageResponse = yield call(PageApi.clonePage, request);
|
|
|
|
|
const applicationId = yield select(
|
|
|
|
|
(state: AppState) => state.entities.pageList.applicationId,
|
|
|
|
|
);
|
|
|
|
|
const isValidResponse = yield validateResponse(response);
|
|
|
|
|
if (isValidResponse) {
|
|
|
|
|
yield put(
|
|
|
|
|
clonePageSuccess(
|
|
|
|
|
response.data.id,
|
|
|
|
|
response.data.name,
|
|
|
|
|
response.data.layouts[0].id,
|
|
|
|
|
),
|
|
|
|
|
);
|
2020-11-03 13:05:40 +00:00
|
|
|
// Add this to the page DSLs for entity explorer
|
2020-08-22 03:10:22 +00:00
|
|
|
yield put({
|
2020-11-03 13:05:40 +00:00
|
|
|
type: ReduxActionTypes.FETCH_PAGE_DSL_SUCCESS,
|
2020-08-22 03:10:22 +00:00
|
|
|
payload: {
|
|
|
|
|
pageId: response.data.id,
|
2020-11-03 13:05:40 +00:00
|
|
|
dsl: extractCurrentDSL(response),
|
2020-08-22 03:10:22 +00:00
|
|
|
},
|
|
|
|
|
});
|
2020-11-03 13:05:40 +00:00
|
|
|
|
2020-12-16 09:21:31 +00:00
|
|
|
yield put(fetchActionsForPage(response.data.id));
|
|
|
|
|
|
2020-08-22 03:10:22 +00:00
|
|
|
history.push(BUILDER_PAGE_URL(applicationId, response.data.id));
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.CLONE_PAGE_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
error,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-23 09:27:00 +00:00
|
|
|
/**
|
|
|
|
|
* this saga do two things
|
|
|
|
|
*
|
|
|
|
|
* 1. Checks if the name of page is conflicting with any used name
|
|
|
|
|
* 2. dispatches a action which triggers a request to update the name
|
|
|
|
|
*
|
|
|
|
|
* @param action
|
|
|
|
|
*/
|
2020-02-21 12:16:49 +00:00
|
|
|
export function* updateWidgetNameSaga(
|
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
|
|
|
action: ReduxAction<{ id: string; newName: string }>,
|
2020-02-21 12:16:49 +00:00
|
|
|
) {
|
|
|
|
|
try {
|
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 { widgetName } = yield select(getWidgetName, action.payload.id);
|
2020-02-21 12:16:49 +00:00
|
|
|
const layoutId = yield select(getCurrentLayoutId);
|
2020-11-23 09:27:00 +00:00
|
|
|
const evalTree = yield select(getDataTree);
|
2020-02-21 12:16:49 +00:00
|
|
|
const pageId = yield select(getCurrentPageId);
|
2020-04-29 10:20:12 +00:00
|
|
|
const existingPageNames = yield select(getExistingPageNames);
|
2020-11-23 09:27:00 +00:00
|
|
|
|
2021-02-01 13:17:55 +00:00
|
|
|
// TODO(abhinav): Why do we need to jump through these hoops just to
|
|
|
|
|
// change the tab name? Figure out a better design to make this moot.
|
|
|
|
|
const tabs:
|
|
|
|
|
| Array<{
|
|
|
|
|
id: string;
|
|
|
|
|
widgetId: string;
|
|
|
|
|
label: string;
|
|
|
|
|
}>
|
|
|
|
|
| undefined = yield select((state: AppState) => {
|
|
|
|
|
// Check if this widget exists in the canvas widgets
|
|
|
|
|
if (state.entities.canvasWidgets.hasOwnProperty(action.payload.id)) {
|
|
|
|
|
// If it does assign it to a variable
|
|
|
|
|
const widget = state.entities.canvasWidgets[action.payload.id];
|
|
|
|
|
// Check if this widget has a parent in the canvas widgets
|
|
|
|
|
if (
|
|
|
|
|
widget.parentId &&
|
|
|
|
|
state.entities.canvasWidgets.hasOwnProperty(widget.parentId)
|
|
|
|
|
) {
|
|
|
|
|
// If the parent exists assign it to a variable
|
|
|
|
|
const parent = state.entities.canvasWidgets[widget.parentId];
|
|
|
|
|
// Check if this parent is a TABS_WIDGET
|
|
|
|
|
if (parent.type === WidgetTypes.TABS_WIDGET) {
|
|
|
|
|
// If it is return the tabs property
|
|
|
|
|
return parent.tabs;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// This isn't a tab in a tabs widget so return undefined
|
|
|
|
|
return;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// If we're trying to update the name of a tab in the TABS_WIDGET
|
|
|
|
|
if (tabs !== undefined) {
|
|
|
|
|
// Get all canvas widgets
|
|
|
|
|
const stateWidgets = yield select(getWidgets);
|
|
|
|
|
// Shallow copy canvas widgets as they're immutable
|
|
|
|
|
const widgets = { ...stateWidgets };
|
|
|
|
|
// Get the parent Id of the tab (canvas widget) whose name we're updating
|
|
|
|
|
const parentId = widgets[action.payload.id].parentId;
|
|
|
|
|
// Update the tabName property of the tab (canvas widget)
|
|
|
|
|
widgets[action.payload.id] = {
|
|
|
|
|
...widgets[action.payload.id],
|
|
|
|
|
tabName: action.payload.newName,
|
2020-02-21 12:16:49 +00:00
|
|
|
};
|
2021-02-01 13:17:55 +00:00
|
|
|
// Shallow copy the parent widget so that we can update the properties
|
|
|
|
|
const parent = { ...widgets[parentId] };
|
|
|
|
|
// Update the tabs property of the parent tabs widget
|
|
|
|
|
parent.tabs = tabs.map(
|
|
|
|
|
(tab: { widgetId: string; label: string; id: string }) => {
|
|
|
|
|
if (tab.widgetId === action.payload.id) {
|
|
|
|
|
return { ...tab, label: action.payload.newName };
|
|
|
|
|
}
|
|
|
|
|
return tab;
|
|
|
|
|
},
|
2020-02-21 12:16:49 +00:00
|
|
|
);
|
2021-02-01 13:17:55 +00:00
|
|
|
// replace the parent widget in the canvas widgets
|
|
|
|
|
widgets[parentId] = parent;
|
|
|
|
|
// Update and save the new widgets
|
|
|
|
|
yield put(updateAndSaveLayout(widgets));
|
|
|
|
|
// Send a update saying that we've successfully updated the name
|
|
|
|
|
yield put(updateWidgetNameSuccess());
|
|
|
|
|
} else {
|
|
|
|
|
// check if name is not conflicting with any
|
|
|
|
|
// existing entity/api/queries/reserved words
|
|
|
|
|
if (
|
|
|
|
|
isNameValid(action.payload.newName, {
|
|
|
|
|
...evalTree,
|
|
|
|
|
...existingPageNames,
|
|
|
|
|
})
|
|
|
|
|
) {
|
|
|
|
|
const request: UpdateWidgetNameRequest = {
|
|
|
|
|
newName: action.payload.newName,
|
|
|
|
|
oldName: widgetName,
|
|
|
|
|
pageId,
|
|
|
|
|
layoutId,
|
|
|
|
|
};
|
|
|
|
|
const response: UpdateWidgetNameResponse = yield call(
|
|
|
|
|
PageApi.updateWidgetName,
|
|
|
|
|
request,
|
|
|
|
|
);
|
|
|
|
|
const isValidResponse = yield validateResponse(response);
|
|
|
|
|
if (isValidResponse) {
|
|
|
|
|
yield updateCanvasWithDSL(response.data, pageId, layoutId);
|
2020-02-21 12:16:49 +00:00
|
|
|
|
2021-02-01 13:17:55 +00:00
|
|
|
yield put(updateWidgetNameSuccess());
|
|
|
|
|
// Add this to the page DSLs for entity explorer
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_PAGE_DSL_SUCCESS,
|
|
|
|
|
payload: {
|
|
|
|
|
pageId: pageId,
|
|
|
|
|
dsl: response.data.dsl,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2020-08-31 05:56:52 +00:00
|
|
|
yield put({
|
2021-02-01 13:17:55 +00:00
|
|
|
type: ReduxActionErrorTypes.UPDATE_WIDGET_NAME_ERROR,
|
2020-08-31 05:56:52 +00:00
|
|
|
payload: {
|
2021-02-01 13:17:55 +00:00
|
|
|
error: {
|
|
|
|
|
message: `Entity name: ${action.payload.newName} is already being used.`,
|
|
|
|
|
},
|
2020-08-31 05:56:52 +00:00
|
|
|
},
|
|
|
|
|
});
|
2020-02-21 12:16:49 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.UPDATE_WIDGET_NAME_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
error,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-16 10:23:19 +00:00
|
|
|
export function* updateCanvasWithDSL(
|
|
|
|
|
data: PageLayout,
|
|
|
|
|
pageId: string,
|
|
|
|
|
layoutId: string,
|
|
|
|
|
) {
|
|
|
|
|
const normalizedWidgets = CanvasWidgetsNormalizer.normalize(data.dsl);
|
|
|
|
|
const currentPageName = yield select(getCurrentPageName);
|
|
|
|
|
const applicationId = yield select(getCurrentApplicationId);
|
|
|
|
|
const canvasWidgetsPayload: UpdateCanvasPayload = {
|
|
|
|
|
pageWidgetId: normalizedWidgets.result,
|
|
|
|
|
currentPageName,
|
|
|
|
|
currentPageId: pageId,
|
|
|
|
|
currentLayoutId: layoutId,
|
|
|
|
|
currentApplicationId: applicationId,
|
|
|
|
|
pageActions: data.layoutOnLoadActions,
|
|
|
|
|
widgets: normalizedWidgets.entities.canvasWidgets,
|
|
|
|
|
};
|
2021-01-25 08:57:26 +00:00
|
|
|
yield put(initCanvasLayout(canvasWidgetsPayload));
|
2020-06-16 10:23:19 +00:00
|
|
|
yield put(fetchActionsForPage(pageId));
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-07 14:24:26 +00:00
|
|
|
export function* setDataUrl() {
|
|
|
|
|
const urlData: UrlDataState = {
|
2020-08-14 07:43:01 +00:00
|
|
|
fullPath: window.location.href,
|
2020-08-07 14:24:26 +00:00
|
|
|
host: window.location.host,
|
|
|
|
|
hostname: window.location.hostname,
|
|
|
|
|
queryParams: getQueryParams(),
|
|
|
|
|
protocol: window.location.protocol,
|
|
|
|
|
pathname: window.location.pathname,
|
|
|
|
|
port: window.location.port,
|
|
|
|
|
hash: window.location.hash,
|
|
|
|
|
};
|
|
|
|
|
yield put(setUrlData(urlData));
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-04 11:40:59 +00:00
|
|
|
function* fetchPageDSLSaga(pageId: string) {
|
|
|
|
|
try {
|
|
|
|
|
const fetchPageResponse: FetchPageResponse = yield call(PageApi.fetchPage, {
|
|
|
|
|
id: pageId,
|
|
|
|
|
});
|
|
|
|
|
const isValidResponse = yield validateResponse(fetchPageResponse);
|
|
|
|
|
if (isValidResponse) {
|
|
|
|
|
return {
|
|
|
|
|
pageId: pageId,
|
|
|
|
|
dsl: extractCurrentDSL(fetchPageResponse),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_PAGE_DSL_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
pageId: pageId,
|
|
|
|
|
error,
|
|
|
|
|
show: false,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function* populatePageDSLsSaga() {
|
|
|
|
|
try {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.POPULATE_PAGEDSLS_INIT,
|
|
|
|
|
});
|
|
|
|
|
const pageIds: string[] = yield select((state: AppState) =>
|
|
|
|
|
state.entities.pageList.pages.map((page: Page) => page.pageId),
|
|
|
|
|
);
|
|
|
|
|
const pageDSLs = yield all(
|
|
|
|
|
pageIds.map((pageId: string) => {
|
|
|
|
|
return call(fetchPageDSLSaga, pageId);
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionTypes.FETCH_PAGE_DSLS_SUCCESS,
|
|
|
|
|
payload: pageDSLs,
|
|
|
|
|
});
|
|
|
|
|
} catch (error) {
|
|
|
|
|
yield put({
|
|
|
|
|
type: ReduxActionErrorTypes.POPULATE_PAGEDSLS_ERROR,
|
|
|
|
|
payload: {
|
|
|
|
|
error,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-17 15:09:55 +00:00
|
|
|
export default function* pageSagas() {
|
|
|
|
|
yield all([
|
2019-11-22 14:02:55 +00:00
|
|
|
takeLatest(ReduxActionTypes.FETCH_PAGE_INIT, fetchPageSaga),
|
2019-10-24 07:03:59 +00:00
|
|
|
takeLatest(
|
|
|
|
|
ReduxActionTypes.FETCH_PUBLISHED_PAGE_INIT,
|
|
|
|
|
fetchPublishedPageSaga,
|
|
|
|
|
),
|
2020-04-13 14:00:50 +00:00
|
|
|
takeLatest(ReduxActionTypes.UPDATE_LAYOUT, saveLayoutSaga),
|
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
|
|
|
takeLeading(ReduxActionTypes.CREATE_PAGE_INIT, createPageSaga),
|
2020-08-22 03:10:22 +00:00
|
|
|
takeLeading(ReduxActionTypes.CLONE_PAGE_INIT, clonePageSaga),
|
2019-11-08 11:02:00 +00:00
|
|
|
takeLatest(ReduxActionTypes.FETCH_PAGE_LIST_INIT, fetchPageListSaga),
|
2020-01-27 08:24:58 +00:00
|
|
|
takeLatest(ReduxActionTypes.UPDATE_PAGE_INIT, updatePageSaga),
|
|
|
|
|
takeLatest(ReduxActionTypes.DELETE_PAGE_INIT, deletePageSaga),
|
2020-01-31 10:46:43 +00:00
|
|
|
debounce(500, ReduxActionTypes.SAVE_PAGE_INIT, savePageSaga),
|
2020-02-21 12:16:49 +00:00
|
|
|
takeLatest(ReduxActionTypes.UPDATE_WIDGET_NAME_INIT, updateWidgetNameSaga),
|
2020-05-05 12:16:51 +00:00
|
|
|
takeLatest(
|
|
|
|
|
ReduxActionTypes.FETCH_ALL_PUBLISHED_PAGES,
|
|
|
|
|
fetchAllPublishedPagesSaga,
|
|
|
|
|
),
|
2019-09-17 15:09:55 +00:00
|
|
|
]);
|
2019-03-30 12:30:42 +00:00
|
|
|
}
|