@@ -101,7 +101,8 @@ export class TunnelViewModel implements ITunnelViewModel {
101
101
id : TunnelPrivacyId . Private ,
102
102
themeIcon : privatePortIcon . id ,
103
103
label : nls . localize ( 'tunnelPrivacy.private' , "Private" )
104
- }
104
+ } ,
105
+ strip : ( ) => undefined
105
106
} ;
106
107
107
108
constructor (
@@ -415,6 +416,31 @@ class ActionBarRenderer extends Disposable implements ITableRenderer<ActionBarCe
415
416
} ) ) ;
416
417
}
417
418
419
+ private tunnelContext ( tunnel : ITunnelItem ) : ITunnelItem {
420
+ let context : ITunnelItem | undefined ;
421
+ if ( tunnel instanceof TunnelItem ) {
422
+ context = tunnel . strip ( ) ;
423
+ }
424
+ if ( ! context ) {
425
+ context = {
426
+ tunnelType : tunnel . tunnelType ,
427
+ remoteHost : tunnel . remoteHost ,
428
+ remotePort : tunnel . remotePort ,
429
+ localAddress : tunnel . localAddress ,
430
+ protocol : tunnel . protocol ,
431
+ localUri : tunnel . localUri ,
432
+ localPort : tunnel . localPort ,
433
+ name : tunnel . name ,
434
+ closeable : tunnel . closeable ,
435
+ source : tunnel . source ,
436
+ privacy : tunnel . privacy ,
437
+ processDescription : tunnel . processDescription ,
438
+ label : tunnel . label
439
+ } ;
440
+ }
441
+ return context ;
442
+ }
443
+
418
444
renderActionBarItem ( element : ActionBarCell , templateData : IActionBarTemplateData ) : void {
419
445
templateData . label . element . style . display = 'flex' ;
420
446
templateData . label . setLabel ( element . label , undefined ,
@@ -424,22 +450,7 @@ class ActionBarRenderer extends Disposable implements ITableRenderer<ActionBarCe
424
450
: element . tooltip ,
425
451
extraClasses : element . menuId === MenuId . TunnelLocalAddressInline ? [ 'ports-view-actionbar-cell-localaddress' ] : undefined
426
452
} ) ;
427
- const tunnelContext : ITunnelItem = {
428
- tunnelType : element . tunnel . tunnelType ,
429
- remoteHost : element . tunnel . remoteHost ,
430
- remotePort : element . tunnel . remotePort ,
431
- localAddress : element . tunnel . localAddress ,
432
- protocol : element . tunnel . protocol ,
433
- localUri : element . tunnel . localUri ,
434
- localPort : element . tunnel . localPort ,
435
- name : element . tunnel . name ,
436
- closeable : element . tunnel . closeable ,
437
- source : element . tunnel . source ,
438
- privacy : element . tunnel . privacy ,
439
- processDescription : element . tunnel . processDescription ,
440
- label : element . tunnel . label
441
- } ;
442
- templateData . actionBar . context = tunnelContext ;
453
+ templateData . actionBar . context = this . tunnelContext ( element . tunnel ) ;
443
454
templateData . container . style . paddingLeft = '10px' ;
444
455
const context : [ string , any ] [ ] =
445
456
[
@@ -581,6 +592,29 @@ class TunnelItem implements ITunnelItem {
581
592
tunnelService ) ;
582
593
}
583
594
595
+ /**
596
+ * Removes all non-serializable properties from the tunnel
597
+ * @returns A new TunnelItem without any services
598
+ */
599
+ public strip ( ) : TunnelItem | undefined {
600
+ return new TunnelItem (
601
+ this . tunnelType ,
602
+ this . remoteHost ,
603
+ this . remotePort ,
604
+ this . source ,
605
+ this . hasRunningProcess ,
606
+ this . protocol ,
607
+ this . localUri ,
608
+ this . localAddress ,
609
+ this . localPort ,
610
+ this . closeable ,
611
+ this . name ,
612
+ this . runningProcess ,
613
+ this . pid ,
614
+ this . _privacy
615
+ ) ;
616
+ }
617
+
584
618
constructor (
585
619
public tunnelType : TunnelType ,
586
620
public remoteHost : string ,
0 commit comments