-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat: added custom action config control type for paragon integrations #39764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
79e2bdc
feat: added custom action config control type for paragon integrations
817da68
feat: minor description changes
6263dad
Merge branch 'release' into feat/custom-actions
f82ed56
feat: no search found placeholder
acc75be
feat: no search found placeholder
d7d679c
feat: check for custom action availability
348b407
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/c…
2f2120d
feat: fix for pluginId test case
e6f50bf
feat: ui fixes
6ab4d0d
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/c…
NilanshBansal 748f2e4
fix: dropdown test updated, magic strings changed
5d230c5
fix: merge from release
73a1906
Merge branch 'feat/custom-actions' of github.com:appsmithorg/appsmith…
aacec72
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/c…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
119 changes: 119 additions & 0 deletions
119
app/client/src/components/formControls/CustomActionsConfigControl/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| import React from "react"; | ||
| import type { ControlType } from "constants/PropertyControlConstants"; | ||
| import FormControl from "pages/Editor/FormControl"; | ||
| import { Grid, Tabs, TabPanel, TabsList, Tab } from "@appsmith/ads"; | ||
| import BaseControl, { type ControlProps } from "../BaseControl"; | ||
| import { HTTP_METHOD } from "PluginActionEditor/constants/CommonApiConstants"; | ||
| import { API_EDITOR_TAB_TITLES } from "ee/constants/messages"; | ||
| import { createMessage } from "ee/constants/messages"; | ||
|
|
||
| enum CUSTOM_ACTION_TABS { | ||
| HEADERS = "HEADERS", | ||
| PARAMS = "PARAMS", | ||
| BODY = "BODY", | ||
| } | ||
|
|
||
| const TabbedControls = (props: ControlProps) => { | ||
| return ( | ||
| <Tabs defaultValue={CUSTOM_ACTION_TABS.HEADERS}> | ||
| <TabsList> | ||
| {Object.values(CUSTOM_ACTION_TABS).map((tab) => ( | ||
| <Tab data-testid={`t--api-editor-${tab}`} key={tab} value={tab}> | ||
| {createMessage(API_EDITOR_TAB_TITLES[tab])} | ||
| </Tab> | ||
| ))} | ||
| </TabsList> | ||
|
|
||
| <TabPanel value={CUSTOM_ACTION_TABS.HEADERS}> | ||
| <FormControl | ||
| config={{ | ||
| controlType: "KEYVALUE_ARRAY", | ||
| configProperty: `${props.configProperty}.headers`, | ||
| formName: props.formName, | ||
| id: `${props.configProperty}.headers`, | ||
| isValid: true, | ||
| // @ts-expect-error FormControl component has incomplete TypeScript definitions for some valid properties | ||
| showHeader: true, | ||
| }} | ||
| formName={props.formName} | ||
| /> | ||
| </TabPanel> | ||
| <TabPanel value={CUSTOM_ACTION_TABS.PARAMS}> | ||
| <FormControl | ||
| config={{ | ||
| controlType: "KEYVALUE_ARRAY", | ||
| configProperty: `${props.configProperty}.params`, | ||
| formName: props.formName, | ||
| id: `${props.configProperty}.params`, | ||
| // @ts-expect-error FormControl component has incomplete TypeScript definitions for some valid properties | ||
| showHeader: true, | ||
| isValid: true, | ||
| }} | ||
| formName={props.formName} | ||
| /> | ||
| </TabPanel> | ||
| <TabPanel value={CUSTOM_ACTION_TABS.BODY}> | ||
| <FormControl | ||
| config={{ | ||
| controlType: "QUERY_DYNAMIC_TEXT", | ||
| configProperty: `${props.configProperty}.body`, | ||
| formName: props.formName, | ||
| id: `${props.configProperty}.body`, | ||
| label: "", | ||
| isValid: true, | ||
| }} | ||
| formName={props.formName} | ||
| /> | ||
| </TabPanel> | ||
| </Tabs> | ||
| ); | ||
| }; | ||
|
|
||
| /** | ||
| * This component is used to configure the function calling for the AI assistant. | ||
| * It allows the user to add, edit and delete functions that can be used by the AI assistant. | ||
| */ | ||
| export class CustomActionsControl extends BaseControl<ControlProps> { | ||
| getControlType(): ControlType { | ||
| return "CUSTOM_ACTIONS_CONFIG_FORM"; | ||
| } | ||
| render() { | ||
| const { props } = this; | ||
|
|
||
| return ( | ||
| <Grid gap="spaces-4" w="100%"> | ||
| <Grid gap="spaces-4" gridTemplateColumns="100px 1fr" w="100%"> | ||
| <FormControl | ||
| config={{ | ||
| controlType: "DROP_DOWN", | ||
| configProperty: `${props.configProperty}.method`, | ||
| formName: props.formName, | ||
| id: `${props.configProperty}.method`, | ||
| label: "", | ||
| isValid: true, | ||
| // @ts-expect-error FormControl component has incomplete TypeScript definitions for some valid properties | ||
| options: Object.values(HTTP_METHOD).map((method) => ({ | ||
| label: method, | ||
| value: method, | ||
| })), | ||
| }} | ||
| formName={props.formName} | ||
| /> | ||
| <FormControl | ||
| config={{ | ||
| controlType: "QUERY_DYNAMIC_INPUT_TEXT", | ||
| configProperty: `${props.configProperty}.path`, | ||
| formName: props.formName, | ||
| id: `${props.configProperty}.path`, | ||
| label: "", | ||
| isValid: true, | ||
| placeholderText: "/v1/users", | ||
| }} | ||
| formName={props.formName} | ||
| /> | ||
| </Grid> | ||
| <TabbedControls {...props} /> | ||
| </Grid> | ||
| ); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Address TypeScript errors properly
There are multiple
@ts-expect-errorcomments indicating incomplete type definitions for FormControl. Consider creating proper type interfaces or contributing to the existing ones instead of suppressing these errors.Also applies to: 72-74
🏁 Script executed:
Length of output: 124
Update FormControl types to remove the need for error suppression
It looks like the FormControl component’s TypeScript definitions (defined in
app/client/src/pages/Editor/FormControl.tsx) are missing theshowHeaderproperty. Please update theFormControlPropsinterface to includeshowHeader(and any other missing props), then remove the accompanying@ts-expect-errorcomments in:app/client/src/components/formControls/CustomActionsConfigControl/index.tsx(lines 59–60)app/client/src/components/formControls/CustomActionsConfigControl/index.tsx(lines 72–74)This change will ensure TypeScript accurately validates the component without suppressing errors.