hide popover link when help enabled
This commit is contained in:
parent
74638f9eb3
commit
78a2c76c79
3 changed files with 44 additions and 40 deletions
|
@ -9,7 +9,7 @@ import {
|
|||
Switch,
|
||||
TextContent,
|
||||
} from "@patternfly/react-core";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { HelpIcon, ExternalLinkAltIcon } from "@patternfly/react-icons";
|
||||
|
||||
import "./help-header.css";
|
||||
|
|
|
@ -53,11 +53,12 @@ export const AssociatedRolesTab = ({
|
|||
|
||||
const getSubRoles = async (
|
||||
role: RoleRepresentation,
|
||||
allRoles: RoleRepresentation[],
|
||||
allRoles: RoleRepresentation[]
|
||||
): Promise<RoleRepresentation[]> => {
|
||||
|
||||
// Fetch all composite roles
|
||||
const allCompositeRoles = await adminClient.roles.getCompositeRoles({id: role.id!});
|
||||
const allCompositeRoles = await adminClient.roles.getCompositeRoles({
|
||||
id: role.id!,
|
||||
});
|
||||
|
||||
// Need to ensure we don't get into an infinite loop, do not add any role that is already there or the starting role
|
||||
const newRoles: Promise<RoleRepresentation[]> = allCompositeRoles.reduce(
|
||||
|
@ -86,8 +87,6 @@ export const AssociatedRolesTab = ({
|
|||
return additionalRoles;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const allRoles: Promise<RoleRepresentation[]> = additionalRoles.reduce(
|
||||
async (acc: Promise<RoleRepresentation[]>, role) => {
|
||||
const resolvedRoles = await acc;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React from "react";
|
||||
import React, { useContext } from "react";
|
||||
import { useHistory, useParams } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button, PageSection, Popover } from "@patternfly/react-core";
|
||||
|
@ -8,6 +8,7 @@ import { boolFormatter, emptyFormatter } from "../util";
|
|||
import { useAdminClient } from "../context/auth/AdminClient";
|
||||
import { QuestionCircleIcon } from "@patternfly/react-icons";
|
||||
import { useRealm } from "../context/realm-context/RealmContext";
|
||||
import { HelpContext } from "../components/help-enabler/HelpHeader";
|
||||
|
||||
export const UsersInRoleTab = () => {
|
||||
const history = useHistory();
|
||||
|
@ -29,6 +30,8 @@ export const UsersInRoleTab = () => {
|
|||
return usersWithRole;
|
||||
};
|
||||
|
||||
const { enabled } = useContext(HelpContext);
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageSection data-testid="users-page" variant="light">
|
||||
|
@ -38,6 +41,7 @@ export const UsersInRoleTab = () => {
|
|||
ariaLabelKey="roles:roleList"
|
||||
searchPlaceholderKey=""
|
||||
toolbarItem={
|
||||
enabled && (
|
||||
<Popover
|
||||
aria-label="Basic popover"
|
||||
position="bottom"
|
||||
|
@ -72,6 +76,7 @@ export const UsersInRoleTab = () => {
|
|||
{t("roles:whoWillAppearLinkText")}
|
||||
</Button>
|
||||
</Popover>
|
||||
)
|
||||
}
|
||||
emptyState={
|
||||
<ListEmptyState
|
||||
|
|
Loading…
Reference in a new issue