Skip to content

Commit

Permalink
Table does not exist error
Browse files Browse the repository at this point in the history
  • Loading branch information
insmac committed Nov 2, 2024
1 parent b1747fb commit 9d0d9bb
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion packages/web-console/src/scenes/Editor/Metrics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import * as QuestDB from "../../../utils/questdb"
import { QuestContext } from "../../../providers"
import { rowsApplied as rowsAppliedSQL, latency as latencySQL } from "./queries"
import { Graph } from "./graph"
import { History } from "@styled-icons/boxicons-regular"

const Root = styled.div`
display: flex;
width: 100%;
height: 100%;
background: #2c2e3d;
Expand Down Expand Up @@ -46,6 +48,13 @@ const Charts = styled.div`
height: 100%;
`

const GlobalError = styled(Box).attrs({
align: "center",
justifyContent: "center",
})`
margin: auto;
`

export const Metrics = () => {
const { quest } = useContext(QuestContext)
const { activeBuffer, updateBuffer } = useEditor()
Expand Down Expand Up @@ -138,7 +147,16 @@ export const Metrics = () => {
fetchRowsApplied(activeBuffer.metricsViewState.tableId)
}, [metricDuration])

if (!table) return null
if (!table)
return (
<Root>
<GlobalError>
<Text color="foreground">
Error: Cannot load metrics. Table not found in the database
</Text>
</GlobalError>
</Root>
)

return (
<Root>
Expand All @@ -165,6 +183,7 @@ export const Metrics = () => {
onChange={(e) =>
setMetricDuration(e.target.value as MetricDuration)
}
prefixIcon={<History size="18px" />}
/>
</Box>
</Toolbar>
Expand Down

0 comments on commit 9d0d9bb

Please sign in to comment.