Skip to content

Commit

Permalink
fix: no data error
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniomuso committed Aug 29, 2023
1 parent e1c4b8b commit b44eb1d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
6 changes: 2 additions & 4 deletions packages/gitlab/src/api/GitlabCIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ export class GitlabCIClient implements GitlabCIApi {
return undefined;
}

protected async callGraphQLApi<T>(
query: GraphQLQuery
): Promise<T | undefined> {
protected callGraphQLApi<T>(query: GraphQLQuery): Promise<T | undefined> {
const options = {
method: 'POST',
headers: {
Expand Down Expand Up @@ -294,7 +292,7 @@ export class GitlabCIClient implements GitlabCIApi {
): Promise<GitlabProjectCoverageResponse | undefined> {
if (!projectSlug) return undefined;

return await this.callGraphQLApi<GitlabProjectCoverageResponse>({
return this.callGraphQLApi<GitlabProjectCoverageResponse>({
variables: {
projectSlug,
projectDefaultBranch,
Expand Down
4 changes: 4 additions & 0 deletions packages/gitlab/src/components/GitlabCI/GitlabCI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
PipelinesTable,
ReleasesCard,
ReleasesCardProps,
CoverageCard,
} from '../widgets';

export type GitlabPageProps = {
Expand Down Expand Up @@ -41,6 +42,9 @@ export const GitlabCI = (props: GitlabPageProps) => (
<Grid item md={12}>
<IssuesTable />
</Grid>
<Grid item md={12}>
<CoverageCard />
</Grid>
</Grid>
</Content>
</Page>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,26 @@ const CoverageCard = (props: Props) => {
>
<Box position="relative">
<div className={classes.lineChartContainer}>
<LineChart
xAxis={[{ scaleType: 'point', dataKey: 'x' }]}
series={[{ dataKey: 'y' }]}
dataset={dataset}
height={300}
margin={{ bottom: 90, top: 20, left: 40, right: 20 }}
/>
{dataset.length > 0 && (
<LineChart
xAxis={[{ scaleType: 'point', dataKey: 'x' }]}
series={[{ dataKey: 'y' }]}
dataset={dataset}
height={300}
margin={{
bottom: 90,
top: 20,
left: 40,
right: 20,
}}
/>
)}
</div>

<div>
{' '}
<b>Last Coverage: </b>
{!!value.coverageDetails
{dataset.length > 0
? `${value.coverageDetails[0].coverage}%`
: 'No data'}
</div>
Expand Down

0 comments on commit b44eb1d

Please sign in to comment.