Skip to content

Commit

Permalink
show empty state in monitoring when no datapoint available
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesis09 committed Sep 13, 2020
1 parent 9991262 commit cc32b9b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions frontend/public/components/monitoring/_monitoring.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ $tooltip-background-color: #151515;

.graph-empty-state {
min-height: 310px;
align-items: center;
display: flex;
justify-content: center;
}

.graph-wrapper__horizontal-bar {
Expand Down
8 changes: 5 additions & 3 deletions frontend/public/components/monitoring/query-browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -680,10 +680,12 @@ const QueryBrowser_: React.FC<QueryBrowserProps> = ({
setSpan(to - from);
};

const isGraphDataEmpty = !graphData || graphData.every((d) => d.length === 0);

return (
<div
className={classNames('query-browser__wrapper', {
'graph-empty-state': _.isEmpty(graphData),
'graph-empty-state': isGraphDataEmpty && !updating,
})}
>
{hideControls ? (
Expand All @@ -702,8 +704,8 @@ const QueryBrowser_: React.FC<QueryBrowserProps> = ({
</div>
)}
{error && <Error error={error} />}
{_.isEmpty(graphData) && !updating && <GraphEmpty />}
{!_.isEmpty(graphData) && (
{isGraphDataEmpty && !updating && <GraphEmpty />}
{!isGraphDataEmpty && (
<>
{samples < maxSamplesForSpan && !updating && (
<Alert
Expand Down

0 comments on commit cc32b9b

Please sign in to comment.