Skip to content

Commit 115e60e

Browse files
fit2botw940853815
andauthored
fix: Luna failed to connect assets after direct connection (#1305)
Co-authored-by: wangruidong <940853815@qq.com>
1 parent 3edd932 commit 115e60e

5 files changed

Lines changed: 79 additions & 91 deletions

File tree

src/app/elements/connect/connect.component.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, EventEmitter, OnDestroy, OnInit, Output} from '@angular/core';
1+
import {Component, EventEmitter, Input, OnDestroy, OnInit, Output} from '@angular/core';
22
import 'rxjs/add/operator/toPromise';
33
import {connectEvt} from '@app/globals';
44
import {MatDialog} from '@angular/material';
@@ -25,6 +25,7 @@ import {ActivatedRoute} from '@angular/router';
2525
})
2626
export class ElementConnectComponent implements OnInit, OnDestroy {
2727
@Output() onNewView: EventEmitter<View> = new EventEmitter<View>();
28+
@Input() direct: boolean = false;
2829
hasLoginTo = false;
2930

3031
constructor(private _appSvc: AppService,
@@ -132,7 +133,7 @@ export class ElementConnectComponent implements OnInit, OnDestroy {
132133
return;
133134
}
134135

135-
if (connectInfo.direct) {
136+
if (this.direct) {
136137
this._logger.debug('Direct connect');
137138
return;
138139
}
@@ -216,7 +217,7 @@ export class ElementConnectComponent implements OnInit, OnDestroy {
216217
return false;
217218
}
218219

219-
if (preData.direct) {
220+
if (this.direct) {
220221
return true;
221222
}
222223
// 验证账号是否有效

src/app/elements/iframe/iframe.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ export class ElementIframeComponent implements OnInit, AfterViewInit, OnDestroy
8585
this.view.termComp = this;
8686
}
8787
clearInterval(this.ping);
88-
this.iframeCommunicationService.sendMessage({name: 'CLEAR'});
8988
break;
9089
case 'CLOSE':
9190
if (this.view && this.view.connected) {
Lines changed: 75 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,89 @@
11
<div #contentWindow>
2-
<app-face-monitor></app-face-monitor>
3-
<div class="terminal-connect" *ngIf="view && view.connectMethod.component === 'koko'">
4-
<div *ngIf="view.connectMethod.value === 'web_sftp'" style="height: 100%; width: 100%">
5-
<elements-content-window *ngIf="view" [view]="view"></elements-content-window>
6-
</div>
2+
<app-face-monitor></app-face-monitor>
3+
<div class="terminal-connect" *ngIf="view && view.connectMethod.component === 'koko'">
4+
<div *ngIf="view.connectMethod.value === 'web_sftp'" style="height: 100%; width: 100%">
5+
<elements-content-window *ngIf="view" [view]="view"></elements-content-window>
6+
</div>
77

8-
<div *ngIf="view.connectMethod.value === 'web_cli'" style="height: 100%; width: 100%">
9-
<mat-card class="header-card">
10-
<mat-card-header style="align-items: center">
11-
<mat-card-title>
12-
<mat-icon [matTooltip]="_i18n.instant('Close')" (click)="handleCloseConnect()">close</mat-icon>
13-
{{ protocol.toUpperCase() }} {{ _i18n.instant('Session') }}
14-
</mat-card-title>
8+
<div *ngIf="view.connectMethod.value === 'web_cli'" style="height: 100%; width: 100%">
9+
<mat-card class="header-card">
10+
<mat-card-header style="align-items: center">
11+
<mat-card-title>
12+
<mat-icon [matTooltip]="_i18n.instant('Close')" (click)="handleCloseConnect()">close</mat-icon>
13+
{{ protocol.toUpperCase() }} {{ _i18n.instant('Session') }}
14+
</mat-card-title>
1515

16-
<mat-divider [vertical]="true"> </mat-divider>
16+
<mat-divider [vertical]="true"></mat-divider>
1717

18-
<div class="info-section">
19-
<div class="top-part">
20-
<div class="desc">
21-
<div style="font-weight: 400; margin-right: 5px">
22-
{{ _i18n.instant('asset') }}:
23-
</div>
24-
{{ assetName }}
25-
</div>
26-
</div>
18+
<div class="info-section">
19+
<div class="top-part">
20+
<div class="desc">
21+
<div style="font-weight: 400; margin-right: 5px">
22+
{{ _i18n.instant('asset') }}:
23+
</div>
24+
{{ assetName }}
25+
</div>
26+
</div>
2727

28-
<div class="bottom-part">
29-
<div class="desc">
30-
<div style="font-weight: 400; margin-right: 5px">
31-
{{ _i18n.instant('ConnectionTime') }}:
32-
</div>
33-
{{ startTime.toLocaleString() }}
34-
</div>
35-
</div>
36-
</div>
28+
<div class="bottom-part">
29+
<div class="desc">
30+
<div style="font-weight: 400; margin-right: 5px">
31+
{{ _i18n.instant('ConnectionTime') }}:
32+
</div>
33+
{{ startTime.toLocaleString() }}
34+
</div>
35+
</div>
36+
</div>
37+
38+
<div class="action-section">
39+
<div class="timer-container">
40+
<div class="timer">
41+
<div [class.active]="isActive" class="status-dot"></div>
42+
<span>{{ totalConnectTime }}</span>
43+
</div>
44+
</div>
45+
46+
<div class="actions">
47+
<div class="action-item">
48+
<button mat-icon-button (click)="handleOpenDrawer('setting')"
49+
*ngIf="protocol !== 'k8s'">
50+
<mat-icon>settings</mat-icon>
51+
</button>
52+
</div>
53+
<div class="action-item" *ngIf="!isNoneProtocol()">
54+
<button mat-icon-button (click)="handleOpenDrawer('file')">
55+
<mat-icon>folder</mat-icon>
56+
</button>
57+
</div>
58+
</div>
59+
</div>
60+
</mat-card-header>
61+
</mat-card>
62+
63+
<mat-card class="terminal-card">
64+
<mat-card-content style="height: 100%">
65+
<elements-connect [direct]="true" (onNewView)="onNewView($event)"
66+
[ngStyle]="{'display': 'none'}"></elements-connect>
67+
<elements-content-window #contentWindow *ngIf="view" [view]="view"></elements-content-window>
68+
</mat-card-content>
69+
</mat-card>
70+
</div>
71+
</div>
3772

38-
<div class="action-section">
39-
<div class="timer-container">
40-
<div class="timer">
73+
<div class="gui" *ngIf="view && view.connectMethod.component === 'lion'">
74+
<div class="timer-container">
75+
<div class="timer">
4176
<div [class.active]="isActive" class="status-dot"></div>
4277
<span>{{ totalConnectTime }}</span>
43-
</div>
4478
</div>
79+
</div>
4580

46-
<div class="actions">
47-
<div class="action-item">
48-
<button mat-icon-button (click)="handleOpenDrawer('setting')" *ngIf="protocol !== 'k8s'">
49-
<mat-icon >settings</mat-icon>
50-
</button>
51-
</div>
52-
<div class="action-item" *ngIf="!isNoneProtocol()">
53-
<button mat-icon-button (click)="handleOpenDrawer('file')">
54-
<mat-icon>folder</mat-icon>
55-
</button>
56-
</div>
81+
<div class="action-icons" [class.show]="showActionIcons">
82+
<div class="close-icon" (click)="handleCloseConnect()">
83+
<mat-icon [matTooltip]="_i18n.instant('Close')">close</mat-icon>
5784
</div>
58-
</div>
59-
</mat-card-header>
60-
</mat-card>
61-
62-
<mat-card class="terminal-card">
63-
<mat-card-content style="height: 100%">
64-
<elements-connect (onNewView)="onNewView($event)" [ngStyle]="{'display': 'none'}"></elements-connect>
65-
<elements-content-window #contentWindow *ngIf="view" [view]="view"></elements-content-window>
66-
</mat-card-content>
67-
</mat-card>
68-
</div>
69-
</div>
85+
</div>
7086

71-
<div class="gui" *ngIf="view && view.connectMethod.component === 'lion'">
72-
<div class="timer-container">
73-
<div class="timer">
74-
<div [class.active]="isActive" class="status-dot"></div>
75-
<span>{{ totalConnectTime }}</span>
76-
</div>
87+
<elements-content-window *ngIf="view" [view]="view" style="height: 100%; width: 100%"></elements-content-window>
7788
</div>
78-
79-
<div class="action-icons" [class.show]="showActionIcons">
80-
<div class="close-icon" (click)="handleCloseConnect()">
81-
<mat-icon [matTooltip]="_i18n.instant('Close')">close</mat-icon>
82-
</div>
83-
</div>
84-
85-
<elements-content-window *ngIf="view" [view]="view" style="height: 100%; width: 100%"></elements-content-window>
86-
</div>
8789
</div>

src/app/pages/direct/direct.component.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ export class PageDirectComponent implements OnInit, OnDestroy {
8080
this._logger.info('DirectComponent getConnectData', this.asset);
8181

8282
this.subscription = this.iframeCommunicationService.message$.subscribe((message) => {
83-
if (message.name === 'CLEAR') {
84-
const key = `JMS_PRE_${this.asset.id}`;
85-
this._localStorage.delete(key);
86-
}
8783
if (message.name === 'CLOSE') {
8884
this.stopTimer();
8985
}

src/app/services/connect-token/acl-dialog/acl-dialog.component.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import {ToastrService} from 'ngx-toastr';
77
import {HttpErrorResponse} from '@angular/common/http';
88
import {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';
99
import {FaceService} from '@app/services/face';
10-
import {IframeCommunicationService} from '@app/services';
11-
1210

1311
@Component({
1412
selector: 'elements-acl-dialog',
@@ -37,7 +35,6 @@ export class ElementACLDialogComponent implements OnInit {
3735
private _http: HttpService,
3836
private sanitizer: DomSanitizer,
3937
private faceService: FaceService,
40-
private iframeCommunicationService: IframeCommunicationService,
4138
@Inject(MAT_DIALOG_DATA) public data: any
4239
) {
4340
}
@@ -96,7 +93,6 @@ export class ElementACLDialogComponent implements OnInit {
9693
if (!data.success) {
9794
this.code = 'other';
9895
this.otherError = data.error_message;
99-
this.iframeCommunicationService.sendMessage({name: 'CLEAR'});
10096
} else {
10197
const msg = await this._i18n.t('Face verify success');
10298
this._toastr.success(msg);
@@ -115,7 +111,6 @@ export class ElementACLDialogComponent implements OnInit {
115111
this.code = 'other';
116112
this.otherError = error.error.detail;
117113
}
118-
this.iframeCommunicationService.sendMessage({name: 'CLEAR'});
119114
};
120115

121116
if (this.tokenAction === 'exchange') {
@@ -142,7 +137,6 @@ export class ElementACLDialogComponent implements OnInit {
142137
if (!data.success) {
143138
this.code = 'other';
144139
this.otherError = data.error_message;
145-
this.iframeCommunicationService.sendMessage({name: 'CLEAR'});
146140
} else {
147141
const msg = await this._i18n.t('Face verify success');
148142
this._toastr.success(msg);
@@ -160,7 +154,6 @@ export class ElementACLDialogComponent implements OnInit {
160154
this.code = 'other';
161155
this.otherError = error.error.detail;
162156
}
163-
this.iframeCommunicationService.sendMessage({name: 'CLEAR'});
164157
};
165158

166159
if (this.tokenAction === 'exchange') {
@@ -193,7 +186,6 @@ export class ElementACLDialogComponent implements OnInit {
193186
this.code = 'other';
194187
this.otherError = error.error.detail;
195188
}
196-
this.iframeCommunicationService.sendMessage({name: 'CLEAR'});
197189
};
198190
if (this.tokenAction === 'exchange') {
199191
this._http.exchangeConnectToken(this.tokenID, true).subscribe(successCallback, errorCallback);
@@ -240,10 +232,8 @@ export class ElementACLDialogComponent implements OnInit {
240232
this.dialogRef.close(this.connectionToken);
241233
} else if (state === 'rejected') {
242234
this.code = 'ticket_review_rejected';
243-
this.iframeCommunicationService.sendMessage({name: 'CLEAR'});
244235
} else if (state === 'closed') {
245236
this.code = 'ticket_review_closed';
246-
this.iframeCommunicationService.sendMessage({name: 'CLEAR'});
247237
}
248238
clearInterval(this.timerCheckTicket);
249239
},

0 commit comments

Comments
 (0)