|
1 |
| -import { SegmentedBarChart } from '@devtron-labs/devtron-fe-common-lib' |
| 1 | +import { SegmentedBarChart, Tooltip } from '@devtron-labs/devtron-fe-common-lib' |
2 | 2 |
|
3 | 3 | export const K8sResourceListTableUsageCell = ({
|
4 | 4 | percentage,
|
5 | 5 | absoluteValue,
|
| 6 | + totalValue, |
6 | 7 | color,
|
7 | 8 | }: {
|
8 | 9 | percentage: string
|
9 | 10 | absoluteValue: string
|
| 11 | + totalValue: string |
10 | 12 | color: string
|
11 | 13 | }) => {
|
12 | 14 | const percentageInNumber = parseInt(percentage, 10)
|
13 | 15 | const usagePercentage = Number.isNaN(percentageInNumber) ? 0 : percentageInNumber
|
14 | 16 |
|
15 | 17 | return (
|
16 |
| - <div className="flexbox-col dc__content-center dc__gap-4"> |
17 |
| - <div className="flex left dc__gap-8"> |
18 |
| - <p className="m-0 fs-13 lh-20 cn-9 flex-grow-1">{absoluteValue}</p> |
19 |
| - <p className="m-0 fs-13 lh-20 cn-7">{percentage}</p> |
| 18 | + <Tooltip |
| 19 | + className="no-content-padding w-160" |
| 20 | + alwaysShowTippyOnHover |
| 21 | + content={ |
| 22 | + <div className="flexbox-col dc__gap-4 p-8"> |
| 23 | + <div className="flex left dc__gap-8 text__white"> |
| 24 | + <p className="m-0 fs-12 lh-18 flex-grow-1">Usage (%)</p> |
| 25 | + <p className="m-0 fs-12 lh-18">{percentage}</p> |
| 26 | + </div> |
| 27 | + <div className="flex left dc__gap-8 text__white"> |
| 28 | + <p className="m-0 fs-12 lh-18 flex-grow-1">Usage (Abs.)</p> |
| 29 | + <p className="m-0 fs-12 lh-18">{absoluteValue}</p> |
| 30 | + </div> |
| 31 | + <div className="flex left dc__gap-8 text__white"> |
| 32 | + <p className="m-0 fs-12 lh-18 flex-grow-1">Allocatable</p> |
| 33 | + <p className="m-0 fs-12 lh-18">{totalValue}</p> |
| 34 | + </div> |
| 35 | + </div> |
| 36 | + } |
| 37 | + > |
| 38 | + <div className="flexbox-col dc__content-center dc__gap-4 py-10 cursor"> |
| 39 | + <div className="flex left dc__gap-8"> |
| 40 | + <p className="m-0 fs-13 lh-20 cn-9 flex-grow-1">{absoluteValue}</p> |
| 41 | + <p className="m-0 fs-13 lh-20 cn-7">{percentage}</p> |
| 42 | + </div> |
| 43 | + <SegmentedBarChart |
| 44 | + entities={[ |
| 45 | + { value: usagePercentage, color }, |
| 46 | + { value: 100 - usagePercentage, color: 'var(--N200)' }, |
| 47 | + ]} |
| 48 | + hideLegend |
| 49 | + /> |
20 | 50 | </div>
|
21 |
| - <SegmentedBarChart |
22 |
| - entities={[ |
23 |
| - { value: usagePercentage, color }, |
24 |
| - { value: 100 - usagePercentage, color: 'var(--N200)' }, |
25 |
| - ]} |
26 |
| - hideLegend |
27 |
| - /> |
28 |
| - </div> |
| 51 | + </Tooltip> |
29 | 52 | )
|
30 | 53 | }
|
0 commit comments