-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore: Moving action settings from editor form to toolbar #36894
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 all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
365ebc7
moving action settings to toolbar
ankitakinger b010259
handling use prepared statement callout link with settings popover
ankitakinger f009298
minor fix
ankitakinger 4dc3a82
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger 4132da1
addressing coderabbitai comments & updating imports
ankitakinger d404b28
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger e0413ce
updating popover size
ankitakinger 695e4f7
addressing review comments
ankitakinger 3397219
removing tailwind classes
ankitakinger 7a14fc1
removing tailwind classes
ankitakinger 73aa5df
addressing design review comments
ankitakinger c1fac59
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
ankitakinger 967f132
fixing client build
ankitakinger 09f390e
minor css fixes
ankitakinger 9e4234c
removing extra margin
ankitakinger 8dbb2fa
css changes
ankitakinger 027e2a3
css changes
ankitakinger 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
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
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
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
10 changes: 10 additions & 0 deletions
10
app/client/src/PluginActionEditor/components/PluginActionSettings/ApiSettings.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,10 @@ | ||
| import { API_EDITOR_FORM_NAME } from "ee/constants/forms"; | ||
| import { reduxForm } from "redux-form"; | ||
| import PluginActionSettingsPopover, { | ||
| type SettingsProps, | ||
| } from "./SettingsPopover"; | ||
|
|
||
| export default reduxForm<unknown, SettingsProps>({ | ||
| form: API_EDITOR_FORM_NAME, | ||
| enableReinitialize: true, | ||
| })(PluginActionSettingsPopover); |
10 changes: 10 additions & 0 deletions
10
app/client/src/PluginActionEditor/components/PluginActionSettings/QuerySettings.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,10 @@ | ||
| import { QUERY_EDITOR_FORM_NAME } from "ee/constants/forms"; | ||
| import { reduxForm } from "redux-form"; | ||
| import PluginActionSettingsPopover, { | ||
| type SettingsProps, | ||
| } from "./SettingsPopover"; | ||
|
|
||
| export default reduxForm<unknown, SettingsProps>({ | ||
| form: QUERY_EDITOR_FORM_NAME, | ||
| enableReinitialize: true, | ||
| })(PluginActionSettingsPopover); |
142 changes: 142 additions & 0 deletions
142
app/client/src/PluginActionEditor/components/PluginActionSettings/SettingsPopover.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,142 @@ | ||
| import React, { useCallback, useEffect, useState } from "react"; | ||
| import { | ||
| Link, | ||
| Popover, | ||
| PopoverBody, | ||
| PopoverContent, | ||
| PopoverHeader, | ||
| PopoverTrigger, | ||
| ToggleButton, | ||
| } from "@appsmith/ads"; | ||
| import ActionSettings from "pages/Editor/ActionSettings"; | ||
| import { usePluginActionContext } from "../../PluginActionContext"; | ||
| import styled, { css } from "styled-components"; | ||
| import { | ||
| API_EDITOR_TAB_TITLES, | ||
| createMessage, | ||
| LEARN_MORE, | ||
| } from "ee/constants/messages"; | ||
| import { useDispatch, useSelector } from "react-redux"; | ||
| import { | ||
| isPluginActionSettingsOpen, | ||
| openPluginActionSettings, | ||
| } from "../../store"; | ||
| import { THEME } from "../../constants/PluginActionConstants"; | ||
| import { type DocsLink, openDoc } from "constants/DocumentationLinks"; | ||
|
|
||
| export interface SettingsProps { | ||
| formName: string; | ||
| docsLink?: DocsLink; | ||
| } | ||
|
|
||
| const Variables = css` | ||
| --popover-width: 280px; | ||
| `; | ||
|
|
||
| /* TODO: Remove this after removing custom width from server side (Ankita) */ | ||
| const SettingsWrapper = styled.div` | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: var(--ads-v2-spaces-4); | ||
|
|
||
| .t--form-control-INPUT_TEXT, | ||
| .t--form-control-DROP_DOWN { | ||
| > div { | ||
| min-width: unset; | ||
| width: 100%; | ||
| } | ||
| } | ||
ankitakinger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| `; | ||
|
|
||
| const StyledPopoverHeader = styled(PopoverHeader)` | ||
| margin-bottom: var(--ads-v2-spaces-5); | ||
| `; | ||
|
|
||
| const StyledPopoverContent = styled(PopoverContent)` | ||
| ${Variables}; | ||
| `; | ||
|
|
||
| const LearnMoreLink = styled(Link)` | ||
| span { | ||
| font-weight: bold; | ||
| } | ||
| `; | ||
|
|
||
| const PluginActionSettingsPopover = (props: SettingsProps) => { | ||
| const { settingsConfig } = usePluginActionContext(); | ||
| const openSettings = useSelector(isPluginActionSettingsOpen); | ||
| const [isOpen, setIsOpen] = useState(false); | ||
| const dispatch = useDispatch(); | ||
|
|
||
| useEffect(() => { | ||
| if (openSettings) { | ||
| handleOpenChange(true); | ||
| } | ||
| }, [openSettings]); | ||
|
|
||
| const handleOpenChange = useCallback( | ||
| (open: boolean) => { | ||
| setIsOpen(open); | ||
|
|
||
| if (openSettings && !open) { | ||
| dispatch(openPluginActionSettings(false)); | ||
| } | ||
| }, | ||
| [openSettings], | ||
| ); | ||
ankitakinger marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const handleEscapeKeyDown = () => { | ||
| handleOpenChange(false); | ||
| }; | ||
|
|
||
| const handleButtonClick = () => { | ||
| handleOpenChange(true); | ||
| }; | ||
|
|
||
| const handleLearnMoreClick = () => { | ||
| openDoc(props.docsLink as DocsLink); | ||
| }; | ||
|
|
||
| return ( | ||
| <Popover onOpenChange={handleOpenChange} open={isOpen}> | ||
| <PopoverTrigger> | ||
| <ToggleButton | ||
| icon="settings-2-line" | ||
| isSelected={isOpen} | ||
| onClick={handleButtonClick} | ||
| size="md" | ||
| /> | ||
| </PopoverTrigger> | ||
| <StyledPopoverContent | ||
| align="end" | ||
| onEscapeKeyDown={handleEscapeKeyDown} | ||
| size="sm" | ||
| > | ||
| <StyledPopoverHeader isClosable> | ||
| {createMessage(API_EDITOR_TAB_TITLES.SETTINGS)} | ||
| </StyledPopoverHeader> | ||
| <PopoverBody> | ||
| <SettingsWrapper> | ||
| <ActionSettings | ||
| actionSettingsConfig={settingsConfig} | ||
| formName={props.formName} | ||
| theme={THEME} | ||
| /> | ||
| {props.docsLink && ( | ||
| <LearnMoreLink | ||
| className="t--action-settings-documentation-link" | ||
| endIcon="share-box-line" | ||
| kind="secondary" | ||
| onClick={handleLearnMoreClick} | ||
| > | ||
| {createMessage(LEARN_MORE)} | ||
| </LearnMoreLink> | ||
| )} | ||
| </SettingsWrapper> | ||
| </PopoverBody> | ||
| </StyledPopoverContent> | ||
| </Popover> | ||
| ); | ||
| }; | ||
|
|
||
| export default PluginActionSettingsPopover; | ||
30 changes: 30 additions & 0 deletions
30
app/client/src/PluginActionEditor/components/PluginActionSettings/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,30 @@ | ||
| import React from "react"; | ||
| import { UIComponentTypes } from "api/PluginApi"; | ||
| import { usePluginActionContext } from "../../PluginActionContext"; | ||
| import ApiSettings from "./ApiSettings"; | ||
| import QuerySettings from "./QuerySettings"; | ||
| import { | ||
| API_EDITOR_FORM_NAME, | ||
| QUERY_EDITOR_FORM_NAME, | ||
| } from "ee/constants/forms"; | ||
| import { DocsLink } from "constants/DocumentationLinks"; | ||
|
|
||
| const API_FORM_COMPONENTS = [ | ||
| UIComponentTypes.ApiEditorForm, | ||
| UIComponentTypes.GraphQLEditorForm, | ||
| ]; | ||
|
|
||
| const PluginActionSettings = () => { | ||
| const { plugin } = usePluginActionContext(); | ||
|
|
||
| return API_FORM_COMPONENTS.includes(plugin.uiComponent) ? ( | ||
| <ApiSettings formName={API_EDITOR_FORM_NAME} /> | ||
| ) : ( | ||
| <QuerySettings | ||
| docsLink={DocsLink.QUERY_SETTINGS} | ||
| formName={QUERY_EDITOR_FORM_NAME} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export default PluginActionSettings; |
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
3 changes: 3 additions & 0 deletions
3
app/client/src/PluginActionEditor/constants/PluginActionConstants.ts
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,3 @@ | ||
| import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig"; | ||
|
|
||
| export const THEME = EditorTheme.LIGHT; |
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 |
|---|---|---|
| @@ -1 +1,4 @@ | ||
| import { EditorTheme } from "components/editorComponents/CodeEditor/EditorConfig"; | ||
|
|
||
| export const POST_BODY_FORM_DATA_KEY = "displayFormat"; | ||
| export const THEME = EditorTheme.LIGHT; |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.