🐛 修复终端大小适配失效.

This commit is contained in:
lijiahangmax
2024-06-30 01:14:44 +08:00
parent 02f5bef6b4
commit 711a4a6bab
8 changed files with 6 additions and 16 deletions

View File

@@ -324,11 +324,6 @@ public class TerminalPreferenceModel implements GenericsDataModel {
*/
private Boolean disconnect;
/**
* 关闭终端
*/
private Boolean closeTab;
}
@Data

View File

@@ -115,7 +115,6 @@ public class TerminalPreferenceStrategy extends AbstractGenericsDataStrategy<Ter
.openSftp(true)
.clear(true)
.disconnect(false)
.closeTab(true)
.build()
.toJsonString();
// 默认配置

View File

@@ -94,7 +94,7 @@
}
// 获取会话
const session = sessionManager.getSession<ISftpSession>(sessionId.value);
if (session.type === PanelSessionType.SFTP.type) {
if (session?.type === PanelSessionType.SFTP.type) {
session.chmod(formModel.value.path, formModel.value.mod);
}
} catch (e) {

View File

@@ -71,7 +71,7 @@
}
// 获取会话
const session = sessionManager.getSession<ISftpSession>(sessionId.value);
if (session.type === PanelSessionType.SFTP.type) {
if (session?.type === PanelSessionType.SFTP.type) {
if (touch.value) {
// 创建文件
session.touch(formModel.value.path);

View File

@@ -79,7 +79,7 @@
}
// 获取会话
const session = sessionManager.getSession<ISftpSession>(sessionId.value);
if (session.type === PanelSessionType.SFTP.type) {
if (session?.type === PanelSessionType.SFTP.type) {
session.move(formModel.value.path, formModel.value.target);
}
} catch (e) {

View File

@@ -201,10 +201,10 @@ export default class TerminalOutputProcessor implements ITerminalOutputProcessor
private processWithType(session: ITerminalSession,
sshProcess: (ssh: ISshSession) => any | void,
sftpProcess: (ssh: ISftpSession) => any | void) {
if (session.type === PanelSessionType.SSH.type) {
if (session?.type === PanelSessionType.SSH.type) {
// SSH 操作
return sshProcess(session as ISshSession);
} else if (session.type === PanelSessionType.SFTP.type) {
} else if (session?.type === PanelSessionType.SFTP.type) {
// SFTP 操作
return sftpProcess(session as ISftpSession);
}

View File

@@ -135,7 +135,7 @@ export default class TerminalSessionManager implements ITerminalSessionManager {
private dispatchResize() {
// 对所有已连接的会话重置大小
Object.values(this.sessions)
.filter(s => s.type === PanelSessionType.SSH.type)
.filter(s => s?.type === PanelSessionType.SSH.type)
.map(s => s as SshSession)
.filter(h => h.connected)
.forEach(h => h.fit());

View File

@@ -177,10 +177,6 @@ export const ActionBarItems = [
item: 'disconnect',
icon: 'icon-poweroff',
content: '断开连接',
}, {
item: 'closeTab',
icon: 'icon-close',
content: '关闭终端',
}
];