fix data list bug

This commit is contained in:
jenny-s51 2021-04-22 16:04:26 -04:00
parent 4182f2bd58
commit 817714df0b
2 changed files with 10 additions and 10 deletions

View file

@ -33,7 +33,7 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
const { t } = useTranslation("roles");
const [name, setName] = useState("");
const adminClient = useAdminClient();
const [selectedRows, setSelectedRows] = useState<RoleRepresentation[]>([]);
const [selectedRows, setSelectedRows] = useState<Role[]>([]);
const errorHandler = useErrorHandler();
const [isFilterDropdownOpen, setIsFilterDropdownOpen] = useState(false);
@ -69,10 +69,10 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
)!.clientId!)
);
return alphabetize(filterDupes).filter((role: RoleRepresentation) => {
return alphabetize(filterDupes).filter((role: Role) => {
return (
props.existingCompositeRoles.find(
(existing: RoleRepresentation) => existing.name === role.name
(existing: Role) => existing.name === role.name
) === undefined && role.name !== name
);
});
@ -116,7 +116,7 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
)!.clientId!)
);
return alphabetize(rolesList).filter((role: RoleRepresentation) => {
return alphabetize(rolesList).filter((role: Role) => {
return (
existingAdditionalRoles.find(
(existing: RoleRepresentation) => existing.name === role.name
@ -170,6 +170,7 @@ export const AssociatedRolesModal = (props: AssociatedRolesModalProps) => {
onClick={() => {
props.toggleDialog();
props.onConfirm(selectedRows);
console.log(selectedRows)
}}
>
{t("common:add")}

View file

@ -13,7 +13,6 @@ import {
import RoleRepresentation from "keycloak-admin/lib/defs/roleRepresentation";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { formattedLinkTableCell } from "../components/external-link/FormattedLink";
import { useAlerts } from "../components/alert/Alerts";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { emptyFormatter } from "../util";
@ -135,7 +134,7 @@ export const AssociatedRolesTab = ({
refresh();
}, [additionalRoles, isInheritedHidden]);
const InheritedRoleName = (role: RoleRepresentation) => {
const InheritedRoleName = (role: Role) => {
return <>{inheritanceMap.current[role.id!]}</>;
};
@ -144,9 +143,9 @@ export const AssociatedRolesTab = ({
<>
{clientId && (
<Label color="blue" key={`label-${id}`}>
{clientId}
</Label>
)}{" "}
{clientId}
</Label>
)}{" "}
{name}
</>
);
@ -268,7 +267,7 @@ export const AssociatedRolesTab = ({
name: "name",
displayKey: "roles:roleName",
cellRenderer: AliasRenderer,
cellFormatters: [formattedLinkTableCell(), emptyFormatter()],
cellFormatters: [emptyFormatter()],
},
{
name: "containerId",