Skip to content

Commit bfa7c6e

Browse files
authored
[public-api] complete installation service (#19200)
1 parent 1113e3c commit bfa7c6e

File tree

17 files changed

+729
-278
lines changed

17 files changed

+729
-278
lines changed

components/dashboard/src/data/setup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import * as UserClasses from "@gitpod/public-api/lib/gitpod/v1/user_pb";
3333
// This is used to version the cache
3434
// If data we cache changes in a non-backwards compatible way, increment this version
3535
// That will bust any previous cache versions a client may have stored
36-
const CACHE_VERSION = "17";
36+
const CACHE_VERSION = "19";
3737

3838
export function noPersistence(queryKey: QueryKey): QueryKey {
3939
return [...queryKey, "no-persistence"];

components/dashboard/src/dedicated-setup/use-needs-setup.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
import { useQuery } from "@tanstack/react-query";
88
import { useFeatureFlag } from "../data/featureflag-query";
99
import { noPersistence } from "../data/setup";
10-
import { getGitpodService } from "../service/service";
10+
import { installationClient } from "../service/public-api";
11+
import { GetOnboardingStateRequest } from "@gitpod/public-api/lib/gitpod/v1/installation_pb";
1112

1213
/**
1314
* @description Returns a flage stating if the current installation still needs setup before it can be used. Also returns an isLoading indicator as the check is async
@@ -17,7 +18,7 @@ export const useNeedsSetup = () => {
1718
const enableDedicatedOnboardingFlow = useFeatureFlag("enableDedicatedOnboardingFlow");
1819

1920
// This needs to only be true if we've loaded the onboarding state
20-
let needsSetup = !isLoading && onboardingState && onboardingState.isCompleted !== true;
21+
let needsSetup = !isLoading && onboardingState && onboardingState.completed !== true;
2122

2223
if (isCurrentHostExcludedFromSetup()) {
2324
needsSetup = false;
@@ -36,7 +37,8 @@ const useOnboardingState = () => {
3637
return useQuery(
3738
noPersistence(["onboarding-state"]),
3839
async () => {
39-
return await getGitpodService().server.getOnboardingState();
40+
const response = await installationClient.getOnboardingState(new GetOnboardingStateRequest());
41+
return response.onboardingState!;
4042
},
4143
{
4244
// Only query if feature flag is enabled

components/dashboard/src/service/json-rpc-installation-client.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import {
2020
CreateBlockedEmailDomainResponse,
2121
GetInstallationWorkspaceDefaultImageRequest,
2222
GetInstallationWorkspaceDefaultImageResponse,
23+
GetOnboardingStateRequest,
24+
GetOnboardingStateResponse,
2325
} from "@gitpod/public-api/lib/gitpod/v1/installation_pb";
2426
import { ApplicationError, ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error";
2527
import { getGitpodService } from "./service";
@@ -111,4 +113,14 @@ export class JsonRpcInstallationClient implements PromiseClient<typeof Installat
111113
// There's no way to get blockedEmailDomain, just ignore it since dashboard don't care about the response data
112114
return new CreateBlockedEmailDomainResponse({});
113115
}
116+
117+
async getOnboardingState(
118+
request: PartialMessage<GetOnboardingStateRequest>,
119+
_options?: CallOptions | undefined,
120+
): Promise<GetOnboardingStateResponse> {
121+
const info = await getGitpodService().server.getOnboardingState();
122+
return new GetOnboardingStateResponse({
123+
onboardingState: converter.toOnboardingState(info),
124+
});
125+
}
114126
}

components/public-api/gitpod/v1/installation.proto

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ service InstallationService {
2727

2828
// CreateBlockedEmailDomain creates a new blocked email domain.
2929
rpc CreateBlockedEmailDomain(CreateBlockedEmailDomainRequest) returns (CreateBlockedEmailDomainResponse) {}
30+
31+
// GetOnboardingState returns the onboarding state of the installation.
32+
rpc GetOnboardingState(GetOnboardingStateRequest) returns (GetOnboardingStateResponse) {}
33+
}
34+
35+
message GetOnboardingStateRequest {}
36+
message GetOnboardingStateResponse {
37+
OnboardingState onboarding_state = 1;
38+
}
39+
40+
message OnboardingState {
41+
bool completed = 1;
3042
}
3143

3244
message GetInstallationWorkspaceDefaultImageRequest {}

0 commit comments

Comments
 (0)