Skip to content

Commit

Permalink
perf: 优化 remote app 的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuler authored and BaiJiangJie committed Apr 21, 2023
1 parent ece44b7 commit 3a06946
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ <h3>{{"Connect" | translate}} - {{ asset.name | truncatechars:30 }}</h3>
*ngFor="let p of protocols"
(click)="onProtocolChange(p)"
[active]="protocol.name === p.name"
[title]="p.name"
>
{{ p.name | uppercase }}
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ElementConnectDialogComponent implements OnInit {
public connectOptions: ConnectOption[] = [];
public outputData: ConnectData = new ConnectData();
public manualAuthInfo: AuthInfo = new AuthInfo();
public connectMethod: ConnectMethod = new ConnectMethod();
public connectMethod: ConnectMethod = new ConnectMethod('Null', '', 'null', 'null');
public preConnectData: ConnectData = new ConnectData();
public onSubmit$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);
public isAppletClientMethod = false;
Expand Down Expand Up @@ -70,7 +70,10 @@ export class ElementConnectDialogComponent implements OnInit {
this.accountSelected = this.accounts[0];
}
if (!this.connectMethod) {
this.connectMethod = this._appSvc.getProtocolConnectMethods(this.protocol.name)[0];
const connectMethods = this._appSvc.getProtocolConnectMethods(this.protocol.name);
if (connectMethods) {
this.connectMethod = connectMethods[0];
}
}
}

Expand All @@ -90,7 +93,7 @@ export class ElementConnectDialogComponent implements OnInit {
if (this.accounts.length === 0) {
return true;
}
if (this.connectMethod.disabled === true) {
if (!this.connectMethod || this.connectMethod.disabled === true) {
return true;
}
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export class ElementConnectMethodComponent implements OnInit {
public connectMethodTypes = [];
public isAppletClientMethod = false;


constructor(private _i18n: I18nService,
private _appSvc: AppService,
private _settingSvc: SettingService
Expand All @@ -45,7 +44,9 @@ export class ElementConnectMethodComponent implements OnInit {
}

currentConnectMethodTypeIndex() {
const i = this.connectMethodTypes.map((item) => item.value).indexOf(this.connectMethod.type);
const i = this.connectMethodTypes
.map((item) => item.value)
.indexOf(this.connectMethod.type);
if (i === -1) {
return 0;
}
Expand Down
8 changes: 8 additions & 0 deletions src/app/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ export class ConnectMethod {
component: string;

disabled: boolean;

constructor(label: string, value: string, type: string, component: string, disabled: boolean = false) {
this.label = label;
this.value = value;
this.type = type;
this.component = component;
this.disabled = disabled;
}
}

export class DataStore {
Expand Down

0 comments on commit 3a06946

Please sign in to comment.