Skip to content
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
8 changes: 7 additions & 1 deletion src/app/elements/asset-tree/asset-tree.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,21 +221,27 @@ export class ElementAssetTreeComponent implements OnInit {
}

handleMenuClick(menu: any) {
console.log('menu', menu);
menu.click();
this.hideRMenu();
}

onNodeClick(event, treeId, treeNode, clickFlag) {
const ztree = this.trees.find(t => t.name === treeId).ztree;

if (treeNode.isParent) {
ztree.expandNode(treeNode);
return;
}

if (treeNode.chkDisabled) {
this._message.warning(this._i18n.instant('DisabledAsset'));
return;
}

// if (treeNode.meta.data.platform_type === 'k8s') {
// return connectOnNewPage(treeNode, 'auto');
// }

if (this.isOpenNewWindow) {
connectOnNewPage(treeNode, 'auto');
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/connect/connect.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</div>
</div>

<div class="gui" *ngIf="view && view.connectMethod?.component === 'lion'">
<div class="gui" *ngIf="view && (view.connectMethod?.component === 'lion')">
<div class="timer-container">
<div class="timer">
<div [class.active]="isActive" class="status-dot"></div>
Expand Down
24 changes: 15 additions & 9 deletions src/app/pages/connect/connect.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
I18nService,
HttpService,
DrawerStateService,
IframeCommunicationService,
IframeCommunicationService
} from '@app/services';

@Component({
Expand Down Expand Up @@ -50,7 +50,7 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
private connectData: any;
private account: Account;
private connectToken: ConnectionToken;
private connectMethod: ConnectMethod;
private connectMethod: ConnectMethod | string;
private asset: any;
private method: string;

Expand All @@ -63,7 +63,7 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
private _route: ActivatedRoute,
private _dialog: NzModalService,
private _drawerStateService: DrawerStateService,
private _iframeCommunicationService: IframeCommunicationService,
private _iframeCommunicationService: IframeCommunicationService
) {
this.startTime = new Date();
}
Expand All @@ -72,21 +72,18 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
this.view = null;
this.isTimerStopped = false;

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

// 监听 iframe 通信消息
this.subscription = this._iframeCommunicationService.message$.subscribe(message => {
if (message.name === 'CLOSE') {
this.stopTimer();
}
});

if (this.isDirect) {
// 直连模式初始化:需要获取资产数据和创建连接令牌
await this.initDirectMode();

} else {
// 普通连接模式初始化:等待 elements-connect 组件触发连接
this.handleEventChangeTime();
}
}
Expand Down Expand Up @@ -263,8 +260,6 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
case 'mongodb':
case 'clickhouse':
case 'k8s':
case 'http':
case 'https':
this.connectMethod = {
component: 'koko',
type: 'web',
Expand All @@ -274,6 +269,17 @@ export class PagesConnectComponent implements OnInit, OnDestroy {
disabled: false
};
return 'web_cli';
case 'http':
case 'https':
this.connectMethod = {
component: 'lion',
type: 'web',
value: 'chrome',
label: 'Chrome',
endpoint_protocol: endpointProtocol,
disabled: false
};
return 'chrome';
case 'rdp':
case 'vnc':
this.connectMethod = {
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/pages.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ export const PagesComponents = [
PagesConnectComponent,
PagesMonitorComponent,
PagesNotFoundComponent,
PagesKubernetesComponent,
PagesKubernetesComponent
];
Loading