asb_cloud_front/src/components/CustomColumn.jsx
2021-04-16 15:50:01 +05:00

26 lines
814 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {Display} from './Display'
export const CustomColumn = ({data}) => {
const dataLast = data[data.length -1]
const lines = [
{label:'Рот., об/мин', accessorName:'rotorSpeed'},
{label:'Долото, м', accessorName:'bitDepth'},
{label:'Забой, м', accessorName:'wellDepth'},
{label:'Расход, м³/ч', accessorName:'flow'},
{label:'Расход х.х., м³/ч', accessorName:'flowIdle'},
]
if(dataLast)
lines.forEach(line => line.value = dataLast[line.accessorName]?.toPrecision(4)??'-' )
else
lines.forEach(line => line.value = '-' )
return (<>
{lines.map(line => <Display className='border_small display_flex_container'
kay={line.label}
label={line.label}
value={line.value}
suffix={line.units}/>)}
</>)
}