Skip to content

Commit

Permalink
Add row count
Browse files Browse the repository at this point in the history
  • Loading branch information
insmac committed Oct 11, 2023
1 parent 91e67cb commit e01d82a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/web-console/src/scenes/Result/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ import { HandPointLeft } from "@styled-icons/fa-regular"
import { TableFreezeColumn } from "@styled-icons/fluentui-system-filled"
import { grid } from "../../js/console/grid"
import { quickVis } from "../../js/console/quick-vis"

import {
PaneContent,
PaneWrapper,
PopperHover,
Text,
Tooltip,
useScreenSize,
} from "../../components"
Expand Down Expand Up @@ -84,6 +84,10 @@ const TableFreezeColumnIcon = styled(TableFreezeColumn)`
transform: scaleX(-1);
`

const RowCount = styled(Text)`
margin-right: 1rem;
`

const Result = ({ viewMode }: { viewMode: ViewMode }) => {
const [count, setCount] = useState<number | undefined>()
const { sm } = useScreenSize()
Expand Down Expand Up @@ -227,10 +231,21 @@ const Result = ({ viewMode }: { viewMode: ViewMode }) => {
},
]

useEffect(() => {
if (result?.type === QuestDB.Type.DQL) {
setCount(result.count)
}
}, [result])

return (
<Root>
<Wrapper>
<Actions>
{count && (
<RowCount color="foreground">
{`${count.toLocaleString()} row${count > 1 ? "s" : ""}`}
</RowCount>
)}
{viewMode === "grid" &&
gridActions.map((action, index) => (
<PopperHover
Expand Down

0 comments on commit e01d82a

Please sign in to comment.