removed use of ui-ext in library (#25611)

fixes: #25417

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-01-09 02:14:56 +01:00 committed by GitHub
parent 0a16b64805
commit 73378713bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View file

@ -15,6 +15,8 @@ import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";
import { useAccess } from "../context/access/Access";
import { fetchWithError } from "@keycloak/keycloak-admin-client";
import { UserProfileConfig } from "@keycloak/keycloak-admin-client/lib/defs/userProfileMetadata";
import { adminClient } from "../admin-client";
import { useAlerts } from "../components/alert/Alerts";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
@ -30,6 +32,8 @@ import { toDashboard } from "../dashboard/routes/Dashboard";
import environment from "../environment";
import helpUrls from "../help-urls";
import { convertFormValuesToObject, convertToFormValues } from "../util";
import { getAuthorizationHeaders } from "../utils/getAuthorizationHeaders";
import { joinPath } from "../utils/joinPath";
import useIsFeatureEnabled, { Feature } from "../utils/useIsFeatureEnabled";
import { RealmSettingsEmailTab } from "./EmailTab";
import { RealmSettingsGeneralTab } from "./GeneralTab";
@ -49,7 +53,6 @@ import { ClientPoliciesTab, toClientPolicies } from "./routes/ClientPolicies";
import { RealmSettingsTab, toRealmSettings } from "./routes/RealmSettings";
import { SecurityDefenses } from "./security-defences/SecurityDefenses";
import { UserProfileTab } from "./user-profile/UserProfileTab";
import { UserProfileConfig } from "@keycloak/keycloak-admin-client/lib/defs/userProfileMetadata";
export interface UIRealmRepresentation extends RealmRepresentation {
upConfig?: UserProfileConfig;
@ -225,7 +228,18 @@ export const RealmSettingsTabs = ({
if (savedRealm.smtpServer?.port === "") {
savedRealm.smtpServer = { ...savedRealm.smtpServer, port: null };
}
await adminClient.realms.update({ realm: realmName }, savedRealm);
const response = await fetchWithError(
joinPath(adminClient.baseUrl, `admin/realms/${realmName}/ui-ext`),
{
method: "PUT",
body: JSON.stringify(savedRealm),
headers: {
"Content-Type": "application/json",
...getAuthorizationHeaders(await adminClient.getAccessToken()),
},
},
);
if (!response.ok) throw new Error(response.statusText);
addAlert(t("realmSaveSuccess"), AlertVariant.success);
} catch (error) {
addError("realmSaveError", error);

View file

@ -53,7 +53,7 @@ export class Realms extends Resource {
void
>({
method: "PUT",
path: "/{realm}/ui-ext",
path: "/{realm}",
urlParamKeys: ["realm"],
});