@@ -2735,6 +2735,12 @@ view.ObjectSidebar = class extends view.Control {
2735
2735
this . element = this . createElement ( 'div' , 'sidebar-object' ) ;
2736
2736
}
2737
2737
2738
+ addSection ( title ) {
2739
+ const element = this . createElement ( 'div' , 'sidebar-section' ) ;
2740
+ element . innerText = title ;
2741
+ this . element . appendChild ( element ) ;
2742
+ }
2743
+
2738
2744
addEntry ( name , item ) {
2739
2745
const entry = new view . NameValueView ( this . _view , name , item ) ;
2740
2746
const element = entry . render ( ) ;
@@ -2747,16 +2753,21 @@ view.ObjectSidebar = class extends view.Control {
2747
2753
return item ;
2748
2754
}
2749
2755
2750
- addHeader ( title ) {
2751
- const element = this . createElement ( 'h1' , 'sidebar-header' ) ;
2752
- element . innerText = title ;
2753
- this . element . appendChild ( element ) ;
2754
- }
2755
-
2756
- addSection ( title ) {
2757
- const element = this . createElement ( 'div' , 'sidebar-section' ) ;
2758
- element . innerText = title ;
2759
- this . element . appendChild ( element ) ;
2756
+ addArgument ( name , argument , source ) {
2757
+ const value = new view . ArgumentView ( this . _view , argument , source ) ;
2758
+ value . on ( 'focus' , ( sender , value ) => {
2759
+ this . emit ( 'focus' , value ) ;
2760
+ this . _focused = this . _focused || new Set ( ) ;
2761
+ this . _focused . add ( value ) ;
2762
+ } ) ;
2763
+ value . on ( 'blur' , ( sender , value ) => {
2764
+ this . emit ( 'blur' , value ) ;
2765
+ this . _focused = this . _focused || new Set ( ) ;
2766
+ this . _focused . delete ( value ) ;
2767
+ } ) ;
2768
+ value . on ( 'select' , ( sender , value ) => this . emit ( 'select' , value ) ) ;
2769
+ value . on ( 'activate' , ( sender , value ) => this . emit ( 'activate' , value ) ) ;
2770
+ this . addEntry ( name , value ) ;
2760
2771
}
2761
2772
2762
2773
error ( error , fatal ) {
@@ -2844,36 +2855,19 @@ view.NodeSidebar = class extends view.ObjectSidebar {
2844
2855
const metadata = node . metadata ;
2845
2856
if ( Array . isArray ( metadata ) && metadata . length > 0 ) {
2846
2857
this . addSection ( 'Metadata' ) ;
2847
- for ( const entry of metadata ) {
2848
- this . addArgument ( entry . name , entry , 'attribute' ) ;
2858
+ for ( const argument of metadata ) {
2859
+ this . addArgument ( argument . name , argument ) ;
2849
2860
}
2850
2861
}
2851
2862
const metrics = this . _view . metrics . node ( node ) ;
2852
2863
if ( Array . isArray ( metrics ) && metrics . length > 0 ) {
2853
2864
this . addSection ( 'Metrics' ) ;
2854
- for ( const metric of metrics ) {
2855
- this . addArgument ( metric . name , metric ) ;
2865
+ for ( const argument of metrics ) {
2866
+ this . addArgument ( argument . name , argument ) ;
2856
2867
}
2857
2868
}
2858
2869
}
2859
2870
2860
- addArgument ( name , argument , source ) {
2861
- const value = new view . ArgumentView ( this . _view , argument , source ) ;
2862
- value . on ( 'focus' , ( sender , value ) => {
2863
- this . emit ( 'focus' , value ) ;
2864
- this . _focused = this . _focused || new Set ( ) ;
2865
- this . _focused . add ( value ) ;
2866
- } ) ;
2867
- value . on ( 'blur' , ( sender , value ) => {
2868
- this . emit ( 'blur' , value ) ;
2869
- this . _focused = this . _focused || new Set ( ) ;
2870
- this . _focused . delete ( value ) ;
2871
- } ) ;
2872
- value . on ( 'select' , ( sender , value ) => this . emit ( 'select' , value ) ) ;
2873
- value . on ( 'activate' , ( sender , value ) => this . emit ( 'activate' , value ) ) ;
2874
- this . addEntry ( name , value ) ;
2875
- }
2876
-
2877
2871
activate ( ) {
2878
2872
this . emit ( 'select' , this . _node ) ;
2879
2873
}
@@ -3517,15 +3511,15 @@ view.ConnectionSidebar = class extends view.ObjectSidebar {
3517
3511
}
3518
3512
if ( Array . isArray ( value . metadata ) && value . metadata . length > 0 ) {
3519
3513
this . addSection ( 'Metadata' ) ;
3520
- for ( const metadata of value . metadata ) {
3521
- this . addProperty ( metadata . name , metadata . value ) ;
3514
+ for ( const argument of value . metadata ) {
3515
+ this . addArgument ( argument . name , argument ) ;
3522
3516
}
3523
3517
}
3524
3518
const metrics = this . _view . metrics . value ( value ) ;
3525
3519
if ( Array . isArray ( metrics ) && metrics . length > 0 ) {
3526
3520
this . addSection ( 'Metrics' ) ;
3527
3521
for ( const argument of metrics ) {
3528
- this . addProperty ( argument . name , argument . value ) ;
3522
+ this . addArgument ( argument . name , argument ) ;
3529
3523
}
3530
3524
}
3531
3525
}
@@ -3618,7 +3612,7 @@ view.TensorSidebar = class extends view.ObjectSidebar {
3618
3612
if ( Array . isArray ( metadata ) && metadata . length > 0 ) {
3619
3613
this . addSection ( 'Metadata' ) ;
3620
3614
for ( const argument of tensor . metadata ) {
3621
- this . addProperty ( argument . name , argument . value ) ;
3615
+ this . addArgument ( argument . name , argument ) ;
3622
3616
}
3623
3617
}
3624
3618
}
@@ -3698,14 +3692,14 @@ view.ModelSidebar = class extends view.ObjectSidebar {
3698
3692
if ( Array . isArray ( metadata ) && metadata . length > 0 ) {
3699
3693
this . addSection ( 'Metadata' ) ;
3700
3694
for ( const argument of metadata ) {
3701
- this . addProperty ( argument . name , argument . value ) ;
3695
+ this . addArgument ( argument . name , argument ) ;
3702
3696
}
3703
3697
}
3704
3698
const metrics = this . _view . metrics . model ( model ) ;
3705
3699
if ( Array . isArray ( metrics ) && metrics . length > 0 ) {
3706
3700
this . addSection ( 'Metrics' ) ;
3707
3701
for ( const argument of metrics ) {
3708
- this . addProperty ( argument . name , argument . value ) ;
3702
+ this . addArgument ( argument . name , argument ) ;
3709
3703
}
3710
3704
}
3711
3705
}
@@ -3764,14 +3758,14 @@ view.TargetSidebar = class extends view.ObjectSidebar {
3764
3758
if ( Array . isArray ( metadata ) && metadata . length > 0 ) {
3765
3759
this . addSection ( 'Metadata' ) ;
3766
3760
for ( const argument of metadata ) {
3767
- this . addProperty ( argument . name , argument . value ) ;
3761
+ this . addArgument ( argument . name , argument ) ;
3768
3762
}
3769
3763
}
3770
3764
const metrics = this . _view . metrics . graph ( target ) ;
3771
3765
if ( Array . isArray ( metrics ) && metrics . length > 0 ) {
3772
3766
this . addSection ( 'Metrics' ) ;
3773
3767
for ( const argument of metrics ) {
3774
- this . addProperty ( argument . name , argument . value ) ;
3768
+ this . addArgument ( argument . name , argument ) ;
3775
3769
}
3776
3770
}
3777
3771
}
@@ -5341,8 +5335,8 @@ metrics.Metrics = class {
5341
5335
if ( data && data . signature === 'metrics' && Array . isArray ( data . metrics ) ) {
5342
5336
this . _metrics . clear ( ) ;
5343
5337
for ( const metric of data . metrics ) {
5344
- if ( metric . kind && 'target' in metric ) {
5345
- const key = `${ metric . kind } ::${ metric . target } ` ;
5338
+ if ( metric . kind && ( 'target' in metric || 'identifier' in metric ) ) {
5339
+ const key = 'target' in metric ? `${ metric . kind } ::${ metric . target } ` : ` ${ metric . kind } [ ${ metric . identifier } ] `;
5346
5340
if ( ! this . _metrics . has ( key ) ) {
5347
5341
this . _metrics . set ( key , new Map ( ) ) ;
5348
5342
}
@@ -5356,9 +5350,10 @@ metrics.Metrics = class {
5356
5350
return false ;
5357
5351
}
5358
5352
5359
- metrics ( entries , type , name ) {
5353
+ metrics ( entries , kind , value ) {
5360
5354
const result = new Map ( entries . map ( ( metric ) => [ metric . name , metric ] ) ) ;
5361
- const key = `${ type } ::${ name } ` ;
5355
+ const name = value . identifier === undefined ? `::${ ( value . name || '' ) . split ( '\n' ) . shift ( ) } ` : `[${ value . identifier } ]` ;
5356
+ const key = `${ kind } ${ name } ` ;
5362
5357
if ( this . _metrics . has ( key ) ) {
5363
5358
for ( const [ name , metric ] of this . _metrics . get ( key ) ) {
5364
5359
result . set ( name , new metrics . Argument ( name , metric . value , metric . type || 'attribute' ) ) ;
@@ -5372,20 +5367,19 @@ metrics.Metrics = class {
5372
5367
}
5373
5368
5374
5369
graph ( value ) {
5375
- return this . metrics ( value . metrics || [ ] , 'graph' , value . name || '' ) ;
5370
+ return this . metrics ( value . metrics || [ ] , 'graph' , value ) ;
5376
5371
}
5377
5372
5378
5373
node ( value ) {
5379
- return this . metrics ( value . metrics || [ ] , 'node' , value . name ) ;
5374
+ return this . metrics ( value . metrics || [ ] , 'node' , value ) ;
5380
5375
}
5381
5376
5382
5377
value ( value ) {
5383
- const name = ( value . name || '' ) . split ( '\n' ) . shift ( ) ;
5384
- return this . metrics ( value . metrics || [ ] , 'value' , name ) ;
5378
+ return this . metrics ( value . metrics || [ ] , 'value' , value ) ;
5385
5379
}
5386
5380
5387
5381
tensor ( value ) {
5388
- return this . metrics ( value . metrics || [ ] , 'tensor' , value . name ) ;
5382
+ return this . metrics ( value . metrics || [ ] , 'tensor' , value ) ;
5389
5383
}
5390
5384
} ;
5391
5385
@@ -6598,7 +6592,7 @@ view.ModelFactoryService = class {
6598
6592
async import ( ) {
6599
6593
if ( this . _host . type === 'Browser' || this . _host . type === 'Python' ) {
6600
6594
const files = [
6601
- './server ' , './onnx' , './pytorch' , './tflite' , './mlnet' ,
6595
+ './message ' , './onnx' , './pytorch' , './tflite' , './mlnet' ,
6602
6596
'./onnx-proto' , './onnx-schema' , './tflite-schema' ,
6603
6597
'onnx-metadata.json' , 'pytorch-metadata.json' , 'tflite-metadata.json'
6604
6598
] ;
0 commit comments