Skip to content

Commit 079b243

Browse files
committed
perf: rdp token 复用
pref: ssh 也添加复用
1 parent fbb624b commit 079b243

19 files changed

+110
-65
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
<div id="chatContainer" class="chat-container" [ngClass]="{'show': !isShow}">
2-
<div class="modal" (click)="toggle()"></div>
1+
<div [ngClass]="{'show': !isShow}" class="chat-container" id="chatContainer">
2+
<div (click)="toggle()" class="modal"></div>
33
<div class="drawer-panel">
4-
<div id="dragBox" [hidden]="!isShow">
4+
<div [hidden]="!isShow" id="dragBox">
55
<div
6-
class="drag-setting"
7-
[hidden]="!isShowSetting || subViews.length > 1"
86
(click)="onSettingOpenDrawer()"
7+
[hidden]="!isShowSetting || subViews.length > 1"
8+
class="drag-setting"
99
>
1010
<i class="fa fa-cog"></i>
1111
</div>
1212
<div [hidden]="!chatAiEnabled" class="drag-button">
13-
<img src="assets/icons/robot-assistant.png" alt="" />
13+
<img alt="" src="assets/icons/chat-ai.png"/>
1414
</div>
1515
</div>
1616
<div class="content">
1717
<iframe
1818
[src]="iframeURL | safeUrl"
19-
title="chat"
2019
height="100%"
20+
title="chat"
2121
width="100%"
2222
></iframe>
2323
</div>
2424
</div>
25-
</div>
25+
</div>

src/app/elements/chat/chat.component.scss

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
.chat-container {
22
overflow: hidden;
3+
34
.content {
45
height: 100%;
6+
57
iframe {
68
border: none;
79
}
@@ -12,7 +14,6 @@
1214
position: fixed;
1315
top: 0;
1416
right: 0;
15-
width: 100%;
1617
width: 440px;
1718
min-width: 260px;
1819
height: 100vh;
@@ -23,11 +24,12 @@
2324
transform: translate(100%);
2425
background: #FFFFFF;
2526
z-index: 120;
27+
opacity: 0.95;
2628
}
2729

2830
#dragBox {
2931
position: absolute;
30-
top: 30%;
32+
bottom: 20%;
3133
left: -48px;
3234
}
3335

@@ -42,53 +44,65 @@
4244
z-index: 0;
4345
pointer-events: auto;
4446
color: #fff;
45-
background-color: #FFFFFF;
47+
background-color: rgba(88, 88, 88, .8);
4648
box-shadow: 0 0 8px 4px #00000014;
4749
cursor: pointer;
4850

4951
&:hover {
50-
left: -50px !important;
51-
width: 50px !important;
52-
transform: translateZ(0) scale(1.06);
53-
transform-style: preserve-3d;
5452
backface-visibility: hidden;
53+
54+
img {
55+
opacity: 1;
56+
}
5557
}
58+
5659
i {
5760
font-size: 20px;
5861
line-height: 45px;
62+
opacity: 0.8;
5963
}
64+
6065
img {
61-
width: 22px;
62-
height: 22px;
66+
width: 20px;
67+
height: 20px;
6368
transform: translateY(10%);
6469
margin-left: 3px;
70+
opacity: 0.8;
6571
}
6672
}
6773

6874
.drag-setting {
6975
width: 36px;
7076
height: 36px;
7177
line-height: 38px;
72-
margin-bottom: 10px;
78+
margin-bottom: 2px;
7379
text-align: center;
7480
border-radius: 50%;
7581
cursor: pointer;
7682
transform: translateX(20%);
77-
background-color: #FFFFFF;
83+
background-color: rgba(88, 88, 88, .8);
7884
border: 1px solid transparent;
7985
transition: border-color 0.3s ease;
86+
position: relative;
87+
8088
&:hover {
81-
background-color: #f0f1f5;
82-
border-color: #a0a0a0;
89+
.setting-list {
90+
display: block;
91+
transform: translateY(0);
92+
}
93+
94+
i {
95+
opacity: 1;
96+
transform: rotate(45deg);
97+
}
8398
}
99+
84100
i {
85101
font-size: 18px;
102+
color: white;
103+
opacity: 0.8;
86104
}
87-
}
88105

89-
.drag-setting {
90-
position: relative;
91-
transition: all 1s;
92106
.setting-list {
93107
position: absolute;
94108
bottom: 35px;
@@ -99,6 +113,7 @@
99113
list-style-type: none;
100114
transition: all 0.3s ease;
101115
transform: translateY(100%);
116+
102117
.setting-item {
103118
width: 28px;
104119
height: 28px;
@@ -108,19 +123,14 @@
108123
margin-bottom: 2px;
109124
overflow: hidden;
110125
background-color: #FFFFFF;
126+
111127
&:hover {
112128
background-color: #f0f1f5;
113129
border-color: #a0a0a0;
114130
}
115131
}
116132
}
117-
&:hover {
118-
.setting-list {
119-
display: block;
120-
transform: translateY(0);
121-
}
122-
}
123-
}
133+
}
124134

125135
.show {
126136
transition: all .3s cubic-bezier(.7, .3, .1, 1);
@@ -137,4 +147,4 @@
137147

138148
.show .drawer-panel {
139149
transform: translate(0);
140-
}
150+
}

src/app/elements/chat/chat.component.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {OnInit, OnDestroy, Component} from '@angular/core';
2-
import {ViewService, SettingService} from '@app/services';
1+
import {Component, OnDestroy, OnInit} from '@angular/core';
2+
import {SettingService, ViewService} from '@app/services';
33
import {View} from '@app/model';
44

55
@Component({
@@ -11,13 +11,14 @@ import {View} from '@app/model';
1111
export class ElementChatComponent implements OnInit, OnDestroy {
1212
isShow = true;
1313
element: any;
14-
iframeURL: String;
14+
iframeURL: string;
1515
currentView: View;
1616

1717
constructor(
1818
public viewSrv: ViewService,
1919
public _settingSvc: SettingService
20-
) {}
20+
) {
21+
}
2122

2223
get isShowSetting() {
2324
const connectMethods = ['koko', 'lion', 'tinker', 'panda'];
@@ -62,7 +63,7 @@ export class ElementChatComponent implements OnInit, OnDestroy {
6263

6364
clientOffset.clientX = event.clientX;
6465
clientOffset.clientY = event.clientY;
65-
document.onmousemove = function(ev: any) {
66+
document.onmousemove = function (ev: any) {
6667
dragBox.style.left = ev.clientX - innerX + 'px';
6768
dragBox.style.top = ev.clientY - innerY + 'px';
6869
const dragDivTop = window.innerHeight - dragBox.getBoundingClientRect().height;
@@ -78,7 +79,7 @@ export class ElementChatComponent implements OnInit, OnDestroy {
7879
ev.preventDefault();
7980
ev.stopPropagation();
8081
};
81-
document.onmouseup = function() {
82+
document.onmouseup = function () {
8283
document.onmousemove = null;
8384
document.onmouseup = null;
8485
};
@@ -87,10 +88,10 @@ export class ElementChatComponent implements OnInit, OnDestroy {
8788
const clientX = event.clientX;
8889
const clientY = event.clientY;
8990
if (
90-
this.isDifferenceWithinThreshold(clientX, clientOffset.clientX)
91-
&& this.isDifferenceWithinThreshold(clientY, clientOffset.clientY)
92-
&& (event.target === dragButton || this.isDescendant(event.target, dragButton))
93-
) {
91+
this.isDifferenceWithinThreshold(clientX, clientOffset.clientX)
92+
&& this.isDifferenceWithinThreshold(clientY, clientOffset.clientY)
93+
&& (event.target === dragButton || this.isDescendant(event.target, dragButton))
94+
) {
9495
this.isShow = !this.isShow;
9596
}
9697
});

src/app/elements/connect/connect-dialog/advanced-option/advanced-option.component.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ export class ElementAdvancedOptionComponent implements OnChanges {
6969
const protocolsCanResolution: Array<string> = ['rdp'];
7070
return !protocolsCanResolution.includes(this.protocol.name);
7171
},
72-
options: resolutionsChoices.map(i => ({label: i, value: i})),
73-
label: 'Resolution',
74-
value: this.setting.graphics.rdp_resolution
72+
options: resolutionsChoices.map(i => ({label: i, value: i.toLowerCase()})),
73+
label: 'RDP resolution',
74+
value: this.setting.graphics.rdp_resolution || 'auto'
7575
},
7676
{
7777
type: 'select',
@@ -96,10 +96,31 @@ export class ElementAdvancedOptionComponent implements OnChanges {
9696
if (!this._settingSvc.hasXPack()) {
9797
return true;
9898
}
99+
99100
return !this.connectMethod || this.connectMethod.component !== 'tinker';
100101
}
102+
},
103+
{
104+
type: 'select',
105+
field: 'reusable',
106+
options: this.boolChoices,
107+
label: 'RDP file reusable',
108+
value: false,
109+
hidden: () => {
110+
if (!this.connectMethod) {
111+
return true;
112+
}
113+
if (!this._settingSvc.globalSetting.CONNECTION_TOKEN_REUSABLE) {
114+
return true;
115+
}
116+
return this.connectMethod.component !== 'tinker' && this.connectMethod.component !== 'razor';
117+
}
101118
}
102119
];
120+
const onlyUsingDefaultFields = ['reusable'];
121+
onlyUsingDefaultFields.forEach(i => {
122+
this.connectOption[i] = this.advancedOptions.find(j => j.field === i).value;
123+
});
103124
this.advancedOptions = this.advancedOptions.filter(i => !i.hidden());
104125
this.advancedOptions.forEach(i => {
105126
if (this.connectOption[i.field] === undefined) {

src/app/elements/connect/connect-dialog/connect-method/connect-method.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<span matTooltip="{{'Click to download rdp file'| translate}}">
3030
<i (click)="downloadRDPFile(method)"
3131
*ngIf="canDownloadRDPFile(method)"
32-
class="fa fa-question-circle-o question"
32+
class="fa fa-arrow-circle-down question"
3333
></i>
3434
</span>
3535
</mat-radio-button>

src/app/elements/connect/connect-dialog/connect-method/connect-method.component.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
.connect-type-group ::ng-deep .mat-tab-group {
2020
.mat-tab-label {
2121
height: 32px !important;
22-
min-width:20px !important;
23-
padding: 0 0!important;
22+
min-width: 20px !important;
23+
padding: 0 0 !important;
2424
}
2525

2626
.mat-tab-label:focus {
@@ -31,3 +31,7 @@
3131
background-color: white;
3232
}
3333
}
34+
35+
.question {
36+
color: #5d5d5d;
37+
}

src/app/elements/connect/connect-dialog/connect-method/connect-method.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
2-
import {Account, ConnectMethod, AuthInfo, Protocol} from '@app/model';
2+
import {Account, AuthInfo, ConnectMethod, Protocol} from '@app/model';
33
import {AppService, I18nService, SettingService} from '@app/services';
44

55
@Component({

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ export class ElementConnectComponent implements OnInit, OnDestroy {
7676
analysisId(id: string) {
7777
const idObject = {};
7878
const idList = id.split('&');
79-
for (let i = 0; i < idList.length; i++) {
80-
idObject[idList[i].split('=')[0]] = (idList[i].split('=')[1]);
79+
for (const element of idList) {
80+
idObject[element.split('=')[0]] = (element.split('=')[1]);
8181
}
8282
return idObject;
8383
}
@@ -213,7 +213,7 @@ export class ElementConnectComponent implements OnInit, OnDestroy {
213213
}
214214

215215
if (connectInfo.downloadRDP) {
216-
return this._http.downloadRDPFile(connToken, this._settingSvc.setting);
216+
return this._http.downloadRDPFile(connToken, this._settingSvc.setting, connectInfo.connectOption);
217217
} else if (connectMethod.type === 'native') {
218218
this.callLocalClient(connToken).then();
219219
} else if (connectMethod.type === 'applet' && appletConnectMethod === 'client') {
@@ -295,9 +295,7 @@ export class ElementConnectComponent implements OnInit, OnDestroy {
295295
const preConnectData = this._appSvc.getPreConnectData(asset);
296296
const isValid = this.checkPreConnectDataForAuto(asset, accounts, preConnectData);
297297
if (isValid) {
298-
return new Promise<ConnectData>(resolve => {
299-
resolve(preConnectData);
300-
});
298+
return Promise.resolve(preConnectData);
301299
}
302300

303301
this._appSvc.connectDialogShown = true;

src/app/elements/content/content-window/default/default.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {Asset, Endpoint, View} from '@app/model';
88
})
99
export class ElementConnectorDefaultComponent implements OnInit {
1010
@Input() view: View;
11-
@Input() connector: String;
11+
@Input() connector: string;
1212
@ViewChild('terminal', {static: false}) el: ElementRef;
1313
iframeURL: string;
1414
baseUrl: string;

src/app/elements/content/content-window/guide/guide.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<div class="content">
22
<div>
3-
<h2 class="subject">{{ assetType }}{{ 'connect info' | translate }}</h2>
3+
<h2 class="subject">{{ assetType }} {{ 'connect info' | translate }}</h2>
44
<table>
55
<tr *ngFor="let item of infoItems">
6-
<td class="title">{{ item.label | async }} </td>
6+
<td class="title">{{ item.label | async }}</td>
77
<td
88
#tooltip="matTooltip"
99
(cbOnSuccess)="onCopySuccess($event)"

0 commit comments

Comments
 (0)