Fix bug where rollup job search would display an empty prompt if no jobs matched the search. (#31642)

* Internationalize and refine message.
This commit is contained in:
CJ Cenizal 2019-02-21 17:56:55 -08:00 committed by GitHub
parent 514673c46e
commit 4c5d2818da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 12 deletions

View file

@ -2,9 +2,17 @@
* 1. Override EUI styles. * 1. Override EUI styles.
*/ */
.rollupJobWizardStepActions { .rollupJobWizardStepActions {
align-items: flex-end; align-items: flex-end; /* 1 */
} }
.rollupJobsRoot { .rollupJobsRoot {
display: flex; display: flex;
} }
/**
* 1. Ensure panel fills width of parent when search input yields no matching rollup jobs.
*/
.rollupJobsListPanel {
// sass-lint:disable-block no-important
flex-grow: 1 !important; /* 1 */
}

View file

@ -7,9 +7,9 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { import {
getPageOfJobs,
isLoading, isLoading,
jobLoadError jobLoadError,
getJobsList,
} from '../../store/selectors'; } from '../../store/selectors';
import { import {
@ -23,7 +23,7 @@ import { JobList as JobListView } from './job_list';
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
jobs: getPageOfJobs(state), hasJobs: Boolean(getJobsList(state).length),
isLoading: isLoading(state), isLoading: isLoading(state),
jobLoadError: jobLoadError(state), jobLoadError: jobLoadError(state),
}; };

View file

@ -44,7 +44,7 @@ export class JobListUi extends Component {
loadJobs: PropTypes.func, loadJobs: PropTypes.func,
refreshJobs: PropTypes.func, refreshJobs: PropTypes.func,
openDetailPanel: PropTypes.func, openDetailPanel: PropTypes.func,
jobs: PropTypes.array, hasJobs: PropTypes.bool,
isLoading: PropTypes.bool, isLoading: PropTypes.bool,
} }
@ -248,7 +248,7 @@ export class JobListUi extends Component {
} }
render() { render() {
const { isLoading, jobs, jobLoadError } = this.props; const { isLoading, hasJobs, jobLoadError } = this.props;
let content; let content;
@ -258,7 +258,7 @@ export class JobListUi extends Component {
} else { } else {
content = this.renderError(jobLoadError); content = this.renderError(jobLoadError);
} }
} else if (!isLoading && !jobs.length) { } else if (!isLoading && !hasJobs) {
content = this.renderEmpty(); content = this.renderEmpty();
} else { } else {
content = this.renderList(); content = this.renderList();
@ -267,6 +267,7 @@ export class JobListUi extends Component {
return ( return (
<EuiPageContent <EuiPageContent
horizontalPosition="center" horizontalPosition="center"
className="rollupJobsListPanel"
> >
{content} {content}
</EuiPageContent> </EuiPageContent>

View file

@ -7,7 +7,7 @@
import React, { Component, Fragment } from 'react'; import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { i18n } from '@kbn/i18n'; import { i18n } from '@kbn/i18n';
import { injectI18n } from '@kbn/i18n/react'; import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
import { import {
EuiCheckbox, EuiCheckbox,
@ -25,6 +25,7 @@ import {
EuiTableRow, EuiTableRow,
EuiTableRowCell, EuiTableRowCell,
EuiTableRowCellCheckbox, EuiTableRowCellCheckbox,
EuiText,
EuiToolTip, EuiToolTip,
} from '@elastic/eui'; } from '@elastic/eui';
@ -392,9 +393,14 @@ export class JobTableUi extends Component {
</EuiTableBody> </EuiTableBody>
</EuiTable> </EuiTable>
) : ( ) : (
<div> <EuiText>
No rollup jobs to show <p>
</div> <FormattedMessage
id="xpack.rollupJobs.jobTable.noJobsMatchSearchMessage"
defaultMessage="No rollup jobs match your search"
/>
</p>
</EuiText>
)} )}
<EuiSpacer size="m" /> <EuiSpacer size="m" />