Always show the pagination toolbar (#4053)

This commit is contained in:
Erik Jan de Wit 2023-01-16 13:09:27 +01:00 committed by GitHub
parent e0246c70d4
commit 5a5426195b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 9 deletions

View file

@ -99,17 +99,17 @@ describe("Client Scopes test", () => {
.itemExist(FilterAssignedType.None, false); .itemExist(FilterAssignedType.None, false);
}); });
//TODO https://github.com/keycloak/keycloak-admin-ui/issues/1959
it("should filter items by Protocol All", () => { it("should filter items by Protocol All", () => {
listingPage listingPage
.selectFilter(Filter.Protocol) .selectFilter(Filter.Protocol)
.selectSecondaryFilterProtocol(FilterProtocol.All) .selectSecondaryFilterProtocol(FilterProtocol.All);
sidebarPage.waitForPageLoad();
listingPage
.showNextPageTableItems() .showNextPageTableItems()
.itemExist(FilterProtocol.SAML, true) .itemExist(FilterProtocol.SAML, true)
.itemExist(openIDConnectItemText, true); //using FilterProtocol.OpenID will fail, text does not match. .itemExist(openIDConnectItemText, true); //using FilterProtocol.OpenID will fail, text does not match.
}); });
//TODO https://github.com/keycloak/keycloak-admin-ui/issues/1959
it("should filter items by Protocol SAML", () => { it("should filter items by Protocol SAML", () => {
listingPage listingPage
.selectFilter(Filter.Protocol) .selectFilter(Filter.Protocol)
@ -118,7 +118,6 @@ describe("Client Scopes test", () => {
.itemExist(openIDConnectItemText, false); //using FilterProtocol.OpenID will fail, text does not match. .itemExist(openIDConnectItemText, false); //using FilterProtocol.OpenID will fail, text does not match.
}); });
//TODO https://github.com/keycloak/keycloak-admin-ui/issues/1959
it("should filter items by Protocol OpenID", () => { it("should filter items by Protocol OpenID", () => {
listingPage listingPage
.selectFilter(Filter.Protocol) .selectFilter(Filter.Protocol)

View file

@ -37,7 +37,11 @@ export const PaginatingTableToolbar: FunctionComponent<TableToolbarProps> = ({
inputGroupOnEnter, inputGroupOnEnter,
}) => { }) => {
const page = Math.round(first / max); const page = Math.round(first / max);
const pagination = (variant: "top" | "bottom" = "top") => ( const KeycloakPagination = ({
variant = "top",
}: {
variant?: "top" | "bottom";
}) => (
<Pagination <Pagination
isCompact isCompact
toggleTemplate={({ firstIndex, lastIndex }: ToggleTemplateProps) => ( toggleTemplate={({ firstIndex, lastIndex }: ToggleTemplateProps) => (
@ -61,14 +65,18 @@ export const PaginatingTableToolbar: FunctionComponent<TableToolbarProps> = ({
toolbarItem={ toolbarItem={
<> <>
{toolbarItem} {toolbarItem}
{count !== 0 && ( <ToolbarItem variant="pagination">
<ToolbarItem variant="pagination">{pagination()}</ToolbarItem> <KeycloakPagination />
)} </ToolbarItem>
</> </>
} }
subToolbar={subToolbar} subToolbar={subToolbar}
toolbarItemFooter={ toolbarItemFooter={
count !== 0 ? <ToolbarItem>{pagination("bottom")}</ToolbarItem> : null count !== 0 ? (
<ToolbarItem>
<KeycloakPagination variant="bottom" />
</ToolbarItem>
) : null
} }
inputGroupName={inputGroupName} inputGroupName={inputGroupName}
inputGroupPlaceholder={inputGroupPlaceholder} inputGroupPlaceholder={inputGroupPlaceholder}