Skip to content

Commit 29df192

Browse files
Laurie T. Malauroboquat
Laurie T. Malau
authored andcommitted
Fix workspace search under user detail
1 parent dd2d765 commit 29df192

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

components/dashboard/src/admin/WorkspacesSearch.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ export function WorkspaceSearch(props: Props) {
6868
const search = async () => {
6969
setSearching(true);
7070
try {
71-
const query: AdminGetWorkspacesQuery = {};
71+
const query: AdminGetWorkspacesQuery = {
72+
ownerId: props?.user?.id, // Workspace search in admin user detail
73+
};
7274
if (matchesInstanceIdOrLegacyWorkspaceIdExactly(queryTerm)) {
7375
query.instanceIdOrWorkspaceId = queryTerm;
7476
} else if (matchesNewWorkspaceIdExactly(queryTerm)) {

components/gitpod-db/src/typeorm/workspace-db-impl.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,10 @@ export abstract class AbstractTypeORMWorkspaceDBImpl implements WorkspaceDB {
768768
} else if (query.workspaceId) {
769769
whereConditions.push("ws.id = :workspaceId");
770770
whereConditionParams.workspaceId = query.workspaceId;
771+
} else if (query.ownerId) {
772+
// If an owner id is provided only search for workspaces belonging to that user.
773+
whereConditions.push("ws.ownerId = :ownerId");
774+
whereConditionParams.ownerId = query.ownerId;
771775
} else if (query.instanceId) {
772776
// in addition to adding "instanceId" to the "WHERE" clause like for the other workspace-guided queries,
773777
// we modify the JOIN condition below to a) select the correct instance and b) make the query faster

components/gitpod-protocol/src/admin-protocol.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,5 @@ export type AdminGetWorkspacesQuery = {
116116
instanceIdOrWorkspaceId?: string;
117117
instanceId?: string;
118118
workspaceId?: string;
119+
ownerId?: string;
119120
};

0 commit comments

Comments
 (0)