Skip to content

Commit 31b8c3b

Browse files
committed
[dashboard] emulate unary call
1 parent 686a185 commit 31b8c3b

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

components/dashboard/src/service/public-api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import { createConnectTransport, createPromiseClient } from "@bufbuild/connect-web";
88
import { Project as ProtocolProject, Team as ProtocolTeam } from "@gitpod/gitpod-protocol/lib/teams-projects-protocol";
9+
import { HelloService } from "@gitpod/public-api/lib/gitpod/experimental/v1/dummy_connectweb";
910
import { TeamsService } from "@gitpod/public-api/lib/gitpod/experimental/v1/teams_connectweb";
1011
import { TokensService } from "@gitpod/public-api/lib/gitpod/experimental/v1/tokens_connectweb";
1112
import { ProjectsService } from "@gitpod/public-api/lib/gitpod/experimental/v1/projects_connectweb";
@@ -20,6 +21,7 @@ const transport = createConnectTransport({
2021
baseUrl: `${window.location.protocol}//${window.location.host}/public-api`,
2122
});
2223

24+
export const helloService = createPromiseClient(HelloService, transport);
2325
export const teamsService = createPromiseClient(TeamsService, transport);
2426
export const personalAccessTokensService = createPromiseClient(TokensService, transport);
2527
export const projectsService = createPromiseClient(ProjectsService, transport);

components/dashboard/src/service/service.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { GitpodHostUrl } from "@gitpod/gitpod-protocol/lib/util/gitpod-host-url"
1919
import { log } from "@gitpod/gitpod-protocol/lib/util/logging";
2020
import { IDEFrontendDashboardService } from "@gitpod/gitpod-protocol/lib/frontend-dashboard-service";
2121
import { RemoteTrackMessage } from "@gitpod/gitpod-protocol/lib/analytics";
22+
import { helloService } from "./public-api";
2223

2324
export const gitpodHostUrl = new GitpodHostUrl(window.location.toString());
2425

@@ -57,6 +58,17 @@ export function getGitpodService(): GitpodService {
5758
return service;
5859
}
5960
const service = _gp.gitpodService || (_gp.gitpodService = createGitpodService());
61+
service.server = new Proxy(service.server, {
62+
get(target, propKey) {
63+
return function (...args: any[]) {
64+
if (propKey === "getWorkspace") {
65+
// TODO(ak) feature flagged
66+
helloService.sayHello({}).catch(console.error);
67+
}
68+
return target[propKey](...args);
69+
};
70+
},
71+
});
6072
return service;
6173
}
6274

components/server/src/container-module.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,7 @@ import * as grpc from "@grpc/grpc-js";
3636
import { Redis } from "ioredis";
3737
import { createChannel, createClient, createClientFactory } from "nice-grpc";
3838
import { retryMiddleware } from "nice-grpc-client-middleware-retry";
39-
import { APIHelloService } from "./api/dummy";
4039
import { API } from "./api/server";
41-
import { APIStatsService } from "./api/stats";
42-
import { APITeamsService } from "./api/teams";
43-
import { APIUserService } from "./api/user";
44-
import { APIWorkspacesService } from "./api/workspaces";
4540
import { AuthProviderParams } from "./auth/auth-provider";
4641
import { AuthProviderService } from "./auth/auth-provider-service";
4742
import { Authenticator } from "./auth/authenticator";
@@ -333,13 +328,6 @@ export const productionContainerModule = new ContainerModule(
333328
// grpc / Connect API
334329
API.contribute(bind);
335330

336-
bind(APIHelloService).toSelf().inSingletonScope();
337-
bind(APIUserService).toSelf().inSingletonScope();
338-
bind(APITeamsService).toSelf().inSingletonScope();
339-
bind(APIWorkspacesService).toSelf().inSingletonScope();
340-
bind(APIStatsService).toSelf().inSingletonScope();
341-
bind(API).toSelf().inSingletonScope();
342-
343331
bind(AuthJWT).toSelf().inSingletonScope();
344332
bind(SignInJWT).toSelf().inSingletonScope();
345333

0 commit comments

Comments
 (0)