undo
parent
3e377e0477
commit
15c095b714
|
@ -46,7 +46,7 @@ const defaultTableData: TableData = {
|
||||||
'timestamp',
|
'timestamp',
|
||||||
'facility',
|
'facility',
|
||||||
'procid',
|
'procid',
|
||||||
'application',
|
'appname',
|
||||||
'host',
|
'host',
|
||||||
'message',
|
'message',
|
||||||
],
|
],
|
||||||
|
@ -412,17 +412,7 @@ export const executeTableBackwardQueryAsync = () => async (
|
||||||
try {
|
try {
|
||||||
dispatch(incrementQueryCount())
|
dispatch(incrementQueryCount())
|
||||||
|
|
||||||
const queryTimeRange = {
|
const query = buildBackwardLogQuery(time, queryConfig, filters, searchTerm)
|
||||||
upper: timeRange.upper,
|
|
||||||
lower: timeRange.lower,
|
|
||||||
seconds: timeRange.seconds,
|
|
||||||
}
|
|
||||||
const query = buildLogQuery(
|
|
||||||
queryTimeRange,
|
|
||||||
queryConfig,
|
|
||||||
filters,
|
|
||||||
searchTerm
|
|
||||||
)
|
|
||||||
const response = await executeQueryAsync(
|
const response = await executeQueryAsync(
|
||||||
proxyLink,
|
proxyLink,
|
||||||
namespace,
|
namespace,
|
||||||
|
|
|
@ -39,7 +39,7 @@ import OverlayTechnology from 'src/reusable_ui/components/overlays/OverlayTechno
|
||||||
import {SeverityFormatOptions, SECONDS_TO_MS} from 'src/logs/constants'
|
import {SeverityFormatOptions, SECONDS_TO_MS} from 'src/logs/constants'
|
||||||
import {Source, Namespace} from 'src/types'
|
import {Source, Namespace} from 'src/types'
|
||||||
|
|
||||||
import {HistogramData, HistogramColor} from 'src/types/histogram'
|
import {HistogramData, HistogramColor, BarGroup} from 'src/types/histogram'
|
||||||
import {
|
import {
|
||||||
Filter,
|
Filter,
|
||||||
SeverityLevelColor,
|
SeverityLevelColor,
|
||||||
|
@ -326,6 +326,7 @@ class LogsPage extends Component<Props, State> {
|
||||||
height={height}
|
height={height}
|
||||||
colorScale={colorForSeverity}
|
colorScale={colorForSeverity}
|
||||||
colors={histogramColors}
|
colors={histogramColors}
|
||||||
|
onBarClick={this.handleBarClick}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</AutoSizer>
|
</AutoSizer>
|
||||||
|
@ -396,6 +397,19 @@ class LogsPage extends Component<Props, State> {
|
||||||
this.props.executeQueriesAsync()
|
this.props.executeQueriesAsync()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private handleBarClick = (group: BarGroup): void => {
|
||||||
|
const {data} = group
|
||||||
|
|
||||||
|
if (!data.length) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const unixTimestamp = data[0].time
|
||||||
|
const timeOption = moment(unixTimestamp).toISOString()
|
||||||
|
|
||||||
|
this.handleSetTimeMarker({timeOption})
|
||||||
|
}
|
||||||
|
|
||||||
private handleSetTimeBounds = async () => {
|
private handleSetTimeBounds = async () => {
|
||||||
const {seconds, windowOption, timeOption} = this.props.timeRange
|
const {seconds, windowOption, timeOption} = this.props.timeRange
|
||||||
let lower = `now() - ${windowOption}`
|
let lower = `now() - ${windowOption}`
|
||||||
|
|
|
@ -1,17 +1,57 @@
|
||||||
import reducer, {defaultState} from 'src/logs/reducers'
|
import reducer, {defaultState} from 'src/logs/reducers'
|
||||||
import {setTimeWindow} from 'src/logs/actions'
|
import {setTimeWindow, setTimeMarker, setTimeBounds} from 'src/logs/actions'
|
||||||
|
|
||||||
describe('Logs.Reducers', () => {
|
describe('Logs.Reducers', () => {
|
||||||
it('can set a time window', () => {
|
it('can set a time window', () => {
|
||||||
const expected = {
|
const actionPayload = {
|
||||||
timeOption: 'now',
|
windowOption: '10m',
|
||||||
windowOption: '1h',
|
seconds: 600,
|
||||||
upper: null,
|
|
||||||
lower: 'now() - 1h',
|
|
||||||
seconds: 3600,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const actual = reducer(defaultState, setTimeWindow(expected))
|
const expected = {
|
||||||
expect(actual.timeWindow).toBe(expected)
|
timeOption: 'now',
|
||||||
|
windowOption: '10m',
|
||||||
|
upper: null,
|
||||||
|
lower: 'now() - 1m',
|
||||||
|
seconds: 600,
|
||||||
|
}
|
||||||
|
|
||||||
|
const actual = reducer(defaultState, setTimeWindow(actionPayload))
|
||||||
|
expect(actual.timeRange).toEqual(expected)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can set a time marker', () => {
|
||||||
|
const actionPayload = {
|
||||||
|
timeOption: '2018-07-10T22:22:21.769Z',
|
||||||
|
}
|
||||||
|
|
||||||
|
const expected = {
|
||||||
|
timeOption: '2018-07-10T22:22:21.769Z',
|
||||||
|
windowOption: '1m',
|
||||||
|
upper: null,
|
||||||
|
lower: 'now() - 1m',
|
||||||
|
seconds: 60,
|
||||||
|
}
|
||||||
|
|
||||||
|
const actual = reducer(defaultState, setTimeMarker(actionPayload))
|
||||||
|
expect(actual.timeRange).toEqual(expected)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can set the time bounds', () => {
|
||||||
|
const payload = {
|
||||||
|
upper: '2018-07-10T22:20:21.769Z',
|
||||||
|
lower: '2018-07-10T22:22:21.769Z',
|
||||||
|
}
|
||||||
|
|
||||||
|
const expected = {
|
||||||
|
timeOption: 'now',
|
||||||
|
windowOption: '1m',
|
||||||
|
upper: '2018-07-10T22:20:21.769Z',
|
||||||
|
lower: '2018-07-10T22:22:21.769Z',
|
||||||
|
seconds: 60,
|
||||||
|
}
|
||||||
|
|
||||||
|
const actual = reducer(defaultState, setTimeBounds(payload))
|
||||||
|
expect(actual.timeRange).toEqual(expected)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue