-
Notifications
You must be signed in to change notification settings - Fork 916
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Discover] Fixes pagination style (#5778)
* fixes pagination style Signed-off-by: Ashwin P Chandran <[email protected]> * style-lint fix Signed-off-by: Ashwin P Chandran <[email protected]> * fix react warning for unnecessary prop Signed-off-by: Ashwin P Chandran <[email protected]> * Show total hit count and pass services in embeddable Signed-off-by: Ashwin P Chandran <[email protected]> * removed unnecessary div Signed-off-by: Ashwin P Chandran <[email protected]> --------- Signed-off-by: Ashwin P Chandran <[email protected]> Signed-off-by: Anan Zhuang <[email protected]> Co-authored-by: Anan Zhuang <[email protected]>
- Loading branch information
Showing
11 changed files
with
128 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/plugins/discover/public/application/components/default_discover_table/_pagination.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.osdDocTable_pagination { | ||
width: 100%; | ||
|
||
& ~ table { | ||
margin-bottom: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/plugins/discover/public/application/components/default_discover_table/pagination.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { EuiFlexGroup, EuiFlexItem, EuiPagination, EuiTextColor } from '@elastic/eui'; | ||
import React from 'react'; | ||
import { FormattedMessage } from '@osd/i18n/react'; | ||
import './_pagination.scss'; | ||
|
||
interface Props { | ||
pageCount: number; | ||
activePage: number; | ||
goToPage: (page: number) => void; | ||
startItem: number; | ||
endItem: number; | ||
totalItems?: number; | ||
sampleSize: number; | ||
} | ||
|
||
export const Pagination = ({ | ||
pageCount, | ||
activePage, | ||
goToPage, | ||
startItem, | ||
endItem, | ||
totalItems = 0, | ||
sampleSize, | ||
}: Props) => { | ||
return ( | ||
<EuiFlexGroup className="osdDocTable_pagination" alignItems="center" justifyContent="flexEnd"> | ||
{endItem >= sampleSize && ( | ||
<EuiFlexItem grow={false}> | ||
<EuiTextColor color="subdued"> | ||
<FormattedMessage | ||
id="discover.docTable.limitedSearchResultLabel" | ||
defaultMessage="Limited to {sampleSize} results. Refine your search." | ||
values={{ sampleSize }} | ||
/> | ||
</EuiTextColor> | ||
</EuiFlexItem> | ||
)} | ||
<EuiFlexItem grow={false}> | ||
<FormattedMessage | ||
id="discover.docTable.pagerControl.pagesCountLabel" | ||
defaultMessage="{startItem}–{endItem} of {totalItems}" | ||
values={{ | ||
startItem, | ||
endItem, | ||
totalItems, | ||
}} | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiPagination | ||
pageCount={pageCount} | ||
activePage={activePage} | ||
onPageClick={(currentPage) => goToPage(currentPage)} | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.