@@ -11,7 +11,6 @@ import {
11
11
TestCollection ,
12
12
TargetPair ,
13
13
BuildGraphMetrics ,
14
- BazelCommand ,
15
14
} from "@/graphql/__generated__/graphql" ;
16
15
import styles from "../AppBar/index.module.css"
17
16
import React from "react" ;
@@ -68,19 +67,19 @@ const BazelInvocation: React.FC<{
68
67
invocationID,
69
68
build,
70
69
state,
71
- stepLabel,
72
70
bazelCommand,
73
71
profile,
74
- relatedFiles,
75
72
sourceControl,
76
73
user,
77
74
metrics,
78
75
testCollection,
79
- targets
76
+ targets,
77
+ //stepLabel,
78
+ //relatedFiles,
80
79
81
80
} = invocationOverview ;
82
81
83
- var buildLogs = "tmp"
82
+
84
83
//data for runner metrics
85
84
var runnerMetrics : RunnerCount [ ] = [ ] ;
86
85
metrics ?. actionSummary ?. runnerCount ?. map ( ( item : RunnerCount ) => runnerMetrics . push ( item ) ) ;
@@ -91,9 +90,6 @@ const BazelInvocation: React.FC<{
91
90
//artifact metrics
92
91
var artifactMetrics : ArtifactMetrics | undefined = metrics ?. artifactMetrics ?? undefined ;
93
92
94
- //data for target metrics
95
- var targetMetrics : TargetMetrics | undefined | null = metrics ?. targetMetrics ?? undefined
96
-
97
93
//memory metrics
98
94
var memoryMetrics : MemoryMetrics | undefined = metrics ?. memoryMetrics ?? undefined
99
95
@@ -107,21 +103,21 @@ const BazelInvocation: React.FC<{
107
103
var networkMetrics : NetworkMetrics | undefined = metrics ?. networkMetrics ?? undefined
108
104
const bytesRecv = networkMetrics ?. systemNetworkStats ?. bytesRecv ?? 0
109
105
const bytesSent = networkMetrics ?. systemNetworkStats ?. bytesSent ?? 0
110
- const hideNetworkMetricsTab : boolean = bytesRecv == 0 && bytesSent == 0
111
106
112
107
//test data
113
108
var testCollections : TestCollection [ ] | undefined | null = testCollection
109
+
110
+ //data for target metrics
111
+ var targetMetrics : TargetMetrics | undefined | null = metrics ?. targetMetrics ?? undefined
114
112
var targetData : TargetPair [ ] | undefined | null = targets
115
113
var targetTimes : Map < string , number > = new Map < string , number > ( ) ;
116
-
117
114
targetData ?. map ( x => { targetTimes . set ( x . label ?? "" , x . durationInMs ?? 0 ) } )
118
115
119
- //show/hide tabs
120
- const testCount = testCollection ?. length ?? 0
121
- const hideTestsTab : boolean = testCount == 0
122
- const hideTargetsTab : boolean = ( targetData ?. length ?? 0 ) == 0 ? true : false
123
- const hideSourceControlTab : boolean = sourceControl == undefined || sourceControl == null ? true : false
116
+ //logs
117
+ var buildLogs = "tmp"
118
+ const logs : string = buildLogs ?? "no build log data found..."
124
119
120
+ //build the title
125
121
let { exitCode } = state ;
126
122
exitCode = exitCode ?? null ;
127
123
const titleBits : React . ReactNode [ ] = [ < span key = "label" > User: { user ?. LDAP } </ span > ] ;
@@ -133,9 +129,7 @@ const BazelInvocation: React.FC<{
133
129
titleBits . push ( < BuildStepResultTag key = "result" result = { exitCode ?. name as BuildStepResultEnum } /> ) ;
134
130
}
135
131
136
- //logs
137
- const logs : string = buildLogs ?? "no build log data found..."
138
-
132
+ //tabs
139
133
var items : TabsProps [ 'items' ] = [
140
134
{
141
135
key : 'BazelInvocationTabs-Problems' ,
@@ -146,14 +140,12 @@ const BazelInvocation: React.FC<{
146
140
{ exitCode === null || exitCode . code !== 0 ? (
147
141
children
148
142
) : (
149
-
150
143
< PortalAlert
151
144
message = "There is no debug information to display because there are no reported failures with the build step"
152
145
type = "success"
153
146
showIcon
154
147
/>
155
148
) }
156
-
157
149
</ Space > ,
158
150
} ,
159
151
{
@@ -190,7 +182,6 @@ const BazelInvocation: React.FC<{
190
182
< ActionDataMetrics acMetrics = { acMetrics } />
191
183
</ Space > ,
192
184
} ,
193
-
194
185
{
195
186
key : 'BazelInvocationTabs-Artifacts' ,
196
187
label : 'Artifacts' ,
@@ -215,7 +206,6 @@ const BazelInvocation: React.FC<{
215
206
< TimingMetricsDisplay timingMetrics = { timingMetrics } buildGraphMetrics = { buildGraphMetrics } />
216
207
</ Space > ,
217
208
} ,
218
-
219
209
{
220
210
key : 'BazelInvocationTabs-Targets' ,
221
211
label : 'Targets' ,
@@ -258,25 +248,35 @@ const BazelInvocation: React.FC<{
258
248
} ,
259
249
] ;
260
250
261
- const hideLogs = true //hide the logs tab for now
262
- if ( hideLogs == true ) {
263
- var idx = items . findIndex ( ( x , _ ) => x . key == "BazelInvocationTabs-Logs" )
264
- if ( idx > - 1 ) {
265
- items . splice ( idx , 1 ) ;
266
- }
251
+ //show/hide tabs
252
+ interface TabShowHideDisplay {
253
+ hide : boolean ,
254
+ key : string
267
255
}
268
256
269
- if ( hideTestsTab == true ) {
270
- var idx = items . findIndex ( ( x , _ ) => x . key == "BazelInvocationTabs-Tests" )
271
- if ( idx > - 1 ) {
272
- items . splice ( idx , 1 ) ;
273
- }
274
- }
257
+ const hideTestsTab : boolean = ( testCollection ?. length ?? 0 ) == 0
258
+ const hideTargetsTab : boolean = ( targetData ?. length ?? 0 ) == 0 ? true : false
259
+ const hideNetworkTab : boolean = bytesRecv == 0 && bytesSent == 0
260
+ const hideSourceControlTab : boolean = sourceControl ?. runID == undefined || sourceControl . runID == null || sourceControl . runID == "" ? true : false
261
+ const hideLogsTab : boolean = true
262
+ const hideMemoryTab : boolean = ( memoryMetrics ?. peakPostGcHeapSize ?? 0 ) == 0 && ( memoryMetrics ?. peakPostGcHeapSize ?? 0 ) == 0 && ( memoryMetrics ?. usedHeapSizePostBuild ?? 0 ) == 0
263
+
264
+ const showHideTabs : TabShowHideDisplay [ ] = [
265
+ { key : "BazelInvocationTabs-Tests" , hide : hideTestsTab } ,
266
+ { key : "BazelInvocationTabs-Targets" , hide : hideTargetsTab } ,
267
+ { key : "BazelInvocationTabs-Network" , hide : hideNetworkTab } ,
268
+ { key : "BazelInvocationTabs-SourceControl" , hide : hideSourceControlTab } ,
269
+ { key : "BazelInvocationTabs-Logs" , hide : hideLogsTab } ,
270
+ { key : "BazelInvocationTabs-Memory" , hide : hideMemoryTab } ,
271
+ ]
275
272
276
- if ( hideNetworkMetricsTab == true ) {
277
- var idx = items . findIndex ( ( x , _ ) => x . key == "BazelInvocationTabs-Network" )
278
- if ( idx > - 1 ) {
279
- items . splice ( idx , 1 ) ;
273
+ for ( var i in showHideTabs ) {
274
+ var tab = showHideTabs [ i ]
275
+ if ( tab . hide == true ) {
276
+ var idx = items . findIndex ( ( x , _ ) => x . key == tab . key )
277
+ if ( idx > - 1 ) {
278
+ items . splice ( idx , 1 ) ;
279
+ }
280
280
}
281
281
}
282
282
0 commit comments