Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: 优化 remote app 的支持 #810

Merged
merged 1 commit into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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