diff --git a/src/App.tsx b/src/App.tsx index afdeb3375a..7bc6be69f5 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -22,6 +22,7 @@ import { UserFederationSection } from "./user-federation/UserFederationSection"; import { PageNotFoundSection } from "./PageNotFoundSection"; import { RealmContextProvider } from "./components/realm-context/RealmContext"; +import { ClientSettings } from "./clients/ClientSettings"; export const App = () => { return ( @@ -33,6 +34,11 @@ export const App = () => { + diff --git a/src/clients/ClientList.tsx b/src/clients/ClientList.tsx index 3251a58ea4..aaf612023c 100644 --- a/src/clients/ClientList.tsx +++ b/src/clients/ClientList.tsx @@ -1,5 +1,6 @@ import React, { useContext } from "react"; import { useTranslation } from "react-i18next"; +import { Link } from "react-router-dom"; import { Table, TableBody, @@ -41,11 +42,11 @@ export const ClientList = ({ baseUrl, clients }: ClientListProps) => { const field = data!.toString(); const value = convertClientId(field); return field.indexOf("true") !== -1 ? ( - <>{value} + {value} ) : ( - <> + {value} Disabled - + ); }; @@ -60,12 +61,18 @@ export const ClientList = ({ baseUrl, clients }: ClientListProps) => { }; /* eslint-disable no-template-curly-in-string */ - const replaceBaseUrl = (r: ClientRepresentation) => - r.rootUrl && - r.rootUrl - .replace("${authBaseUrl}", baseUrl) - .replace("${authAdminUrl}", baseUrl) + - (r.baseUrl ? r.baseUrl.substr(1) : ""); + const replaceBaseUrl = (r: ClientRepresentation) => { + if (r.rootUrl) { + if (!r.rootUrl.startsWith("http") || r.rootUrl.indexOf("$") !== -1) { + r.rootUrl = + r.rootUrl + .replace("${authBaseUrl}", baseUrl) + .replace("${authAdminUrl}", baseUrl) + + (r.baseUrl ? r.baseUrl.substr(1) : ""); + } + } + return r.rootUrl; + }; const data = clients! .map((r) => { @@ -120,7 +127,7 @@ export const ClientList = ({ baseUrl, clients }: ClientListProps) => { httpClient.doDelete( `/admin/realms/${realm}/clients/${data[rowId].client.id}` ); - add(t("clientDeletedSucess"), AlertVariant.success); + add(t("clientDeletedSuccess"), AlertVariant.success); } catch (error) { add(`${t("clientDeleteError")} ${error}`, AlertVariant.danger); } diff --git a/src/clients/ClientSettings.tsx b/src/clients/ClientSettings.tsx new file mode 100644 index 0000000000..137711d33c --- /dev/null +++ b/src/clients/ClientSettings.tsx @@ -0,0 +1,137 @@ +import React, { useState, FormEvent } from "react"; +import { useTranslation } from "react-i18next"; +import { + FormGroup, + TextInput, + Form, + Dropdown, + DropdownToggle, + DropdownItem, + Switch, + TextArea, + PageSection, +} from "@patternfly/react-core"; +import { useForm } from "react-hook-form"; + +import { ScrollForm } from "../components/scroll-form/ScrollForm"; +import { ClientDescription } from "./ClientDescription"; +import { ClientRepresentation } from "./models/client-model"; +import { CapabilityConfig } from "./add/CapabilityConfig"; + +type ClientSettingsProps = { + client: ClientRepresentation; +}; + +export const ClientSettings = ({ client: clientInit }: ClientSettingsProps) => { + const { t } = useTranslation("clients"); + const [client, setClient] = useState({ ...clientInit }); + const form = useForm(); + const onChange = ( + value: string | boolean, + event: FormEvent + ) => { + const target = event.target; + const name = (target as HTMLInputElement).name; + + setClient({ + ...client, + [name]: value, + }); + }; + return ( + + +
+ + +
+ + +
+ + + + + + + + + +
+
+ + {}}> + {t("loginTheme")} + + } + dropdownItems={[ + Link, + , + ]} + /> + + + + + + + + +