Skip to content

Commit 1b0ed7d

Browse files
committed
Fixed: Fix the issue where HTTP assets cannot be accessed directly
1 parent 738eb08 commit 1b0ed7d

5 files changed

Lines changed: 117 additions & 77 deletions

File tree

src/app/elements/asset-tree/asset-tree.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,21 +221,27 @@ export class ElementAssetTreeComponent implements OnInit {
221221
}
222222

223223
handleMenuClick(menu: any) {
224-
console.log('menu', menu);
225224
menu.click();
226225
this.hideRMenu();
227226
}
228227

229228
onNodeClick(event, treeId, treeNode, clickFlag) {
230229
const ztree = this.trees.find(t => t.name === treeId).ztree;
230+
231231
if (treeNode.isParent) {
232232
ztree.expandNode(treeNode);
233233
return;
234234
}
235+
235236
if (treeNode.chkDisabled) {
236237
this._message.warning(this._i18n.instant('DisabledAsset'));
237238
return;
238239
}
240+
241+
// if (treeNode.meta.data.platform_type === 'k8s') {
242+
// return connectOnNewPage(treeNode, 'auto');
243+
// }
244+
239245
if (this.isOpenNewWindow) {
240246
connectOnNewPage(treeNode, 'auto');
241247
} else {

src/app/pages/connect/connect.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
</div>
6464
</div>
6565

66-
<div class="gui" *ngIf="view && view.connectMethod?.component === 'lion'">
66+
<div class="gui" *ngIf="view && (view.connectMethod?.component === 'lion')">
6767
<div class="timer-container">
6868
<div class="timer">
6969
<div [class.active]="isActive" class="status-dot"></div>

src/app/pages/connect/connect.component.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
I18nService,
1212
HttpService,
1313
DrawerStateService,
14-
IframeCommunicationService,
14+
IframeCommunicationService
1515
} from '@app/services';
1616

1717
@Component({
@@ -50,7 +50,7 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
5050
private connectData: any;
5151
private account: Account;
5252
private connectToken: ConnectionToken;
53-
private connectMethod: ConnectMethod;
53+
private connectMethod: ConnectMethod | string;
5454
private asset: any;
5555
private method: string;
5656

@@ -63,7 +63,7 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
6363
private _route: ActivatedRoute,
6464
private _dialog: NzModalService,
6565
private _drawerStateService: DrawerStateService,
66-
private _iframeCommunicationService: IframeCommunicationService,
66+
private _iframeCommunicationService: IframeCommunicationService
6767
) {
6868
this.startTime = new Date();
6969
}
@@ -72,21 +72,18 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
7272
this.view = null;
7373
this.isTimerStopped = false;
7474

75-
// 检查是否为直连模式
7675
this.checkDirectMode();
7776

78-
// 监听 iframe 通信消息
7977
this.subscription = this._iframeCommunicationService.message$.subscribe(message => {
8078
if (message.name === 'CLOSE') {
8179
this.stopTimer();
8280
}
8381
});
8482

8583
if (this.isDirect) {
86-
// 直连模式初始化:需要获取资产数据和创建连接令牌
8784
await this.initDirectMode();
85+
8886
} else {
89-
// 普通连接模式初始化:等待 elements-connect 组件触发连接
9087
this.handleEventChangeTime();
9188
}
9289
}
@@ -263,8 +260,6 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
263260
case 'mongodb':
264261
case 'clickhouse':
265262
case 'k8s':
266-
case 'http':
267-
case 'https':
268263
this.connectMethod = {
269264
component: 'koko',
270265
type: 'web',
@@ -274,6 +269,17 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
274269
disabled: false
275270
};
276271
return 'web_cli';
272+
case 'http':
273+
case 'https':
274+
this.connectMethod = {
275+
component: 'lion',
276+
type: 'web',
277+
value: 'chrome',
278+
label: 'Chrome',
279+
endpoint_protocol: endpointProtocol,
280+
disabled: false
281+
};
282+
return 'chrome';
277283
case 'rdp':
278284
case 'vnc':
279285
this.connectMethod = {

src/app/pages/pages.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ export const PagesComponents = [
1919
PagesConnectComponent,
2020
PagesMonitorComponent,
2121
PagesNotFoundComponent,
22-
PagesKubernetesComponent,
22+
PagesKubernetesComponent
2323
];

0 commit comments

Comments
 (0)