Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discover] Fixes pagination style #5778

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.osdDocTable_pagination {
width: 100%;

& ~ table {
margin-bottom: 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ import {
EuiDataGridColumn,
EuiDataGridSorting,
EuiProgress,
EuiPagination,
EuiFlexGroup,
EuiFlexItem,
} from '@elastic/eui';
import { FormattedMessage } from '@osd/i18n/react';
import { TableHeader } from './table_header';
import { DocViewFilterFn, OpenSearchSearchHit } from '../../doc_views/doc_views_types';
import { TableRow } from './table_rows';
import { IndexPattern } from '../../../opensearch_dashboards_services';
import { Pagination } from './pagination';

export interface DefaultDiscoverTableProps {
displayedTableColumns: EuiDataGridColumn[];
Expand Down Expand Up @@ -111,28 +109,16 @@ export const LegacyDiscoverTable = ({

return (
indexPattern && (
<>
<div>
{showPagination ? (
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiPagination
pageCount={pageCount}
activePage={activePage}
onPageClick={(currentPage) => goToPage(currentPage)}
/>
</EuiFlexItem>
<EuiFlexItem>
<FormattedMessage
id="discover.docTable.pagerControl.pagesCountLabel"
defaultMessage="{startItem}&ndash;{endItem} of {totalItems}"
values={{
startItem: currentRowCounts.startRow,
endItem: currentRowCounts.endRow,
totalItems: rows.length,
}}
/>
</EuiFlexItem>
</EuiFlexGroup>
<Pagination
pageCount={pageCount}
activePage={activePage}
goToPage={goToPage}
startItem={currentRowCounts.startRow + 1}
endItem={currentRowCounts.endRow}
totalItems={rows.length}
/>
) : null}
<table data-test-subj="docTable" className="osd-table table">
<thead>
Expand Down Expand Up @@ -187,7 +173,17 @@ export const LegacyDiscoverTable = ({
</EuiButtonEmpty>
</EuiCallOut>
)}
</>
{showPagination ? (
<Pagination
pageCount={pageCount}
activePage={activePage}
goToPage={goToPage}
startItem={currentRowCounts.startRow + 1}
endItem={currentRowCounts.endRow}
totalItems={rows.length}
/>
) : null}
</div>
)
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { EuiFlexGroup, EuiFlexItem, EuiPagination } 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;
}

export const Pagination = ({
pageCount,
activePage,
goToPage,
startItem,
endItem,
totalItems,
}: Props) => {
return (
<EuiFlexGroup className="osdDocTable_pagination" alignItems="center" justifyContent="flexEnd">
<EuiFlexItem grow={false}>
<FormattedMessage
id="discover.docTable.pagerControl.pagesCountLabel"
defaultMessage="{startItem}&ndash;{endItem} of {totalItems}"
values={{
startItem,
endItem,
totalItems,
}}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiPagination
pageCount={pageCount}
activePage={activePage}
onPageClick={(currentPage) => goToPage(currentPage)}
/>
</EuiFlexItem>
</EuiFlexGroup>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ const FieldList = ({
<>
<EuiButtonEmpty
iconSide="right"
iconSize="s"
color="text"
iconType={expanded ? 'arrowDown' : 'arrowRight'}
onClick={() => setExpanded(!expanded)}
Expand Down
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to fix a style-lint error. unrelated to this PR

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$vis-description-width: 200px;
$event-vis-height: 55px;
$timeline-panel-height: 90px;
$content-padding-top: 110px; // Padding needed within view events flyout content to sit comfortably below flyout header
$content-padding-top: 110px; // Padding required for view events flyout content to align below flyout header.
$date-range-height: 45px; // Static height we want for the date range picker component
$error-icon-padding-right: -8px; // This is so the error icon is aligned consistent with the event count icons
$base-vis-min-height: 25vh; // Visualizations require the container to have a valid width and height to render
Expand Down
Loading