-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathtooltip.js
72 lines (65 loc) · 2.48 KB
/
tooltip.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import {TabletTooltipContent} from '../components/TooltipsContent';
import {cn} from './cn';
const nodeB = cn('node-tootltip');
const NodeTooltip = (props) => {
const {data} = props;
return (
data && (
<div className={nodeB()}>
<table>
<tbody>
<tr>
<td className={nodeB('label')}>ID</td>
<td className={nodeB('value')}>{data.nodeId || '?'}</td>
</tr>
<tr>
<td className={nodeB('label')}>Rack</td>
<td className={nodeB('value')}>{data.rack || '?'}</td>
</tr>
{data.connected && data.capacity ? (
<tr>
<td className={nodeB('label')}>Net</td>
<td className={nodeB('value')}>
{`${data.connected} / ${data.capacity}`}
</td>
</tr>
) : null}
</tbody>
</table>
</div>
)
);
};
const histogramB = cn('histogram-tooltip');
const HistogramTooltip = (props) => {
const {data} = props;
return (
data && (
<div className={histogramB()}>
<table>
<tbody>
<tr>
<td className={histogramB('label')}>Count</td>
<td className={histogramB('value')}>{data.count || '?'}</td>
</tr>
<tr>
<td className={histogramB('label')}>From</td>
<td className={histogramB('value')}>{data.leftBound || '?'}</td>
</tr>
<tr>
<td className={histogramB('label')}>To</td>
<td className={histogramB('value')}>{data.rightBound || '?'}</td>
</tr>
</tbody>
</table>
</div>
)
);
};
const cellB = cn('cell-tooltip');
export const tooltipTemplates = {
tablet: (data) => <TabletTooltipContent data={data} />,
node: (data) => <NodeTooltip data={data} />,
histogram: (data) => <HistogramTooltip data={data} />,
cell: (data) => <div className={cellB()}>{data}</div>,
};