From 23f7320faca467611f4b499191416db92b959762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chuailei000=E2=80=9D?= <2280131253@qq.com> Date: Wed, 19 Apr 2023 11:42:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20remote=20app=E8=BF=9E=E6=8E=A5=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=9C=89=E6=B2=A1=E6=9C=89license?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connect-dialog.component.html | 2 +- .../connect-dialog.component.ts | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/app/elements/connect/connect-dialog/connect-dialog.component.html b/src/app/elements/connect/connect-dialog/connect-dialog.component.html index 28bfceb9..c1994279 100644 --- a/src/app/elements/connect/connect-dialog/connect-dialog.component.html +++ b/src/app/elements/connect/connect-dialog/connect-dialog.component.html @@ -53,7 +53,7 @@

{{"Connect" | translate}} - {{ asset.name | truncatechars:30 }}

color="primary" style="width: 100%" type="submit" - [disabled]="accounts.length===0 || connectMethod.disabled === true" + [disabled]="isConnectDisabled()" [mat-dialog-close]="outputData" (click)="onConfirm()" > diff --git a/src/app/elements/connect/connect-dialog/connect-dialog.component.ts b/src/app/elements/connect/connect-dialog/connect-dialog.component.ts index 216d567c..773333af 100644 --- a/src/app/elements/connect/connect-dialog/connect-dialog.component.ts +++ b/src/app/elements/connect/connect-dialog/connect-dialog.component.ts @@ -24,6 +24,7 @@ export class ElementConnectDialogComponent implements OnInit { public connectMethod: ConnectMethod = new ConnectMethod(); public preConnectData: ConnectData = new ConnectData(); public onSubmit$: BehaviorSubject = new BehaviorSubject(true); + public isAppletClientMethod = false; constructor(public dialogRef: MatDialogRef, private _settingSvc: SettingService, @@ -42,6 +43,9 @@ export class ElementConnectDialogComponent implements OnInit { if (this.protocols.length === 0) { this.protocols = [{name: 'ssh', port: 22, public: true, setting: {sftp_enabled: true}}]; } + this._settingSvc.appletConnectMethod$.subscribe((state) => { + this.isAppletClientMethod = state === 'client'; + }); this.setDefaults(); } @@ -82,6 +86,22 @@ export class ElementConnectDialogComponent implements OnInit { } } + isConnectDisabled(): Boolean { + if (this.accounts.length === 0) { + return true; + } + if (this.connectMethod.disabled === true) { + return true; + } + if ( + this.connectMethod.component === 'razor' || + (this.connectMethod.type === 'applet' && this.isAppletClientMethod) + ) { + return !this._settingSvc.hasXPack(); + } + return false; + } + onConfirm(downloadRDP = false) { this.outputData.account = this.accountSelected; this.outputData.connectMethod = this.connectMethod;