Skip to content

Commit fd390d5

Browse files
authored
fix: update GitHub provider to support Enterprise Server (#3803)
See also: SwissDataScienceCenter/renku-data-services#979
1 parent 80b9399 commit fd390d5

File tree

2 files changed

+43
-6
lines changed

2 files changed

+43
-6
lines changed

client/src/features/connectedServices/ConnectedServicesPage.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import {
5656
} from "./api/connectedServices.api";
5757
import { AppInstallationsPaginated } from "./api/connectedServices.types";
5858
import ContactUsCard from "./ContactUsCard";
59+
import { getSettingsUrl } from "./connectedServices.utils";
5960

6061
const CHECK_STATUS_QUERY_PARAM = "check-status";
6162

@@ -340,12 +341,10 @@ function GitHubAppInstallations({
340341
"This application"
341342
);
342343

343-
const settingsUrl = provider.app_slug
344-
? safeNewUrl(
345-
`apps/${provider.app_slug}/installations/select_target`,
346-
provider.url
347-
)
348-
: null;
344+
const settingsUrl = getSettingsUrl({
345+
app_slug: provider.app_slug,
346+
url: provider.url,
347+
});
349348

350349
const refreshInstallationsButton = (
351350
<Button
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*!
2+
* Copyright 2025 - Swiss Data Science Center (SDSC)
3+
* A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
4+
* Eidgenössische Technische Hochschule Zürich (ETHZ).
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import { safeNewUrl } from "~/utils/helpers/safeNewUrl.utils";
20+
import type { Provider } from "./api/connectedServices.api";
21+
22+
type GetSettingsUrlArgs = Pick<Provider, "app_slug" | "url">;
23+
24+
export function getSettingsUrl({
25+
app_slug,
26+
url,
27+
}: GetSettingsUrlArgs): URL | null {
28+
if (!app_slug) {
29+
return null;
30+
}
31+
32+
const parsedUrl = safeNewUrl(url);
33+
if (parsedUrl?.hostname.toLowerCase() === "github.com") {
34+
return safeNewUrl(`apps/${app_slug}/installations/select_target`, url);
35+
}
36+
37+
return safeNewUrl(`github-apps/${app_slug}/installations/select_target`, url);
38+
}

0 commit comments

Comments
 (0)