Remove useless React fragments (#1062)

This commit is contained in:
Jon Koops 2021-08-26 14:15:28 +02:00 committed by GitHub
parent b15c240d9e
commit e062603ff2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 3157 additions and 3328 deletions

View file

@ -30,6 +30,8 @@ module.exports = {
// react/prop-types cannot handle generic props, so we need to disable it. // react/prop-types cannot handle generic props, so we need to disable it.
// https://github.com/yannickcr/eslint-plugin-react/issues/2777#issuecomment-814968432 // https://github.com/yannickcr/eslint-plugin-react/issues/2777#issuecomment-814968432
"react/prop-types": "off", "react/prop-types": "off",
// Prevent fragments from being added that have only a single child.
"react/jsx-no-useless-fragment": "error"
}, },
overrides: [ overrides: [
{ {

View file

@ -27,10 +27,8 @@ export const Header = () => {
const adminClient = useAdminClient(); const adminClient = useAdminClient();
const { t } = useTranslation(); const { t } = useTranslation();
const ManageAccountDropdownItem = () => { const ManageAccountDropdownItem = () =>
return ( adminClient.keycloak ? (
<>
{adminClient.keycloak && (
<DropdownItem <DropdownItem
key="manage account" key="manage account"
id="manage-account" id="manage-account"
@ -38,15 +36,10 @@ export const Header = () => {
> >
{t("manageAccount")} {t("manageAccount")}
</DropdownItem> </DropdownItem>
)} ) : null;
</>
);
};
const SignOutDropdownItem = () => { const SignOutDropdownItem = () =>
return ( adminClient.keycloak ? (
<>
{adminClient.keycloak && (
<DropdownItem <DropdownItem
id="sign-out" id="sign-out"
key="sign out" key="sign out"
@ -54,10 +47,7 @@ export const Header = () => {
> >
{t("signOut")} {t("signOut")}
</DropdownItem> </DropdownItem>
)} ) : null;
</>
);
};
const ServerInfoDropdownItem = () => { const ServerInfoDropdownItem = () => {
const { realm } = useRealm(); const { realm } = useRealm();

View file

@ -107,7 +107,6 @@ export const ClientScopesSection = () => {
}); });
const TypeSelector = (scope: ClientScopeDefaultOptionalType) => ( const TypeSelector = (scope: ClientScopeDefaultOptionalType) => (
<>
<CellDropdown <CellDropdown
clientScope={scope} clientScope={scope}
type={scope.type} type={scope.type}
@ -122,7 +121,6 @@ export const ClientScopesSection = () => {
} }
}} }}
/> />
</>
); );
const ClientScopeDetailLink = ({ const ClientScopeDetailLink = ({
@ -130,14 +128,12 @@ export const ClientScopesSection = () => {
type, type,
name, name,
}: ClientScopeDefaultOptionalType) => ( }: ClientScopeDefaultOptionalType) => (
<>
<Link <Link
key={id} key={id}
to={toClientScope({ realm, id: id!, type, tab: "settings" })} to={toClientScope({ realm, id: id!, type, tab: "settings" })}
> >
{name} {name}
</Link> </Link>
</>
); );
return ( return (
<> <>

View file

@ -128,10 +128,10 @@ export const AddMapperDialog = (props: AddMapperDialogProps) => {
<DataListItemCells <DataListItemCells
dataListCells={[ dataListCells={[
<DataListCell key={`name-${mapper.id}`}> <DataListCell key={`name-${mapper.id}`}>
<>{mapper.name}</> {mapper.name}
</DataListCell>, </DataListCell>,
<DataListCell key={`helpText-${mapper.id}`}> <DataListCell key={`helpText-${mapper.id}`}>
<>{mapper.helpText}</> {mapper.helpText}
</DataListCell>, </DataListCell>,
]} ]}
/> />

View file

@ -99,11 +99,9 @@ export const MapperList = ({ clientScope, refresh }: MapperListProps) => {
); );
const MapperLink = ({ id, name }: Row) => ( const MapperLink = ({ id, name }: Row) => (
<>
<Link to={toMapper({ realm, id: clientScope.id!, mapperId: id! })}> <Link to={toMapper({ realm, id: clientScope.id!, mapperId: id! })}>
{name} {name}
</Link> </Link>
</>
); );
return ( return (

View file

@ -164,7 +164,6 @@ export const MappingDetails = () => {
onSubmit={handleSubmit(save)} onSubmit={handleSubmit(save)}
role="manage-clients" role="manage-clients"
> >
<>
{!mapperId.match(isGuid) && ( {!mapperId.match(isGuid) && (
<FormGroup <FormGroup
label={t("common:name")} label={t("common:name")}
@ -178,9 +177,7 @@ export const MappingDetails = () => {
fieldId="name" fieldId="name"
isRequired isRequired
validated={ validated={
errors.name errors.name ? ValidatedOptions.error : ValidatedOptions.default
? ValidatedOptions.error
: ValidatedOptions.default
} }
helperTextInvalid={t("common:required")} helperTextInvalid={t("common:required")}
> >
@ -197,7 +194,6 @@ export const MappingDetails = () => {
/> />
</FormGroup> </FormGroup>
)} )}
</>
<FormGroup <FormGroup
label={t("realmRolePrefix")} label={t("realmRolePrefix")}
labelIcon={ labelIcon={

View file

@ -38,7 +38,6 @@ export const ClientSettings = ({ save, reset }: ClientSettingsProps) => {
); );
return ( return (
<>
<ScrollForm <ScrollForm
className="pf-u-px-lg" className="pf-u-px-lg"
sections={[ sections={[
@ -174,6 +173,8 @@ export const ClientSettings = ({ save, reset }: ClientSettingsProps) => {
<SelectOption key="empty" value=""> <SelectOption key="empty" value="">
{t("common:choose")} {t("common:choose")}
</SelectOption> </SelectOption>
{/* The type for the children of Select are incorrect, so we need a fragment here. */}
{/* eslint-disable-next-line react/jsx-no-useless-fragment */}
<> <>
{loginThemes?.map((theme) => ( {loginThemes?.map((theme) => (
<SelectOption <SelectOption
@ -236,9 +237,7 @@ export const ClientSettings = ({ save, reset }: ClientSettingsProps) => {
id="kc-consent-screen-text" id="kc-consent-screen-text"
name="attributes.consent-screen-text" name="attributes.consent-screen-text"
ref={register} ref={register}
isDisabled={ isDisabled={!(consentRequired && displayOnConsentScreen === "true")}
!(consentRequired && displayOnConsentScreen === "true")
}
/> />
</FormGroup> </FormGroup>
<SaveReset <SaveReset
@ -249,6 +248,5 @@ export const ClientSettings = ({ save, reset }: ClientSettingsProps) => {
/> />
</FormAccess> </FormAccess>
</ScrollForm> </ScrollForm>
</>
); );
}; };

View file

@ -70,7 +70,6 @@ export const ClientsSection = () => {
}); });
const ClientDetailLink = (client: ClientRepresentation) => ( const ClientDetailLink = (client: ClientRepresentation) => (
<>
<Link <Link
key={client.id} key={client.id}
to={toClient({ realm, clientId: client.id!, tab: "settings" })} to={toClient({ realm, clientId: client.id!, tab: "settings" })}
@ -82,15 +81,12 @@ export const ClientsSection = () => {
</Badge> </Badge>
)} )}
</Link> </Link>
</>
); );
const ClientDescription = (client: ClientRepresentation) => ( const ClientDescription = (client: ClientRepresentation) => (
<>
<TableText wrapModifier="truncate"> <TableText wrapModifier="truncate">
{emptyFormatter()(client.description)} {emptyFormatter()(client.description)}
</TableText> </TableText>
</>
); );
return ( return (

View file

@ -38,7 +38,6 @@ export const CapabilityConfig = ({
unWrap={unWrap} unWrap={unWrap}
className="keycloak__capability-config__form" className="keycloak__capability-config__form"
> >
<>
{protocol === "openid-connect" && ( {protocol === "openid-connect" && (
<> <>
<FormGroup <FormGroup
@ -231,8 +230,6 @@ export const CapabilityConfig = ({
</FormGroup> </FormGroup>
</> </>
)} )}
</>
<>
{protocol === "saml" && ( {protocol === "saml" && (
<> <>
<FormGroup <FormGroup
@ -295,7 +292,6 @@ export const CapabilityConfig = ({
</FormGroup> </FormGroup>
</> </>
)} )}
</>
</FormAccess> </FormAccess>
); );
}; };

View file

@ -21,7 +21,6 @@ export const SignedJWT = () => {
const [open, isOpen] = useState(false); const [open, isOpen] = useState(false);
return ( return (
<>
<FormGroup <FormGroup
label={t("signatureAlgorithm")} label={t("signatureAlgorithm")}
fieldId="kc-signature-algorithm" fieldId="kc-signature-algorithm"
@ -67,6 +66,5 @@ export const SignedJWT = () => {
)} )}
/> />
</FormGroup> </FormGroup>
</>
); );
}; };

View file

@ -153,9 +153,8 @@ export const Keys = ({ clientId, save }: KeysProps) => {
)} )}
/> />
</FormGroup> </FormGroup>
{useJwksUrl !== "true" && ( {useJwksUrl !== "true" &&
<> (keyInfo ? (
{keyInfo ? (
<FormGroup <FormGroup
label={t("certificate")} label={t("certificate")}
fieldId="certificate" fieldId="certificate"
@ -176,9 +175,7 @@ export const Keys = ({ clientId, save }: KeysProps) => {
</FormGroup> </FormGroup>
) : ( ) : (
"No client certificate configured" "No client certificate configured"
)} ))}
</>
)}
{useJwksUrl === "true" && ( {useJwksUrl === "true" && (
<FormGroup <FormGroup
label={t("jwksUrl")} label={t("jwksUrl")}

View file

@ -140,7 +140,6 @@ export const ClientScopes = ({ clientId, protocol }: ClientScopesProps) => {
}; };
const TypeSelector = (scope: Row) => ( const TypeSelector = (scope: Row) => (
<>
<CellDropdown <CellDropdown
clientScope={scope} clientScope={scope}
type={scope.type} type={scope.type}
@ -160,7 +159,6 @@ export const ClientScopes = ({ clientId, protocol }: ClientScopesProps) => {
} }
}} }}
/> />
</>
); );
return ( return (

View file

@ -97,9 +97,7 @@ export const ServiceAccount = ({ client }: ServiceAccountProps) => {
addError("clients:roleMappingUpdatedError", error); addError("clients:roleMappingUpdatedError", error);
} }
}; };
return ( return serviceAccount ? (
<>
{serviceAccount && (
<RoleMapping <RoleMapping
name={client.clientId!} name={client.clientId!}
id={serviceAccount.id!} id={serviceAccount.id!}
@ -108,7 +106,5 @@ export const ServiceAccount = ({ client }: ServiceAccountProps) => {
save={assignRoles} save={assignRoles}
onHideRolesToggle={() => setHide(!hide)} onHideRolesToggle={() => setHide(!hide)}
/> />
)} ) : null;
</>
);
}; };

View file

@ -75,7 +75,6 @@ export const AttributesForm = ({
}, [fields]); }, [fields]);
return ( return (
<>
<FormAccess role="manage-realm" onSubmit={handleSubmit(save)}> <FormAccess role="manage-realm" onSubmit={handleSubmit(save)}>
<TableComposable <TableComposable
className="kc-attributes__table" className="kc-attributes__table"
@ -178,15 +177,10 @@ export const AttributesForm = ({
<Button variant="primary" type="submit" isDisabled={!watchLast}> <Button variant="primary" type="submit" isDisabled={!watchLast}>
{t("common:save")} {t("common:save")}
</Button> </Button>
<Button <Button onClick={reset} variant="link" isDisabled={!formState.isDirty}>
onClick={reset}
variant="link"
isDisabled={!formState.isDirty}
>
{t("common:revert")} {t("common:revert")}
</Button> </Button>
</ActionGroup> </ActionGroup>
</FormAccess> </FormAccess>
</>
); );
}; };

View file

@ -22,9 +22,7 @@ export const GroupBreadCrumbs = () => {
}); });
}, [history]); }, [history]);
return ( return subGroups.length !== 0 ? (
<>
{subGroups.length !== 0 && (
<Breadcrumb> <Breadcrumb>
<BreadcrumbItem key="home"> <BreadcrumbItem key="home">
<Link to={`/${realm}/groups`}>{t("groups")}</Link> <Link to={`/${realm}/groups`}>{t("groups")}</Link>
@ -45,14 +43,10 @@ export const GroupBreadCrumbs = () => {
</Link> </Link>
)} )}
{isLastGroup && {isLastGroup &&
(group.id === "search" (group.id === "search" ? group.name : t("groups:groupDetails"))}
? group.name
: t("groups:groupDetails"))}
</BreadcrumbItem> </BreadcrumbItem>
); );
})} })}
</Breadcrumb> </Breadcrumb>
)} ) : null;
</>
);
}; };

View file

@ -37,7 +37,7 @@ export const PageBreadCrumbs = () => {
{crumbs.map(({ match, breadcrumb: crumb }, i) => ( {crumbs.map(({ match, breadcrumb: crumb }, i) => (
<BreadcrumbItem key={i} isActive={crumbs.length - 1 === i}> <BreadcrumbItem key={i} isActive={crumbs.length - 1 === i}>
{crumbs.length - 1 !== i && <Link to={match.url}>{crumb}</Link>} {crumbs.length - 1 !== i && <Link to={match.url}>{crumb}</Link>}
{crumbs.length - 1 === i && <>{crumb}</>} {crumbs.length - 1 === i && crumb}
</BreadcrumbItem> </BreadcrumbItem>
))} ))}
</Breadcrumb> </Breadcrumb>

View file

@ -24,11 +24,9 @@ export const ErrorRenderer = ({ error, resetErrorBoundary }: FallbackProps) => {
/> />
} }
actionLinks={ actionLinks={
<React.Fragment>
<AlertActionLink onClick={resetErrorBoundary}> <AlertActionLink onClick={resetErrorBoundary}>
{t("retry")} {t("retry")}
</AlertActionLink> </AlertActionLink>
</React.Fragment>
} }
></Alert> ></Alert>
</PageSection> </PageSection>

View file

@ -192,7 +192,7 @@ export const GroupPickerDialog = ({
{group.name} {group.name}
</Button> </Button>
)} )}
{navigation.length - 1 === i && <>{group.name}</>} {navigation.length - 1 === i && group.name}
</BreadcrumbItem> </BreadcrumbItem>
))} ))}
</Breadcrumb> </Breadcrumb>
@ -255,7 +255,7 @@ export const GroupPickerDialog = ({
dataListCells={[ dataListCells={[
<DataListCell key={`name-${group.id}`}> <DataListCell key={`name-${group.id}`}>
{filter === "" ? ( {filter === "" ? (
<>{group.name}</> group.name
) : ( ) : (
<GroupPath group={findSubGroup(group, filter)} /> <GroupPath group={findSubGroup(group, filter)} />
)} )}

View file

@ -23,13 +23,9 @@ export const HelpItem = ({
}: HelpItemProps) => { }: HelpItemProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { enabled } = useHelp(); const { enabled } = useHelp();
return ( return enabled ? (
<>
{enabled && (
<Popover <Popover
bodyContent={ bodyContent={isValidElement(helpText) ? helpText : t(helpText as string)}
isValidElement(helpText) ? helpText : t(helpText as string)
}
> >
<> <>
{!unWrap && ( {!unWrap && (
@ -46,7 +42,5 @@ export const HelpItem = ({
{unWrap && <HelpIcon noVerticalAlign={noVerticalAlign} />} {unWrap && <HelpIcon noVerticalAlign={noVerticalAlign} />}
</> </>
</Popover> </Popover>
)} ) : null;
</>
);
}; };

View file

@ -40,7 +40,6 @@ export const ListEmptyState = ({
icon, icon,
}: ListEmptyStateProps) => { }: ListEmptyStateProps) => {
return ( return (
<>
<EmptyState data-testid="empty-state" variant="large"> <EmptyState data-testid="empty-state" variant="large">
{hasIcon && isSearchVariant ? ( {hasIcon && isSearchVariant ? (
<EmptyStateIcon icon={SearchIcon} /> <EmptyStateIcon icon={SearchIcon} />
@ -76,6 +75,5 @@ export const ListEmptyState = ({
</EmptyStateSecondaryActions> </EmptyStateSecondaryActions>
)} )}
</EmptyState> </EmptyState>
</>
); );
}; };

View file

@ -427,12 +427,7 @@ export function KeycloakDataTable<T>({
{loading && <Loading />} {loading && <Loading />}
</PaginatingTableToolbar> </PaginatingTableToolbar>
)} )}
<> {!loading && (!data || data?.length === 0) && search === "" && emptyState}
{!loading &&
(!data || data?.length === 0) &&
search === "" &&
emptyState}
</>
</> </>
); );
} }

View file

@ -73,7 +73,7 @@ export const PaginatingTableToolbar: FunctionComponent<TableToolbarProps> = ({
} }
subToolbar={subToolbar} subToolbar={subToolbar}
toolbarItemFooter={ toolbarItemFooter={
count !== 0 ? <ToolbarItem>{pagination("bottom")}</ToolbarItem> : <></> count !== 0 ? <ToolbarItem>{pagination("bottom")}</ToolbarItem> : null
} }
inputGroupName={inputGroupName} inputGroupName={inputGroupName}
inputGroupPlaceholder={inputGroupPlaceholder} inputGroupPlaceholder={inputGroupPlaceholder}

View file

@ -1,6 +1,5 @@
import React, { import React, {
FormEvent, FormEvent,
Fragment,
FunctionComponent, FunctionComponent,
ReactNode, ReactNode,
useState, useState,
@ -74,7 +73,6 @@ export const TableToolbar: FunctionComponent<TableToolbarProps> = ({
<> <>
<Toolbar> <Toolbar>
<ToolbarContent> <ToolbarContent>
<Fragment>
{inputGroupName && ( {inputGroupName && (
<ToolbarItem> <ToolbarItem>
<InputGroup> <InputGroup>
@ -102,7 +100,6 @@ export const TableToolbar: FunctionComponent<TableToolbarProps> = ({
</InputGroup> </InputGroup>
</ToolbarItem> </ToolbarItem>
)} )}
</Fragment>
{toolbarItem} {toolbarItem}
</ToolbarContent> </ToolbarContent>
</Toolbar> </Toolbar>

View file

@ -101,7 +101,7 @@ export const ViewHeader = ({
</Badge>{" "} </Badge>{" "}
</Fragment> </Fragment>
)} )}
{isValidElement(badge.text) && <>{badge.text}</>}{" "} {isValidElement(badge.text) && badge.text}{" "}
</Fragment> </Fragment>
))} ))}
</LevelItem> </LevelItem>

View file

@ -125,14 +125,10 @@ const Dashboard = () => {
{feature}{" "} {feature}{" "}
{isExperimentalFeature(feature) ? ( {isExperimentalFeature(feature) ? (
<Label color="orange">{t("experimental")}</Label> <Label color="orange">{t("experimental")}</Label>
) : ( ) : null}
<></>
)}
{isPreviewFeature(feature) ? ( {isPreviewFeature(feature) ? (
<Label color="blue">{t("preview")}</Label> <Label color="blue">{t("preview")}</Label>
) : ( ) : null}
<></>
)}
</ListItem> </ListItem>
))} ))}
</List> </List>

View file

@ -137,7 +137,6 @@ export const AdminEvents = () => {
}; };
const LinkResource = (row: AdminEventRepresentation) => ( const LinkResource = (row: AdminEventRepresentation) => (
<>
<Truncate text={row.resourcePath}> <Truncate text={row.resourcePath}>
{(text) => ( {(text) => (
<> <>
@ -154,12 +153,10 @@ export const AdminEvents = () => {
</> </>
)} )}
</Truncate> </Truncate>
</>
); );
const adminEventSearchFormDisplay = () => { const adminEventSearchFormDisplay = () => {
return ( return (
<>
<Flex <Flex
direction={{ default: "column" }} direction={{ default: "column" }}
spaceItems={{ default: "spaceItemsNone" }} spaceItems={{ default: "spaceItemsNone" }}
@ -295,7 +292,6 @@ export const AdminEvents = () => {
</Button> </Button>
</FlexItem> </FlexItem>
</Flex> </Flex>
</>
); );
}; };

View file

@ -77,7 +77,6 @@ export const GroupTable = () => {
}; };
const GroupNameCell = (group: GroupRepresentation) => ( const GroupNameCell = (group: GroupRepresentation) => (
<>
<Link <Link
key={group.id} key={group.id}
to={`${location.pathname}/${group.id}`} to={`${location.pathname}/${group.id}`}
@ -87,7 +86,6 @@ export const GroupTable = () => {
> >
{group.name} {group.name}
</Link> </Link>
</>
); );
const handleModalToggle = () => { const handleModalToggle = () => {

View file

@ -99,11 +99,9 @@ export const Members = () => {
}; };
const UserDetailLink = (user: MembersOf) => ( const UserDetailLink = (user: MembersOf) => (
<>
<Link key={user.id} to={toUser({ realm, id: user.id!, tab: "settings" })}> <Link key={user.id} to={toUser({ realm, id: user.id!, tab: "settings" })}>
{user.username} {user.username}
</Link> </Link>
</>
); );
return ( return (
<> <>

View file

@ -62,7 +62,6 @@ export const SearchGroups = () => {
}; };
const GroupNameCell = (group: SearchGroup) => ( const GroupNameCell = (group: SearchGroup) => (
<>
<Link <Link
key={group.id} key={group.id}
to={`/${realm}/groups/search/${group.link}`} to={`/${realm}/groups/search/${group.link}`}
@ -72,7 +71,6 @@ export const SearchGroups = () => {
> >
{group.name} {group.name}
</Link> </Link>
</>
); );
const flatten = ( const flatten = (

View file

@ -70,7 +70,6 @@ export const IdentityProvidersSection = () => {
const loader = () => Promise.resolve(_.sortBy(providers, "alias")); const loader = () => Promise.resolve(_.sortBy(providers, "alias"));
const DetailLink = (identityProvider: IdentityProviderRepresentation) => ( const DetailLink = (identityProvider: IdentityProviderRepresentation) => (
<>
<Link <Link
key={identityProvider.providerId} key={identityProvider.providerId}
to={`/${realm}/identity-providers/${identityProvider.providerId}/settings`} to={`/${realm}/identity-providers/${identityProvider.providerId}/settings`}
@ -86,7 +85,6 @@ export const IdentityProvidersSection = () => {
</Badge> </Badge>
)} )}
</Link> </Link>
</>
); );
const navigateToCreate = (providerId: string) => const navigateToCreate = (providerId: string) =>

View file

@ -64,6 +64,8 @@ const LoginFlow = ({
aria-label={t(label)} aria-label={t(label)}
isOpen={open} isOpen={open}
> >
{/* The type for the children of Select are incorrect, so we need a fragment here. */}
{/* eslint-disable-next-line react/jsx-no-useless-fragment */}
<> <>
{defaultValue === "" && ( {defaultValue === "" && (
<SelectOption key="empty" value={defaultValue}> <SelectOption key="empty" value={defaultValue}>
@ -71,6 +73,8 @@ const LoginFlow = ({
</SelectOption> </SelectOption>
)} )}
</> </>
{/* The type for the children of Select are incorrect, so we need a fragment here. */}
{/* eslint-disable-next-line react/jsx-no-useless-fragment */}
<> <>
{flows?.map((option) => ( {flows?.map((option) => (
<SelectOption <SelectOption

View file

@ -32,7 +32,6 @@ export const ExtendedNonDiscoverySettings = () => {
const [promptOpen, setPromptOpen] = useState(false); const [promptOpen, setPromptOpen] = useState(false);
return ( return (
<>
<ExpandableSection <ExpandableSection
toggleText={t("advanced")} toggleText={t("advanced")}
onToggle={() => setIsExpanded(!isExpanded)} onToggle={() => setIsExpanded(!isExpanded)}
@ -115,12 +114,8 @@ export const ExtendedNonDiscoverySettings = () => {
)} )}
/> />
</FormGroup> </FormGroup>
<TextField <TextField field="config.forwardParameters" label="forwardParameters" />
field="config.forwardParameters"
label="forwardParameters"
/>
</Form> </Form>
</ExpandableSection> </ExpandableSection>
</>
); );
}; };

View file

@ -41,6 +41,6 @@ export const FontAwesomeIcon = ({ icon }: FontAwesomeIconProps) => {
/> />
); );
default: default:
return <></>; return null;
} }
}; };

View file

@ -28,7 +28,7 @@ export const AliasRendererComponent = ({
}, [containerId]); }, [containerId]);
if (filterType === "roles" || !containerName) { if (filterType === "roles" || !containerName) {
return <>{name}</>; return name;
} }
if (filterType === "clients" || containerName) { if (filterType === "clients" || containerName) {

View file

@ -134,9 +134,8 @@ export const AssociatedRolesTab = ({
refresh(); refresh();
}, [additionalRoles, isInheritedHidden]); }, [additionalRoles, isInheritedHidden]);
const InheritedRoleName = (role: RoleRepresentation) => { const InheritedRoleName = (role: RoleRepresentation) =>
return <>{inheritanceMap.current[role.id!]}</>; inheritanceMap.current[role.id!];
};
const AliasRenderer = ({ id, name, clientId }: Role) => { const AliasRenderer = ({ id, name, clientId }: Role) => {
return ( return (
@ -201,7 +200,6 @@ export const AssociatedRolesTab = ({
const goToCreate = () => history.push(`${url}/add-role`); const goToCreate = () => history.push(`${url}/add-role`);
return ( return (
<>
<PageSection variant="light" padding={{ default: "noPadding" }}> <PageSection variant="light" padding={{ default: "noPadding" }}>
<DeleteConfirm /> <DeleteConfirm />
<DeleteAssociatedRolesConfirm /> <DeleteAssociatedRolesConfirm />
@ -293,6 +291,5 @@ export const AssociatedRolesTab = ({
} }
/> />
</PageSection> </PageSection>
</>
); );
}; };

View file

@ -45,7 +45,6 @@ export const RoleAttributes = ({
const watchFirstKey = watch("attributes[0].key", ""); const watchFirstKey = watch("attributes[0].key", "");
return ( return (
<>
<FormAccess role="manage-realm"> <FormAccess role="manage-realm">
<TableComposable <TableComposable
className="kc-role-attributes__table" className="kc-role-attributes__table"
@ -153,6 +152,5 @@ export const RoleAttributes = ({
</Button> </Button>
</ActionGroup> </ActionGroup>
</FormAccess> </FormAccess>
</>
); );
}; };

View file

@ -126,11 +126,7 @@ export const RolesList = ({
ariaLabelKey="roles:roleList" ariaLabelKey="roles:roleList"
searchPlaceholderKey="roles:searchFor" searchPlaceholderKey="roles:searchFor"
isPaginated={paginated} isPaginated={paginated}
toolbarItem={ toolbarItem={<Button onClick={goToCreate}>{t("createRole")}</Button>}
<>
<Button onClick={goToCreate}>{t("createRole")}</Button>
</>
}
actions={[ actions={[
{ {
title: t("common:delete"), title: t("common:delete"),

View file

@ -42,7 +42,6 @@ export const UsersInRoleTab = () => {
const { enabled } = useHelp(); const { enabled } = useHelp();
return ( return (
<>
<PageSection data-testid="users-page" variant="light"> <PageSection data-testid="users-page" variant="light">
<KeycloakDataTable <KeycloakDataTable
isPaginated isPaginated
@ -138,6 +137,5 @@ export const UsersInRoleTab = () => {
]} ]}
/> />
</PageSection> </PageSection>
</>
); );
}; };

View file

@ -49,7 +49,6 @@ export const RealmSettingsGeneralTab = ({
const requireSslTypes = ["all", "external", "none"]; const requireSslTypes = ["all", "external", "none"];
return ( return (
<>
<PageSection variant="light"> <PageSection variant="light">
<FormAccess <FormAccess
isHorizontal isHorizontal
@ -75,10 +74,7 @@ export const RealmSettingsGeneralTab = ({
ref={register} ref={register}
/> />
</FormGroup> </FormGroup>
<FormGroup <FormGroup label={t("htmlDisplayName")} fieldId="kc-html-display-name">
label={t("htmlDisplayName")}
fieldId="kc-html-display-name"
>
<TextInput <TextInput
type="text" type="text"
id="kc-html-display-name" id="kc-html-display-name"
@ -215,6 +211,5 @@ export const RealmSettingsGeneralTab = ({
</ActionGroup> </ActionGroup>
</FormAccess> </FormAccess>
</PageSection> </PageSection>
</>
); );
}; };

View file

@ -130,14 +130,11 @@ export const KeysListTab = ({ realmComponents }: KeysListTabProps) => {
const goToCreate = () => history.push(`${url}/add-role`); const goToCreate = () => history.push(`${url}/add-role`);
const ProviderRenderer = ({ provider }: KeyData) => { const ProviderRenderer = ({ provider }: KeyData) => provider;
return <>{provider}</>;
};
const ButtonRenderer = ({ type, publicKey, certificate }: KeyData) => { const ButtonRenderer = ({ type, publicKey, certificate }: KeyData) => {
if (type === "EC") { if (type === "EC") {
return ( return (
<>
<Button <Button
onClick={() => { onClick={() => {
togglePublicKeyDialog(); togglePublicKeyDialog();
@ -148,11 +145,9 @@ export const KeysListTab = ({ realmComponents }: KeysListTabProps) => {
> >
{t("realm-settings:publicKeys").slice(0, -1)} {t("realm-settings:publicKeys").slice(0, -1)}
</Button> </Button>
</>
); );
} else if (type === "RSA") { } else if (type === "RSA") {
return ( return (
<>
<div className="button-wrapper"> <div className="button-wrapper">
<Button <Button
onClick={() => { onClick={() => {
@ -175,7 +170,6 @@ export const KeysListTab = ({ realmComponents }: KeysListTabProps) => {
{t("realm-settings:certificate")} {t("realm-settings:certificate")}
</Button> </Button>
</div> </div>
</>
); );
} }
}; };
@ -200,7 +194,6 @@ export const KeysListTab = ({ realmComponents }: KeysListTabProps) => {
]; ];
return ( return (
<>
<PageSection variant="light" padding={{ default: "noPadding" }}> <PageSection variant="light" padding={{ default: "noPadding" }}>
<PublicKeyDialog /> <PublicKeyDialog />
<CertificateDialog /> <CertificateDialog />
@ -287,6 +280,5 @@ export const KeysListTab = ({ realmComponents }: KeysListTabProps) => {
} }
/> />
</PageSection> </PageSection>
</>
); );
}; };

View file

@ -256,7 +256,6 @@ export const KeysTabInner = ({ components, refresh }: KeysTabInnerProps) => {
<DeleteConfirm /> <DeleteConfirm />
<PageSection variant="light" padding={{ default: "noPadding" }}> <PageSection variant="light" padding={{ default: "noPadding" }}>
<Toolbar> <Toolbar>
<>
<ToolbarGroup className="providers-toolbar"> <ToolbarGroup className="providers-toolbar">
<ToolbarItem> <ToolbarItem>
<InputGroup> <InputGroup>
@ -309,7 +308,6 @@ export const KeysTabInner = ({ components, refresh }: KeysTabInnerProps) => {
/> />
</ToolbarItem> </ToolbarItem>
</ToolbarGroup> </ToolbarGroup>
</>
</Toolbar> </Toolbar>
<DataList <DataList
aria-label={t("groups")} aria-label={t("groups")}
@ -375,7 +373,6 @@ export const KeysTabInner = ({ components, refresh }: KeysTabInnerProps) => {
data-testid="provider-name" data-testid="provider-name"
key={`name-${idx}`} key={`name-${idx}`}
> >
<>
<Link <Link
key={component.name} key={component.name}
data-testid="provider-name-link" data-testid="provider-name-link"
@ -383,13 +380,12 @@ export const KeysTabInner = ({ components, refresh }: KeysTabInnerProps) => {
> >
{component.name} {component.name}
</Link> </Link>
</>
</DataListCell>, </DataListCell>,
<DataListCell key={`providerId-${idx}`}> <DataListCell key={`providerId-${idx}`}>
<>{component.providerId}</> {component.providerId}
</DataListCell>, </DataListCell>,
<DataListCell key={`providerDescription-${idx}`}> <DataListCell key={`providerDescription-${idx}`}>
<>{component.providerDescription}</> {component.providerDescription}
</DataListCell>, </DataListCell>,
<DataListAction <DataListAction
aria-labelledby="data-list-action" aria-labelledby="data-list-action"

View file

@ -18,12 +18,8 @@ export const RealmSettingsLoginTab = ({
const { t } = useTranslation("realm-settings"); const { t } = useTranslation("realm-settings");
return ( return (
<>
<PageSection variant="light"> <PageSection variant="light">
<FormPanel <FormPanel className="kc-login-screen" title="Login screen customization">
className="kc-login-screen"
title="Login screen customization"
>
<FormAccess isHorizontal role="manage-realm"> <FormAccess isHorizontal role="manage-realm">
<FormGroup <FormGroup
label={t("userRegistration")} label={t("userRegistration")}
@ -210,6 +206,5 @@ export const RealmSettingsLoginTab = ({
</FormAccess> </FormAccess>
</FormPanel> </FormPanel>
</PageSection> </PageSection>
</>
); );
}; };

View file

@ -53,7 +53,6 @@ export const EditProviderCrumb = () => {
const { realm } = useRealm(); const { realm } = useRealm();
return ( return (
<>
<Breadcrumb> <Breadcrumb>
<BreadcrumbItem <BreadcrumbItem
render={(props) => ( render={(props) => (
@ -65,7 +64,6 @@ export const EditProviderCrumb = () => {
<BreadcrumbItem>{t("providers")}</BreadcrumbItem> <BreadcrumbItem>{t("providers")}</BreadcrumbItem>
<BreadcrumbItem isActive>{t("editProvider")}</BreadcrumbItem> <BreadcrumbItem isActive>{t("editProvider")}</BreadcrumbItem>
</Breadcrumb> </Breadcrumb>
</>
); );
}; };

View file

@ -70,7 +70,6 @@ export const RealmSettingsSessionsTab = ({
}; };
return ( return (
<>
<PageSection variant="light"> <PageSection variant="light">
<FormPanel <FormPanel
title={t("SSOSessionSettings")} title={t("SSOSessionSettings")}
@ -453,6 +452,5 @@ export const RealmSettingsSessionsTab = ({
</FormAccess> </FormAccess>
</FormPanel> </FormPanel>
</PageSection> </PageSection>
</>
); );
}; };

View file

@ -55,7 +55,6 @@ export const RealmSettingsThemesTab = ({
}); });
return ( return (
<>
<PageSection variant="light"> <PageSection variant="light">
<FormAccess <FormAccess
isHorizontal isHorizontal
@ -350,11 +349,7 @@ export const RealmSettingsThemesTab = ({
</> </>
)} )}
<ActionGroup> <ActionGroup>
<Button <Button variant="primary" type="submit" data-testid="themes-tab-save">
variant="primary"
type="submit"
data-testid="themes-tab-save"
>
{t("common:save")} {t("common:save")}
</Button> </Button>
<Button variant="link" onClick={reset}> <Button variant="link" onClick={reset}>
@ -363,6 +358,5 @@ export const RealmSettingsThemesTab = ({
</ActionGroup> </ActionGroup>
</FormAccess> </FormAccess>
</PageSection> </PageSection>
</>
); );
}; };

View file

@ -101,7 +101,6 @@ export const RealmSettingsTokensTab = ({
} }
}; };
return ( return (
<>
<PageSection variant="light"> <PageSection variant="light">
<FormPanel <FormPanel
title={t("realm-settings:general")} title={t("realm-settings:general")}
@ -539,6 +538,5 @@ export const RealmSettingsTokensTab = ({
</FormAccess> </FormAccess>
</FormPanel> </FormPanel>
</PageSection> </PageSection>
</>
); );
}; };

View file

@ -39,15 +39,13 @@ export function EventsTypeTable({
onSelect={onSelect ? onSelect : undefined} onSelect={onSelect ? onSelect : undefined}
canSelectAll={!!onSelect} canSelectAll={!!onSelect}
toolbarItem={ toolbarItem={
<> addTypes && (
{addTypes && (
<ToolbarItem> <ToolbarItem>
<Button id="addTypes" onClick={addTypes} data-testid="addTypes"> <Button id="addTypes" onClick={addTypes} data-testid="addTypes">
{t("addSavedTypes")} {t("addSavedTypes")}
</Button> </Button>
</ToolbarItem> </ToolbarItem>
)} )
</>
} }
actions={ actions={
!onDelete !onDelete

View file

@ -195,7 +195,6 @@ export const AESGeneratedForm = ({
/> />
)} )}
{editMode && ( {editMode && (
<>
<TextInput <TextInput
ref={form.register()} ref={form.register()}
type="text" type="text"
@ -208,7 +207,6 @@ export const AESGeneratedForm = ({
: ValidatedOptions.default : ValidatedOptions.default
} }
/> />
</>
)} )}
</FormGroup> </FormGroup>
<FormGroup <FormGroup

View file

@ -194,7 +194,6 @@ export const ECDSAGeneratedForm = ({
/> />
)} )}
{editMode && ( {editMode && (
<>
<TextInput <TextInput
ref={form.register()} ref={form.register()}
type="text" type="text"
@ -207,7 +206,6 @@ export const ECDSAGeneratedForm = ({
: ValidatedOptions.default : ValidatedOptions.default
} }
/> />
</>
)} )}
</FormGroup> </FormGroup>
<FormGroup <FormGroup

View file

@ -202,7 +202,6 @@ export const HMACGeneratedForm = ({
/> />
)} )}
{editMode && ( {editMode && (
<>
<TextInput <TextInput
ref={form.register()} ref={form.register()}
type="text" type="text"
@ -215,7 +214,6 @@ export const HMACGeneratedForm = ({
: ValidatedOptions.default : ValidatedOptions.default
} }
/> />
</>
)} )}
</FormGroup> </FormGroup>
<FormGroup <FormGroup

View file

@ -209,7 +209,6 @@ export const JavaKeystoreForm = ({
/> />
)} )}
{editMode && ( {editMode && (
<>
<TextInput <TextInput
ref={form.register()} ref={form.register()}
type="text" type="text"
@ -222,7 +221,6 @@ export const JavaKeystoreForm = ({
: ValidatedOptions.default : ValidatedOptions.default
} }
/> />
</>
)} )}
</FormGroup> </FormGroup>
<FormGroup <FormGroup

View file

@ -203,7 +203,6 @@ export const RSAGeneratedForm = ({
/> />
)} )}
{editMode && ( {editMode && (
<>
<TextInput <TextInput
ref={form.register()} ref={form.register()}
type="text" type="text"
@ -216,7 +215,6 @@ export const RSAGeneratedForm = ({
: ValidatedOptions.default : ValidatedOptions.default
} }
/> />
</>
)} )}
</FormGroup> </FormGroup>
<FormGroup <FormGroup

View file

@ -212,7 +212,6 @@ export const RSAForm = ({
/> />
)} )}
{editMode && ( {editMode && (
<>
<TextInput <TextInput
ref={form.register()} ref={form.register()}
type="text" type="text"
@ -225,7 +224,6 @@ export const RSAForm = ({
: ValidatedOptions.default : ValidatedOptions.default
} }
/> />
</>
)} )}
</FormGroup> </FormGroup>
<FormGroup <FormGroup

View file

@ -316,9 +316,7 @@ export const KerberosSettingsRequired = ({
)} )}
></Controller> ></Controller>
</FormGroup> </FormGroup>
) : ( ) : null}
<></>
)}
<FormGroup <FormGroup
label={t("updateFirstLogin")} label={t("updateFirstLogin")}

View file

@ -15,7 +15,6 @@ export const LdapMapperHardcodedLdapGroup = ({
const helpText = useTranslation("user-federation-help").t; const helpText = useTranslation("user-federation-help").t;
return ( return (
<>
<FormGroup <FormGroup
label={t("group")} label={t("group")}
labelIcon={ labelIcon={
@ -42,6 +41,5 @@ export const LdapMapperHardcodedLdapGroup = ({
} }
/> />
</FormGroup> </FormGroup>
</>
); );
}; };

View file

@ -76,9 +76,7 @@ export const LdapMapperList = () => {
}; };
const MapperLink = (mapper: ComponentRepresentation) => ( const MapperLink = (mapper: ComponentRepresentation) => (
<>
<Link to={`${getUrl(url)}/${mapper.id}`}>{mapper.name}</Link> <Link to={`${getUrl(url)}/${mapper.id}`}>{mapper.name}</Link>
</>
); );
return ( return (

View file

@ -15,7 +15,6 @@ export const LdapMapperMsadUserAccount = ({
const helpText = useTranslation("user-federation-help").t; const helpText = useTranslation("user-federation-help").t;
return ( return (
<>
<FormGroup <FormGroup
label={t("passwordPolicyHintsEnabled")} label={t("passwordPolicyHintsEnabled")}
labelIcon={ labelIcon={
@ -44,6 +43,5 @@ export const LdapMapperMsadUserAccount = ({
)} )}
></Controller> ></Controller>
</FormGroup> </FormGroup>
</>
); );
}; };

View file

@ -173,7 +173,6 @@ export const LdapMapperUserAttribute = ({
></Controller> ></Controller>
</FormGroup> </FormGroup>
{mapperType === "certificate-ldap-mapper" ? ( {mapperType === "certificate-ldap-mapper" ? (
<>
<FormGroup <FormGroup
label={t("derFormatted")} label={t("derFormatted")}
labelIcon={ labelIcon={
@ -202,10 +201,7 @@ export const LdapMapperUserAttribute = ({
)} )}
></Controller> ></Controller>
</FormGroup> </FormGroup>
</> ) : null}
) : (
<></>
)}
</> </>
); );
}; };

View file

@ -190,9 +190,7 @@ export const SettingsCache = ({
)} )}
></Controller> ></Controller>
</FormGroup> </FormGroup>
) : ( ) : null}
<></>
)}
{_.isEqual(cachePolicyType, ["EVICT_DAILY"]) || {_.isEqual(cachePolicyType, ["EVICT_DAILY"]) ||
_.isEqual(cachePolicyType, ["EVICT_WEEKLY"]) ? ( _.isEqual(cachePolicyType, ["EVICT_WEEKLY"]) ? (
<> <>
@ -269,9 +267,7 @@ export const SettingsCache = ({
></Controller> ></Controller>
</FormGroup> </FormGroup>
</> </>
) : ( ) : null}
<></>
)}
{_.isEqual(cachePolicyType, ["MAX_LIFESPAN"]) ? ( {_.isEqual(cachePolicyType, ["MAX_LIFESPAN"]) ? (
<FormGroup <FormGroup
label={t("maxLifespan")} label={t("maxLifespan")}
@ -292,9 +288,7 @@ export const SettingsCache = ({
data-testid="kerberos-cache-lifespan" data-testid="kerberos-cache-lifespan"
/> />
</FormGroup> </FormGroup>
) : ( ) : null}
<></>
)}
</FormAccess> </FormAccess>
</> </>
); );

View file

@ -353,7 +353,6 @@ export const UserForm = ({
typeAheadAriaLabel="Select an action" typeAheadAriaLabel="Select an action"
control={control} control={control}
render={() => ( render={() => (
<>
<InputGroup> <InputGroup>
<ChipGroup categoryName={" "}> <ChipGroup categoryName={" "}>
{selectedGroups.map((currentChip) => ( {selectedGroups.map((currentChip) => (
@ -374,7 +373,6 @@ export const UserForm = ({
{t("users:joinGroups")} {t("users:joinGroups")}
</Button> </Button>
</InputGroup> </InputGroup>
</>
)} )}
/> />
</FormGroup> </FormGroup>

View file

@ -189,9 +189,7 @@ export const UserGroups = () => {
refresh(); refresh();
}, [isDirectMembership]); }, [isDirectMembership]);
const AliasRenderer = (group: GroupRepresentation) => { const AliasRenderer = (group: GroupRepresentation) => group.name;
return <>{group.name}</>;
};
const toggleModal = () => { const toggleModal = () => {
setOpen(!open); setOpen(!open);
@ -232,8 +230,7 @@ export const UserGroups = () => {
directMembershipList.length === 0 || directMembershipList.length === 0 ||
isDirectMembership; isDirectMembership;
return ( return (
<> canLeaveGroup && (
{canLeaveGroup && (
<Button <Button
data-testid={`leave-${group.name}`} data-testid={`leave-${group.name}`}
onClick={() => leave(group)} onClick={() => leave(group)}
@ -241,8 +238,7 @@ export const UserGroups = () => {
> >
{t("leave")} {t("leave")}
</Button> </Button>
)} )
</>
); );
}; };

View file

@ -63,14 +63,12 @@ export const UsersSection = () => {
); );
const UserDetailLink = (user: UserRepresentation) => ( const UserDetailLink = (user: UserRepresentation) => (
<>
<Link <Link
key={user.username} key={user.username}
to={toUser({ realm: realmName, id: user.id!, tab: "settings" })} to={toUser({ realm: realmName, id: user.id!, tab: "settings" })}
> >
{user.username} {user.username}
</Link> </Link>
</>
); );
const loader = async (first?: number, max?: number, search?: string) => { const loader = async (first?: number, max?: number, search?: string) => {