Skip to content

Commit

Permalink
chore: Adding host as a parameter for get home page workspaces API (a…
Browse files Browse the repository at this point in the history
…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 -->
  • Loading branch information
trishaanand authored Dec 27, 2024
1 parent 0255bce commit d36c2d8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ public Mono<ResponseDTO<Workspace>> deleteLogo(@PathVariable String workspaceId)

@JsonView(Views.Public.class)
@GetMapping("/home")
public Mono<ResponseDTO<List<Workspace>>> workspacesForHome() {
public Mono<ResponseDTO<List<Workspace>>> workspacesForHome(
@RequestHeader(name = "Host", required = false) String hostname) {
return userWorkspaceService
.getUserWorkspacesByRecentlyUsedOrder()
.getUserWorkspacesByRecentlyUsedOrder(hostname)
.map(workspaces -> new ResponseDTO<>(HttpStatus.OK.value(), workspaces, null));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ Mono<MemberInfoDTO> updatePermissionGroupForMember(

Boolean isLastAdminRoleEntity(PermissionGroup permissionGroup);

Mono<List<Workspace>> getUserWorkspacesByRecentlyUsedOrder();
Mono<List<Workspace>> getUserWorkspacesByRecentlyUsedOrder(String hostname);
}
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public Boolean isLastAdminRoleEntity(PermissionGroup permissionGroup) {
* @return Mono of list of workspaces
*/
@Override
public Mono<List<Workspace>> getUserWorkspacesByRecentlyUsedOrder() {
public Mono<List<Workspace>> getUserWorkspacesByRecentlyUsedOrder(String hostname) {

Mono<List<String>> workspaceIdsMono = userDataService
.getForCurrentUser()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public void getUserWorkspacesByRecentlyUsedOrder_noRecentWorkspaces_allEntriesAr
cleanup();
createDummyWorkspaces().blockLast();

StepVerifier.create(userWorkspaceService.getUserWorkspacesByRecentlyUsedOrder())
StepVerifier.create(userWorkspaceService.getUserWorkspacesByRecentlyUsedOrder(null))
.assertNext(workspaces -> {
assertThat(workspaces).hasSize(4);
workspaces.forEach(workspace -> {
Expand All @@ -274,7 +274,7 @@ public void getUserWorkspacesByRecentlyUsedOrder_withRecentlyUsedWorkspaces_allE
userData.setRecentlyUsedEntityIds(recentlyUsedEntityDTOs);
doReturn(Mono.just(userData)).when(userDataService).getForCurrentUser();

StepVerifier.create(userWorkspaceService.getUserWorkspacesByRecentlyUsedOrder())
StepVerifier.create(userWorkspaceService.getUserWorkspacesByRecentlyUsedOrder(null))
.assertNext(workspaces -> {
assertThat(workspaces).hasSize(4);
List<String> fetchedWorkspaceIds = new ArrayList<>();
Expand Down

0 comments on commit d36c2d8

Please sign in to comment.