Skip to content

Commit

Permalink
Merge pull request #808 from jumpserver/dev
Browse files Browse the repository at this point in the history
v3.2.0
  • Loading branch information
BaiJiangJie committed Apr 20, 2023
2 parents 9a206e1 + ece44b7 commit 82036a3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h3>{{"Connect" | translate}} - {{ asset.name | truncatechars:30 }}</h3>
color="primary"
style="width: 100%"
type="submit"
[disabled]="accounts.length===0 || connectMethod.disabled === true"
[disabled]="isConnectDisabled()"
[mat-dialog-close]="outputData"
(click)="onConfirm()"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class ElementConnectDialogComponent implements OnInit {
public connectMethod: ConnectMethod = new ConnectMethod();
public preConnectData: ConnectData = new ConnectData();
public onSubmit$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);
public isAppletClientMethod = false;

constructor(public dialogRef: MatDialogRef<ElementConnectDialogComponent>,
private _settingSvc: SettingService,
Expand All @@ -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();
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 82036a3

Please sign in to comment.