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

[6.7] [ML] Fixing position of job management search bar error (#30251) #30361

Merged
merged 1 commit into from
Feb 7, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
Expand Up @@ -7,20 +7,21 @@

import PropTypes from 'prop-types';
import React, {
Component
Component,
Fragment,
} from 'react';

import { ml } from 'plugins/ml/services/ml_api_service';
import { JobGroup } from '../job_group';

import {
EuiSearchBar,
EuiCallOut,
EuiSpacer,
EuiFlexGroup,
EuiFlexItem,
EuiFormRow,
} from '@elastic/eui';
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';

function loadGroups() {
return ml.jobs.groups()
Expand Down Expand Up @@ -68,29 +69,9 @@ class JobFilterBarUI extends Component {
}
};

renderError() {
const { error } = this.state;
if (!error) {
return;
}
return (
<EuiFlexItem grow={false}>
<EuiCallOut
color="danger"
title={(<FormattedMessage
id="xpack.ml.jobsList.jobFilterBar.invalidSearchErrorMessage"
defaultMessage="Invalid search: {errorMessage}"
values={{ errorMessage: error.message }}
/>
)}
/>
<EuiSpacer size="l" />
</EuiFlexItem>
);
}

render() {
const { intl } = this.props;
const { error } = this.state;
const filters = [
{
type: 'field_value_toggle_group',
Expand Down Expand Up @@ -164,8 +145,15 @@ class JobFilterBarUI extends Component {
onChange={this.onChange}
className="mlJobFilterBar"
/>
<EuiFormRow
fullWidth
isInvalid={(error !== null)}
error={getError(error)}
style={{ maxHeight: '0px' }}
>
<Fragment />
</EuiFormRow>
</EuiFlexItem>
{ this.renderError() || ''}
</EuiFlexGroup>
);
}
Expand All @@ -174,4 +162,15 @@ JobFilterBarUI.propTypes = {
setFilters: PropTypes.func.isRequired,
};

function getError(error) {
if (error) {
return i18n.translate('xpack.ml.jobsList.jobFilterBar.invalidSearchErrorMessage', {
defaultMessage: 'Invalid search: {errorMessage}',
values: { errorMessage: error.message },
});
}

return '';
}

export const JobFilterBar = injectI18n(JobFilterBarUI);
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
min-height: 60px;
display: flex;
align-items: center;

& > div:nth-child(1) {
width: 300px;
}
}

.job-management {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
// SASSTODO: This looks like it needs some rewriting for all the pixel values
.multi-select-actions {
padding: 10px 0px;
padding-right: $euiSizeS;
padding-bottom: $euiSizeM;
display: inline-block;
white-space: nowrap;

// SASSTODO: This looks like it should just be an EUI title
.jobs-selected-title {
display: inline-block;
font-weight: normal;

color: #1a1a1a;
font-size: 28px;
font-size: 1.55rem;
line-height: 1.25;
font-weight: 300;
line-height: 2.5rem;
vertical-align: bottom;
}

.actions-border, .actions-border-large {
height: 20px;
border-right: $euiBorderThin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import React, {
Component, Fragment
} from 'react';

import {
EuiTitle
} from '@elastic/eui';

import { ResultLinks } from '../job_actions';
import { MultiJobActionsMenu } from './actions_menu';
import { GroupSelector } from './group_selector';
Expand All @@ -28,13 +32,18 @@ export class MultiJobActions extends Component {
<div className={`multi-select-actions${jobsSelected ? '' : '-no-display'}`}>
{jobsSelected &&
<Fragment>
<span className="jobs-selected-title">
<FormattedMessage
id="xpack.ml.jobsList.multiJobsActions.jobsSelectedLabel"
defaultMessage="{selectedJobsCount, plural, one {# job} other {# jobs}} selected"
values={{ selectedJobsCount: this.props.selectedJobs.length }}
/>
</span>
<EuiTitle
size="s"
style={{ display: 'inline' }}
>
<h3>
<FormattedMessage
id="xpack.ml.jobsList.multiJobsActions.jobsSelectedLabel"
defaultMessage="{selectedJobsCount, plural, one {# job} other {# jobs}} selected"
values={{ selectedJobsCount: this.props.selectedJobs.length }}
/>
</h3>
</EuiTitle>
<div className="actions-border-large" />
<ResultLinks jobs={this.props.selectedJobs} />

Expand Down