asb_cloud_front/src/pages/TelemetryView/ChartTimeOnlineFooter.jsx

52 lines
1.1 KiB
React
Raw Normal View History

2021-08-12 17:47:16 +05:00
import {ValueDisplay} from '../../components/Display'
2021-04-16 15:50:01 +05:00
import {ControlOutlined} from '@ant-design/icons'
import {Popover} from 'antd'
export const ChartTimeOnlineFooter = (props) =>{
const { data,
lineIdle,
lineSp,
linesOther} = props
let sp = null
let idle = null
if(data && lineSp)
sp = data[lineSp.xAccessorName]
if(data && lineIdle)
idle = data[lineIdle.xAccessorName]
let spField = <ValueDisplay value={sp}/>
let popContent = linesOther?.map(line =>{
let val = null
if(data)
val = data[line.xAccessorName]
return (
<div key={line.label}>
{line.label}
<ValueDisplay value={val}/>
</div>)
})
if(popContent)
spField = <Popover content={popContent}>
<div className="chart-footer">
2021-04-16 15:50:01 +05:00
<ControlOutlined className='display_label'/>
{spField}
</div>
</Popover>
else
spField = <div style={{display:"flex"}}>
{spField}
</div>
return(<div>
{spField}
<div style={{display:"flex"}}>
<span className='display_label'>х.х.</span>
<ValueDisplay value={idle}/>
</div>
</div>)
}