🔨 重构终端前端逻辑

This commit is contained in:
lijiahangmax
2024-02-02 01:29:21 +08:00
parent ae52a556d9
commit 9bf4a8e291
6 changed files with 85 additions and 9 deletions

View File

@@ -162,6 +162,62 @@ public class TerminalPreferenceModel implements PreferenceModel {
}
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ActionBarSettingModel implements IJsonObject {
@Schema(description = "命令输入框")
private Boolean commandInput;
@Schema(description = "连接状态")
private Boolean connectStatus;
@Schema(description = "去顶部")
private Boolean toTop;
@Schema(description = "去底部")
private Boolean toBottom;
@Schema(description = "全选")
private Boolean selectAll;
@Schema(description = "搜索")
private Boolean search;
@Schema(description = "复制")
private Boolean copy;
@Schema(description = "粘贴")
private Boolean paste;
@Schema(description = "中断")
private Boolean interrupt;
@Schema(description = "回车")
private Boolean enter;
@Schema(description = "增大字号")
private Boolean fontSizePlus;
@Schema(description = "减小字号")
private Boolean fontSizeSubtract;
@Schema(description = "命令编辑器")
private Boolean commandEditor;
@Schema(description = "清空")
private Boolean clear;
@Schema(description = "断开连接")
private Boolean disconnect;
@Schema(description = "关闭终端")
private Boolean closeTab;
}
@Data
@Builder
@NoArgsConstructor

View File

@@ -76,7 +76,27 @@ public class TerminalPreferenceStrategy implements IPreferenceStrategy<TerminalP
new TerminalPreferenceModel.ShortcutKeysModel("changeToNextTab", true, false, true, "ArrowRight", true),
new TerminalPreferenceModel.ShortcutKeysModel("openCopyTerminalTab", true, false, true, "KeyO", true),
new TerminalPreferenceModel.ShortcutKeysModel("openNewConnectTab", true, false, true, "KeyN", true)
))
))
.build()
.toJsonString();
// 操作栏设置
String actionBarSetting = TerminalPreferenceModel.ActionBarSettingModel.builder()
.commandInput(false)
.connectStatus(true)
.toTop(true)
.toBottom(true)
.selectAll(false)
.search(true)
.copy(true)
.paste(true)
.interrupt(false)
.enter(false)
.fontSizePlus(false)
.fontSizeSubtract(false)
.commandEditor(true)
.clear(true)
.disconnect(false)
.closeTab(true)
.build()
.toJsonString();
// 默认配置
@@ -84,7 +104,7 @@ public class TerminalPreferenceStrategy implements IPreferenceStrategy<TerminalP
.newConnectionType("group")
.theme(new JSONObject())
.displaySetting(JSONObject.parseObject(defaultDisplaySetting))
.actionBarSetting(new JSONObject())
.actionBarSetting(JSONObject.parseObject(actionBarSetting))
.rightMenuSetting(Lists.of("copy", "paste", "checkAll", "search", "clear"))
.interactSetting(JSONObject.parseObject(defaultInteractSetting))
.pluginsSetting(JSONObject.parseObject(defaultPluginsSetting))

View File

@@ -189,7 +189,7 @@ export default defineStore('terminal', {
return;
}
// 获取会话
return this.sessionManager.getSession(tab.key);
return this.sessionManager.getSession(activeTab.key);
},
},

View File

@@ -130,11 +130,11 @@
.tab-title-wrapper {
display: flex;
align-items: center;
align-items: stretch;
.tab-title-icon {
font-size: 16px;
margin-right: 4px;
margin-right: 6px;
}
}

View File

@@ -71,7 +71,7 @@
}
} else {
// 修改标题
document.title = '主机终端';
document.title = TerminalTabs.TERMINAL_PANEL.title;
}
});

View File

@@ -37,7 +37,7 @@
panel: ITerminalTabManager
}>();
// FIXME 全部关闭则关闭
// FIXME 全部关闭展示新增
</script>
@@ -49,11 +49,11 @@
.tab-title-wrapper {
display: flex;
align-items: center;
align-items: stretch;
.tab-title-icon {
font-size: 16px;
margin-right: 4px;
margin-right: 6px;
}
}