1- import { Subscription } from 'rxjs' ;
2- import { ActivatedRoute , Router } from '@angular/router' ;
3- import { NzModalService } from 'ng-zorro-antd/modal' ;
4- import { View , Account , AuthInfo , ConnectionToken , ConnectMethod , Endpoint } from '@app/model' ;
5- import { Component , OnInit , OnDestroy , ElementRef , ViewChildren , QueryList } from '@angular/core' ;
6- import { ElementACLDialogComponent } from '@src/app/services/connect-token/acl-dialog/acl-dialog.component' ;
1+ import { Subscription } from 'rxjs' ;
2+ import { ActivatedRoute , Router } from '@angular/router' ;
3+ import { NzModalService } from 'ng-zorro-antd/modal' ;
4+ import { View , Account , AuthInfo , ConnectionToken , ConnectMethod , Endpoint } from '@app/model' ;
5+ import { Component , OnInit , OnDestroy , ElementRef , ViewChildren , QueryList } from '@angular/core' ;
6+ import { ElementACLDialogComponent } from '@src/app/services/connect-token/acl-dialog/acl-dialog.component' ;
77import {
88 LogService ,
99 AppService ,
@@ -13,8 +13,8 @@ import {
1313 DrawerStateService ,
1414 IframeCommunicationService
1515} from '@app/services' ;
16- import { CookieService } from 'ngx-cookie-service' ;
17- import { Protocol } from '@app/model' ;
16+ import { CookieService } from 'ngx-cookie-service' ;
17+ import { Protocol } from '@app/model' ;
1818
1919@Component ( {
2020 standalone : false ,
@@ -111,6 +111,7 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
111111 * 检查是否为直连模式
112112 */
113113 private checkDirectMode ( ) {
114+
114115 if ( this . _route . snapshot . routeConfig ?. path === 'admin-connect' ) {
115116 this . isAdminConnect = true ;
116117 }
@@ -194,7 +195,7 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
194195
195196 this . connectData = {
196197 method : this . method ,
197- protocol : { name : this . protocol } ,
198+ protocol : { name : this . protocol } ,
198199 asset : this . permedAsset ,
199200 account : this . account ,
200201 autoLogin : true ,
@@ -204,9 +205,6 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
204205 direct : true
205206 } ;
206207
207- console . log ( 'permedAsset' , this . permedAsset ) ;
208- console . log ( 'connectData' , this . connectData ) ;
209-
210208 this . _appSvc . setPreConnectData ( this . asset , this . connectData ) ;
211209
212210 const res = await this . getConnectToken ( this . permedAsset , this . connectData ) ;
@@ -295,23 +293,7 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
295293 } ;
296294 return 'web_cli' ;
297295 case 'http' :
298- case 'https' : {
299- const connectMethods = this . _appSvc . getProtocolConnectMethods ( protocol ) || [ ] ;
300- const preferredMethod =
301- connectMethods . find ( item => item . type === 'web' ) || connectMethods [ 0 ] ;
302-
303- if ( preferredMethod ) {
304- this . connectMethod = {
305- component : preferredMethod . component || 'lion' ,
306- type : preferredMethod . type || 'web' ,
307- value : preferredMethod . value || 'chrome' ,
308- label : preferredMethod . label || 'Chrome' ,
309- endpoint_protocol : preferredMethod . endpoint_protocol || endpointProtocol ,
310- disabled : preferredMethod . disabled ?? false
311- } ;
312- return this . connectMethod . value ;
313- }
314-
296+ case 'https' :
315297 this . connectMethod = {
316298 component : 'lion' ,
317299 type : 'web' ,
@@ -321,7 +303,6 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
321303 disabled : false
322304 } ;
323305 return 'chrome' ;
324- }
325306 case 'rdp' :
326307 case 'vnc' :
327308 this . connectMethod = {
@@ -363,7 +344,7 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
363344 this . permedAsset ,
364345 {
365346 ...this . connectData ,
366- permed_protocol : { name : this . protocol } ,
347+ permed_protocol : { name : this . protocol } ,
367348 connectMethod : this . connectMethod
368349 } ,
369350 this . connectToken ,
@@ -432,7 +413,7 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
432413 nzContent : ElementACLDialogComponent ,
433414 nzData : {
434415 asset : this . permedAsset ,
435- connectData : { ...this . connectData , direct : true } ,
416+ connectData : { ...this . connectData , direct : true } ,
436417 code : error . error . code ,
437418 tokenAction : 'create' ,
438419 error : error
0 commit comments