Make all routes lower case (#2863)

This commit is contained in:
Erik Jan de Wit 2022-06-22 13:35:10 +02:00 committed by GitHub
parent ea4f122a73
commit b3c4bfe6e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 138 additions and 81 deletions

View file

@ -102,7 +102,7 @@ describe("Realm settings events tab tests", () => {
cy.findByTestId("rs-events-tab").click(); cy.findByTestId("rs-events-tab").click();
cy.wait("@load"); cy.wait("@load");
realmSettingsPage realmSettingsPage
.toggleSwitch(realmSettingsPage.enableEvents) .toggleSwitch(realmSettingsPage.enableEvents, false)
.save(realmSettingsPage.eventsUserSave); .save(realmSettingsPage.eventsUserSave);
masthead.checkNotificationMessage("Successfully saved configuration"); masthead.checkNotificationMessage("Successfully saved configuration");
realmSettingsPage.clearEvents("user"); realmSettingsPage.clearEvents("user");
@ -148,14 +148,14 @@ describe("Realm settings events tab tests", () => {
cy.findByTestId("option-ecdsa-generated").click(); cy.findByTestId("option-ecdsa-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_ecdsa-generated"); realmSettingsPage.enterConsoleDisplayName("test_ecdsa-generated");
realmSettingsPage.toggleSwitch("active"); realmSettingsPage.toggleSwitch("active", false);
realmSettingsPage.addProvider(); realmSettingsPage.addProvider();
realmSettingsPage.toggleAddProviderDropdown(); realmSettingsPage.toggleAddProviderDropdown();
cy.findByTestId("option-hmac-generated").click(); cy.findByTestId("option-hmac-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_hmac-generated"); realmSettingsPage.enterConsoleDisplayName("test_hmac-generated");
realmSettingsPage.toggleSwitch("enabled"); realmSettingsPage.toggleSwitch("enabled", false);
realmSettingsPage.addProvider(); realmSettingsPage.addProvider();
realmSettingsPage.toggleAddProviderDropdown(); realmSettingsPage.toggleAddProviderDropdown();

View file

@ -29,10 +29,16 @@ describe("Realm settings general tab tests", () => {
it("Test all general tab switches", () => { it("Test all general tab switches", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
realmSettingsPage.toggleSwitch(realmSettingsPage.managedAccessSwitch); realmSettingsPage.toggleSwitch(
realmSettingsPage.managedAccessSwitch,
false
);
realmSettingsPage.save(realmSettingsPage.generalSaveBtn); realmSettingsPage.save(realmSettingsPage.generalSaveBtn);
masthead.checkNotificationMessage("Realm successfully updated", true); masthead.checkNotificationMessage("Realm successfully updated", true);
realmSettingsPage.toggleSwitch(realmSettingsPage.managedAccessSwitch); realmSettingsPage.toggleSwitch(
realmSettingsPage.managedAccessSwitch,
false
);
realmSettingsPage.save(realmSettingsPage.generalSaveBtn); realmSettingsPage.save(realmSettingsPage.generalSaveBtn);
masthead.checkNotificationMessage("Realm successfully updated", true); masthead.checkNotificationMessage("Realm successfully updated", true);

View file

@ -30,7 +30,10 @@ describe("Realm settings tabs tests", () => {
it("shows the 'user profile' tab if enabled", () => { it("shows the 'user profile' tab if enabled", () => {
sidebarPage.goToRealmSettings(); sidebarPage.goToRealmSettings();
cy.findByTestId(realmSettingsPage.userProfileTab).should("not.exist"); cy.findByTestId(realmSettingsPage.userProfileTab).should("not.exist");
realmSettingsPage.toggleSwitch(realmSettingsPage.profileEnabledSwitch); realmSettingsPage.toggleSwitch(
realmSettingsPage.profileEnabledSwitch,
false
);
realmSettingsPage.save(realmSettingsPage.generalSaveBtn); realmSettingsPage.save(realmSettingsPage.generalSaveBtn);
masthead.checkNotificationMessage("Realm successfully updated"); masthead.checkNotificationMessage("Realm successfully updated");
cy.findByTestId(realmSettingsPage.userProfileTab).should("exist"); cy.findByTestId(realmSettingsPage.userProfileTab).should("exist");
@ -47,8 +50,6 @@ describe("Realm settings tabs tests", () => {
realmSettingsPage.toggleSwitch(realmSettingsPage.loginWithEmailSwitch); realmSettingsPage.toggleSwitch(realmSettingsPage.loginWithEmailSwitch);
realmSettingsPage.toggleSwitch(realmSettingsPage.duplicateEmailsSwitch);
// Check values // Check values
cy.findByTestId(realmSettingsPage.userRegSwitch).should("have.value", "on"); cy.findByTestId(realmSettingsPage.userRegSwitch).should("have.value", "on");
cy.findByTestId(realmSettingsPage.forgotPwdSwitch).should( cy.findByTestId(realmSettingsPage.forgotPwdSwitch).should(
@ -87,7 +88,9 @@ describe("Realm settings tabs tests", () => {
realmSettingsPage.toggleCheck(realmSettingsPage.enableSslCheck); realmSettingsPage.toggleCheck(realmSettingsPage.enableSslCheck);
realmSettingsPage.toggleCheck(realmSettingsPage.enableStartTlsCheck); realmSettingsPage.toggleCheck(realmSettingsPage.enableStartTlsCheck);
realmSettingsPage.fillHostField("localhost"); realmSettingsPage.fillHostField("localhost");
cy.intercept(`/admin/realms/${realmName}/users/*`).as("load");
cy.findByTestId(realmSettingsPage.testConnectionButton).click(); cy.findByTestId(realmSettingsPage.testConnectionButton).click();
cy.wait("@load");
realmSettingsPage.fillEmailField( realmSettingsPage.fillEmailField(
"example" + (Math.random() + 1).toString(36).substring(7) + "@example.com" "example" + (Math.random() + 1).toString(36).substring(7) + "@example.com"

View file

@ -1,9 +1,6 @@
export default class OTPPolicies { export default class OTPPolicies {
goToTab() { goToTab() {
cy.get("#pf-tab-policies-policies") cy.findAllByTestId("policies").click().get("#pf-tab-2-otpPolicy").click();
.click()
.get("#pf-tab-2-otpPolicy")
.click();
return this; return this;
} }

View file

@ -1,6 +1,6 @@
export default class PasswordPolicies { export default class PasswordPolicies {
goToTab() { goToTab() {
cy.get("#pf-tab-policies-policies").click(); cy.findAllByTestId("policies").click();
return this; return this;
} }

View file

@ -10,7 +10,7 @@ export default class RequiredActions {
} }
goToTab() { goToTab() {
cy.get("#pf-tab-requiredActions-requiredActions").click(); cy.findByTestId("requiredActions").click();
} }
enableAction(name: string) { enableAction(name: string) {

View file

@ -4,15 +4,12 @@ export default class WebAuthnPolicies {
return this; return this;
} }
goToTab() { goToTab() {
cy.get("#pf-tab-policies-policies") cy.findByTestId("policies").click().get("#pf-tab-3-webauthnPolicy").click();
.click()
.get("#pf-tab-3-webauthnPolicy")
.click();
return this; return this;
} }
goToPasswordlessTab() { goToPasswordlessTab() {
cy.get("#pf-tab-policies-policies") cy.findByTestId("policies")
.click() .click()
.get("#pf-tab-4-webauthnPasswordlessPolicy") .get("#pf-tab-4-webauthnPasswordlessPolicy")
.click(); .click();

View file

@ -188,11 +188,11 @@ export default class RealmSettingsPage extends CommonPage {
private clientPolicyDrpDwn = '[data-testid="action-dropdown"] button'; private clientPolicyDrpDwn = '[data-testid="action-dropdown"] button';
private deleteclientPolicyDrpDwn = "deleteClientPolicyDropdown"; private deleteclientPolicyDrpDwn = "deleteClientPolicyDropdown";
private clientProfileOne = private clientProfileOne =
'a[href*="realm-settings/clientPolicies/Test/edit-profile"]'; 'a[href*="realm-settings/client-policies/Test/edit-profile"]';
private clientProfileTwo = private clientProfileTwo =
'a[href*="realm-settings/clientPolicies/Edit/edit-profile"]'; 'a[href*="realm-settings/client-policies/Edit/edit-profile"]';
private clientPolicy = private clientPolicy =
'a[href*="realm-settings/clientPolicies/Test/edit-policy"]'; 'a[href*="realm-settings/client-policies/Test/edit-policy"]';
private reloadBtn = "reloadProfile"; private reloadBtn = "reloadProfile";
private addExecutor = "addExecutor"; private addExecutor = "addExecutor";
private addExecutorDrpDwn = ".pf-c-select__toggle"; private addExecutorDrpDwn = ".pf-c-select__toggle";
@ -381,8 +381,12 @@ export default class RealmSettingsPage extends CommonPage {
cy.findByTestId(this.disabledKeysOption).click(); cy.findByTestId(this.disabledKeysOption).click();
} }
toggleSwitch(switchName: string) { toggleSwitch(switchName: string, waitFor: boolean | undefined = true) {
cy.intercept("/admin/realms/*").as("load");
cy.findByTestId(switchName).click({ force: true }); cy.findByTestId(switchName).click({ force: true });
if (waitFor) {
cy.wait("@load");
}
return this; return this;
} }
@ -516,7 +520,7 @@ export default class RealmSettingsPage extends CommonPage {
); );
cy.findByTestId(this.offlineSessionIdleInput).clear().type("7"); cy.findByTestId(this.offlineSessionIdleInput).clear().type("7");
this.toggleSwitch(this.offlineSessionMaxSwitch); this.toggleSwitch(this.offlineSessionMaxSwitch, false);
cy.findByTestId(this.loginTimeoutInput).clear().type("9"); cy.findByTestId(this.loginTimeoutInput).clear().type("9");
this.changeTimeUnit( this.changeTimeUnit(
@ -533,7 +537,7 @@ export default class RealmSettingsPage extends CommonPage {
} }
populateTokensPage() { populateTokensPage() {
this.toggleSwitch(this.revokeRefreshTokenSwitch); this.toggleSwitch(this.revokeRefreshTokenSwitch, false);
cy.findByTestId(this.accessTokenLifespanInput) cy.findByTestId(this.accessTokenLifespanInput)
.focus() .focus()
@ -840,7 +844,7 @@ export default class RealmSettingsPage extends CommonPage {
`/admin/realms/${this.realmName}/client-policies/profiles*` `/admin/realms/${this.realmName}/client-policies/profiles*`
).as("profilesFetch"); ).as("profilesFetch");
cy.get( cy.get(
'a[href*="realm-settings/clientPolicies/' + name + '/edit-profile"]' 'a[href*="realm-settings/client-policies/' + name + '/edit-profile"]'
).click(); ).click();
cy.wait("@profilesFetch"); cy.wait("@profilesFetch");
return this; return this;

View file

@ -1,5 +1,5 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { Link } from "react-router-dom"; import { Link, useHistory } from "react-router-dom";
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
import { sortBy } from "lodash-es"; import { sortBy } from "lodash-es";
import { import {
@ -16,7 +16,6 @@ import {
import type AuthenticationFlowRepresentation from "@keycloak/keycloak-admin-client/lib/defs/authenticationFlowRepresentation"; import type AuthenticationFlowRepresentation from "@keycloak/keycloak-admin-client/lib/defs/authenticationFlowRepresentation";
import { useAdminClient } from "../context/auth/AdminClient"; import { useAdminClient } from "../context/auth/AdminClient";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState"; import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import { ViewHeader } from "../components/view-header/ViewHeader"; import { ViewHeader } from "../components/view-header/ViewHeader";
import { useRealm } from "../context/realm-context/RealmContext"; import { useRealm } from "../context/realm-context/RealmContext";
@ -32,6 +31,11 @@ import { Policies } from "./policies/Policies";
import helpUrls from "../help-urls"; import helpUrls from "../help-urls";
import { BindFlowDialog } from "./BindFlowDialog"; import { BindFlowDialog } from "./BindFlowDialog";
import { UsedBy } from "./components/UsedBy"; import { UsedBy } from "./components/UsedBy";
import {
routableTab,
RoutableTabs,
} from "../components/routable-tabs/RoutableTabs";
import { AuthenticationTab, toAuthentication } from "./routes/Authentication";
import "./authentication-section.css"; import "./authentication-section.css";
@ -54,6 +58,7 @@ export default function AuthenticationSection() {
const { t } = useTranslation("authentication"); const { t } = useTranslation("authentication");
const adminClient = useAdminClient(); const adminClient = useAdminClient();
const { realm } = useRealm(); const { realm } = useRealm();
const history = useHistory();
const [key, setKey] = useState(0); const [key, setKey] = useState(0);
const refresh = () => setKey(key + 1); const refresh = () => setKey(key + 1);
const { addAlert, addError } = useAlerts(); const { addAlert, addError } = useAlerts();
@ -162,6 +167,12 @@ export default function AuthenticationSection() {
</> </>
); );
const route = (tab: AuthenticationTab) =>
routableTab({
to: toAuthentication({ realm, tab }),
history,
});
return ( return (
<> <>
<DeleteConfirm /> <DeleteConfirm />
@ -192,10 +203,14 @@ export default function AuthenticationSection() {
divider={false} divider={false}
/> />
<PageSection variant="light" className="pf-u-p-0"> <PageSection variant="light" className="pf-u-p-0">
<KeycloakTabs isBox> <RoutableTabs
isBox
defaultLocation={toAuthentication({ realm, tab: "flows" })}
>
<Tab <Tab
eventKey="flows" data-testid="flows"
title={<TabTitleText>{t("flows")}</TabTitleText>} title={<TabTitleText>{t("flows")}</TabTitleText>}
{...route("flows")}
> >
<KeycloakDataTable <KeycloakDataTable
key={key} key={key}
@ -275,20 +290,20 @@ export default function AuthenticationSection() {
/> />
</Tab> </Tab>
<Tab <Tab
id="requiredActions" data-testid="requiredActions"
eventKey="requiredActions"
title={<TabTitleText>{t("requiredActions")}</TabTitleText>} title={<TabTitleText>{t("requiredActions")}</TabTitleText>}
{...route("required-actions")}
> >
<RequiredActions /> <RequiredActions />
</Tab> </Tab>
<Tab <Tab
id="policies" data-testid="policies"
eventKey="policies"
title={<TabTitleText>{t("policies")}</TabTitleText>} title={<TabTitleText>{t("policies")}</TabTitleText>}
{...route("policies")}
> >
<Policies /> <Policies />
</Tab> </Tab>
</KeycloakTabs> </RoutableTabs>
</PageSection> </PageSection>
</> </>
); );

View file

@ -3,7 +3,9 @@ import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type AuthenticationParams = { realm: string; tab?: string }; export type AuthenticationTab = "flows" | "required-actions" | "policies";
export type AuthenticationParams = { realm: string; tab?: AuthenticationTab };
export const AuthenticationRoute: RouteDef = { export const AuthenticationRoute: RouteDef = {
path: "/:realm/authentication/:tab?", path: "/:realm/authentication/:tab?",

View file

@ -13,11 +13,10 @@ import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/
import type { ClientQuery } from "@keycloak/keycloak-admin-client/lib/resources/clients"; import type { ClientQuery } from "@keycloak/keycloak-admin-client/lib/resources/clients";
import React, { useState } from "react"; import React, { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom"; import { Link, useHistory } from "react-router-dom";
import { useAlerts } from "../components/alert/Alerts"; import { useAlerts } from "../components/alert/Alerts";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog"; import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { formattedLinkTableCell } from "../components/external-link/FormattedLink"; import { formattedLinkTableCell } from "../components/external-link/FormattedLink";
import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs";
import { import {
Action, Action,
KeycloakDataTable, KeycloakDataTable,
@ -33,6 +32,11 @@ import { toImportClient } from "./routes/ImportClient";
import { isRealmClient, getProtocolName } from "./utils"; import { isRealmClient, getProtocolName } from "./utils";
import helpUrls from "../help-urls"; import helpUrls from "../help-urls";
import { useAccess } from "../context/access/Access"; import { useAccess } from "../context/access/Access";
import {
routableTab,
RoutableTabs,
} from "../components/routable-tabs/RoutableTabs";
import { ClientsTab, toClients } from "./routes/Clients";
export default function ClientsSection() { export default function ClientsSection() {
const { t } = useTranslation("clients"); const { t } = useTranslation("clients");
@ -41,6 +45,7 @@ export default function ClientsSection() {
const adminClient = useAdminClient(); const adminClient = useAdminClient();
const { realm } = useRealm(); const { realm } = useRealm();
const baseUrl = getBaseUrl(adminClient); const baseUrl = getBaseUrl(adminClient);
const history = useHistory();
const [key, setKey] = useState(0); const [key, setKey] = useState(0);
const refresh = () => setKey(new Date().getTime()); const refresh = () => setKey(new Date().getTime());
@ -127,6 +132,12 @@ export default function ClientsSection() {
); );
}; };
const route = (tab: ClientsTab) =>
routableTab({
to: toClients({ realm, tab }),
history,
});
return ( return (
<> <>
<ViewHeader <ViewHeader
@ -136,11 +147,18 @@ export default function ClientsSection() {
divider={false} divider={false}
/> />
<PageSection variant="light" className="pf-u-p-0"> <PageSection variant="light" className="pf-u-p-0">
<KeycloakTabs isBox> <RoutableTabs
mountOnEnter
isBox
defaultLocation={toClients({
realm,
tab: "list",
})}
>
<Tab <Tab
data-testid="list" data-testid="list"
eventKey="list"
title={<TabTitleText>{t("clientsList")}</TabTitleText>} title={<TabTitleText>{t("clientsList")}</TabTitleText>}
{...route("list")}
> >
<DeleteConfirm /> <DeleteConfirm />
<KeycloakDataTable <KeycloakDataTable
@ -220,12 +238,12 @@ export default function ClientsSection() {
</Tab> </Tab>
<Tab <Tab
data-testid="initialAccessToken" data-testid="initialAccessToken"
eventKey="initialAccessToken"
title={<TabTitleText>{t("initialAccessToken")}</TabTitleText>} title={<TabTitleText>{t("initialAccessToken")}</TabTitleText>}
{...route("initial-access-token")}
> >
<InitialAccessTokenList /> <InitialAccessTokenList />
</Tab> </Tab>
</KeycloakTabs> </RoutableTabs>
</PageSection> </PageSection>
</> </>
); );

View file

@ -57,7 +57,7 @@ export default function CreateInitialAccessToken() {
toggleDialog={() => { toggleDialog={() => {
setToken(""); setToken("");
addAlert(t("tokenSaveSuccess"), AlertVariant.success); addAlert(t("tokenSaveSuccess"), AlertVariant.success);
history.push(toClients({ realm, tab: "initialAccessToken" })); history.push(toClients({ realm, tab: "initial-access-token" }));
}} }}
/> />
)} )}
@ -147,7 +147,7 @@ export default function CreateInitialAccessToken() {
component={(props) => ( component={(props) => (
<Link <Link
{...props} {...props}
to={toClients({ realm, tab: "initialAccessToken" })} to={toClients({ realm, tab: "initial-access-token" })}
/> />
)} )}
> >

View file

@ -3,7 +3,7 @@ import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type ClientsTab = "list" | "initialAccessToken"; export type ClientsTab = "list" | "initial-access-token";
export type ClientsParams = { export type ClientsParams = {
realm: string; realm: string;

View file

@ -31,8 +31,7 @@ import moment from "moment";
import React, { useState } from "react"; import React, { useState } from "react";
import { Controller, useForm } from "react-hook-form"; import { Controller, useForm } from "react-hook-form";
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
import { Link } from "react-router-dom"; import { Link, useHistory } from "react-router-dom";
import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState"; import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { ViewHeader } from "../components/view-header/ViewHeader"; import { ViewHeader } from "../components/view-header/ViewHeader";
@ -42,8 +41,14 @@ import { useRealm } from "../context/realm-context/RealmContext";
import { toRealmSettings } from "../realm-settings/routes/RealmSettings"; import { toRealmSettings } from "../realm-settings/routes/RealmSettings";
import { toUser } from "../user/routes/User"; import { toUser } from "../user/routes/User";
import { AdminEvents } from "./AdminEvents"; import { AdminEvents } from "./AdminEvents";
import "./events.css";
import helpUrls from "../help-urls"; import helpUrls from "../help-urls";
import {
routableTab,
RoutableTabs,
} from "../components/routable-tabs/RoutableTabs";
import { EventsTab, toEvents } from "./routes/Events";
import "./events.css";
type UserEventSearchForm = { type UserEventSearchForm = {
client: string; client: string;
@ -411,6 +416,13 @@ export default function EventsSection() {
); );
}; };
const history = useHistory();
const route = (tab: EventsTab) =>
routableTab({
to: toEvents({ realm, tab }),
history,
});
return ( return (
<> <>
<ViewHeader <ViewHeader
@ -429,10 +441,13 @@ export default function EventsSection() {
divider={false} divider={false}
/> />
<PageSection variant="light" className="pf-u-p-0"> <PageSection variant="light" className="pf-u-p-0">
<KeycloakTabs isBox> <RoutableTabs
isBox
defaultLocation={toEvents({ realm, tab: "user-events" })}
>
<Tab <Tab
eventKey="userEvents"
title={<TabTitleText>{t("userEvents")}</TabTitleText>} title={<TabTitleText>{t("userEvents")}</TabTitleText>}
{...route("user-events")}
> >
<div className="keycloak__events_table"> <div className="keycloak__events_table">
<KeycloakDataTable <KeycloakDataTable
@ -486,13 +501,13 @@ export default function EventsSection() {
</div> </div>
</Tab> </Tab>
<Tab <Tab
eventKey="adminEvents"
title={<TabTitleText>{t("adminEvents")}</TabTitleText>} title={<TabTitleText>{t("adminEvents")}</TabTitleText>}
data-testid="admin-events-tab" data-testid="admin-events-tab"
{...route("admin-events")}
> >
<AdminEvents /> <AdminEvents />
</Tab> </Tab>
</KeycloakTabs> </RoutableTabs>
</PageSection> </PageSection>
</> </>
); );

View file

@ -3,7 +3,7 @@ import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type EventsTab = "userEvents" | "adminEvents"; export type EventsTab = "user-events" | "admin-events";
export type EventsParams = { export type EventsParams = {
realm: string; realm: string;

View file

@ -78,7 +78,7 @@ export const RolesList = ({
) : ( ) : (
<> <>
<Link <Link
to={toRealmSettings({ realm: realmName, tab: "userRegistration" })} to={toRealmSettings({ realm: realmName, tab: "user-registration" })}
> >
{role.name}{" "} {role.name}{" "}
</Link> </Link>

View file

@ -327,7 +327,7 @@ export const RealmSettingsTabs = ({
<Tab <Tab
title={<TabTitleText>{t("securityDefences")}</TabTitleText>} title={<TabTitleText>{t("securityDefences")}</TabTitleText>}
data-testid="rs-security-defenses-tab" data-testid="rs-security-defenses-tab"
{...route("securityDefences")} {...route("security-defenses")}
> >
<SecurityDefenses realm={realm} save={save} /> <SecurityDefenses realm={realm} save={save} />
</Tab> </Tab>
@ -350,7 +350,7 @@ export const RealmSettingsTabs = ({
<TabTitleText>{t("realm-settings:clientPolicies")}</TabTitleText> <TabTitleText>{t("realm-settings:clientPolicies")}</TabTitleText>
} }
data-testid="rs-clientPolicies-tab" data-testid="rs-clientPolicies-tab"
{...route("clientPolicies")} {...route("client-policies")}
> >
<RoutableTabs <RoutableTabs
mountOnEnter mountOnEnter
@ -405,7 +405,7 @@ export const RealmSettingsTabs = ({
<TabTitleText>{t("realm-settings:userProfile")}</TabTitleText> <TabTitleText>{t("realm-settings:userProfile")}</TabTitleText>
} }
data-testid="rs-user-profile-tab" data-testid="rs-user-profile-tab"
{...route("userProfile")} {...route("user-profile")}
> >
<UserProfileTab /> <UserProfileTab />
</Tab> </Tab>
@ -413,7 +413,7 @@ export const RealmSettingsTabs = ({
<Tab <Tab
title={<TabTitleText>{t("userRegistration")}</TabTitleText>} title={<TabTitleText>{t("userRegistration")}</TabTitleText>}
data-testid="rs-userRegistration-tab" data-testid="rs-userRegistration-tab"
{...route("userRegistration")} {...route("user-registration")}
> >
<UserRegistration /> <UserRegistration />
</Tab> </Tab>

View file

@ -8,7 +8,7 @@ export type AddAttributeParams = {
}; };
export const AddAttributeRoute: RouteDef = { export const AddAttributeRoute: RouteDef = {
path: "/:realm/realm-settings/userProfile/attributes/add-attribute", path: "/:realm/realm-settings/user-profile/attributes/add-attribute",
component: lazy(() => import("../NewAttributeSettings")), component: lazy(() => import("../NewAttributeSettings")),
breadcrumb: (t) => t("realm-settings:createAttribute"), breadcrumb: (t) => t("realm-settings:createAttribute"),
access: "manage-realm", access: "manage-realm",

View file

@ -6,7 +6,7 @@ import type { RouteDef } from "../../route-config";
export type AddClientPolicyParams = { realm: string }; export type AddClientPolicyParams = { realm: string };
export const AddClientPolicyRoute: RouteDef = { export const AddClientPolicyRoute: RouteDef = {
path: "/:realm/realm-settings/clientPolicies/policies/add-client-policy", path: "/:realm/realm-settings/client-policies/policies/add-client-policy",
component: lazy(() => import("../NewClientPolicyForm")), component: lazy(() => import("../NewClientPolicyForm")),
breadcrumb: (t) => t("realm-settings:createPolicy"), breadcrumb: (t) => t("realm-settings:createPolicy"),
access: "manage-clients", access: "manage-clients",

View file

@ -9,7 +9,7 @@ export type AddClientProfileParams = {
}; };
export const AddClientProfileRoute: RouteDef = { export const AddClientProfileRoute: RouteDef = {
path: "/:realm/realm-settings/clientPolicies/:tab/add-profile", path: "/:realm/realm-settings/client-policies/:tab/add-profile",
component: lazy(() => import("../ClientProfileForm")), component: lazy(() => import("../ClientProfileForm")),
breadcrumb: (t) => t("realm-settings:newClientProfile"), breadcrumb: (t) => t("realm-settings:newClientProfile"),
access: "manage-realm", access: "manage-realm",

View file

@ -9,7 +9,7 @@ export type NewClientPolicyConditionParams = {
}; };
export const NewClientPolicyConditionRoute: RouteDef = { export const NewClientPolicyConditionRoute: RouteDef = {
path: "/:realm/realm-settings/clientPolicies/:policyName?/edit-policy/create-condition", path: "/:realm/realm-settings/client-policies/:policyName?/edit-policy/create-condition",
component: lazy(() => import("../NewClientPolicyCondition")), component: lazy(() => import("../NewClientPolicyCondition")),
breadcrumb: (t) => t("realm-settings:addCondition"), breadcrumb: (t) => t("realm-settings:addCondition"),
access: "manage-clients", access: "manage-clients",

View file

@ -9,7 +9,7 @@ export type AddExecutorParams = {
}; };
export const AddExecutorRoute: RouteDef = { export const AddExecutorRoute: RouteDef = {
path: "/:realm/realm-settings/clientPolicies/:profileName/add-executor", path: "/:realm/realm-settings/client-policies/:profileName/add-executor",
component: lazy(() => import("../ExecutorForm")), component: lazy(() => import("../ExecutorForm")),
breadcrumb: (t) => t("realm-settings:addExecutor"), breadcrumb: (t) => t("realm-settings:addExecutor"),
access: "manage-realm", access: "manage-realm",

View file

@ -9,7 +9,7 @@ export type AttributeParams = {
}; };
export const AttributeRoute: RouteDef = { export const AttributeRoute: RouteDef = {
path: "/:realm/realm-settings/userProfile/attributes/:attributeName/edit-attribute", path: "/:realm/realm-settings/user-profile/attributes/:attributeName/edit-attribute",
component: lazy(() => import("../NewAttributeSettings")), component: lazy(() => import("../NewAttributeSettings")),
breadcrumb: (t) => t("realm-settings:editAttribute"), breadcrumb: (t) => t("realm-settings:editAttribute"),
access: "manage-realm", access: "manage-realm",

View file

@ -11,7 +11,7 @@ export type ClientPoliciesParams = {
}; };
export const ClientPoliciesRoute: RouteDef = { export const ClientPoliciesRoute: RouteDef = {
path: "/:realm/realm-settings/clientPolicies/:tab", path: "/:realm/realm-settings/client-policies/:tab",
component: lazy(() => import("../RealmSettingsSection")), component: lazy(() => import("../RealmSettingsSection")),
breadcrumb: (t) => t("realm-settings:clientPolicies"), breadcrumb: (t) => t("realm-settings:clientPolicies"),
access: "view-realm", access: "view-realm",

View file

@ -9,7 +9,7 @@ export type ClientProfileParams = {
}; };
export const ClientProfileRoute: RouteDef = { export const ClientProfileRoute: RouteDef = {
path: "/:realm/realm-settings/clientPolicies/:profileName/edit-profile", path: "/:realm/realm-settings/client-policies/:profileName/edit-profile",
component: lazy(() => import("../ClientProfileForm")), component: lazy(() => import("../ClientProfileForm")),
breadcrumb: (t) => t("realm-settings:clientProfile"), breadcrumb: (t) => t("realm-settings:clientProfile"),
access: ["view-realm", "view-users"], access: ["view-realm", "view-users"],

View file

@ -9,7 +9,7 @@ export type EditAttributesGroupParams = {
}; };
export const EditAttributesGroupRoute: RouteDef = { export const EditAttributesGroupRoute: RouteDef = {
path: "/:realm/realm-settings/userProfile/attributesGroup/edit/:name", path: "/:realm/realm-settings/user-profile/attributesGroup/edit/:name",
component: lazy(() => import("../user-profile/AttributesGroupDetails")), component: lazy(() => import("../user-profile/AttributesGroupDetails")),
breadcrumb: (t) => t("attributes-group:editGroupText"), breadcrumb: (t) => t("attributes-group:editGroupText"),
access: "view-realm", access: "view-realm",

View file

@ -9,7 +9,7 @@ export type EditClientPolicyParams = {
}; };
export const EditClientPolicyRoute: RouteDef = { export const EditClientPolicyRoute: RouteDef = {
path: "/:realm/realm-settings/clientPolicies/:policyName/edit-policy", path: "/:realm/realm-settings/client-policies/:policyName/edit-policy",
component: lazy(() => import("../NewClientPolicyForm")), component: lazy(() => import("../NewClientPolicyForm")),
access: "manage-realm", access: "manage-realm",
breadcrumb: (t) => t("realm-settings:policyDetails"), breadcrumb: (t) => t("realm-settings:policyDetails"),

View file

@ -10,7 +10,7 @@ export type EditClientPolicyConditionParams = {
}; };
export const EditClientPolicyConditionRoute: RouteDef = { export const EditClientPolicyConditionRoute: RouteDef = {
path: "/:realm/realm-settings/clientPolicies/:policyName?/edit-policy/:conditionName/edit-condition", path: "/:realm/realm-settings/client-policies/:policyName?/edit-policy/:conditionName/edit-condition",
component: lazy(() => import("../NewClientPolicyCondition")), component: lazy(() => import("../NewClientPolicyCondition")),
breadcrumb: (t) => t("realm-settings:editCondition"), breadcrumb: (t) => t("realm-settings:editCondition"),
access: "manage-clients", access: "manage-clients",

View file

@ -10,7 +10,7 @@ export type ExecutorParams = {
}; };
export const ExecutorRoute: RouteDef = { export const ExecutorRoute: RouteDef = {
path: "/:realm/realm-settings/clientPolicies/:profileName/edit-profile/:executorName", path: "/:realm/realm-settings/client-policies/:profileName/edit-profile/:executorName",
component: lazy(() => import("../ExecutorForm")), component: lazy(() => import("../ExecutorForm")),
breadcrumb: (t) => t("realm-settings:executorDetails"), breadcrumb: (t) => t("realm-settings:executorDetails"),
access: ["manage-realm"], access: ["manage-realm"],

View file

@ -8,7 +8,7 @@ export type NewAttributesGroupParams = {
}; };
export const NewAttributesGroupRoute: RouteDef = { export const NewAttributesGroupRoute: RouteDef = {
path: "/:realm/realm-settings/userProfile/attributesGroup/new", path: "/:realm/realm-settings/user-profile/attributesGroup/new",
component: lazy(() => import("../user-profile/AttributesGroupDetails")), component: lazy(() => import("../user-profile/AttributesGroupDetails")),
breadcrumb: (t) => t("attributes-group:createGroupText"), breadcrumb: (t) => t("attributes-group:createGroupText"),
access: "view-realm", access: "view-realm",

View file

@ -11,12 +11,12 @@ export type RealmSettingsTab =
| "keys" | "keys"
| "events" | "events"
| "localization" | "localization"
| "securityDefences" | "security-defenses"
| "sessions" | "sessions"
| "tokens" | "tokens"
| "clientPolicies" | "client-policies"
| "userProfile" | "user-profile"
| "userRegistration"; | "user-registration";
export type RealmSettingsParams = { export type RealmSettingsParams = {
realm: string; realm: string;

View file

@ -3,7 +3,7 @@ import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type UserProfileTab = "attributes" | "attributesGroup" | "jsonEditor"; export type UserProfileTab = "attributes" | "attributes-group" | "json-editor";
export type UserProfileParams = { export type UserProfileParams = {
realm: string; realm: string;
@ -11,7 +11,7 @@ export type UserProfileParams = {
}; };
export const UserProfileRoute: RouteDef = { export const UserProfileRoute: RouteDef = {
path: "/:realm/realm-settings/userProfile/:tab", path: "/:realm/realm-settings/user-profile/:tab",
component: lazy(() => import("../RealmSettingsSection")), component: lazy(() => import("../RealmSettingsSection")),
breadcrumb: (t) => t("realm-settings:userProfile"), breadcrumb: (t) => t("realm-settings:userProfile"),
access: "view-realm", access: "view-realm",

View file

@ -99,7 +99,7 @@ export default function AttributesGroupForm() {
const success = await save({ ...config, groups }); const success = await save({ ...config, groups });
if (success) { if (success) {
history.push(toUserProfile({ realm, tab: "attributesGroup" })); history.push(toUserProfile({ realm, tab: "attributes-group" }));
} }
}; };
@ -193,7 +193,7 @@ export default function AttributesGroupForm() {
component={(props) => ( component={(props) => (
<Link <Link
{...props} {...props}
to={toUserProfile({ realm, tab: "attributesGroup" })} to={toUserProfile({ realm, tab: "attributes-group" })}
/> />
)} )}
> >

View file

@ -38,7 +38,7 @@ export const UserProfileTab = () => {
title={<TabTitleText>{t("attributesGroup")}</TabTitleText>} title={<TabTitleText>{t("attributesGroup")}</TabTitleText>}
data-testid="attributesGroupTab" data-testid="attributesGroupTab"
{...routableTab({ {...routableTab({
to: toUserProfile({ realm, tab: "attributesGroup" }), to: toUserProfile({ realm, tab: "attributes-group" }),
history, history,
})} })}
> >
@ -48,7 +48,7 @@ export const UserProfileTab = () => {
title={<TabTitleText>{t("jsonEditor")}</TabTitleText>} title={<TabTitleText>{t("jsonEditor")}</TabTitleText>}
data-testid="jsonEditorTab" data-testid="jsonEditorTab"
{...routableTab({ {...routableTab({
to: toUserProfile({ realm, tab: "jsonEditor" }), to: toUserProfile({ realm, tab: "json-editor" }),
history, history,
})} })}
> >