chore: Adding a new hook to set settingsConfig for an action based on IDE type (#36442)

## Description

Adding a new hook to set `settingsConfig` for an action based on IDE
type. This is being used in PluginActionEditor in the new modular flow.

Fixes #36438 #36439 

## Automation

/ok-to-test tags="@tag.All"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/10955776812>
> Commit: 447d926c31c6e26922bb24851c68727bec14d1ae
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10955776812&attempt=2"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Fri, 20 Sep 2024 10:12:39 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **New Features**
- Introduced a new hook, `useActionSettingsConfig`, for simplified
access to plugin action settings.
- Updated the `PluginActionEditor` to utilize the new hook, enhancing
the logic for retrieving plugin settings.
- Added a re-exporting mechanism for `useActionSettingsConfig` to
improve organization within the Plugin Action Editor.
- **Improvements**
- Streamlined the process of accessing plugin configurations, improving
overall code clarity and maintainability.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Ankita Kinger 2024-09-20 19:37:10 +05:30 committed by GitHub
parent 54a0f2b3c0
commit 0ad0989a55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 4 deletions

View File

@ -7,7 +7,6 @@ import {
getDatasource,
getEditorConfig,
getPlugin,
getPluginSettingConfigs,
} from "ee/selectors/entitiesSelector";
import { PluginActionContextProvider } from "./PluginActionContext";
import { get } from "lodash";
@ -16,6 +15,7 @@ import Spinner from "components/editorComponents/Spinner";
import CenteredWrapper from "components/designSystems/appsmith/CenteredWrapper";
import { Text } from "@appsmith/ads";
import { useIsEditorInitialised } from "IDE/hooks";
import { useActionSettingsConfig } from "./hooks";
interface ChildrenProps {
children: React.ReactNode | React.ReactNode[];
@ -35,9 +35,7 @@ const PluginActionEditor = (props: ChildrenProps) => {
const datasourceId = get(action, "datasource.id", "");
const datasource = useSelector((state) => getDatasource(state, datasourceId));
const settingsConfig = useSelector((state) =>
getPluginSettingConfigs(state, pluginId),
);
const settingsConfig = useActionSettingsConfig(action);
const editorConfig = useSelector((state) => getEditorConfig(state, pluginId));

View File

@ -0,0 +1 @@
export { useActionSettingsConfig } from "ee/PluginActionEditor/hooks/useActionSettingsConfig";

View File

@ -0,0 +1,11 @@
import { useSelector } from "react-redux";
import { getPluginSettingConfigs } from "ee/selectors/entitiesSelector";
import type { Action } from "entities/Action";
function useActionSettingsConfig(action?: Action) {
return useSelector((state) =>
getPluginSettingConfigs(state, action?.pluginId || ""),
);
}
export { useActionSettingsConfig };

View File

@ -0,0 +1 @@
export * from "ce/PluginActionEditor/hooks/useActionSettingsConfig";