@@ -32,6 +32,8 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
3232 public isActive : boolean = true ;
3333 public isTimerStopped : boolean = false ;
3434 public showActionIcons : boolean = false ;
35+ private readonly guiComponents : Set < string > = new Set ( [ 'lion' , 'tinker' , 'razor' , 'panda' ] ) ;
36+ private readonly terminalComponents : Set < string > = new Set ( [ 'koko' , 'chen' , 'magnus' , 'nec' ] ) ;
3537
3638 // Direct 模式相关属性
3739 public endpoint : Endpoint ;
@@ -106,7 +108,8 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
106108 private checkDirectMode ( ) {
107109 const params = this . _route . snapshot . queryParams ;
108110 // 检查是否有 direct: true 参数,或者同时有 account, asset, protocol 参数
109- this . isDirect = params [ 'direct' ] === 'true' || ! ! ( params [ 'account' ] && params [ 'asset' ] && params [ 'protocol' ] ) ;
111+ this . isDirect =
112+ params [ 'direct' ] === 'true' || ! ! ( params [ 'account' ] && params [ 'asset' ] && params [ 'protocol' ] ) ;
110113
111114 if ( this . isDirect ) {
112115 this . accountId = params [ 'account' ] ;
@@ -342,6 +345,8 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
342345 this . view . active = true ;
343346 }
344347
348+ console . log ( 'view' , this . view ) ;
349+
345350 if ( this . view ) {
346351 this . _viewSrv . addView ( this . view ) ;
347352 this . _viewSrv . activeView ( this . view ) ;
@@ -562,4 +567,37 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
562567 return [ 'k8s' , 'website' ] . includes ( assetInfo . protocol ) ;
563568 }
564569 }
570+
571+ /**
572+ * 判断当前视图是否为 GUI 组件
573+ */
574+ public isGuiComponent ( ) : boolean {
575+ const componentName = this . view ?. connectMethod ?. component as string | undefined ;
576+ return ! ! componentName && this . guiComponents . has ( componentName ) ;
577+ }
578+
579+ /**
580+ * 判断当前视图是否为终端类组件
581+ */
582+ public isTerminalComponent ( ) : boolean {
583+ const componentName = this . view ?. connectMethod ?. component as string | undefined ;
584+ return ! ! componentName && this . terminalComponents . has ( componentName ) ;
585+ }
586+
587+ /**
588+ * 是否为 Web SFTP
589+ */
590+ public isWebSftp ( ) : boolean {
591+ return this . view ?. connectMethod ?. value === 'web_sftp' ;
592+ }
593+
594+ /**
595+ * 是否为 Web CLI 或 Web GUI
596+ */
597+ public isWebCliOrGui ( ) : boolean {
598+ const value = this . view ?. connectMethod ?. value as string | undefined ;
599+ return (
600+ value === 'web_cli' || value === 'web_gui' || value === 'db_guide' || value === 'vnc_guide'
601+ ) ;
602+ }
565603}
0 commit comments