Skip to content

chore: Adding host as a parameter for get home page workspaces API#38392

Merged
trishaanand merged 2 commits intoreleasefrom
feat/seat-based-refactor-add-hostname
Dec 27, 2024
Merged

chore: Adding host as a parameter for get home page workspaces API#38392
trishaanand merged 2 commits intoreleasefrom
feat/seat-based-refactor-add-hostname

Conversation

@trishaanand
Copy link
Contributor

@trishaanand trishaanand commented Dec 27, 2024

Description

Helper refactor for Seat based pricing feature for recording the deployment host
Fixes #Issue Number
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

/test sanity

🔍 Cypress test results

Tip

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


Fri, 27 Dec 2024 12:14:36 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Enhanced workspace retrieval functionality to support optional hostname parameter in user workspace requests.
  • Bug Fixes

    • Improved handling of user workspaces based on recently used order with the inclusion of hostname.

@trishaanand trishaanand requested a review from abhvsn December 27, 2024 11:31
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 27, 2024

Walkthrough

The pull request introduces modifications to the workspacesForHome method across several files in the Appsmith server. The primary change involves adding an optional hostname parameter to method signatures in the WorkspaceControllerCE, UserWorkspaceServiceCE, and UserWorkspaceServiceCEImpl classes. This enhancement allows the method to incorporate hostname-based logic when retrieving user workspaces, although the current implementation does not alter the core functionality.

Changes

File Change Summary
app/server/appsmith-server/src/main/java/.../WorkspaceControllerCE.java Updated method signature to accept optional @RequestHeader("Host") parameter.
app/server/appsmith-server/src/main/java/.../UserWorkspaceServiceCE.java Modified getUserWorkspacesByRecentlyUsedOrder() to include hostname parameter.
app/server/appsmith-server/src/main/java/.../UserWorkspaceServiceCEImpl.java Updated implementation to match new method signature with hostname parameter.
app/server/appsmith-server/src/test/java/.../UserWorkspaceServiceUnitTest.java Updated test method calls to include null argument for hostname.

Possibly related PRs

Suggested reviewers

  • nidhi-nair
  • abhvsn

Poem

🏠 Hostname whispers, code unfurls
A method's signature gently twirls
Parameters dance, new paths emerge
Workspaces flow, boundaries merge
Coding magic, subtle and light! ✨


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 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.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

@trishaanand trishaanand self-assigned this Dec 27, 2024
@trishaanand trishaanand added the ok-to-test Required label for CI label Dec 27, 2024
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Dec 27, 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

🧹 Nitpick comments (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/WorkspaceControllerCE.java (1)

111-114: Optional hostname parameter is well integrated.
Passing the hostname to getUserWorkspacesByRecentlyUsedOrder is a good step toward host-specific processing. In the future, consider adding logic or documentation to clarify how the hostname shapes the returned workspaces.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0255bce and 5d37e8d.

📒 Files selected for processing (3)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/WorkspaceControllerCE.java (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserWorkspaceServiceCE.java (1 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserWorkspaceServiceCEImpl.java (1 hunks)
🔇 Additional comments (2)
app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserWorkspaceServiceCE.java (1)

27-27: Nice addition of the hostname parameter.
Adding the hostname parameter expands future flexibility, enabling host-based workspace retrieval if needed.

app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/UserWorkspaceServiceCEImpl.java (1)

396-396: Parameter currently unused.
Although the hostname parameter is introduced, the logic does not reference it yet. If additional host-based filtering is planned, leave as is. Otherwise, consider either removing or implementing the parameter usage to avoid confusion.

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

🧹 Nitpick comments (2)
app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserWorkspaceServiceUnitTest.java (2)

250-250: Add a test scenario for non-null hostname
Currently, this test only verifies behavior for a null hostname. To fully ensure coverage of the seat-based pricing logic, consider adding a test that passes a valid hostname (e.g., "my-deployment-host") and asserts the resulting workspace ordering.

+ @Test
+ @WithUserDetails(value = "api_user")
+ public void getUserWorkspacesByRecentlyUsedOrder_withNonNullHost_shouldReturnExpectedWorkspaces() {
+     StepVerifier.create(userWorkspaceService.getUserWorkspacesByRecentlyUsedOrder("my-deployment-host"))
+         .assertNext(workspaces -> {
+             // Insert assertions checking workspace ordering or filtering based on hostname
+         })
+         .verifyComplete();
+ }

277-277: Consider verifying non-null hostname with recently used workspaces
Similar to the above test, ensure the logic holds when a valid hostname is provided for recently used workspaces.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d37e8d and 481dcbc.

📒 Files selected for processing (1)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/services/UserWorkspaceServiceUnitTest.java (2 hunks)

@github-actions
Copy link

Failed server tests

  • com.appsmith.server.services.LayoutActionServiceTest#OnLoadActionsWhenActionDependentOnWidgetButNotPageLoadCandidate

@GetMapping("/home")
public Mono<ResponseDTO<List<Workspace>>> workspacesForHome() {
public Mono<ResponseDTO<List<Workspace>>> workspacesForHome(
@RequestHeader(name = "Host", required = false) String hostname) {
Copy link
Contributor

@abhvsn abhvsn Dec 27, 2024

Choose a reason for hiding this comment

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

Should we replace this with x-appsmith-host to make it apparent that this is custom header?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not a custom header.

Copy link
Contributor

@abhvsn abhvsn left a comment

Choose a reason for hiding this comment

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

Very minor comment but feel free to reject 🙂

@trishaanand trishaanand merged commit d36c2d8 into release Dec 27, 2024
@trishaanand trishaanand deleted the feat/seat-based-refactor-add-hostname branch December 27, 2024 12:35
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Feb 7, 2025
…ppsmithorg#38392)

## Description
Helper refactor for Seat based pricing feature for recording the
deployment host
Fixes #`Issue Number`  
_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

/test sanity

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12515621363>
> Commit: 481dcbc
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12515621363&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Fri, 27 Dec 2024 12:14:36 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


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

- **New Features**
- Enhanced workspace retrieval functionality to support optional
hostname parameter in user workspace requests.

- **Bug Fixes**
- Improved handling of user workspaces based on recently used order with
the inclusion of hostname.
<!-- 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

ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants