[ML] Jobs list bug fixes (#20823)

This commit is contained in:
James Gowdy 2018-07-16 16:33:59 +01:00 committed by GitHub
parent 46bacc6c64
commit 54cf83d360
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 31 additions and 27 deletions

View file

@ -94,6 +94,7 @@ export class DeleteJobModal extends Component {
confirmButtonText="Delete"
buttonColor="danger"
defaultFocusedButton={EUI_MODAL_CONFIRM_BUTTON}
className="eui-textBreakWord"
>
{(this.state.deleting === true) &&
<div>
@ -107,7 +108,7 @@ export class DeleteJobModal extends Component {
{(this.state.deleting === false) &&
<React.Fragment>
<p>Are you sure you want to delete {(this.state.jobs.length > 1) ? 'these jobs' : 'this job'}</p>
<p>Are you sure you want to delete {(this.state.jobs.length > 1) ? 'these jobs' : 'this job'}?</p>
{(this.state.jobs.length > 1) &&
<p>Deleting multiple jobs can be time consuming.
They will be deleted in the background and may not disappear from the jobs list instantly

View file

@ -117,5 +117,5 @@ JobDetails.propTypes = {
jobId: PropTypes.string.isRequired,
job: PropTypes.object,
addYourself: PropTypes.func.isRequired,
removeYourself: PropTypes.func,
removeYourself: PropTypes.func.isRequired,
};

View file

@ -25,6 +25,7 @@ import React, {
const DEFAULT_REFRESH_INTERVAL_MS = 30000;
const MINIMUM_REFRESH_INTERVAL_MS = 5000;
let jobsRefreshInterval = null;
export class JobsListView extends Component {
constructor(props) {
@ -46,7 +47,6 @@ export class JobsListView extends Component {
this.showStartDatafeedModal = () => {};
this.blockRefresh = false;
this.refreshInterval = null;
}
componentDidMount() {
@ -58,6 +58,7 @@ export class JobsListView extends Component {
}
componentWillUnmount() {
timefilter.off('refreshIntervalUpdate');
this.clearRefreshInterval();
}
@ -95,13 +96,13 @@ export class JobsListView extends Component {
this.clearRefreshInterval();
if (interval >= MINIMUM_REFRESH_INTERVAL_MS) {
this.blockRefresh = false;
this.refreshInterval = setInterval(() => (this.refreshJobSummaryList()), interval);
jobsRefreshInterval = setInterval(() => (this.refreshJobSummaryList()), interval);
}
}
clearRefreshInterval() {
this.blockRefresh = true;
clearInterval(this.refreshInterval);
clearInterval(jobsRefreshInterval);
}
toggleRow = (jobId) => {
@ -119,6 +120,7 @@ export class JobsListView extends Component {
jobId={jobId}
job={this.state.fullJobsList[jobId]}
addYourself={this.addUpdateFunction}
removeYourself={this.removeUpdateFunction}
/>
);
} else {
@ -126,6 +128,7 @@ export class JobsListView extends Component {
<JobDetails
jobId={jobId}
addYourself={this.addUpdateFunction}
removeYourself={this.removeUpdateFunction}
/>
);
}

View file

@ -106,7 +106,7 @@ export class JobStatsBar extends Component {
const stats = Object.keys(jobStats).map(k => jobStats[k]);
return (
<div className="jobs-stats-bar-new">
<div className="jobs-stats-bar">
{
stats.filter(s => (s.show)).map(s => <Stat key={s.label} stat={s} />)
}

View file

@ -1,4 +1,4 @@
.jobs-stats-bar-new {
.jobs-stats-bar {
height: 42px;
padding: 14px;

View file

@ -91,6 +91,8 @@ export class StartDatafeedModal extends Component {
}
render() {
const { jobs } = this.state;
const startableJobs = (jobs !== undefined) ? jobs.filter(j => j.hasDatafeed) : [];
let modal;
if (this.state.isModalVisible) {
@ -102,7 +104,7 @@ export class StartDatafeedModal extends Component {
>
<EuiModalHeader>
<EuiModalHeaderTitle>
Start {(this.state.jobs.length > 1) ? `${this.state.jobs.length} jobs` : this.state.jobs[0].id}
Start {(startableJobs.length > 1) ? `${startableJobs.length} jobs` : startableJobs[0].id}
</EuiModalHeaderTitle>
</EuiModalHeader>

View file

@ -5,11 +5,11 @@
*/
import 'ngreact';
import ReactDOM from 'react-dom';
import React from 'react';
import { uiModules } from 'ui/modules';
const module = uiModules.get('apps/ml', ['react']);
import template from './jobs.html';
import { checkLicense } from 'plugins/ml/license/check_license';
import { checkGetJobsPrivilege } from 'plugins/ml/privilege/check_privilege';
@ -19,6 +19,8 @@ import { initPromise } from 'plugins/ml/util/promise';
import uiRoutes from 'ui/routes';
const template = `<ml-nav-menu name="jobs" /><jobs-page />`;
uiRoutes
.when('/jobs/?', {
template,
@ -27,16 +29,21 @@ uiRoutes
privileges: checkGetJobsPrivilege,
mlNodeCount: getMlNodeCount,
loadNewJobDefaults,
initPromise: initPromise(true)
initPromise: initPromise(false)
}
});
import { JobsPage } from './jobs';
module.directive('jobsPage', function ($injector) {
const reactDirective = $injector.get('reactDirective');
return reactDirective(JobsPage, undefined, { restrict: 'E' }, { });
module.directive('jobsPage', function () {
return {
scope: {},
restrict: 'E',
link: (scope, element) => {
ReactDOM.render(
React.createElement(JobsPage),
element[0]
);
}
};
});

View file

@ -5,4 +5,4 @@
*/
import './jobs_directive';
import './directive';

View file

@ -1,9 +0,0 @@
<ml-nav-menu name="jobs"></ml-nav-menu>
<ml-jobs-page-wrapper>
<div class='jobs-stats-bar'>
<span ng-if='js.show' class='stat' ng-repeat='js in jobStats'>
<span class='stat-label'>{{js.label}}</span>: <span class='stat-value'>{{js.value}}</span>
</span>
</div>
<jobs-page></jobs-page>
</ml-jobs-page-wrapper>