Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions src/components/details/context.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import React from "react"
import { TextSmall, Flex } from "@netdata/netdata-ui"
import { useAttributeValue } from "@/components/provider"
import Row from "./row"

const Info = ({ title, children }) => (
<Flex gap={2}>
<TextSmall color="textDescription">{title}</TextSmall>
<Flex as={TextSmall} background="elementBackground">
{children}
</Flex>
</Flex>
)
import Info from "./info"

const Context = () => {
const contextScope = useAttributeValue("contextScope")
Expand Down
2 changes: 2 additions & 0 deletions src/components/details/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useAttributeValue } from "@/components/provider"
import Context from "./context"
import Source from "./source"
import Description from "./description"
import Units from "./units"

const Container = styled(Flex).attrs({
column: true,
Expand All @@ -23,6 +24,7 @@ const Details = () => {
<Description />
{nodeName && <Source />}
<Context />
<Units />
</Container>
)
}
Expand Down
13 changes: 13 additions & 0 deletions src/components/details/info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from "react"
import { TextSmall, Flex } from "@netdata/netdata-ui"

const Info = ({ title, children }) => (
<Flex gap={2}>
<TextSmall color="textDescription">{title}</TextSmall>
<Flex as={TextSmall} background="elementBackground">
{children}
</Flex>
</Flex>
)

export default Info
16 changes: 16 additions & 0 deletions src/components/details/units.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react"
import { useUnitSign } from "@/components/provider"
import Row from "./row"
import Info from "./info"

const Units = () => {
const rawUnits = useUnitSign({ withoutConversion: true, long: true })

return (
<Row title="Units" color="key" data-testid="cartDetails-units">
<Info title="Raw data units">{rawUnits}</Info>
</Row>
)
}

export default Units
14 changes: 11 additions & 3 deletions src/components/title/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ import {
useIsMinimal,
useAttributeValue,
} from "@/components/provider"
import { withTooltip } from "@/components/tooltip"

const TextWithTooltip = withTooltip(TextSmall)

export const Title = props => {
const title = useTitle()
const units = useUnitSign({ long: true })
const units = useUnitSign({ withoutConversion: true, long: true })
const name = useName()
const isMinimal = useIsMinimal()
const contextScope = useAttributeValue("contextScope")
Expand Down Expand Up @@ -39,9 +42,14 @@ export const Title = props => {
</CopyToClipboard>
)}
{!!units && !isMinimal && (
<TextSmall color="textLite" whiteSpace="nowrap">
<TextWithTooltip
color="textLite"
whiteSpace="nowrap"
title="Source unit (alerts)"
tooltipProps={{ align: "top" }}
>
• [{units}]
</TextSmall>
</TextWithTooltip>
)}
</Flex>
)
Expand Down