Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Commit

Permalink
Fix for quantum flow component
Browse files Browse the repository at this point in the history
modify order of whiteboard tags and create noDataFound state for empty arrays
  • Loading branch information
sarah-clements committed Jun 6, 2018
1 parent 319e02d commit 8f81a03
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/components/graph-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default class GraphContainer extends React.Component {
data: null,
status: null,
apiFailed: false,
noDataFound: false,
};
}

Expand Down Expand Up @@ -45,7 +46,7 @@ export default class GraphContainer extends React.Component {

parseData(data) {
if (data.length === 0) {
this.setState({ apiFailed: true });
this.setState({ noDataFound: true });
return;
}
const { checkStatus, keys, targetValue, targetLine } = this.props;
Expand All @@ -57,9 +58,15 @@ export default class GraphContainer extends React.Component {
}

render() {
const { data, status, apiFailed } = this.state;
const { data, status, apiFailed, noDataFound } = this.state;
const { title, link, legend, baselines, target, width, height, customClass } = this.props;
let viewport = [0, 0];
let message = 'Oops, something went wrong.';

if (noDataFound) {
message = 'No data found';
}

return (
<Widget
className={`graphic-timeline graphic-widget ${customClass}`}
Expand All @@ -70,8 +77,8 @@ export default class GraphContainer extends React.Component {
viewport={size => (viewport = size)}
status={status}
>
{apiFailed ?
<div>Oops, something went wrong.</div> :
{apiFailed || noDataFound ?
<div>{message}</div> :
<div>
{!data &&
<div>Loading...</div>}
Expand Down
2 changes: 1 addition & 1 deletion src/quantum/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ export const flowGraphProps = {
target: 'Fix P1 Bugs',
width: 950,
height: 300,
query: { whiteboard: '[qf:p1][qf:f61]' },
query: { whiteboard: '[qf:f61][qf:p1]' },
keys: ['total', 'closed', 'needsAnalysis', 'analyzed'],
};

0 comments on commit 8f81a03

Please sign in to comment.