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
feat: show slash command prompt on focus in property pane #31920
Conversation
WalkthroughWalkthroughThe recent updates focus on enhancing the slash command menu functionality within the code editor, particularly for specific widget types and properties. A new constant and function have been introduced to determine the appropriateness of displaying the slash command menu, primarily targeting table and JSON widgets and their Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8342952328. |
Deploy-Preview-URL: https://ce-31920.dp.appsmith.com |
Keeping in draft state, because we still need to decide whether to add this behind a flag or release it to everyone |
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8371579698. |
Deploy-Preview-URL: https://ce-31920.dp.appsmith.com |
app/client/src/components/editorComponents/ActionCreator/constants.ts
Outdated
Show resolved
Hide resolved
import { featureFlagIntercept } from "../../../../support/Objects/FeatureFlags"; | ||
import { | ||
agHelper, | ||
locators, | ||
entityExplorer, | ||
propPane, | ||
draggableWidgets, | ||
} from "../../../../support/Objects/ObjectsCore"; | ||
import EditorNavigation, { | ||
EntityType, | ||
} from "../../../../support/Pages/EditorNavigation"; | ||
|
||
describe("Property Pane Suggestions", { tags: ["@tag.JS"] }, () => { | ||
before(() => { | ||
featureFlagIntercept({ | ||
ab_learnability_ease_of_initial_use_enabled: true, | ||
}); | ||
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TABLE, 200, 200); | ||
}); | ||
|
||
it("1. Should show Property Pane Suggestions on / command & when typing {{}}", () => { | ||
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget); | ||
propPane.ToggleJSMode("Table data", true); | ||
propPane.FocusIntoTextField("Table data"); | ||
agHelper.GetElementsNAssertTextPresence(locators._hints, "Add a binding"); | ||
agHelper.GetNClickByContains(locators._hints, "Add a binding"); | ||
propPane.ValidatePropertyFieldValue("Table data", "{{}}"); | ||
|
||
entityExplorer.DragDropWidgetNVerify(draggableWidgets.JSONFORM, 600, 400); | ||
EditorNavigation.SelectEntityByName("JSONForm1", EntityType.Widget); | ||
propPane.ToggleJSMode("Source data", true); | ||
propPane.FocusIntoTextField("Source data"); | ||
agHelper.GetElementsNAssertTextPresence(locators._hints, "Add a binding"); | ||
agHelper.GetNClickByContains(locators._hints, "Add a binding"); | ||
propPane.ValidatePropertyFieldValue("Source data", "{{}}"); | ||
}); | ||
}); |
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.
Is it possible to write integration test for this rather than E2E test?
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.
@rishabhrathod01 Thanks a lot for proactively checking the test and making this suggestion. I tried this out and it seems a little tricky to write integration test for this mainly because, it involves two components: 1. Code editor (we need to focus on it) 2. Menu popup itself (Where we verify if it opened up or not)
The main issue with menu popup is that its html content appears outside propertyPane / CodeEditor component and it wont be possible in react testing library to locate this html outside code editor / property pane component.
Secondly this is experimental feature behind a flag and we may choose to keep it or revert it based on mixpanel results, hence it does not make sense to invest efforts on this to write integration test. If we decide to keep this feature in future, we can take a relook at it and add integration tests then. Please let me know what you think
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.
Makes sense. Let's go with E2E test.
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8386141408. |
Deploy-Preview-URL: https://ce-31920.dp.appsmith.com |
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.
Changes look good to me. I have tested it on DP.
import { featureFlagIntercept } from "../../../../support/Objects/FeatureFlags"; | ||
import { | ||
agHelper, | ||
locators, | ||
entityExplorer, | ||
propPane, | ||
draggableWidgets, | ||
} from "../../../../support/Objects/ObjectsCore"; | ||
import EditorNavigation, { | ||
EntityType, | ||
} from "../../../../support/Pages/EditorNavigation"; | ||
|
||
describe("Property Pane Suggestions", { tags: ["@tag.JS"] }, () => { | ||
before(() => { | ||
featureFlagIntercept({ | ||
ab_learnability_ease_of_initial_use_enabled: true, | ||
}); | ||
entityExplorer.DragDropWidgetNVerify(draggableWidgets.TABLE, 200, 200); | ||
}); | ||
|
||
it("1. Should show Property Pane Suggestions on / command & when typing {{}}", () => { | ||
EditorNavigation.SelectEntityByName("Table1", EntityType.Widget); | ||
propPane.ToggleJSMode("Table data", true); | ||
propPane.FocusIntoTextField("Table data"); | ||
agHelper.GetElementsNAssertTextPresence(locators._hints, "Add a binding"); | ||
agHelper.GetNClickByContains(locators._hints, "Add a binding"); | ||
propPane.ValidatePropertyFieldValue("Table data", "{{}}"); | ||
|
||
entityExplorer.DragDropWidgetNVerify(draggableWidgets.JSONFORM, 600, 400); | ||
EditorNavigation.SelectEntityByName("JSONForm1", EntityType.Widget); | ||
propPane.ToggleJSMode("Source data", true); | ||
propPane.FocusIntoTextField("Source data"); | ||
agHelper.GetElementsNAssertTextPresence(locators._hints, "Add a binding"); | ||
agHelper.GetNClickByContains(locators._hints, "Add a binding"); | ||
propPane.ValidatePropertyFieldValue("Source data", "{{}}"); | ||
}); | ||
}); |
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.
Makes sense. Let's go with E2E test.
Description
This PR adds builds on top of existing slash command menu feature. Today when we enter JS mode for any of the properties and type in
/
command, we are able to see the following menu.With the changes in this PR, now whenever we switch to JS mode for data property of Table and JSON form widgets, if we focus on the input box, we should be able to see the menu with options showing up as shown below:
Screen.Recording.2024-03-20.at.10.58.30.AM.mov
Limitations:
Fixes #31900
or
Fixes
Issue URL
Warning
If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.
Automation
/ok-to-test tags="@tag.All"
🔍 Cypress test results
Important
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/8386142777
Commit:
90bea1f91b3d864c984548b11ec4d3a5bd70b3f7
Cypress dashboard url: Click here!
All cypress tests have passed 🎉🎉🎉
Summary by CodeRabbit
data
property.Summary by CodeRabbit
CodeEditor
with advanced properties to support diverse functionalities including AI assistance and plugin integrations.PropertyPane
interaction by adding a method for focusing and asserting auto-save in text fields.