parent
f497f8cd8f
commit
eab11255ba
3 changed files with 28 additions and 4 deletions
|
@ -11,6 +11,7 @@
|
||||||
"applicationsIntroMessage": "Track and manage your app permission to access your account",
|
"applicationsIntroMessage": "Track and manage your app permission to access your account",
|
||||||
"applicationType": "Application type",
|
"applicationType": "Application type",
|
||||||
"avatar": "Avatar",
|
"avatar": "Avatar",
|
||||||
|
"backTo": "Back to {{app}}",
|
||||||
"basic-authentication": "Basic authentication",
|
"basic-authentication": "Basic authentication",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"choose": "Choose...",
|
"choose": "Choose...",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Page, Spinner } from "@patternfly/react-core";
|
import { Button, Page, Spinner } from "@patternfly/react-core";
|
||||||
import {
|
import {
|
||||||
KeycloakMasthead,
|
KeycloakMasthead,
|
||||||
Translations,
|
Translations,
|
||||||
|
@ -13,11 +13,31 @@ import { environment } from "../environment";
|
||||||
import { keycloak } from "../keycloak";
|
import { keycloak } from "../keycloak";
|
||||||
import { joinPath } from "../utils/joinPath";
|
import { joinPath } from "../utils/joinPath";
|
||||||
import { PageNav } from "./PageNav";
|
import { PageNav } from "./PageNav";
|
||||||
|
import { ExternalLinkSquareAltIcon } from "@patternfly/react-icons";
|
||||||
|
|
||||||
import style from "./Root.module.css";
|
import style from "./Root.module.css";
|
||||||
|
|
||||||
|
const ReferrerLink = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const searchParams = new URLSearchParams(location.search);
|
||||||
|
|
||||||
|
return searchParams.has("referrer_uri") ? (
|
||||||
|
<Button
|
||||||
|
component="a"
|
||||||
|
href={searchParams.get("referrer_uri")!.replace("_hash_", "#")}
|
||||||
|
variant="link"
|
||||||
|
icon={<ExternalLinkSquareAltIcon />}
|
||||||
|
iconPosition="right"
|
||||||
|
isInline
|
||||||
|
>
|
||||||
|
{t("backTo", { app: searchParams.get("referrer") })}
|
||||||
|
</Button>
|
||||||
|
) : null;
|
||||||
|
};
|
||||||
|
|
||||||
export const Root = () => {
|
export const Root = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const translations = useMemo<Translations>(
|
const translations = useMemo<Translations>(
|
||||||
() => ({
|
() => ({
|
||||||
avatar: t("avatar"),
|
avatar: t("avatar"),
|
||||||
|
@ -41,7 +61,7 @@ export const Root = () => {
|
||||||
alt: t("logo"),
|
alt: t("logo"),
|
||||||
className: style.brand,
|
className: style.brand,
|
||||||
}}
|
}}
|
||||||
dropdownItems={[]}
|
toolbarItems={[<ReferrerLink key="link" />]}
|
||||||
keycloak={keycloak}
|
keycloak={keycloak}
|
||||||
/>
|
/>
|
||||||
</TranslationsProvider>
|
</TranslationsProvider>
|
||||||
|
|
|
@ -32,7 +32,8 @@ type KeycloakMastheadProps = PageHeaderProps & {
|
||||||
};
|
};
|
||||||
keycloak?: Keycloak;
|
keycloak?: Keycloak;
|
||||||
kebabDropdownItems?: ReactNode[];
|
kebabDropdownItems?: ReactNode[];
|
||||||
dropdownItems: ReactNode[];
|
dropdownItems?: ReactNode[];
|
||||||
|
toolbarItems?: ReactNode[];
|
||||||
};
|
};
|
||||||
|
|
||||||
const KeycloakMasthead = ({
|
const KeycloakMasthead = ({
|
||||||
|
@ -45,7 +46,8 @@ const KeycloakMasthead = ({
|
||||||
} = {},
|
} = {},
|
||||||
keycloak,
|
keycloak,
|
||||||
kebabDropdownItems,
|
kebabDropdownItems,
|
||||||
dropdownItems,
|
dropdownItems = [],
|
||||||
|
toolbarItems,
|
||||||
...rest
|
...rest
|
||||||
}: KeycloakMastheadProps) => {
|
}: KeycloakMastheadProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
@ -94,6 +96,7 @@ const KeycloakMasthead = ({
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</PageHeaderToolsItem>
|
</PageHeaderToolsItem>
|
||||||
|
<PageHeaderToolsItem>{toolbarItems}</PageHeaderToolsItem>
|
||||||
<PageHeaderToolsItem
|
<PageHeaderToolsItem
|
||||||
visibility={{
|
visibility={{
|
||||||
default: "hidden",
|
default: "hidden",
|
||||||
|
|
Loading…
Reference in a new issue