1- import { Component , Input , OnChanges , OnInit } from '@angular/core' ;
2- import { ConnectMethod , ConnectOption , GlobalSetting , Protocol , Setting } from '@app/model' ;
3- import { resolutionsChoices } from '@app/globals' ;
4- import { SettingService } from '@app/services' ;
1+ import { Component , Input , OnChanges , OnInit } from '@angular/core' ;
2+ import { ConnectMethod , ConnectOption , GlobalSetting , Protocol , Setting } from '@app/model' ;
3+ import { resolutionsChoices } from '@app/globals' ;
4+ import { SettingService } from '@app/services' ;
55
66@Component ( {
77 standalone : false ,
88 selector : 'elements-advanced-option' ,
99 templateUrl : 'advanced-option.component.html' ,
10- styleUrls : [ 'advanced-option.component.scss' ] ,
10+ styleUrls : [ 'advanced-option.component.scss' ]
1111} )
1212export class ElementAdvancedOptionComponent implements OnChanges , OnInit {
1313 @Input ( ) protocol : Protocol ;
@@ -19,8 +19,8 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
1919 public globalSetting : GlobalSetting ;
2020 private allOptions : ConnectOption [ ] = [ ] ;
2121 private boolChoices = [
22- { label : 'Yes' , value : true } ,
23- { label : 'No' , value : false } ,
22+ { label : 'Yes' , value : true } ,
23+ { label : 'No' , value : false }
2424 ] ;
2525
2626 constructor ( public _settingSvc : SettingService ) {
@@ -33,15 +33,18 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
3333 label : 'Charset' ,
3434 hidden : ( ) => {
3535 const protocolsCanCharset : Array < string > = [ 'ssh' , 'telnet' ] ;
36- return this . connectMethod && this . connectMethod . component !== 'koko' || ! protocolsCanCharset . includes ( this . protocol . name ) ;
36+ return (
37+ ( this . connectMethod && this . connectMethod . component !== 'koko' ) ||
38+ ! protocolsCanCharset . includes ( this . protocol . name )
39+ ) ;
3740 } ,
3841 value : 'default' ,
3942 options : [
40- { label : 'Default' , value : 'default' } ,
41- { label : 'UTF-8' , value : 'utf8' } ,
42- { label : 'GBK' , value : 'gbk' } ,
43- { label : 'GB2312' , value : 'gb2312' } ,
44- { label : 'IOS-8859-1' , value : 'ios-8859-1' } ,
43+ { label : 'Default' , value : 'default' } ,
44+ { label : 'UTF-8' , value : 'utf8' } ,
45+ { label : 'GBK' , value : 'gbk' } ,
46+ { label : 'GB2312' , value : 'gb2312' } ,
47+ { label : 'IOS-8859-1' , value : 'ios-8859-1' }
4548 ]
4649 } ,
4750 {
@@ -51,7 +54,10 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
5154 const protocolsCanAutoHash : Array < string > = [ 'mysql' , 'mariadb' ] ;
5255 if ( this . connectMethod ) {
5356 if ( this . connectMethod . component === 'koko' ) {
54- return this . connectMethod . component !== 'koko' || ! protocolsCanAutoHash . includes ( this . protocol . name ) ;
57+ return (
58+ this . connectMethod . component !== 'koko' ||
59+ ! protocolsCanAutoHash . includes ( this . protocol . name )
60+ ) ;
5561 }
5662 if ( this . connectMethod . component === 'chen' ) {
5763 return false ;
@@ -67,7 +73,11 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
6773 type : 'select' ,
6874 field : 'token_reusable' ,
6975 hidden : ( ) => {
70- return ! ( this . connectMethod . component === 'magnus' && this . connectMethod . value === 'db_client' && this . globalSetting . CONNECTION_TOKEN_REUSABLE ) ;
76+ return ! (
77+ this . connectMethod . component === 'magnus' &&
78+ this . connectMethod . value === 'db_client' &&
79+ this . globalSetting . CONNECTION_TOKEN_REUSABLE
80+ ) ;
7181 } ,
7282 label : 'Set reusable' ,
7383 value : false ,
@@ -80,7 +90,7 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
8090 const protocolsCanResolution : Array < string > = [ 'rdp' ] ;
8191 return ! protocolsCanResolution . includes ( this . protocol . name ) ;
8292 } ,
83- options : resolutionsChoices . map ( i => ( { label : i , value : i . toLowerCase ( ) } ) ) ,
93+ options : resolutionsChoices . map ( i => ( { label : i , value : i . toLowerCase ( ) } ) ) ,
8494 label : 'RDP resolution' ,
8595 value : this . setting . graphics . rdp_resolution || 'auto'
8696 } ,
@@ -98,8 +108,10 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
98108 type : 'select' ,
99109 field : 'appletConnectMethod' ,
100110 options : [
101- { label : 'Web' , value : 'web' } ,
102- ...( this . globalSetting . TERMINAL_RAZOR_ENABLED ? [ { label : 'Client' , value : 'client' } ] : [ ] )
111+ { label : 'Web' , value : 'web' } ,
112+ ...( this . globalSetting . TERMINAL_RAZOR_ENABLED
113+ ? [ { label : 'Client' , value : 'client' } ]
114+ : [ ] )
103115 ] ,
104116 label : 'Applet connect method' ,
105117 value : this . setting . graphics . applet_connection_method ,
@@ -114,8 +126,8 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
114126 type : 'select' ,
115127 field : 'virtualappConnectMethod' ,
116128 options : [
117- { label : 'Web' , value : 'web' } ,
118- ...( true ? [ { label : 'Client' , value : 'client' } ] : [ ] )
129+ { label : 'Web' , value : 'web' } ,
130+ ...( true ? [ { label : 'Client' , value : 'client' } ] : [ ] )
119131 ] ,
120132 label : 'Virtualapp connect method' ,
121133 value : this . setting . graphics . applet_connection_method ,
@@ -157,15 +169,16 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
157169 } ,
158170 value : 'auto' ,
159171 options : [
160- { label : 'Auto' , value : 'auto' } ,
161- { label : 'Low Speed Broadband (256 Kbps - 2 Mbps)' , value : 'low_speed_broadband' } ,
162- { label : 'High-speed broadband (2 Mbps – 10 Mbps )' , value : 'high_speed_broadband' } ,
172+ { label : 'Auto' , value : 'auto' } ,
173+ { label : 'Low Speed Broadband (256 Kbps - 2 Mbps)' , value : 'low_speed_broadband' } ,
174+ { label : 'High-speed broadband (2 Mbps – 10 Mbps )' , value : 'high_speed_broadband' }
163175 ]
164176 }
165177 ] ;
166178 }
167179
168180 ngOnInit ( ) {
181+ this . checkOptions ( ) ;
169182 }
170183
171184 checkOptions ( ) {
0 commit comments