in sapp/ui/frontend/src/index.js [39:90]
function IssuesForLatestRun(): React$Node {
const RunsQuery = gql`
query Run {
runs {
edges {
node {
run_id
date
}
}
}
}
`;
const {loading, error} = useQuery(RunsQuery, {
onCompleted: data => {
var run_id = -1;
data.runs.edges.forEach(edge => {
if (edge.node.run_id > run_id) {
run_id = edge.node.run_id;
}
});
if (run_id === -1) {
Modal.error({
title: 'Unable to load run data',
content: 'No completed run found',
});
}
window.location = `/run/${run_id}`;
},
});
if (error) {
Modal.error({title: 'Unable to load run data', content: error.toString()});
}
if (loading) {
return (
<Card>
<div style={{height: '12em', textAlign: 'center', paddingTop: '5em'}}>
<Text type="secondary">
<LoadingOutlined />
<br />
Loading latest run...
</Text>
</div>
</Card>
);
}
return null;
}