[ML] Fixes labels in datafeed time range selector modal (#24489)

This commit is contained in:
Pete Harverson 2018-10-24 15:50:56 +01:00 committed by GitHub
parent 7a90b326b6
commit e900879cc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 11 deletions

View file

@ -159,7 +159,7 @@ export class JobsList extends Component {
}, {
name: 'Latest timestamp',
truncateText: false,
field: 'latestTimeStampSortValue',
field: 'latestTimestampSortValue',
sortable: true,
render: (time, item) => (
<span className="euiTableCellContent__text">

View file

@ -257,7 +257,7 @@ export class JobsListView extends Component {
fullJobsList[job.id] = job.fullJob;
delete job.fullJob;
}
job.latestTimeStampSortValue = (job.latestTimeStampMs || 0);
job.latestTimestampSortValue = (job.latestTimestampMs || 0);
return job;
});
const filteredJobsSummaryList = filterJobs(jobsSummaryList, this.state.filterClauses);

View file

@ -196,6 +196,6 @@ StartDatafeedModal.propTypes = {
};
function getLowestLatestTime(jobs) {
const times = jobs.map(j => j.latestTimeStampSortValue);
const times = jobs.map(j => j.latestTimestampSortValue);
return moment(Math.min(...times));
}

View file

@ -28,7 +28,7 @@ export class TimeRangeSelector extends Component {
startTab: 0,
endTab: 1,
};
this.latestTimeStamp = this.props.startTime;
this.latestTimestamp = this.props.startTime;
this.now = this.props.now;
}
@ -69,15 +69,24 @@ export class TimeRangeSelector extends Component {
}
getTabItems() {
const datePickerTimes = {
start: (moment.isMoment(this.props.startTime)) ? this.props.startTime : this.latestTimeStamp,
start: (moment.isMoment(this.props.startTime)) ? this.props.startTime : this.latestTimestamp,
end: (moment.isMoment(this.props.endTime)) ? this.props.endTime : this.now,
};
const formattedStartTime = this.latestTimeStamp.format(TIME_FORMAT);
const formattedStartTime = this.latestTimestamp.format(TIME_FORMAT);
// Show different labels for the start time depending on whether
// the job has seen any data yet
const showContinueLabels = (this.latestTimestamp.valueOf() > 0);
const startLabels = (showContinueLabels === true) ?
[`Continue from ${formattedStartTime}`, 'Continue from now', 'Continue from specified time'] :
['Start at beginning of data', 'Start from now', 'Specify start time'];
const startItems = [
{ index: 0, label: `Continue from ${formattedStartTime}` },
{ index: 1, label: 'Continue from now' },
{ index: 2, label: 'Continue from specified time',
{ index: 0, label: startLabels[0] },
{ index: 1, label: startLabels[1] },
{ index: 2, label: startLabels[2],
body: (
<EuiDatePicker
selected={datePickerTimes.start}

View file

@ -99,7 +99,7 @@ export function jobsProvider(callWithRequest) {
const hasDatafeed = (typeof job.datafeed_config === 'object' && Object.keys(job.datafeed_config).length);
const {
earliest: earliestTimestampMs,
latest: latestTimestampMs } = earliestAndLatestTimeStamps(job.data_counts);
latest: latestTimestampMs } = earliestAndLatestTimestamps(job.data_counts);
const tempJob = {
id: job.job_id,
@ -241,7 +241,7 @@ export function jobsProvider(callWithRequest) {
return jobs;
}
function earliestAndLatestTimeStamps(dataCounts) {
function earliestAndLatestTimestamps(dataCounts) {
const obj = {
earliest: undefined,
latest: undefined,