Skip to content

Commit

Permalink
feat: update batch progression in build status
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Mar 4, 2024
1 parent 71d46fe commit 42ac1b3
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 43 deletions.
6 changes: 0 additions & 6 deletions apps/backend/src/graphql/__generated__/resolver-types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions apps/backend/src/graphql/definitions/Build.ts
Expand Up @@ -76,10 +76,6 @@ export const typeDefs = gql`
stats: BuildStats!
"Build type"
type: BuildType
"Received batch count "
batchCount: Int
"Expected batch count"
totalBatch: Int
"Pull request head commit"
prHeadCommit: String
"Commit"
Expand Down
12 changes: 0 additions & 12 deletions apps/frontend/src/containers/Build.tsx
Expand Up @@ -179,18 +179,6 @@ export const getBuildLabel = (
}
};

export const checkIsBuildIncomplete = (build: {
batchCount?: number | null;
totalBatch?: number | null;
}): boolean => {
return (
build.totalBatch != null &&
build.batchCount != null &&
build.totalBatch > 0 &&
build.batchCount < build.totalBatch
);
};

export const checkIsBuildEmpty = (build: {
stats: { total: number };
}): boolean => {
Expand Down
17 changes: 10 additions & 7 deletions apps/frontend/src/containers/BuildStatusDescription.tsx
@@ -1,17 +1,20 @@
import { FragmentType, graphql, useFragment } from "@/gql";
import { Code } from "@/ui/Code";

import { checkIsBuildEmpty, checkIsBuildIncomplete } from "./Build";
import { checkIsBuildEmpty } from "./Build";

const BuildFragment = graphql(`
fragment BuildStatusDescription_Build on Build {
type
status
batchCount
totalBatch
stats {
total
}
parallel {
total
received
nonce
}
}
`);

Expand All @@ -29,14 +32,14 @@ export const BuildStatusDescription = (props: {
const project = useFragment(ProjectFragment, props.project);

if (build.status === "expired") {
if (checkIsBuildIncomplete(build)) {
if (build.parallel) {
return (
<>
Build has been killed because it took too much time to receive all
The build was aborted because it took too long to receive all the
batches.
<br />
Be sure that argos upload is called up to the number specified in
parallel total.
Received {build.parallel.received}/{build.parallel.total} batches with
nonce <span className="font-mono">{build.parallel.nonce}</span>.
</>
);
}
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/gql/gql.ts
Expand Up @@ -28,7 +28,7 @@ const documents = {
"\n query ProjectBreadcrumbMenu_account($slug: String!) {\n account(slug: $slug) {\n id\n projects(first: 100, after: 0) {\n edges {\n id\n name\n }\n }\n }\n }\n": types.ProjectBreadcrumbMenu_AccountDocument,
"\n fragment BuildStatusChip_Build on Build {\n ...BuildStatusDescription_Build\n type\n status\n }\n": types.BuildStatusChip_BuildFragmentDoc,
"\n fragment BuildStatusChip_Project on Project {\n ...BuildStatusDescription_Project\n }\n": types.BuildStatusChip_ProjectFragmentDoc,
"\n fragment BuildStatusDescription_Build on Build {\n type\n status\n batchCount\n totalBatch\n stats {\n total\n }\n }\n": types.BuildStatusDescription_BuildFragmentDoc,
"\n fragment BuildStatusDescription_Build on Build {\n type\n status\n stats {\n total\n }\n parallel {\n total\n received\n nonce\n }\n }\n": types.BuildStatusDescription_BuildFragmentDoc,
"\n fragment BuildStatusDescription_Project on Project {\n referenceBranch\n }\n": types.BuildStatusDescription_ProjectFragmentDoc,
"\n fragment GithubAccountLink_GithubAccount on GithubAccount {\n login\n name\n url\n }\n": types.GithubAccountLink_GithubAccountFragmentDoc,
"\n fragment GithubInstallationsSelect_GhApiInstallation on GhApiInstallation {\n id\n account {\n id\n login\n name\n }\n }\n": types.GithubInstallationsSelect_GhApiInstallationFragmentDoc,
Expand Down Expand Up @@ -199,7 +199,7 @@ export function graphql(source: "\n fragment BuildStatusChip_Project on Project
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n fragment BuildStatusDescription_Build on Build {\n type\n status\n batchCount\n totalBatch\n stats {\n total\n }\n }\n"): (typeof documents)["\n fragment BuildStatusDescription_Build on Build {\n type\n status\n batchCount\n totalBatch\n stats {\n total\n }\n }\n"];
export function graphql(source: "\n fragment BuildStatusDescription_Build on Build {\n type\n status\n stats {\n total\n }\n parallel {\n total\n received\n nonce\n }\n }\n"): (typeof documents)["\n fragment BuildStatusDescription_Build on Build {\n type\n status\n stats {\n total\n }\n parallel {\n total\n received\n nonce\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
18 changes: 7 additions & 11 deletions apps/frontend/src/gql/graphql.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/frontend/src/ui/Progress.tsx
@@ -1,4 +1,4 @@
import clsx from "clsx";
import { clsx } from "clsx";

export const Progress = ({
className,
Expand Down

0 comments on commit 42ac1b3

Please sign in to comment.