Skip to content

Commit

Permalink
Merge pull request #834 from jumpserver/pr@dev@perf_fix_connect_options
Browse files Browse the repository at this point in the history
perf: 优化连接选项提交
  • Loading branch information
ibuler committed Jun 6, 2023
2 parents 59bd6cc + 26e6e4c commit d905906
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<ng-container *ngIf="item.type === 'select'">
<mat-form-field class="option-item">
<mat-label>{{ item.label | translate }}</mat-label>
<mat-select [(ngModel)]="item.value" [name]="item.field">
<mat-select (ngModelChange)="optionChange(item)" [(ngModel)]="item.value" [name]="item.field">
<mat-option *ngFor="let option of item.options" [value]="option.value">
{{ option.label | translate }}
</mat-option>
Expand All @@ -30,7 +30,7 @@
</ng-container>
<ng-container *ngIf="item.type === 'radio'">
<div class="option-item">
<mat-radio-group [(ngModel)]="item.value" [name]="item.field">
<mat-radio-group (ngModelChange)="optionChange(item)" [(ngModel)]="item.value" [name]="item.field">
<mat-label style="margin-right: 10px">{{ item.label | translate }}</mat-label>
<mat-radio-button *ngFor="let option of item.options" [value]="option.value">
{{ option.label | translate }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export class ElementAdvancedOptionComponent implements OnChanges {
];
this.advancedOptions = this.advancedOptions.filter(i => !i.hidden());
this.isShowAdvancedOption = this.advancedOptions.length > 0;
this.optionChange(null);
}

optionChange(event) {
Expand Down
8 changes: 4 additions & 4 deletions src/app/services/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ export class HttpService {
const {account, protocol, manualAuthInfo, connectMethod} = connectData;
const username = account.username.startsWith('@') ? manualAuthInfo.username : account.username;
const secret = encryptPassword(manualAuthInfo.secret);
const connectOption = connectData.connectOptions.reduce((result, option) => {
result[option.field] = option.value;
return result;
}, {});
const connectOption = {};
for (const option of connectData.connectOptions) {
connectOption[option.field] = option.value;
}
const data = {
asset: asset.id,
account: account.alias,
Expand Down

0 comments on commit d905906

Please sign in to comment.