Skip to content
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: IDE tab list search view #34759

Merged
merged 18 commits into from
Jul 10, 2024
Merged

feat: IDE tab list search view #34759

merged 18 commits into from
Jul 10, 2024

Conversation

albinAppsmith
Copy link
Collaborator

@albinAppsmith albinAppsmith commented Jul 5, 2024

Description

This PR adds search functionality to the overflow list of tabs.

Fixes #34293

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9873481673
Commit: c09ae9f
Cypress dashboard.
Tags: @tag.All
Spec:


Wed, 10 Jul 2024 12:35:26 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Implemented fuzzy search functionality within the editor pane.
    • Added a search bar to the editor pane for improved query and file searching.
  • Improvements

    • Enhanced empty state handling to display more informative messages when search results are empty.
    • Updated button elements to use consistent test IDs ("t--add-item") for improved testability.
  • Bug Fixes

    • Refactored rendering logic in various components to ensure accurate results based on search input.
  • Tests

    • Added comprehensive tests for the new fuzzy search functionality and updated test assertions to align with new button test IDs.
  • Chores

    • Updated design-system dependency to version 2.1.43.

@albinAppsmith albinAppsmith requested a review from KelvinOm as a code owner July 5, 2024 11:51
Copy link
Contributor

coderabbitai bot commented Jul 5, 2024

Walkthrough

The changes introduce a search bar and add button to the list views in the editor pane of a client application. The update includes state management for search terms, fuzzy search functionality, and relevant tests. The modifications streamline the process of searching and adding items within the lists, enhancing user experience.

Changes

File Path Change Summary
app/client/package.json Updated design-system dependency version from 2.1.42 to 2.1.43.
app/client/src/ce/constants/messages.ts Added a function to EDITOR_PANE_TEXTS to return a message for empty search results.
app/client/src/pages/Editor/IDE/EditorPane/JS/List.tsx Implemented search functionality, refactored logic, and adjusted imports.
app/client/src/pages/Editor/IDE/EditorPane/Query/List.tsx Added local state management, search functionality, and refactored logic to use AddAndSearchbar component.
app/client/src/pages/Editor/IDE/EditorPane/components/AddAndSearchbar.tsx Introduced a functional component to render a search input and an "Add" button.
app/client/src/pages/Editor/IDE/EditorPane/fuzzySearchInFiles.test.ts Added test suite for fuzzySearchInFiles function.
app/client/src/pages/Editor/IDE/EditorPane/utils.ts Introduced fuzzySearchInFiles function and FUSE_OPTIONS constant.
app/client/cypress/support/Pages/JSEditor.ts Updated method for adding a new JavaScript object.
app/client/src/pages/Editor/IDE/EditorPane/JS/BlankState.tsx Added buttonTestId prop to EmptyState component.
app/client/src/pages/Editor/IDE/EditorPane/Query/BlankState.tsx Added buttonTestId prop to EmptyState component.
app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx Changed element selection method for "Add new" button in tests.
app/client/src/pages/Editor/IDE/EditorPane/components/EmptyState.tsx Added buttonTestId prop to EmptyState component's <Button> element.
app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx Replaced button assertion with getByTestId("t--add-item") in test code.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant SearchBar
    participant Backend

    User->>SearchBar: Enter search term
    SearchBar->>Backend: Fetch filtered data
    Backend-->>SearchBar: Return filtered data
    SearchBar-->>UI: Display search results
    User->>UI: Click "Add" button
    UI->>Backend: Add new item
    Backend-->>UI: Confirm addition
    UI-->>User: Display updated list
Loading

Assessment against linked issues

Objective Addressed Explanation
Add search bar to the list view of overflow list (#34293)

Poem

In the editor's quiet view,
A search bar fresh and new,
Fuzzy searches glide with ease,
Finding files like a breeze.
Add a button, shiny and bright,
Making tasks a pure delight. 🐇✨


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added IDE Navigation Issues/feature requests related to IDE navigation, and context switching IDE Pod Issues that new developers face while exploring the IDE Task A simple Todo labels Jul 5, 2024
@albinAppsmith albinAppsmith requested a review from hetunandu July 5, 2024 11:51
@github-actions github-actions bot added the Enhancement New feature or request label Jul 5, 2024
@albinAppsmith albinAppsmith added the ok-to-test Required label for CI label Jul 5, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f0f24fc and ac04312.

Files ignored due to path filters (1)
  • app/client/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
Files selected for processing (7)
  • app/client/package.json (1 hunks)
  • app/client/src/ce/constants/messages.ts (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/List.tsx (6 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/List.tsx (5 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/components/AddAndSearchbar.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/fuzzySearchInFiles.test.ts (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/utils.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • app/client/package.json
  • app/client/src/ce/constants/messages.ts
Additional comments not posted (12)
app/client/src/pages/Editor/IDE/EditorPane/components/AddAndSearchbar.tsx (2)

10-25: LGTM!

The component logic is correct and adheres to best practices.


1-8: Ensure all imported components are used.

The Button and SearchInput components from the design system are used, but the Flex component should be checked for usage.

Verification successful

All imported components are used.

The Flex component is utilized in the file, so there are no issues with unused imports.

  • Flex component usage:
    • <Flex alignItems="center" flexDirection="row" gap="spaces-3" px="spaces-3">
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify usage of Flex component in AddAndSearchbar.tsx

# Test: Ensure that the Flex component is actually used in the file.
rg --type tsx 'Flex' app/client/src/pages/Editor/IDE/EditorPane/components/AddAndSearchbar.tsx

Length of output: 122


Script:

#!/bin/bash
# Description: Verify usage of Flex component in AddAndSearchbar.tsx

# Test: Ensure that the Flex component is actually used in the file.
rg 'Flex' app/client/src/pages/Editor/IDE/EditorPane/components/AddAndSearchbar.tsx

Length of output: 234

app/client/src/pages/Editor/IDE/EditorPane/utils.ts (2)

1-12: Ensure all imported types are used.

The EditorSegmentList type from selectors is used. The FUSE_OPTIONS are correctly defined for fuzzy search.


14-30: LGTM!

The function logic is correct and adheres to best practices.

app/client/src/pages/Editor/IDE/EditorPane/fuzzySearchInFiles.test.ts (2)

1-20: Ensure all imported constants are used.

The PluginType constant from entities is used. The sample data is correctly defined for testing.


22-47: LGTM!

The test cases provide sufficient coverage and are correctly defined.

app/client/src/pages/Editor/IDE/EditorPane/Query/List.tsx (2)

Line range hint 1-22:
Ensure all imported hooks and selectors are used.

The imported hooks and selectors are used correctly. The component defines local state and uses selectors to fetch data.


Line range hint 26-110:
LGTM!

The search functionality is correctly implemented and the rendering logic is updated accordingly.

app/client/src/pages/Editor/IDE/EditorPane/JS/List.tsx (4)

37-39: State and search functionality look good.

The addition of searchTerm state and onSearch function is appropriate for the search functionality. The use of fuzzySearchInFiles to filter files based on the search term is correct.

Also applies to: 47-48, 56-58


69-75: Rendering search bar looks good.

The use of AddAndSearchbar component to render the search bar is appropriate.


Line range hint 89-126:
Rendering search results looks good.

The use of localFiles array to render search results and the message for no search results are appropriate.


1-3: Imports look good, but verify the removal of Button.

The new imports for useState, AddAndSearchbar, and fuzzySearchInFiles are necessary for the new search functionality. Ensure that the Button import removal is consistent with the summary.

Also applies to: 21-23

Verification successful

Verification successful: Button import removed.

The Button import has been successfully removed from app/client/src/pages/Editor/IDE/EditorPane/JS/List.tsx, as verified by the absence of this import in the search results.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the removal of `Button` import.

# Test: Search for `Button` import. Expect: No occurrences of `Button` import.
rg --type-add 'tsx' --type 'tsx' 'import { Button } from'

Length of output: 169


Script:

#!/bin/bash
# Description: Verify the removal of `Button` import.

# Test: Search for `Button` import. Expect: No occurrences of `Button` import.
rg --type-add 'tsx' --type 'tsx' 'import { Button } from'

Length of output: 169


Script:

#!/bin/bash
# Description: Verify the removal of `Button` import.

# Test: Search for `Button` import. Expect: No occurrences of `Button` import.
rg --type-add 'tsx' --type 'tsx' 'import { Button } from'

Length of output: 169


Script:

#!/bin/bash
# Description: Verify the removal of `Button` import.

# Test: Search for `Button` import. Expect: No occurrences of `Button` import.
grep -r 'import { Button } from' .

Length of output: 7385

@albinAppsmith albinAppsmith added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 8, 2024
@albinAppsmith albinAppsmith added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 8, 2024
<SearchInput onChange={onSearch} size="sm" />
{hasAddPermission ? (
<Button
className="t--add-item !min-w-[24px]"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use data-testid for t--add-item instead of className.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will take this up in a separate PR since this change is not introduced by this PR rather this is a change in location. Also, this update will cause updates in some cypress files as well.

@albinAppsmith albinAppsmith added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 9, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ac04312 and 4569848.

Files selected for processing (1)
  • app/client/cypress/support/Pages/JSEditor.ts (1 hunks)
Additional context used
Path-based instructions (1)
app/client/cypress/support/Pages/JSEditor.ts (1)

Pattern app/client/cypress/**/**.*: Follow best practices for Cypress code and e2e automation.
Avoid using cy.wait in code.
Avoid using cy.pause in code.
Use variables for locators, not strings.
Use data-* attributes for selectors; avoid Xpaths and CSS attributes.
Avoid selectors like .btn.submit or button[type=submit].
Perform logins via API with LoginFromAPI.
Only interact with controlled sites/servers.
Ensure tests can run with it.only and are independent.
Use before, beforeEach, after, afterEach correctly; clean state before tests.
Check new specs for flakiness by running them 10 times on CI.
Use multiple assertions; don't treat Cypress as unit tests.
Use constants for strings.
Include datasource operations in before hooks.

Additional comments not posted (2)
app/client/cypress/support/Pages/JSEditor.ts (2)

108-108: LGTM! The method call PageLeftPane.switchToAddNew() is correctly integrated.

This change replaces the old method of clicking directly on the new JS object element and improves the clarity and maintainability of the code.


109-109: LGTM! The old code is appropriately commented out.

Commenting out the old direct click method helps maintain the context and provides a fallback if needed.

@albinAppsmith albinAppsmith added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 10, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ff0355b and 257eb48.

Files selected for processing (2)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/List.tsx (6 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/List.tsx (4 hunks)
Files skipped from review as they are similar to previous changes (2)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/List.tsx
  • app/client/src/pages/Editor/IDE/EditorPane/Query/List.tsx

hetunandu
hetunandu previously approved these changes Jul 10, 2024
@albinAppsmith albinAppsmith added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 10, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 257eb48 and b93b2e8.

Files selected for processing (1)
  • app/client/cypress/support/Pages/JSEditor.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/support/Pages/JSEditor.ts

@albinAppsmith albinAppsmith requested a review from hetunandu July 10, 2024 09:39
@albinAppsmith albinAppsmith added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 10, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b93b2e8 and 126197d.

Files selected for processing (5)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/BlankState.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/BlankState.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx (3 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/components/AddAndSearchbar.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/components/EmptyState.tsx (2 hunks)
Files skipped from review due to trivial changes (3)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/BlankState.tsx
  • app/client/src/pages/Editor/IDE/EditorPane/Query/BlankState.tsx
  • app/client/src/pages/Editor/IDE/EditorPane/Query/QueryRender.test.tsx
Files skipped from review as they are similar to previous changes (1)
  • app/client/src/pages/Editor/IDE/EditorPane/components/AddAndSearchbar.tsx
Additional comments not posted (2)
app/client/src/pages/Editor/IDE/EditorPane/components/EmptyState.tsx (2)

10-10: LGTM!

The addition of the buttonTestId prop to the EmptyStateProps interface is consistent and straightforward.


15-15: LGTM!

The usage of the buttonTestId prop as the data-testid attribute for the Button component enhances testability. This is a good practice for identifying elements in tests.

Also applies to: 51-51

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 126197d and c09ae9f.

Files selected for processing (1)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
  • app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx

@albinAppsmith albinAppsmith added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jul 10, 2024
@albinAppsmith albinAppsmith merged commit b8f161c into release Jul 10, 2024
84 checks passed
@albinAppsmith albinAppsmith deleted the ide-tab-list-search-view branch July 10, 2024 13:28
@coderabbitai coderabbitai bot mentioned this pull request Jan 29, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request IDE Navigation Issues/feature requests related to IDE navigation, and context switching IDE Pod Issues that new developers face while exploring the IDE ok-to-test Required label for CI Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] - Add search bar to the list view of overflow list
5 participants