PromucFlow_constructor/app/client/src/ce/hooks/datasourceEditorHooks.tsx

144 lines
4.4 KiB
TypeScript
Raw Normal View History

chore: Refactoring header actions on datasource page to support reusable queries on EE (#29442) ## Description Refactoring header actions on datasource page to support reusable queries on EE #### PR fixes following issue(s) Fixes [#28568](https://github.com/appsmithorg/appsmith/issues/28568) #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new header action management system in the data source editor, allowing for dynamic action button generation based on user permissions and editor type. - Implemented a new editor type detection hook to improve editor experience. - **Improvements** - Streamlined the data source editor interface by removing unused permissions checks and simplifying action button logic. - Enhanced the editor's routing system with additional constants for deprecated paths. - **Refactor** - Refactored the `DSFormHeader` component to utilize the new `useHeaderActions` hook for a cleaner and more maintainable codebase. - Updated Redux state management to include a new action handler for resetting editor state. - **Style** - Adjusted the layout of the `LeftPaneContainer` by removing the `min-width` property for a more responsive design. - **Chores** - Cleaned up imports and unused variables across multiple files to improve code clarity and maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-08 11:42:14 +00:00
import React from "react";
import { useSelector } from "react-redux";
import NewActionButton from "pages/Editor/DataSourceEditor/NewActionButton";
import { EditorNames } from "./";
import type { Datasource } from "entities/Datasource";
import type { ApiDatasourceForm } from "entities/Datasource/RestAPIForm";
import { Button } from "design-system";
import {
GENERATE_NEW_PAGE_BUTTON_TEXT,
createMessage,
} from "@appsmith/constants/messages";
import AnalyticsUtil from "@appsmith/utils/AnalyticsUtil";
chore: Refactoring header actions on datasource page to support reusable queries on EE (#29442) ## Description Refactoring header actions on datasource page to support reusable queries on EE #### PR fixes following issue(s) Fixes [#28568](https://github.com/appsmithorg/appsmith/issues/28568) #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new header action management system in the data source editor, allowing for dynamic action button generation based on user permissions and editor type. - Implemented a new editor type detection hook to improve editor experience. - **Improvements** - Streamlined the data source editor interface by removing unused permissions checks and simplifying action button logic. - Enhanced the editor's routing system with additional constants for deprecated paths. - **Refactor** - Refactored the `DSFormHeader` component to utilize the new `useHeaderActions` hook for a cleaner and more maintainable codebase. - Updated Redux state management to include a new action handler for resetting editor state. - **Style** - Adjusted the layout of the `LeftPaneContainer` by removing the `min-width` property for a more responsive design. - **Chores** - Cleaned up imports and unused variables across multiple files to improve code clarity and maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-08 11:42:14 +00:00
import history from "utils/history";
import { generateTemplateFormURL } from "@appsmith/RouteBuilder";
import {
getCurrentApplication,
fix: Refactoring code to fix a couple of issues related to modules on EE (#29843) ## Description Refactoring code to fix a couple of issues related to modules on EE #### PR fixes following issue(s) Fixes [#29842](https://github.com/appsmithorg/appsmith/issues/29842) [#29445](https://github.com/appsmithorg/appsmith/issues/29445) #### Type of change - Bug fix (non-breaking change which fixes an issue) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new interface for improved action context handling. - Added functionality to create API actions based on the editor type. - Implemented a new hook for retrieving parent entity information in the datasource editor. - **Refactor** - Updated various components to utilize the new `ActionParentEntityTypeInterface`. - Enhanced reducer logic for better handling of action configurations. - Streamlined entity exports and imports for consistency. - **Bug Fixes** - Fixed redirection logic in the Datasource Blank State component for a smoother user experience. - **Chores** - Removed unused event listeners from sagas to optimize performance. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-26 06:08:00 +00:00
getCurrentApplicationId,
chore: Refactoring header actions on datasource page to support reusable queries on EE (#29442) ## Description Refactoring header actions on datasource page to support reusable queries on EE #### PR fixes following issue(s) Fixes [#28568](https://github.com/appsmithorg/appsmith/issues/28568) #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new header action management system in the data source editor, allowing for dynamic action button generation based on user permissions and editor type. - Implemented a new editor type detection hook to improve editor experience. - **Improvements** - Streamlined the data source editor interface by removing unused permissions checks and simplifying action button logic. - Enhanced the editor's routing system with additional constants for deprecated paths. - **Refactor** - Refactored the `DSFormHeader` component to utilize the new `useHeaderActions` hook for a cleaner and more maintainable codebase. - Updated Redux state management to include a new action handler for resetting editor state. - **Style** - Adjusted the layout of the `LeftPaneContainer` by removing the `min-width` property for a more responsive design. - **Chores** - Cleaned up imports and unused variables across multiple files to improve code clarity and maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-08 11:42:14 +00:00
getCurrentPageId,
getPagePermissions,
} from "selectors/editorSelectors";
import { useShowPageGenerationOnHeader } from "pages/Editor/DataSourceEditor/hooks";
import type { AppState } from "@appsmith/reducers";
import {
getHasCreatePagePermission,
hasCreateDSActionPermissionInApp,
} from "@appsmith/utils/BusinessFeatures/permissionPageHelpers";
import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
fix: Refactoring code to fix a couple of issues related to modules on EE (#29843) ## Description Refactoring code to fix a couple of issues related to modules on EE #### PR fixes following issue(s) Fixes [#29842](https://github.com/appsmithorg/appsmith/issues/29842) [#29445](https://github.com/appsmithorg/appsmith/issues/29445) #### Type of change - Bug fix (non-breaking change which fixes an issue) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new interface for improved action context handling. - Added functionality to create API actions based on the editor type. - Implemented a new hook for retrieving parent entity information in the datasource editor. - **Refactor** - Updated various components to utilize the new `ActionParentEntityTypeInterface`. - Enhanced reducer logic for better handling of action configurations. - Streamlined entity exports and imports for consistency. - **Bug Fixes** - Fixed redirection logic in the Datasource Blank State component for a smoother user experience. - **Chores** - Removed unused event listeners from sagas to optimize performance. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-26 06:08:00 +00:00
import { ActionParentEntityType } from "@appsmith/entities/Engine/actionHelpers";
fix: interchanged primary btn to gen crud from new query (#30007) ## Description Earlier the `New query` button was primary and `Generate New Page` button was secondary button but now this PR interchanges the UI for both only for the preview data supported datasources i.e. Google sheet, Mysql, Postgres, Mongo Mock db. #### PR fixes following issue(s) Fixes #29599 > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced the ability to preview data within the data source editor for supported plugins. - **Enhancements** - Improved user interface by changing certain buttons from secondary to primary, enhancing visibility and interaction. - **Refactor** - Streamlined the logic for determining if a data source plugin supports data preview. - **Style** - Updated button styles for a more consistent and prominent user interface in the data source editor sections. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-01-05 08:24:18 +00:00
import { isEnabledForPreviewData } from "utils/editorContextUtils";
import { getPlugin } from "@appsmith/selectors/entitiesSelector";
chore: Refactoring header actions on datasource page to support reusable queries on EE (#29442) ## Description Refactoring header actions on datasource page to support reusable queries on EE #### PR fixes following issue(s) Fixes [#28568](https://github.com/appsmithorg/appsmith/issues/28568) #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new header action management system in the data source editor, allowing for dynamic action button generation based on user permissions and editor type. - Implemented a new editor type detection hook to improve editor experience. - **Improvements** - Streamlined the data source editor interface by removing unused permissions checks and simplifying action button logic. - Enhanced the editor's routing system with additional constants for deprecated paths. - **Refactor** - Refactored the `DSFormHeader` component to utilize the new `useHeaderActions` hook for a cleaner and more maintainable codebase. - Updated Redux state management to include a new action handler for resetting editor state. - **Style** - Adjusted the layout of the `LeftPaneContainer` by removing the `min-width` property for a more responsive design. - **Chores** - Cleaned up imports and unused variables across multiple files to improve code clarity and maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-08 11:42:14 +00:00
export interface HeaderActionProps {
datasource: Datasource | ApiDatasourceForm | undefined;
isPluginAuthorized: boolean;
pluginType: string;
showReconnectButton?: boolean;
}
export const useHeaderActions = (
editorType: string,
{
datasource,
isPluginAuthorized,
pluginType,
showReconnectButton = false,
}: HeaderActionProps,
) => {
const pageId = useSelector(getCurrentPageId);
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
const userAppPermissions = useSelector(
(state: AppState) => getCurrentApplication(state)?.userPermissions ?? [],
);
const pagePermissions = useSelector((state: AppState) =>
getPagePermissions(state),
);
const showGenerateButton = useShowPageGenerationOnHeader(
datasource as Datasource,
);
fix: interchanged primary btn to gen crud from new query (#30007) ## Description Earlier the `New query` button was primary and `Generate New Page` button was secondary button but now this PR interchanges the UI for both only for the preview data supported datasources i.e. Google sheet, Mysql, Postgres, Mongo Mock db. #### PR fixes following issue(s) Fixes #29599 > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced the ability to preview data within the data source editor for supported plugins. - **Enhancements** - Improved user interface by changing certain buttons from secondary to primary, enhancing visibility and interaction. - **Refactor** - Streamlined the logic for determining if a data source plugin supports data preview. - **Style** - Updated button styles for a more consistent and prominent user interface in the data source editor sections. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-01-05 08:24:18 +00:00
const plugin = useSelector((state: AppState) =>
getPlugin(state, datasource?.pluginId || ""),
);
const isPluginAllowedToPreviewData =
!!plugin && isEnabledForPreviewData(datasource as Datasource, plugin);
chore: Refactoring header actions on datasource page to support reusable queries on EE (#29442) ## Description Refactoring header actions on datasource page to support reusable queries on EE #### PR fixes following issue(s) Fixes [#28568](https://github.com/appsmithorg/appsmith/issues/28568) #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new header action management system in the data source editor, allowing for dynamic action button generation based on user permissions and editor type. - Implemented a new editor type detection hook to improve editor experience. - **Improvements** - Streamlined the data source editor interface by removing unused permissions checks and simplifying action button logic. - Enhanced the editor's routing system with additional constants for deprecated paths. - **Refactor** - Refactored the `DSFormHeader` component to utilize the new `useHeaderActions` hook for a cleaner and more maintainable codebase. - Updated Redux state management to include a new action handler for resetting editor state. - **Style** - Adjusted the layout of the `LeftPaneContainer` by removing the `min-width` property for a more responsive design. - **Chores** - Cleaned up imports and unused variables across multiple files to improve code clarity and maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-08 11:42:14 +00:00
if (editorType === EditorNames.APPLICATION) {
chore: Refactoring entity types and updating DS action create permission to fix some bugs on EE (#29573) ## Description Refactoring entity types and updating DS action create permission to fix some bugs on EE #### PR fixes following issue(s) Fixes # (issue number) #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [x] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Streamlined entity type naming conventions across the application for better consistency. - Enhanced type definitions for improved code clarity and maintainability. - Updated function calls to use object parameters with named properties for better readability. - **New Features** - Introduced a new entity type for module instances, expanding the application's data handling capabilities. - **Bug Fixes** - Corrected improper type assertions to ensure accurate entity recognition and processing. - **Documentation** - Added comments to clarify the non-introduction of certain dependencies in specific components. - **Style** - Adjusted import statements to align with the updated naming conventions. - **Tests** - Updated test cases to reflect changes in entity type references and assertions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-14 14:44:30 +00:00
const canCreateDatasourceActions = hasCreateDSActionPermissionInApp({
isEnabled: isFeatureEnabled,
dsPermissions: datasource?.userPermissions ?? [],
chore: Refactoring header actions on datasource page to support reusable queries on EE (#29442) ## Description Refactoring header actions on datasource page to support reusable queries on EE #### PR fixes following issue(s) Fixes [#28568](https://github.com/appsmithorg/appsmith/issues/28568) #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new header action management system in the data source editor, allowing for dynamic action button generation based on user permissions and editor type. - Implemented a new editor type detection hook to improve editor experience. - **Improvements** - Streamlined the data source editor interface by removing unused permissions checks and simplifying action button logic. - Enhanced the editor's routing system with additional constants for deprecated paths. - **Refactor** - Refactored the `DSFormHeader` component to utilize the new `useHeaderActions` hook for a cleaner and more maintainable codebase. - Updated Redux state management to include a new action handler for resetting editor state. - **Style** - Adjusted the layout of the `LeftPaneContainer` by removing the `min-width` property for a more responsive design. - **Chores** - Cleaned up imports and unused variables across multiple files to improve code clarity and maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-08 11:42:14 +00:00
pagePermissions,
chore: Refactoring entity types and updating DS action create permission to fix some bugs on EE (#29573) ## Description Refactoring entity types and updating DS action create permission to fix some bugs on EE #### PR fixes following issue(s) Fixes # (issue number) #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [x] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Streamlined entity type naming conventions across the application for better consistency. - Enhanced type definitions for improved code clarity and maintainability. - Updated function calls to use object parameters with named properties for better readability. - **New Features** - Introduced a new entity type for module instances, expanding the application's data handling capabilities. - **Bug Fixes** - Corrected improper type assertions to ensure accurate entity recognition and processing. - **Documentation** - Added comments to clarify the non-introduction of certain dependencies in specific components. - **Style** - Adjusted import statements to align with the updated naming conventions. - **Tests** - Updated test cases to reflect changes in entity type references and assertions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-14 14:44:30 +00:00
});
chore: Refactoring header actions on datasource page to support reusable queries on EE (#29442) ## Description Refactoring header actions on datasource page to support reusable queries on EE #### PR fixes following issue(s) Fixes [#28568](https://github.com/appsmithorg/appsmith/issues/28568) #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new header action management system in the data source editor, allowing for dynamic action button generation based on user permissions and editor type. - Implemented a new editor type detection hook to improve editor experience. - **Improvements** - Streamlined the data source editor interface by removing unused permissions checks and simplifying action button logic. - Enhanced the editor's routing system with additional constants for deprecated paths. - **Refactor** - Refactored the `DSFormHeader` component to utilize the new `useHeaderActions` hook for a cleaner and more maintainable codebase. - Updated Redux state management to include a new action handler for resetting editor state. - **Style** - Adjusted the layout of the `LeftPaneContainer` by removing the `min-width` property for a more responsive design. - **Chores** - Cleaned up imports and unused variables across multiple files to improve code clarity and maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-08 11:42:14 +00:00
const canCreatePages = getHasCreatePagePermission(
isFeatureEnabled,
userAppPermissions,
);
const canGeneratePage = canCreateDatasourceActions && canCreatePages;
const routeToGeneratePage = () => {
if (!showGenerateButton) {
// disable button when it doesn't support page generation
return;
}
AnalyticsUtil.logEvent("DATASOURCE_CARD_GEN_CRUD_PAGE_ACTION");
history.push(
generateTemplateFormURL({
pageId,
params: {
datasourceId: (datasource as Datasource).id,
new_page: true,
},
}),
);
};
const newActionButton = (
<NewActionButton
datasource={datasource as Datasource}
disabled={!canCreateDatasourceActions || !isPluginAuthorized}
eventFrom="datasource-pane"
fix: interchanged primary btn to gen crud from new query (#30007) ## Description Earlier the `New query` button was primary and `Generate New Page` button was secondary button but now this PR interchanges the UI for both only for the preview data supported datasources i.e. Google sheet, Mysql, Postgres, Mongo Mock db. #### PR fixes following issue(s) Fixes #29599 > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced the ability to preview data within the data source editor for supported plugins. - **Enhancements** - Improved user interface by changing certain buttons from secondary to primary, enhancing visibility and interaction. - **Refactor** - Streamlined the logic for determining if a data source plugin supports data preview. - **Style** - Updated button styles for a more consistent and prominent user interface in the data source editor sections. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-01-05 08:24:18 +00:00
isNewQuerySecondaryButton={!!isPluginAllowedToPreviewData}
chore: Refactoring header actions on datasource page to support reusable queries on EE (#29442) ## Description Refactoring header actions on datasource page to support reusable queries on EE #### PR fixes following issue(s) Fixes [#28568](https://github.com/appsmithorg/appsmith/issues/28568) #### Type of change - Chore (housekeeping or task changes that don't impact user perception) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new header action management system in the data source editor, allowing for dynamic action button generation based on user permissions and editor type. - Implemented a new editor type detection hook to improve editor experience. - **Improvements** - Streamlined the data source editor interface by removing unused permissions checks and simplifying action button logic. - Enhanced the editor's routing system with additional constants for deprecated paths. - **Refactor** - Refactored the `DSFormHeader` component to utilize the new `useHeaderActions` hook for a cleaner and more maintainable codebase. - Updated Redux state management to include a new action handler for resetting editor state. - **Style** - Adjusted the layout of the `LeftPaneContainer` by removing the `min-width` property for a more responsive design. - **Chores** - Cleaned up imports and unused variables across multiple files to improve code clarity and maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-08 11:42:14 +00:00
pluginType={pluginType}
/>
);
const generatePageButton =
showGenerateButton && !showReconnectButton ? (
<Button
className={"t--generate-template"}
isDisabled={!canGeneratePage}
kind="secondary"
onClick={(e: any) => {
e.stopPropagation();
e.preventDefault();
routeToGeneratePage();
}}
size="md"
>
{createMessage(GENERATE_NEW_PAGE_BUTTON_TEXT)}
</Button>
) : null;
return {
newActionButton,
generatePageButton,
};
}
return {};
};
fix: Refactoring code to fix a couple of issues related to modules on EE (#29843) ## Description Refactoring code to fix a couple of issues related to modules on EE #### PR fixes following issue(s) Fixes [#29842](https://github.com/appsmithorg/appsmith/issues/29842) [#29445](https://github.com/appsmithorg/appsmith/issues/29445) #### Type of change - Bug fix (non-breaking change which fixes an issue) ## Testing #### How Has This Been Tested? - [x] Manual - [ ] JUnit - [ ] Jest - [x] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new interface for improved action context handling. - Added functionality to create API actions based on the editor type. - Implemented a new hook for retrieving parent entity information in the datasource editor. - **Refactor** - Updated various components to utilize the new `ActionParentEntityTypeInterface`. - Enhanced reducer logic for better handling of action configurations. - Streamlined entity exports and imports for consistency. - **Bug Fixes** - Fixed redirection logic in the Datasource Blank State component for a smoother user experience. - **Chores** - Removed unused event listeners from sagas to optimize performance. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2023-12-26 06:08:00 +00:00
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const useParentEntityInfo = (editorType: string) => {
const appId = useSelector(getCurrentApplicationId);
const pageId = useSelector(getCurrentPageId);
return {
editorId: appId || "",
parentEntityId: pageId || "",
parentEntityType: ActionParentEntityType.PAGE,
};
};