[Infra UI] Change node detail link to set time range to 1 hour (#26977)
* Change time range for link to -1h * Moving timeRange manipulation up a level to the node component
This commit is contained in:
parent
b9e2935f6e
commit
ff20e3ea2f
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import { EuiToolTip } from '@elastic/eui';
|
||||
import moment from 'moment';
|
||||
import { darken, readableColor } from 'polished';
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
@ -41,6 +42,12 @@ export class Node extends React.PureComponent<Props, State> {
|
|||
const rawValue = (metric && metric.value) || 0;
|
||||
const color = colorFromValue(options.legend, rawValue, bounds);
|
||||
const value = formatter(rawValue);
|
||||
const newTimerange = {
|
||||
...timeRange,
|
||||
from: moment(timeRange.to)
|
||||
.subtract(1, 'hour')
|
||||
.valueOf(),
|
||||
};
|
||||
return (
|
||||
<NodeContextMenu
|
||||
node={node}
|
||||
|
@ -48,7 +55,7 @@ export class Node extends React.PureComponent<Props, State> {
|
|||
isPopoverOpen={isPopoverOpen}
|
||||
closePopover={this.closePopover}
|
||||
options={options}
|
||||
timeRange={timeRange}
|
||||
timeRange={newTimerange}
|
||||
>
|
||||
<EuiToolTip position="top" content={`${node.name} | ${value}`}>
|
||||
<NodeContainer
|
||||
|
|
Loading…
Reference in a new issue