Skip to content

Commit e142e1c

Browse files
committed
Fixed: Fix the issue where the client selecting assets via the HTTP protocol does not have RDP Resume.
1 parent f78d06d commit e142e1c

2 files changed

Lines changed: 82 additions & 54 deletions

File tree

src/app/elements/connect/connect-dialog/advanced-option/advanced-option.component.html

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div *ngIf='advancedOptions && advancedOptions.length' class="advanced-option">
1+
<div *ngIf="advancedOptions && advancedOptions.length" class="advanced-option">
22
<nz-collapse>
33
<nz-collapse-panel
44
*ngIf="isShowAdvancedOption"
@@ -8,42 +8,49 @@
88
<nz-form-item *ngFor="let item of advancedOptions">
99
<nz-form-label nzNoColon>{{ item.label | translate }}</nz-form-label>
1010
<span>
11+
<!-- checkbox -->
1112
<ng-container *ngIf="item.type === 'checkbox'">
1213
<label
13-
(ngModelChange)="onChange()"
14-
[(ngModel)]="connectOption[item.field]"
15-
[name]="item.field"
1614
nz-checkbox
15+
[name]="item.field"
16+
[ngModel]="connectOption[item.field]"
17+
(ngModelChange)="connectOption[item.field]=$event; onChange()"
1718
>
1819
{{ item.label | translate }}
1920
</label>
2021
</ng-container>
22+
23+
<!-- select -->
2124
<ng-container *ngIf="item.type === 'select'">
22-
<nz-select
23-
(ngModelChange)="onChange()"
24-
[(ngModel)]="connectOption[item.field]"
25-
[name]="item.field"
26-
style="width: 100%"
27-
>
28-
<nz-option
29-
*ngFor="let option of item.options"
30-
[nzLabel]="option.label | translate"
31-
[nzValue]="option.value"
32-
></nz-option>
33-
</nz-select>
25+
<nz-select
26+
style="width: 100%"
27+
[name]="item.field"
28+
[ngModel]="connectOption[item.field]"
29+
(ngModelChange)="connectOption[item.field]=$event; onChange()"
30+
>
31+
<nz-option
32+
*ngFor="let option of item.options"
33+
[nzLabel]="option.label | translate"
34+
[nzValue]="option.value"
35+
></nz-option>
36+
</nz-select>
3437
</ng-container>
38+
39+
<!-- radio -->
3540
<ng-container *ngIf="item.type === 'radio'">
36-
<nz-radio-group
37-
(ngModelChange)="onChange()"
38-
[(ngModel)]="connectOption[item.field]"
39-
[name]="item.field"
41+
<nz-radio-group
42+
[name]="item.field"
43+
[ngModel]="connectOption[item.field]"
44+
(ngModelChange)="connectOption[item.field]=$event; onChange()"
45+
>
46+
<label
47+
*ngFor="let option of item.options"
48+
nz-radio
49+
[nzValue]="option.value"
4050
>
41-
<label
42-
*ngFor="let option of item.options"
43-
[nzValue]="option.value"
44-
nz-radio
45-
>{{ option.label | translate }}</label>
46-
</nz-radio-group>
51+
{{ option.label | translate }}
52+
</label>
53+
</nz-radio-group>
4754
</ng-container>
4855
</span>
4956
</nz-form-item>

src/app/elements/connect/connect-dialog/advanced-option/advanced-option.component.ts

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { SettingService } from '@app/services';
2+
import { resolutionsChoices } from '@app/globals';
13
import { Component, Input, OnChanges, OnInit } from '@angular/core';
24
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,
@@ -13,20 +13,33 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
1313
@Input() protocol: Protocol;
1414
@Input() connectMethod: ConnectMethod;
1515
@Input() connectOption: any = {};
16-
public advancedOptions: ConnectOption[] = [];
16+
1717
public isShowAdvancedOption = false;
18-
public setting: Setting;
19-
public globalSetting: GlobalSetting;
20-
private allOptions: ConnectOption[] = [];
2118
private boolChoices = [
2219
{ label: 'Yes', value: true },
2320
{ label: 'No', value: false }
2421
];
2522

23+
public setting: Setting;
24+
public globalSetting: GlobalSetting;
25+
private allOptions: ConnectOption[] = [];
26+
public advancedOptions: ConnectOption[] = [];
27+
2628
constructor(public _settingSvc: SettingService) {
2729
this.setting = _settingSvc.setting;
2830
this.globalSetting = _settingSvc.globalSetting;
29-
this.allOptions = [
31+
}
32+
33+
ngOnInit() {
34+
this.allOptions = this.buildAllOptions();
35+
this.checkOptions();
36+
}
37+
38+
buildAllOptions(): ConnectOption[] {
39+
const gs = this._settingSvc.globalSetting;
40+
const hasX = this._settingSvc.hasXPack?.() ?? false;
41+
42+
return [
3043
{
3144
type: 'select',
3245
field: 'charset',
@@ -109,9 +122,7 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
109122
field: 'appletConnectMethod',
110123
options: [
111124
{ label: 'Web', value: 'web' },
112-
...(this.globalSetting.TERMINAL_RAZOR_ENABLED
113-
? [{ label: 'Client', value: 'client' }]
114-
: [])
125+
...(gs.TERMINAL_RAZOR_ENABLED ? [{ label: 'Client', value: 'client' }] : [])
115126
],
116127
label: 'Applet connect method',
117128
value: this.setting.graphics.applet_connection_method,
@@ -132,31 +143,36 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
132143
label: 'Virtualapp connect method',
133144
value: this.setting.graphics.applet_connection_method,
134145
hidden: () => {
135-
if (!this._settingSvc.hasXPack()) {
136-
return true;
137-
}
146+
if (!hasX) return true;
138147
return !this.connectMethod || this.connectMethod.component !== 'panda';
139148
}
140149
},
141150
{
142151
type: 'select',
143152
field: 'reusable',
144153
options: this.boolChoices,
145-
label: 'RDP file reusable',
154+
label: ' RDP file reusable',
146155
value: false,
147156
hidden: () => {
148-
if (!this.connectMethod) {
149-
return true;
150-
}
151-
if (!this._settingSvc.globalSetting.CONNECTION_TOKEN_REUSABLE) {
152-
return true;
153-
}
154-
if (this.connectMethod.component === 'razor') {
155-
return false;
156-
}
157+
if (!this.connectMethod) return true;
158+
if (!gs.CONNECTION_TOKEN_REUSABLE) return true;
159+
160+
// razor 直接显示
161+
if (this.connectMethod.component === 'razor') return false;
162+
157163
if (this.connectMethod.component === 'tinker') {
158-
return this.connectOption.appletConnectMethod !== 'client';
164+
const method = (
165+
this.connectOption.appletConnectMethod ??
166+
this.connectOption.virtualappConnectMethod ??
167+
this.setting.graphics.applet_connection_method ??
168+
''
169+
)
170+
.toString()
171+
.toLowerCase();
172+
173+
return method !== 'client';
159174
}
175+
160176
return true;
161177
}
162178
},
@@ -177,32 +193,37 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
177193
];
178194
}
179195

180-
ngOnInit() {
181-
this.checkOptions();
182-
}
183-
184196
checkOptions() {
185197
if (!this.protocol) {
186198
return;
187199
}
200+
188201
const onlyUsingDefaultFields = ['reusable'];
202+
189203
this.allOptions.forEach(i => {
190204
if (this.connectOption[i.field] === undefined) {
191205
this.connectOption[i.field] = i.value;
192206
}
207+
193208
if (onlyUsingDefaultFields.includes(i.field)) {
194209
i.value = this.connectOption[i.field];
195210
}
196211
});
212+
197213
this.advancedOptions = this.allOptions.filter(i => !i.hidden());
198214
this.isShowAdvancedOption = this.advancedOptions.length > 0;
215+
216+
console.log('advancedOptions', this.advancedOptions);
217+
console.log('isShowAdvancedOption', this.isShowAdvancedOption);
199218
}
200219

201220
onChange() {
221+
this.allOptions = this.buildAllOptions();
202222
this.checkOptions();
203223
}
204224

205225
ngOnChanges() {
226+
this.allOptions = this.buildAllOptions();
206227
this.checkOptions();
207228
}
208229
}

0 commit comments

Comments
 (0)