Skip to content

Commit

Permalink
[Reporting] Fix report table pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Apr 7, 2020
1 parent 898504d commit 31ffa15
Showing 1 changed file with 28 additions and 29 deletions.
57 changes: 28 additions & 29 deletions x-pack/plugins/reporting/public/components/report_listing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import {
EuiInMemoryTable,
EuiBasicTable,
EuiPageContent,
EuiSpacer,
EuiText,
Expand All @@ -16,7 +16,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react';
import { get } from 'lodash';
import moment from 'moment';
import { Component, default as React } from 'react';
import { Component, Fragment, default as React } from 'react';
import { Subscription } from 'rxjs';
import { ApplicationStart, ToastsSetup } from 'src/core/public';
import { ILicense, LicensingPluginSetup } from '../../../licensing/public';
Expand Down Expand Up @@ -225,6 +225,7 @@ class ReportListingUi extends Component<Props, State> {
throw error;
}
}
this.setState(() => ({ page: 0 }), this.fetchJobs);
};

return (
Expand Down Expand Up @@ -476,34 +477,32 @@ class ReportListingUi extends Component<Props, State> {
onSelectionChange: this.onSelectionChange,
};

const search = {
toolsRight: this.renderDeleteButton(),
};

return (
<EuiInMemoryTable
itemId="id"
items={this.state.jobs}
loading={this.state.isLoading}
columns={tableColumns}
message={
this.state.isLoading
? intl.formatMessage({
id: 'xpack.reporting.listing.table.loadingReportsDescription',
defaultMessage: 'Loading reports',
})
: intl.formatMessage({
id: 'xpack.reporting.listing.table.noCreatedReportsDescription',
defaultMessage: 'No reports have been created',
})
}
pagination={pagination}
selection={selection}
search={search}
isSelectable={true}
onChange={this.onTableChange}
data-test-subj="reportJobListing"
/>
<Fragment>
<EuiBasicTable
itemId="id"
items={this.state.jobs}
loading={this.state.isLoading}
columns={tableColumns}
noItemsMessage={
this.state.isLoading
? intl.formatMessage({
id: 'xpack.reporting.listing.table.loadingReportsDescription',
defaultMessage: 'Loading reports',
})
: intl.formatMessage({
id: 'xpack.reporting.listing.table.noCreatedReportsDescription',
defaultMessage: 'No reports have been created',
})
}
pagination={pagination}
selection={selection}
isSelectable={true}
onChange={this.onTableChange}
data-test-subj="reportJobListing"
/>
{this.state.selectedJobs.length > 0 ? this.renderDeleteButton() : null}
</Fragment>
);
}
}
Expand Down

0 comments on commit 31ffa15

Please sign in to comment.