Skip to content

Commit fdbf605

Browse files
Cell Disabled mode (#20222)
* wip * Implement UI * remove commented out code * Cell disabled check for websockets
1 parent d5208cb commit fdbf605

File tree

11 files changed

+885
-88
lines changed

11 files changed

+885
-88
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* Copyright (c) 2024 Gitpod GmbH. All rights reserved.
3+
* Licensed under the GNU Affero General Public License (AGPL).
4+
* See License.AGPL.txt in the project root for license information.
5+
*/
6+
7+
import { Heading2 } from "@podkit/typography/Headings";
8+
import { TextMuted } from "@podkit/typography/TextMuted";
9+
import { useTheme } from "../theme-context";
10+
11+
import cubicleImg from "../images/cubicle.webp";
12+
import cubicleDarkImg from "../images/cubicle-dark.webp";
13+
import cubicleImg2x from "../images/[email protected]";
14+
import cubicleDarkImg2x from "../images/[email protected]";
15+
16+
export const DisabledCell = () => {
17+
const { isDark } = useTheme();
18+
19+
return (
20+
<div className="p-0 h-[100dvh] flex flex-col items-center justify-center">
21+
<section className="flex flex-col justify-center items-center text-center">
22+
<img
23+
src={isDark ? cubicleDarkImg : cubicleImg}
24+
srcSet={`${isDark ? cubicleDarkImg : cubicleImg} 1x, ${
25+
isDark ? cubicleDarkImg2x : cubicleImg2x
26+
} 2x`}
27+
alt="cubical illustration"
28+
width="240"
29+
height="251"
30+
/>
31+
<Heading2 className="my-4">Thank you for evaluating Gitpod</Heading2>
32+
<TextMuted>
33+
This evaluation instance is now stopped. <br />
34+
Please contact our team to move to next steps.
35+
</TextMuted>
36+
</section>
37+
</div>
38+
);
39+
};

components/dashboard/src/components/error-boundaries/QueryErrorBoundary.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { isGitpodIo } from "../../utils";
1313
import { CaughtError } from "./ReloadPageErrorBoundary";
1414
import { gitpodHostUrl } from "../../service/service";
1515
import QuickStart from "../QuickStart";
16+
import { DisabledCell } from "../../cell-disabled/DisabledCell";
1617

1718
// Error boundary intended to catch and handle expected errors from api calls
1819
export const QueryErrorBoundary: FC = ({ children }) => {
@@ -57,6 +58,10 @@ const ExpectedQueryErrorsFallback: FC<FallbackProps> = ({ error, resetErrorBound
5758
return <div></div>;
5859
}
5960

61+
if (caughtError.code === ErrorCodes.CELL_EXPIRED) {
62+
return <DisabledCell />;
63+
}
64+
6065
// User needs to Login
6166
if (caughtError.code === ErrorCodes.NOT_AUTHENTICATED) {
6267
console.log("clearing query cache for unauthenticated user");

components/dashboard/src/hooks/use-user-loader.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ export const useUserLoader = () => {
2222
queryFn: async () => {
2323
const user = (await userClient.getAuthenticatedUser({})).user;
2424

25-
return user || null;
25+
return user ?? null;
2626
},
2727
// We'll let an ErrorBoundary catch the error
2828
useErrorBoundary: true,
2929
// It's important we don't retry as we want to show the login screen as quickly as possible if a 401
3030
retry: (_failureCount: number, error: Error & { code?: number }) => {
31-
return error.code !== ErrorCodes.NOT_AUTHENTICATED && error.code !== ErrorCodes.USER_DELETED;
31+
return (
32+
error.code !== ErrorCodes.NOT_AUTHENTICATED &&
33+
error.code !== ErrorCodes.USER_DELETED &&
34+
error.code !== ErrorCodes.CELL_EXPIRED
35+
);
3236
},
3337
// docs: https://tanstack.com/query/v4/docs/react/guides/query-retries
3438
// backoff by doubling, max. 10s

components/gitpod-protocol/src/messaging/error.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ export const ErrorCodes = {
107107
// 481 Professional plan is required for this operation
108108
PLAN_PROFESSIONAL_REQUIRED: 481 as const,
109109

110+
// 482 Cell Expired
111+
CELL_EXPIRED: 482 as const,
112+
110113
// 490 Too Many Running Workspace
111114
TOO_MANY_RUNNING_WORKSPACES: 490 as const,
112115

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ message FailedPreconditionDetails {
2828
RepositoryNotFoundError repository_not_found = 5;
2929
RepositoryUnauthorizedError repository_unauthorized = 6;
3030
ImageBuildLogsNotYetAvailableError image_build_logs_not_yet_available = 7;
31+
CellDisabledError cell_is_disabled = 8;
3132
}
3233
}
3334

@@ -64,6 +65,8 @@ message RepositoryUnauthorizedError {
6465

6566
message ImageBuildLogsNotYetAvailableError {}
6667

68+
message CellDisabledError {}
69+
6770
/*
6871
// details for INVALID_ARGUMENT status code
6972
// TODO: this is not yet implemented in the backend

components/public-api/go/v1/error.pb.go

Lines changed: 134 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)