Skip to content

Commit 1bd0b79

Browse files
authored
Merge pull request #53 from buildbarn/logs
Targets Exploration View, Problems Tab Updates
2 parents 2ee1c2c + 73ad032 commit 1bd0b79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3200
-246
lines changed

ent/gen/ent/gql_collection.go

+22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ent/gen/ent/gql_pagination.go

+47
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ent/schema/targetpair.go

+20-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package schema
22

33
import (
4+
"entgo.io/contrib/entgql"
45
"entgo.io/ent"
6+
"entgo.io/ent/schema"
57
"entgo.io/ent/schema/edge"
68
"entgo.io/ent/schema/field"
79
)
@@ -15,17 +17,23 @@ type TargetPair struct {
1517
func (TargetPair) Fields() []ent.Field {
1618
return []ent.Field{
1719
// The label of the target ex: //foo:bar.
18-
field.String("label").Optional(),
20+
field.String("label").
21+
Optional(),
1922

2023
// Duration in Milliseconds.
2124
// Time from target configured message received and processed until target completed message received and processed, calculated on build complete
22-
field.Int64("duration_in_ms").Optional(),
25+
field.Int64("duration_in_ms").
26+
Optional().
27+
Annotations(entgql.OrderField("DURATION")),
2328

2429
// Overall success of the target (defaults to false).
25-
field.Bool("success").Optional().Default(false),
30+
field.Bool("success").
31+
Optional().
32+
Default(false),
2633

2734
// The target kind if available.
28-
field.String("target_kind").Optional(),
35+
field.String("target_kind").
36+
Optional(),
2937

3038
// The size of the test, if the target is a test target. Unset otherwise.
3139
field.Enum("test_size").
@@ -72,3 +80,11 @@ func (TargetPair) Edges() []ent.Edge {
7280
Unique(),
7381
}
7482
}
83+
84+
// Annotations of the TargetPair
85+
func (TargetPair) Annotations() []schema.Annotation {
86+
return []schema.Annotation{
87+
entgql.RelayConnection(),
88+
entgql.QueryField("findTargets"),
89+
}
90+
}

frontend/src/app/bazel-invocations/[invocationID]/index.graphql.ts

+21-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ export const LOAD_FULL_BAZEL_INVOCATION_DETAILS = gql(/* GraphQL */ `
88
}
99
`);
1010

11+
export const GET_PROBLEM_DETAILS = gql(/* GraphQL */ `
12+
query GetProblemDetails($invocationID: String!) {
13+
bazelInvocation(invocationId: $invocationID) {
14+
...ProblemDetails
15+
}
16+
}
17+
`);
18+
19+
export const PROBLEM_DETAILS_FRAGMENT = gql(/* GraphQL */`
20+
21+
fragment ProblemDetails on BazelInvocation{
22+
problems {
23+
...ProblemInfo
24+
}
25+
}
26+
27+
`)
28+
1129
export const BAZEL_INVOCATION_FRAGMENT = gql(/* GraphQL */ `
1230
fragment BazelInvocationInfo on BazelInvocation {
1331
metrics {
@@ -212,6 +230,9 @@ fragment BazelInvocationInfo on BazelInvocation {
212230
}
213231
id
214232
}
233+
configurationMnemonic
234+
cpu
235+
numFetches
215236
stepLabel
216237
sourceControl {
217238
id
@@ -287,16 +308,11 @@ fragment BlobReferenceInfo on BlobReference {
287308

288309
export const FULL_BAZEL_INVOCATION_DETAILS = gql(/* GraphQL */ `
289310
fragment FullBazelInvocationDetails on BazelInvocation {
290-
problems {
291-
...ProblemInfo
292-
}
293311
...BazelInvocationInfo
294312
}
295313
`);
296314

297315

298-
299-
300316
export const GET_ACTION_PROBLEM = gql(/* GraphQL */ `
301317
query GetActionProblem($id: ID!) {
302318
node(id: $id) {

frontend/src/app/bazel-invocations/[invocationID]/page.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ const BazelInvocationsContent: React.FC<Props> = ({ loading, error, networkStatu
4040
</Spin>
4141
);
4242
}
43+
if (loading && networkStatus !== NetworkStatus.poll) {
44+
return (
45+
<Spin />
46+
);
47+
}
4348
if (error && invocationInfo) {
4449
return (
4550
<>
@@ -50,12 +55,7 @@ const BazelInvocationsContent: React.FC<Props> = ({ loading, error, networkStatu
5055
}
5156

5257
if (invocationInfo) {
53-
return <BazelInvocation invocationOverview={invocationInfo}>
54-
<BuildProblems
55-
problems={problems}
56-
/>
57-
</BazelInvocation>
58-
58+
return <BazelInvocation invocationOverview={invocationInfo} />
5959
}
6060

6161
return <></>
@@ -78,7 +78,7 @@ const Page: React.FC<PageParams> = ({ params }) => {
7878

7979
const invocation = getFragmentData(FULL_BAZEL_INVOCATION_DETAILS, data?.bazelInvocation);
8080
const invocationOverview = getFragmentData(BAZEL_INVOCATION_FRAGMENT, invocation)
81-
const problems = invocation?.problems.map(p => getFragmentData(PROBLEM_INFO_FRAGMENT, p))
81+
8282

8383
const stop = shouldStopPolling(invocation);
8484
useEffect(() => {
@@ -91,7 +91,7 @@ const Page: React.FC<PageParams> = ({ params }) => {
9191

9292
return (
9393
<Content
94-
content={<BazelInvocationsContent loading={loading} error={error} networkStatus={networkStatus} invocationInfo={invocationOverview as BazelInvocationInfoFragment} problems={problems ?? []} />}
94+
content={<BazelInvocationsContent loading={loading} error={error} networkStatus={networkStatus} invocationInfo={invocationOverview as BazelInvocationInfoFragment} problems={[]} />}
9595
/>
9696
);
9797
}

frontend/src/app/targets/[slug]/graphql.ts

Whitespace-only changes.
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
'use client';
2+
3+
import React from 'react';
4+
import Content from '@/components/Content';
5+
import PortalCard from '@/components/PortalCard';
6+
import { Space } from 'antd';
7+
import { DeploymentUnitOutlined } from '@ant-design/icons';
8+
import TargetDetails from '@/components/Targets/TargetDetails';
9+
10+
interface PageParams {
11+
params: {
12+
slug: string
13+
}
14+
}
15+
16+
const Page: React.FC<PageParams> = ({ params }) => {
17+
const label = decodeURIComponent(atob(decodeURIComponent(params.slug)))
18+
return (
19+
<Content
20+
content={
21+
<Space direction="vertical" size="middle" style={{ display: 'flex' }}>
22+
<PortalCard
23+
icon={<DeploymentUnitOutlined />}
24+
titleBits={[<span key="title">Target Details</span>]}
25+
>
26+
<TargetDetails label={label} />
27+
</PortalCard>
28+
</Space >
29+
}
30+
/>
31+
);
32+
}
33+
34+
export default Page;

frontend/src/app/targets/graphql.tsx

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { gql } from "@/graphql/__generated__";
2+
3+
export const GET_TARGETS_DATA = gql(/* GraphQl */`
4+
query GetTargetsWithOffset(
5+
$label: String,
6+
$offset: Int,
7+
$limit: Int,
8+
$sortBy: String,
9+
$direction: String) {
10+
getTargetsWithOffset(
11+
label: $label
12+
offset: $offset
13+
limit: $limit
14+
sortBy: $sortBy
15+
direction: $direction
16+
) {
17+
total
18+
result {
19+
label
20+
sum
21+
min
22+
max
23+
avg
24+
count
25+
passRate
26+
}
27+
}
28+
}
29+
`);
30+
31+
export const FIND_TARGETS = gql(/* GraphQL */ `
32+
query FindTargets(
33+
$first: Int!
34+
$where: TargetPairWhereInput
35+
$orderBy: TargetPairOrder
36+
$after: Cursor
37+
){
38+
findTargets (first: $first, where: $where, orderBy: $orderBy, after: $after){
39+
totalCount
40+
pageInfo{
41+
startCursor
42+
endCursor
43+
hasNextPage
44+
hasPreviousPage
45+
}
46+
edges {
47+
node {
48+
id
49+
durationInMs
50+
label
51+
success
52+
bazelInvocation {
53+
invocationID
54+
}
55+
}
56+
}
57+
}
58+
}
59+
`);
60+
61+
export default GET_TARGETS_DATA;

frontend/src/app/targets/page.tsx

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use client';
2+
3+
import React from 'react';
4+
import Content from '@/components/Content';
5+
import PortalCard from '@/components/PortalCard';
6+
import { Space } from 'antd';
7+
import { DeploymentUnitOutlined } from '@ant-design/icons';
8+
import TargetGrid from '@/components/Targets/TargetGrid';
9+
10+
const Page: React.FC = () => {
11+
return (
12+
<Content
13+
content={
14+
<Space direction="vertical" size="middle" style={{ display: 'flex' }}>
15+
<PortalCard
16+
icon={<DeploymentUnitOutlined />}
17+
titleBits={[<span key="title">Targets Overview</span>]}>
18+
<TargetGrid />
19+
</PortalCard>
20+
</Space >
21+
}
22+
/>
23+
);
24+
}
25+
26+
export default Page;

frontend/src/components/ActionDataMetrics/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const ActionDataMetrics: React.FC<{ acMetrics: ActionSummary | undefined; }> = (
124124
</PortalCard> */}
125125
</Col>
126126
<Col span="10">
127-
<PortalCard type="inner" icon={<PieChartOutlined />} titleBits={["User Time Breakdown"]}>
127+
<PortalCard type="inner" icon={<PieChartOutlined />} titleBits={["User Time Breakdown"]} hidden={totalUserTime == 0}>
128128
<PieChart width={600} height={556}>
129129
<Pie
130130
activeIndex={activeIndexRunner}

frontend/src/components/AppBar/AppBarMenu.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import React from 'react';
44
import { Menu } from 'antd';
55
import { MenuMode } from 'rc-menu/es/interface';
66
import { usePathname } from 'next/navigation';
7-
import { ItemType } from 'antd/lib/menu/hooks/useItems';
7+
//import { ItemType } from 'antd/lib/menu/hooks/useItems';
88
import styles from './index.module.css';
99
import { getClosestKey } from '@/components/Utilities/navigation';
10+
import { ItemType } from 'antd/lib/menu/interface';
1011

1112
type Props = {
1213
mode: MenuMode;

frontend/src/components/AppBar/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const APP_BAR_MENU_ITEMS: ItemType[] = [
2222
getItem({ depth: 0, href: '/bazel-invocations', title: 'Invocations' }),
2323
getItem({ depth: 0, href: '/trends', title: "Trends" }),
2424
getItem({ depth: 0, href: '/tests', title: "Tests" }),
25+
getItem({ depth: 0, href: '/targets', title: "Targets" }),
2526
];
2627

2728
type Props = {

0 commit comments

Comments
 (0)