Show a tooltip to explain bearer-only clients (#1244)
This commit is contained in:
parent
02ce5c4e6e
commit
cfe83c769b
2 changed files with 28 additions and 3 deletions
|
@ -4,15 +4,18 @@ import {
|
||||||
ButtonVariant,
|
ButtonVariant,
|
||||||
Divider,
|
Divider,
|
||||||
DropdownItem,
|
DropdownItem,
|
||||||
|
Label,
|
||||||
PageSection,
|
PageSection,
|
||||||
Spinner,
|
Spinner,
|
||||||
Tab,
|
Tab,
|
||||||
Tabs,
|
Tabs,
|
||||||
TabTitleText,
|
TabTitleText,
|
||||||
|
Tooltip,
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
|
import { InfoCircleIcon } from "@patternfly/react-icons";
|
||||||
import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
|
import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import React, { useState } from "react";
|
import React, { useMemo, useState } from "react";
|
||||||
import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
|
import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useHistory, useParams } from "react-router-dom";
|
import { useHistory, useParams } from "react-router-dom";
|
||||||
|
@ -28,7 +31,10 @@ import {
|
||||||
MultiLine,
|
MultiLine,
|
||||||
toValue,
|
toValue,
|
||||||
} from "../components/multi-line-input/MultiLineInput";
|
} from "../components/multi-line-input/MultiLineInput";
|
||||||
import { ViewHeader } from "../components/view-header/ViewHeader";
|
import {
|
||||||
|
ViewHeader,
|
||||||
|
ViewHeaderBadge,
|
||||||
|
} from "../components/view-header/ViewHeader";
|
||||||
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
||||||
import { useRealm } from "../context/realm-context/RealmContext";
|
import { useRealm } from "../context/realm-context/RealmContext";
|
||||||
import { RolesList } from "../realm-roles/RolesList";
|
import { RolesList } from "../realm-roles/RolesList";
|
||||||
|
@ -74,13 +80,30 @@ const ClientDetailHeader = ({
|
||||||
save();
|
save();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const badges = useMemo<ViewHeaderBadge[]>(() => {
|
||||||
|
if (!client.protocol) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const text = client.bearerOnly ? (
|
||||||
|
<Tooltip content={t("explainBearerOnly")}>
|
||||||
|
<Label icon={<InfoCircleIcon />}>{client.protocol}</Label>
|
||||||
|
</Tooltip>
|
||||||
|
) : (
|
||||||
|
<Label>{client.protocol}</Label>
|
||||||
|
);
|
||||||
|
|
||||||
|
return [{ text }];
|
||||||
|
}, [client]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DisableConfirm />
|
<DisableConfirm />
|
||||||
<ViewHeader
|
<ViewHeader
|
||||||
titleKey={client ? client.clientId! : ""}
|
titleKey={client ? client.clientId! : ""}
|
||||||
subKey="clients:clientsExplain"
|
subKey="clients:clientsExplain"
|
||||||
badges={[{ text: client.protocol }]}
|
badges={badges}
|
||||||
divider={false}
|
divider={false}
|
||||||
helpTextKey="clients-help:enableDisable"
|
helpTextKey="clients-help:enableDisable"
|
||||||
dropdownItems={[
|
dropdownItems={[
|
||||||
|
|
|
@ -71,6 +71,8 @@ export default {
|
||||||
capabilityConfig: "Capability config",
|
capabilityConfig: "Capability config",
|
||||||
clientsExplain:
|
clientsExplain:
|
||||||
"Clients are applications and services that can request authentication of a user",
|
"Clients are applications and services that can request authentication of a user",
|
||||||
|
explainBearerOnly:
|
||||||
|
"This is a special OIDC type. This client only allows bearer token requests and cannot participate in browser logins.",
|
||||||
createSuccess: "Client created successfully",
|
createSuccess: "Client created successfully",
|
||||||
createError: "Could not create client: '{{error}}'",
|
createError: "Could not create client: '{{error}}'",
|
||||||
clientImportError: "Could not import client: {{error}}",
|
clientImportError: "Could not import client: {{error}}",
|
||||||
|
|
Loading…
Reference in a new issue