15
15
import m from 'mithril' ;
16
16
17
17
import { Icons } from '../base/semantic_icons' ;
18
- import { duration , Time , TimeSpan } from '../base/time' ;
18
+ import { Time , TimeSpan } from '../base/time' ;
19
19
import { exists } from '../base/utils' ;
20
20
import { raf } from '../core/raf_scheduler' ;
21
21
import { Engine } from '../trace_processor/engine' ;
@@ -25,11 +25,11 @@ import {DetailsShell} from '../widgets/details_shell';
25
25
import { GridLayout , GridLayoutColumn } from '../widgets/grid_layout' ;
26
26
import { MenuItem , PopupMenu2 } from '../widgets/menu' ;
27
27
import { Section } from '../widgets/section' ;
28
- import { Tree , TreeNode } from '../widgets/tree' ;
28
+ import { Tree } from '../widgets/tree' ;
29
29
30
30
import { BottomTab , NewBottomTabArgs } from './bottom_tab' ;
31
31
import { addDebugSliceTrack } from './debug_tracks/debug_tracks' ;
32
- import { FlowPoint , globals } from './globals' ;
32
+ import { Flow , FlowPoint , globals } from './globals' ;
33
33
import { addQueryResultsTab } from './query_result_tab' ;
34
34
import { hasArgs , renderArguments } from './slice_args' ;
35
35
import { renderDetails } from './slice_details' ;
@@ -43,6 +43,7 @@ import {DurationWidget} from './widgets/duration';
43
43
import { addSqlTableTab } from './sql_table_tab' ;
44
44
import { SqlTables } from './widgets/sql/table/well_known_sql_tables' ;
45
45
import { SliceRef } from './widgets/slice' ;
46
+ import { BasicTable } from '../widgets/basic_table' ;
46
47
47
48
interface ContextMenuItem {
48
49
name : string ;
@@ -363,12 +364,35 @@ export class ThreadSliceDetailsTab extends BottomTab<ThreadSliceDetailsTabConfig
363
364
return m (
364
365
Section ,
365
366
{ title : 'Preceding Flows' } ,
366
- m (
367
- Tree ,
368
- inFlows . map ( ( { begin, dur} ) =>
369
- this . renderFlow ( begin , dur , ! isRunTask ) ,
370
- ) ,
371
- ) ,
367
+ m ( BasicTable , {
368
+ columns : [
369
+ {
370
+ title : 'Slice' ,
371
+ render : ( flow : Flow ) =>
372
+ m ( SliceRef , {
373
+ id : asSliceSqlId ( flow . begin . sliceId ) ,
374
+ name :
375
+ flow . begin . sliceChromeCustomName ?? flow . begin . sliceName ,
376
+ ts : flow . begin . sliceStartTs ,
377
+ dur : flow . begin . sliceEndTs - flow . begin . sliceStartTs ,
378
+ sqlTrackId : flow . begin . trackId ,
379
+ } ) ,
380
+ } ,
381
+ {
382
+ title : 'Delay' ,
383
+ render : ( flow : Flow ) =>
384
+ m ( DurationWidget , {
385
+ dur : flow . end . sliceStartTs - flow . begin . sliceEndTs ,
386
+ } ) ,
387
+ } ,
388
+ {
389
+ title : 'Thread' ,
390
+ render : ( flow : Flow ) =>
391
+ this . getThreadNameForFlow ( flow . begin , ! isRunTask ) ,
392
+ } ,
393
+ ] ,
394
+ data : inFlows ,
395
+ } ) ,
372
396
) ;
373
397
} else {
374
398
return null ;
@@ -387,45 +411,47 @@ export class ThreadSliceDetailsTab extends BottomTab<ThreadSliceDetailsTabConfig
387
411
return m (
388
412
Section ,
389
413
{ title : 'Following Flows' } ,
390
- m (
391
- Tree ,
392
- outFlows . map ( ( { end, dur} ) => this . renderFlow ( end , dur , ! isPostTask ) ) ,
393
- ) ,
414
+ m ( BasicTable , {
415
+ columns : [
416
+ {
417
+ title : 'Slice' ,
418
+ render : ( flow : Flow ) =>
419
+ m ( SliceRef , {
420
+ id : asSliceSqlId ( flow . end . sliceId ) ,
421
+ name : flow . end . sliceChromeCustomName ?? flow . end . sliceName ,
422
+ ts : flow . end . sliceStartTs ,
423
+ dur : flow . end . sliceEndTs - flow . end . sliceStartTs ,
424
+ sqlTrackId : flow . end . trackId ,
425
+ } ) ,
426
+ } ,
427
+ {
428
+ title : 'Delay' ,
429
+ render : ( flow : Flow ) =>
430
+ m ( DurationWidget , {
431
+ dur : flow . end . sliceEndTs - flow . end . sliceStartTs ,
432
+ } ) ,
433
+ } ,
434
+ {
435
+ title : 'Thread' ,
436
+ render : ( flow : Flow ) =>
437
+ this . getThreadNameForFlow ( flow . end , ! isPostTask ) ,
438
+ } ,
439
+ ] ,
440
+ data : outFlows ,
441
+ } ) ,
394
442
) ;
395
443
} else {
396
444
return null ;
397
445
}
398
446
}
399
447
400
- private renderFlow (
448
+ private getThreadNameForFlow (
401
449
flow : FlowPoint ,
402
- dur : duration ,
403
450
includeProcessName : boolean ,
404
- ) : m . Children {
405
- const description =
406
- flow . sliceChromeCustomName === undefined
407
- ? flow . sliceName
408
- : flow . sliceChromeCustomName ;
409
- const threadName = includeProcessName
451
+ ) : string {
452
+ return includeProcessName
410
453
? `${ flow . threadName } (${ flow . processName } )`
411
454
: flow . threadName ;
412
-
413
- return m (
414
- TreeNode ,
415
- { left : 'Flow' } ,
416
- m ( TreeNode , {
417
- left : 'Slice' ,
418
- right : m ( SliceRef , {
419
- id : asSliceSqlId ( flow . sliceId ) ,
420
- name : description ,
421
- ts : flow . sliceStartTs ,
422
- dur : flow . sliceEndTs - flow . sliceStartTs ,
423
- sqlTrackId : flow . trackId ,
424
- } ) ,
425
- } ) ,
426
- m ( TreeNode , { left : 'Delay' , right : m ( DurationWidget , { dur} ) } ) ,
427
- m ( TreeNode , { left : 'Thread' , right : threadName } ) ,
428
- ) ;
429
455
}
430
456
431
457
private renderContextButton ( sliceInfo : SliceDetails ) : m . Children {
0 commit comments