Skip to content

Commit 7ecc449

Browse files
Merge branch 'main' into ft/focus-targets
2 parents c201542 + 41abfc1 commit 7ecc449

File tree

50 files changed

+229
-158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+229
-158
lines changed

components/blobserve/leeway.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Licensed under the GNU Affero General Public License (AGPL).
33
# See License.AGPL.txt in the project root for license information.
44

5-
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
5+
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122
66

77
# Ensure latest packages are present, like security updates.
88
RUN apk upgrade --no-cache \

components/content-service/leeway.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Licensed under the GNU Affero General Public License (AGPL).
33
# See License.AGPL.txt in the project root for license information.
44

5-
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473
5+
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122
66

77
# Ensure latest packages are present, like security updates.
88
RUN apk upgrade --no-cache \

components/dashboard/leeway.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Licensed under the GNU Affero General Public License (AGPL).
33
# See License.AGPL.txt in the project root for license information.
44

5-
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:490977f0fd3d8596d173839dbb314153797312553b43f6a24b0e341cf2e8d473 as compress
5+
FROM cgr.dev/chainguard/wolfi-base:latest@sha256:5dcb7597e50978fc9dea77d96665bcd47ab0600386710c6e8dab35adf1102122 as compress
66

77
RUN apk add brotli gzip
88

components/dashboard/src/components/InputWithCopy.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ export function InputWithCopy(props: { value: string; tip?: string; className?:
2727
type="text"
2828
value={props.value}
2929
/>
30-
<div className="cursor-pointer" onClick={() => handleCopyToClipboard(props.value)}>
31-
<div className="absolute top-1/3 right-3">
32-
<Tooltip content={copied ? "Copied" : tip}>
33-
<img src={copy} alt="copy icon" title={tip} />
34-
</Tooltip>
35-
</div>
36-
</div>
30+
<button className="reset absolute top-1/3 right-3" onClick={() => handleCopyToClipboard(props.value)}>
31+
<Tooltip content={copied ? "Copied" : tip}>
32+
<img src={copy} alt="copy icon" title={tip} />
33+
</Tooltip>
34+
</button>
3735
</div>
3836
);
3937
}

components/dashboard/src/data/featureflag-query.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const featureFlags = {
2424
enableDedicatedOnboardingFlow: false,
2525
usageDownload: false,
2626
phoneVerificationByCall: false,
27+
doRetryUserLoader: true,
2728
};
2829

2930
export const useFeatureFlag = (featureFlag: keyof typeof featureFlags) => {

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ import { trackLocation } from "../Analytics";
1111
import { refreshSearchData } from "../components/RepositoryFinder";
1212
import { useQuery } from "@tanstack/react-query";
1313
import { noPersistence } from "../data/setup";
14+
import { ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error";
15+
import { useFeatureFlag } from "../data/featureflag-query";
1416

1517
export const useUserLoader = () => {
1618
const { user, setUser } = useContext(UserContext);
19+
const doRetryUserLoader = useFeatureFlag("doRetryUserLoader");
1720

1821
// For now, we're using the user context to store the user, but letting react-query handle the loading
1922
// In the future, we should remove the user context and use react-query to access the user
@@ -27,8 +30,15 @@ export const useUserLoader = () => {
2730
// We'll let an ErrorBoundary catch the error
2831
useErrorBoundary: true,
2932
// It's important we don't retry as we want to show the login screen as quickly as possible if a 401
30-
// TODO: In the future we can consider retrying for non 401 errors
31-
retry: false,
33+
retry: (_failureCount: number, error: Error & { code?: number }) => {
34+
if (!doRetryUserLoader) {
35+
return false;
36+
}
37+
return error.code !== ErrorCodes.NOT_AUTHENTICATED;
38+
},
39+
// docs: https://tanstack.com/query/v4/docs/react/guides/query-retries
40+
// backoff by doubling, max. 10s
41+
retryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 10000),
3242
cacheTime: 1000 * 60 * 60 * 1, // 1 hour
3343
staleTime: 1000 * 60 * 60 * 1, // 1 hour
3444
onSuccess: (loadedUser) => {

components/dashboard/src/index.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
button {
5656
@apply cursor-pointer px-4 py-2 my-auto bg-green-600 dark:bg-green-700 hover:bg-green-700 dark:hover:bg-green-600 text-gray-100 dark:text-green-100 text-sm font-medium rounded-md focus:outline-none focus:ring transition ease-in-out;
5757
}
58+
button.reset {
59+
@apply bg-transparent hover:bg-transparent font-normal rounded-none;
60+
padding: unset;
61+
text-align: start;
62+
}
5863
button.secondary {
5964
@apply bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-500 dark:text-gray-100 hover:text-gray-600;
6065
}

components/dashboard/src/teams/git-integrations/GitIntegrationModal.tsx

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,7 @@ export const GitIntegrationModal: FunctionComponent<Props> = (props) => {
4242
const isNew = !savedProvider;
4343

4444
// This is a readonly value to copy and plug into external oauth config
45-
const redirectURL = useMemo(() => {
46-
let url = "";
47-
48-
// Once it's saved, use what's stored
49-
if (!isNew) {
50-
url = savedProvider?.oauth.callBackUrl ?? url;
51-
} else {
52-
// Otherwise construct it w/ their provided host value or example
53-
url = callbackUrl(host || getPlaceholderForIntegrationType(type));
54-
}
55-
56-
return url;
57-
}, [host, isNew, savedProvider?.oauth.callBackUrl, type]);
45+
const redirectURL = callbackUrl();
5846

5947
// "bitbucket.org" is set as host value whenever "Bitbucket" is selected
6048
useEffect(() => {
@@ -281,13 +269,8 @@ export const GitIntegrationModal: FunctionComponent<Props> = (props) => {
281269
);
282270
};
283271

284-
const callbackUrl = (host: string) => {
285-
// Negative Lookahead (?!\/)
286-
// `\/` matches the character `/`
287-
// "https://foobar:80".replace(/:(?!\/)/, "_")
288-
// => 'https://foobar_80'
289-
host = host.replace(/:(?!\/)/, "_");
290-
const pathname = `/auth/${host}/callback`;
272+
const callbackUrl = () => {
273+
const pathname = `/auth/callback`;
291274
return gitpodHostUrl.with({ pathname }).toString();
292275
};
293276

components/dashboard/src/user-settings/Integrations.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ test("should update redirectURL preview", async () => {
2020

2121
const redirectURL = screen.getByLabelText(/Redirect/i);
2222
// screen.debug(redirectURL);
23-
expect((redirectURL as HTMLInputElement).value).toEqual("http://localhost/auth/gitlab.gitpod.io_80/callback");
23+
expect((redirectURL as HTMLInputElement).value).toEqual("http://localhost/auth/callback");
2424
});

components/dashboard/src/user-settings/Integrations.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -504,13 +504,8 @@ export function GitIntegrationModal(
504504
onAuthorize?: (payload?: string) => void;
505505
},
506506
) {
507-
const callbackUrl = (host: string) => {
508-
// Negative Lookahead (?!\/)
509-
// `\/` matches the character `/`
510-
// "https://foobar:80".replace(/:(?!\/)/, "_")
511-
// => 'https://foobar_80'
512-
host = host.replace(/:(?!\/)/, "_");
513-
const pathname = `/auth/${host}/callback`;
507+
const callbackUrl = () => {
508+
const pathname = `/auth/callback`;
514509
return gitpodHostUrl.with({ pathname }).toString();
515510
};
516511

@@ -519,7 +514,7 @@ export function GitIntegrationModal(
519514

520515
const [type, setType] = useState<string>("GitLab");
521516
const [host, setHost] = useState<string>("");
522-
const [redirectURI, setRedirectURI] = useState<string>(callbackUrl("gitlab.example.com"));
517+
const [redirectURI, setRedirectURI] = useState<string>(callbackUrl());
523518
const [clientId, setClientId] = useState<string>("");
524519
const [clientSecret, setClientSecret] = useState<string>("");
525520
const [busy, setBusy] = useState<boolean>(false);
@@ -632,7 +627,6 @@ export function GitIntegrationModal(
632627
}
633628

634629
setHost(newHostValue);
635-
setRedirectURI(callbackUrl(newHostValue));
636630
setErrorMessage(undefined);
637631
}
638632
};

0 commit comments

Comments
 (0)