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
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Component, Input, OnChanges, OnInit} from '@angular/core';
import {ConnectMethod, ConnectOption, GlobalSetting, Protocol, Setting} from '@app/model';
import {resolutionsChoices} from '@app/globals';
import {SettingService} from '@app/services';
import { Component, Input, OnChanges, OnInit } from '@angular/core';
import { ConnectMethod, ConnectOption, GlobalSetting, Protocol, Setting } from '@app/model';
import { resolutionsChoices } from '@app/globals';
import { SettingService } from '@app/services';

@Component({
standalone: false,
selector: 'elements-advanced-option',
templateUrl: 'advanced-option.component.html',
styleUrls: ['advanced-option.component.scss'],
styleUrls: ['advanced-option.component.scss']
})
export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
@Input() protocol: Protocol;
Expand All @@ -19,8 +19,8 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
public globalSetting: GlobalSetting;
private allOptions: ConnectOption[] = [];
private boolChoices = [
{label: 'Yes', value: true},
{label: 'No', value: false},
{ label: 'Yes', value: true },
{ label: 'No', value: false }
];

constructor(public _settingSvc: SettingService) {
Expand All @@ -33,15 +33,18 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
label: 'Charset',
hidden: () => {
const protocolsCanCharset: Array<string> = ['ssh', 'telnet'];
return this.connectMethod && this.connectMethod.component !== 'koko' || !protocolsCanCharset.includes(this.protocol.name);
return (
(this.connectMethod && this.connectMethod.component !== 'koko') ||
!protocolsCanCharset.includes(this.protocol.name)
);
},
value: 'default',
options: [
{label: 'Default', value: 'default'},
{label: 'UTF-8', value: 'utf8'},
{label: 'GBK', value: 'gbk'},
{label: 'GB2312', value: 'gb2312'},
{label: 'IOS-8859-1', value: 'ios-8859-1'},
{ label: 'Default', value: 'default' },
{ label: 'UTF-8', value: 'utf8' },
{ label: 'GBK', value: 'gbk' },
{ label: 'GB2312', value: 'gb2312' },
{ label: 'IOS-8859-1', value: 'ios-8859-1' }
]
},
{
Expand All @@ -51,7 +54,10 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
const protocolsCanAutoHash: Array<string> = ['mysql', 'mariadb'];
if (this.connectMethod) {
if (this.connectMethod.component === 'koko') {
return this.connectMethod.component !== 'koko' || !protocolsCanAutoHash.includes(this.protocol.name);
return (
this.connectMethod.component !== 'koko' ||
!protocolsCanAutoHash.includes(this.protocol.name)
);
}
if (this.connectMethod.component === 'chen') {
return false;
Expand All @@ -67,7 +73,11 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
type: 'select',
field: 'token_reusable',
hidden: () => {
return !(this.connectMethod.component === 'magnus' && this.connectMethod.value === 'db_client' && this.globalSetting.CONNECTION_TOKEN_REUSABLE);
return !(
this.connectMethod.component === 'magnus' &&
this.connectMethod.value === 'db_client' &&
this.globalSetting.CONNECTION_TOKEN_REUSABLE
);
},
label: 'Set reusable',
value: false,
Expand All @@ -80,7 +90,7 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
const protocolsCanResolution: Array<string> = ['rdp'];
return !protocolsCanResolution.includes(this.protocol.name);
},
options: resolutionsChoices.map(i => ({label: i, value: i.toLowerCase()})),
options: resolutionsChoices.map(i => ({ label: i, value: i.toLowerCase() })),
label: 'RDP resolution',
value: this.setting.graphics.rdp_resolution || 'auto'
},
Expand All @@ -98,8 +108,10 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
type: 'select',
field: 'appletConnectMethod',
options: [
{label: 'Web', value: 'web'},
...(this.globalSetting.TERMINAL_RAZOR_ENABLED ? [{label: 'Client', value: 'client'}] : [])
{ label: 'Web', value: 'web' },
...(this.globalSetting.TERMINAL_RAZOR_ENABLED
? [{ label: 'Client', value: 'client' }]
: [])
],
label: 'Applet connect method',
value: this.setting.graphics.applet_connection_method,
Expand All @@ -114,8 +126,8 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
type: 'select',
field: 'virtualappConnectMethod',
options: [
{label: 'Web', value: 'web'},
...(true ? [{label: 'Client', value: 'client'}] : [])
{ label: 'Web', value: 'web' },
...(true ? [{ label: 'Client', value: 'client' }] : [])
],
label: 'Virtualapp connect method',
value: this.setting.graphics.applet_connection_method,
Expand Down Expand Up @@ -157,15 +169,16 @@ export class ElementAdvancedOptionComponent implements OnChanges, OnInit {
},
value: 'auto',
options: [
{label: 'Auto', value: 'auto'},
{label: 'Low Speed Broadband (256 Kbps - 2 Mbps)', value: 'low_speed_broadband'},
{label: 'High-speed broadband (2 Mbps – 10 Mbps )', value: 'high_speed_broadband'},
{ label: 'Auto', value: 'auto' },
{ label: 'Low Speed Broadband (256 Kbps - 2 Mbps)', value: 'low_speed_broadband' },
{ label: 'High-speed broadband (2 Mbps – 10 Mbps )', value: 'high_speed_broadband' }
]
}
];
}

ngOnInit() {
this.checkOptions();
}

checkOptions() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
</ng-template>

<nz-radio-group [(ngModel)]="connectMethod" class="connect-method" name="connect-method">
<!-- <nz-radio-button *ngFor="let method of item['methods']" [disabled]="method.disabled" [value]="method">-->
<label *ngFor="let method of item['methods']" [nzValue]="method" nz-radio>
{{ method.label }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

.connect-type-group {
border: solid #cbc9c9 1px;
}
Expand All @@ -19,29 +18,58 @@
width: 70px;
}

.connect-type-group ::ng-deep {
.ant-tabs-nav-list {
width: 100%;
/* Tab 布局优化 - 允许溢出操作但防止闪烁 */
.full-width-tabs ::ng-deep {
.ant-tabs-nav {
.ant-tabs-nav-wrap {
/* 允许溢出,但设置合理的阈值 */
overflow: hidden;
}

& > div {
.ant-tabs-nav-list {
display: flex;
width: 100%;

.ant-tabs-tab {
/* 设置合理的最小宽度,避免过度压缩 */
min-width: 100px;
flex: 1;
padding-top: 6px;
padding-bottom: 8px;

.ant-tabs-tab-btn {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 0 12px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

i {
margin-right: 8px;
flex-shrink: 0;
}
}
}
}

.ant-tabs-tab {
min-width: 20px;
padding-top: 6px;
padding-bottom: 8px;
flex: 1;
justify-content: center; /* 水平居中标题文字 */
text-align: center;
/* 优化溢出操作按钮的显示逻辑 */
.ant-tabs-nav-operations {
/* 只在真正需要时才显示 */
opacity: 1;
transition: opacity 0.2s ease;

i {
margin-right: 10px;
/* 当没有溢出时隐藏 */
&.ant-tabs-nav-operations-hidden {
opacity: 0;
pointer-events: none;
}
}
}
}

.question {
color: #5d5d5d;
}
.question {
color: #5d5d5d;
}