Skip to content

Commit

Permalink
[dashboard] Additional fetch pinned workspace
Browse files Browse the repository at this point in the history
Fixes #4488
  • Loading branch information
corneliusludmann committed Jun 16, 2021
1 parent d9aba83 commit 85a704f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.

## June 2021

- Fix active workspace list in dashboard (show also older pinned workspaces) ([#4523](https://github.com/gitpod-io/gitpod/pull/4523))
- Adding `ItemsList` component as a more maintainable and consistent way to render a list of workspaces, git integrations, environment variables, etc. ([#4454](https://github.com/gitpod-io/gitpod/pull/4454))
- Improve backup stability when pods get evicted ([#4405](https://github.com/gitpod-io/gitpod/pull/4405))
- Fix text color in workspaces list for dark theme ([#4410](https://github.com/gitpod-io/gitpod/pull/4410))
Expand Down
18 changes: 14 additions & 4 deletions components/dashboard/src/workspaces/workspace-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ export class WorkspaceModel implements Disposable, Partial<GitpodClient> {
limit: this.internalLimit
}).then( infos => {
this.updateMap(infos);
this.notifyWorkpaces();
// Additional fetch pinned workspaces
// see also: https://github.com/gitpod-io/gitpod/issues/4488
getGitpodService().server.getWorkspaces({
limit: this.internalLimit,
pinnedOnly: true,
}).then(infos => {
this.updateMap(infos);
this.notifyWorkpaces();
});
});
this.disposables.push(getGitpodService().registerClient(this));
}
Expand Down Expand Up @@ -121,12 +129,14 @@ export class WorkspaceModel implements Disposable, Partial<GitpodClient> {
infos = infos.sort((a,b) => {
return WorkspaceInfo.lastActiveISODate(b).localeCompare(WorkspaceInfo.lastActiveISODate(a));
});
this.setWorkspaces(infos);
this.setWorkspaces(infos.slice(0, this.internalLimit));
}

protected isActive(info: WorkspaceInfo): boolean {
return info.workspace.pinned ||
(!!info.latestInstance && !['stopping', 'stopped'].includes(info.latestInstance.status?.phase));
return (
info.workspace.pinned ||
(!!info.latestInstance && info.latestInstance.status?.phase !== 'stopped')
) && !info.workspace.softDeleted;
}

public getAllFetchedWorkspaces(): Map<string, WorkspaceInfo> {
Expand Down

0 comments on commit 85a704f

Please sign in to comment.