Changed to use RoutableTabs (#2244)
This commit is contained in:
parent
883e59a5a3
commit
b426886e6a
1 changed files with 26 additions and 7 deletions
|
@ -11,7 +11,6 @@ import {
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
|
|
||||||
import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
|
import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
|
||||||
import { KeycloakTabs } from "../../components/keycloak-tabs/KeycloakTabs";
|
|
||||||
import { useAlerts } from "../../components/alert/Alerts";
|
import { useAlerts } from "../../components/alert/Alerts";
|
||||||
import { ViewHeader } from "../../components/view-header/ViewHeader";
|
import { ViewHeader } from "../../components/view-header/ViewHeader";
|
||||||
import { KeycloakSpinner } from "../../components/keycloak-spinner/KeycloakSpinner";
|
import { KeycloakSpinner } from "../../components/keycloak-spinner/KeycloakSpinner";
|
||||||
|
@ -35,7 +34,11 @@ import {
|
||||||
import { useRealm } from "../../context/realm-context/RealmContext";
|
import { useRealm } from "../../context/realm-context/RealmContext";
|
||||||
import useToggle from "../../utils/useToggle";
|
import useToggle from "../../utils/useToggle";
|
||||||
import { toMapper } from "../routes/Mapper";
|
import { toMapper } from "../routes/Mapper";
|
||||||
import { toClientScope } from "../routes/ClientScope";
|
import { ClientScopeTab, toClientScope } from "../routes/ClientScope";
|
||||||
|
import {
|
||||||
|
routableTab,
|
||||||
|
RoutableTabs,
|
||||||
|
} from "../../components/routable-tabs/RoutableTabs";
|
||||||
|
|
||||||
export default function ClientScopeForm() {
|
export default function ClientScopeForm() {
|
||||||
const { t } = useTranslation("client-scopes");
|
const { t } = useTranslation("client-scopes");
|
||||||
|
@ -241,6 +244,17 @@ export default function ClientScopeForm() {
|
||||||
return <KeycloakSpinner />;
|
return <KeycloakSpinner />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const clientRoute = (tab: ClientScopeTab) =>
|
||||||
|
routableTab({
|
||||||
|
to: toClientScope({
|
||||||
|
realm,
|
||||||
|
id,
|
||||||
|
tab,
|
||||||
|
type,
|
||||||
|
}),
|
||||||
|
history,
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DeleteConfirm />
|
<DeleteConfirm />
|
||||||
|
@ -268,18 +282,22 @@ export default function ClientScopeForm() {
|
||||||
</PageSection>
|
</PageSection>
|
||||||
)}
|
)}
|
||||||
{id && clientScope && (
|
{id && clientScope && (
|
||||||
<KeycloakTabs isBox>
|
<RoutableTabs isBox>
|
||||||
<Tab
|
<Tab
|
||||||
eventKey="settings"
|
id="settings"
|
||||||
|
data-testid="settings"
|
||||||
title={<TabTitleText>{t("common:settings")}</TabTitleText>}
|
title={<TabTitleText>{t("common:settings")}</TabTitleText>}
|
||||||
|
{...clientRoute("settings")}
|
||||||
>
|
>
|
||||||
<PageSection variant="light">
|
<PageSection variant="light">
|
||||||
<ScopeForm save={save} clientScope={clientScope} />
|
<ScopeForm save={save} clientScope={clientScope} />
|
||||||
</PageSection>
|
</PageSection>
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab
|
<Tab
|
||||||
eventKey="mappers"
|
id="mappers"
|
||||||
|
data-testid="mappers"
|
||||||
title={<TabTitleText>{t("common:mappers")}</TabTitleText>}
|
title={<TabTitleText>{t("common:mappers")}</TabTitleText>}
|
||||||
|
{...clientRoute("mappers")}
|
||||||
>
|
>
|
||||||
<MapperList
|
<MapperList
|
||||||
model={clientScope}
|
model={clientScope}
|
||||||
|
@ -291,9 +309,10 @@ export default function ClientScopeForm() {
|
||||||
/>
|
/>
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab
|
<Tab
|
||||||
|
id="scope"
|
||||||
data-testid="scopeTab"
|
data-testid="scopeTab"
|
||||||
eventKey="scope"
|
|
||||||
title={<TabTitleText>{t("scope")}</TabTitleText>}
|
title={<TabTitleText>{t("scope")}</TabTitleText>}
|
||||||
|
{...clientRoute("scope")}
|
||||||
>
|
>
|
||||||
<RoleMapping
|
<RoleMapping
|
||||||
id={id}
|
id={id}
|
||||||
|
@ -304,7 +323,7 @@ export default function ClientScopeForm() {
|
||||||
onHideRolesToggle={toggleHide}
|
onHideRolesToggle={toggleHide}
|
||||||
/>
|
/>
|
||||||
</Tab>
|
</Tab>
|
||||||
</KeycloakTabs>
|
</RoutableTabs>
|
||||||
)}
|
)}
|
||||||
</PageSection>
|
</PageSection>
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Reference in a new issue