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: added the code to sort the collection in the proper order. #35413

Conversation

Naveen-Goud
Copy link
Contributor

@Naveen-Goud Naveen-Goud commented Aug 5, 2024

Description:
The collection dropdown in MongoDB query editor isn't sorted, typing to filter doesn't work, and hitting a key like u doesn't scroll to the next item starting with you.

fixes: 28190

Updated in PR:
1.Added the sort code to the collection after Api trgger.
2.Added the test case for this scenario.

snap shots:
Screenshot from 2024-08-05 16-07-18
Screenshot from 2024-08-05 16-22-29

Summary by CodeRabbit

  • New Features

    • Enhanced the output structure of the datasource trigger, providing a clearer representation of entities with labels and values.
    • Implemented case-insensitive sorting for the returned collections, improving data usability.
  • Tests

    • Added a new test to validate the ordering of collections returned by the datasource trigger, ensuring data integrity and expected behavior.

Copy link
Contributor

coderabbitai bot commented Aug 5, 2024

Walkthrough

The changes enhance the trigger method in the DatasourceTriggerSolutionCEImpl class by modifying the result type from List<Object> to List<Map<String, String>>, which improves data representation. Additionally, a new test method was added to validate the order of collections returned by the datasource trigger, ensuring proper functionality and data handling.

Changes

Files Change Summary
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java Updated the trigger method to return a sorted list of maps instead of a list of objects, enhancing data structure and usability.
app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/DatasourceTriggerSolutionTest.java Added a new test method to verify that collections returned by the datasource trigger are ordered correctly, improving test coverage and data integrity verification.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DatasourceTrigger
    participant DatasourceStructure

    User->>DatasourceTrigger: trigger()
    DatasourceTrigger->>DatasourceStructure: getStructure()
    DatasourceStructure-->>DatasourceTrigger: return tables
    DatasourceTrigger->>User: return ordered collections
Loading

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 using 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.

Other keywords and placeholders

  • Add @coderabbitai anywhere in the PR title to generate the title automatically.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.

CodeRabbit Configuration 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.

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 c888543 and 27a980a.

Files selected for processing (2)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java (2 hunks)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/DatasourceTriggerSolutionTest.java (1 hunks)
Additional comments not posted (3)
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/DatasourceTriggerSolutionCEImpl.java (2)

30-31: Imports look good.

The new imports for Comparator, HashMap, List, Map, and Optional are appropriate for the changes made to the trigger method.


132-148: LGTM! But verify the function usage in the codebase.

The changes to the trigger method enhance the structure of the data being processed and ensure that the final output is ordered. The logic for creating maps and adding them to the result list is clear and the sorting step is implemented correctly.

However, ensure that all function calls to trigger handle the new result structure correctly.

app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/DatasourceTriggerSolutionTest.java (1)

206-271: The new test method is well-structured and effective.

The test method datasourceTriggerTest_should_return_collections_inorder is well-structured and effectively validates the ordering of collections. The use of Mockito for mocking dependencies is appropriate and the assertions ensure the correctness of the order.

@nidhi-nair nidhi-nair requested review from a team and removed request for nidhi-nair and sondermanish August 6, 2024 03:32
@sneha122
Copy link
Contributor

sneha122 commented Aug 6, 2024

/build-deploy-preview skip-tests=true

Copy link

github-actions bot commented Aug 6, 2024

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/10260988337.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 35413.
recreate: .

Copy link

github-actions bot commented Aug 6, 2024

Deploy-Preview-URL: https://ce-35413.dp.appsmith.com

@NilanshBansal NilanshBansal added Community Contributor Meant to track issues that are assigned to external contributors Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. labels Aug 10, 2024
@Naveen-Goud
Copy link
Contributor Author

Hii @NilanshBansal @sneha122 @nidhi-nair , could you please assign reviewer to this PR.

thank you.

Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Aug 19, 2024
@Naveen-Goud
Copy link
Contributor Author

Hii @NilanshBansal @sneha122 @nidhi-nair @rohan-arthur , could you please assign reviewer to this PR.

thank you.

@NilanshBansal
Copy link
Contributor

Added @sneha122 as reviewer as she has checked this earlier

defaultEnvironmentId,
new TriggerRequestDTO("ENTITY_SELECTOR", Map.of(), ClientDataDisplayType.DROP_DOWN));

Mono<TriggerResultDTO> columnNamesMono = datasourceTriggerSolution.trigger(
Copy link
Contributor

Choose a reason for hiding this comment

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

@Naveen-Goud Is columnNamesMono required? I don't see it being used anywhere, if that's the case, can you please remove it?

@sneha122
Copy link
Contributor

Created shadow Pr here to track the test cases

@Naveen-Goud
Copy link
Contributor Author

Hii @sneha122 , I have updated the test case. Can you check now .
thank you

@sneha122
Copy link
Contributor

Hii @sneha122 , I have updated the test case. Can you check now . thank you

Thank you @Naveen-Goud for prompt response, test cases are running on the shadow PR, will let you know if anything fails there

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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 27a980a and 5843a9f.

Files selected for processing (1)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/DatasourceTriggerSolutionTest.java (1 hunks)

@nerbos nerbos merged commit ff0c613 into appsmithorg:release Aug 29, 2024
16 of 19 checks passed
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Sep 26, 2024
…smithorg#35413)

**Description:**
The collection dropdown in MongoDB query editor isn't sorted, typing to
filter doesn't work, and hitting a key like u doesn't scroll to the next
item starting with you.

fixes: [28190](appsmithorg#28190)

**Updated in PR:**
1.Added the sort code to the collection after Api trgger.
2.Added the test case for this scenario.

**snap shots:**
![Screenshot from 2024-08-05
16-07-18](https://github.com/user-attachments/assets/8c75866f-c843-455e-80e0-1cb6d4e893ce)
![Screenshot from 2024-08-05
16-22-29](https://github.com/user-attachments/assets/4452f99d-2b6e-42aa-82b3-38bc256af216)




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


- **New Features**
- Enhanced the output structure of the datasource trigger, providing a
clearer representation of entities with labels and values.
- Implemented case-insensitive sorting for the returned collections,
improving data usability.

- **Tests**
- Added a new test to validate the ordering of collections returned by
the datasource trigger, ensuring data integrity and expected behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contributor Meant to track issues that are assigned to external contributors Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Mongo collections dropdown filtering
4 participants