Skip to content

Commit 252a099

Browse files
[ML] Fixing position of job management search bar error (#30251) (#30361)
* [ML] Style tweaks for job management in K7 * adjusting search bar error * removing custom title style for EuiTitle
1 parent eb77967 commit 252a099

File tree

4 files changed

+42
-51
lines changed

4 files changed

+42
-51
lines changed

x-pack/plugins/ml/public/jobs/jobs_list/components/job_filter_bar/job_filter_bar.js

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@
77

88
import PropTypes from 'prop-types';
99
import React, {
10-
Component
10+
Component,
11+
Fragment,
1112
} from 'react';
1213

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

1617
import {
1718
EuiSearchBar,
18-
EuiCallOut,
19-
EuiSpacer,
2019
EuiFlexGroup,
2120
EuiFlexItem,
21+
EuiFormRow,
2222
} from '@elastic/eui';
2323
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';
24+
import { i18n } from '@kbn/i18n';
2425

2526
function loadGroups() {
2627
return ml.jobs.groups()
@@ -68,29 +69,9 @@ class JobFilterBarUI extends Component {
6869
}
6970
};
7071

71-
renderError() {
72-
const { error } = this.state;
73-
if (!error) {
74-
return;
75-
}
76-
return (
77-
<EuiFlexItem grow={false}>
78-
<EuiCallOut
79-
color="danger"
80-
title={(<FormattedMessage
81-
id="xpack.ml.jobsList.jobFilterBar.invalidSearchErrorMessage"
82-
defaultMessage="Invalid search: {errorMessage}"
83-
values={{ errorMessage: error.message }}
84-
/>
85-
)}
86-
/>
87-
<EuiSpacer size="l" />
88-
</EuiFlexItem>
89-
);
90-
}
91-
9272
render() {
9373
const { intl } = this.props;
74+
const { error } = this.state;
9475
const filters = [
9576
{
9677
type: 'field_value_toggle_group',
@@ -164,8 +145,15 @@ class JobFilterBarUI extends Component {
164145
onChange={this.onChange}
165146
className="mlJobFilterBar"
166147
/>
148+
<EuiFormRow
149+
fullWidth
150+
isInvalid={(error !== null)}
151+
error={getError(error)}
152+
style={{ maxHeight: '0px' }}
153+
>
154+
<Fragment />
155+
</EuiFormRow>
167156
</EuiFlexItem>
168-
{ this.renderError() || ''}
169157
</EuiFlexGroup>
170158
);
171159
}
@@ -174,4 +162,15 @@ JobFilterBarUI.propTypes = {
174162
setFilters: PropTypes.func.isRequired,
175163
};
176164

165+
function getError(error) {
166+
if (error) {
167+
return i18n.translate('xpack.ml.jobsList.jobFilterBar.invalidSearchErrorMessage', {
168+
defaultMessage: 'Invalid search: {errorMessage}',
169+
values: { errorMessage: error.message },
170+
});
171+
}
172+
173+
return '';
174+
}
175+
177176
export const JobFilterBar = injectI18n(JobFilterBarUI);

x-pack/plugins/ml/public/jobs/jobs_list/components/jobs_list_view/_jobs_list_view.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
min-height: 60px;
44
display: flex;
55
align-items: center;
6-
7-
& > div:nth-child(1) {
8-
width: 300px;
9-
}
106
}
117

128
.job-management {

x-pack/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/_multi_job_actions.scss

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
11
// SASSTODO: This looks like it needs some rewriting for all the pixel values
22
.multi-select-actions {
3-
padding: 10px 0px;
3+
padding-right: $euiSizeS;
4+
padding-bottom: $euiSizeM;
45
display: inline-block;
56
white-space: nowrap;
67

7-
// SASSTODO: This looks like it should just be an EUI title
8-
.jobs-selected-title {
9-
display: inline-block;
10-
font-weight: normal;
11-
12-
color: #1a1a1a;
13-
font-size: 28px;
14-
font-size: 1.55rem;
15-
line-height: 1.25;
16-
font-weight: 300;
17-
line-height: 2.5rem;
18-
vertical-align: bottom;
19-
}
20-
218
.actions-border, .actions-border-large {
229
height: 20px;
2310
border-right: $euiBorderThin;

x-pack/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/multi_job_actions.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import React, {
1010
Component, Fragment
1111
} from 'react';
1212

13+
import {
14+
EuiTitle
15+
} from '@elastic/eui';
16+
1317
import { ResultLinks } from '../job_actions';
1418
import { MultiJobActionsMenu } from './actions_menu';
1519
import { GroupSelector } from './group_selector';
@@ -28,13 +32,18 @@ export class MultiJobActions extends Component {
2832
<div className={`multi-select-actions${jobsSelected ? '' : '-no-display'}`}>
2933
{jobsSelected &&
3034
<Fragment>
31-
<span className="jobs-selected-title">
32-
<FormattedMessage
33-
id="xpack.ml.jobsList.multiJobsActions.jobsSelectedLabel"
34-
defaultMessage="{selectedJobsCount, plural, one {# job} other {# jobs}} selected"
35-
values={{ selectedJobsCount: this.props.selectedJobs.length }}
36-
/>
37-
</span>
35+
<EuiTitle
36+
size="s"
37+
style={{ display: 'inline' }}
38+
>
39+
<h3>
40+
<FormattedMessage
41+
id="xpack.ml.jobsList.multiJobsActions.jobsSelectedLabel"
42+
defaultMessage="{selectedJobsCount, plural, one {# job} other {# jobs}} selected"
43+
values={{ selectedJobsCount: this.props.selectedJobs.length }}
44+
/>
45+
</h3>
46+
</EuiTitle>
3847
<div className="actions-border-large" />
3948
<ResultLinks jobs={this.props.selectedJobs} />
4049

0 commit comments

Comments
 (0)