feat: 添加终端交互配置项.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package com.orion.ops.module.infra.handler.preference.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.orion.lang.able.IJsonObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -33,14 +33,20 @@ public class TerminalPreferenceModel implements PreferenceModel {
|
||||
@Schema(description = "操作栏设置")
|
||||
private JSONObject actionBarSetting;
|
||||
|
||||
@Schema(description = "背景设置")
|
||||
private JSONObject backgroundSetting;
|
||||
@Schema(description = "交互设置")
|
||||
private JSONObject interactSetting;
|
||||
|
||||
@Schema(description = "插件设置")
|
||||
private JSONObject pluginsSetting;
|
||||
|
||||
@Schema(description = "会话设置")
|
||||
private JSONObject sessionSetting;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class DisplaySettingModel {
|
||||
public static class DisplaySettingModel implements IJsonObject {
|
||||
|
||||
@Schema(description = "字体样式")
|
||||
private String fontFamily;
|
||||
@@ -63,14 +69,74 @@ public class TerminalPreferenceModel implements PreferenceModel {
|
||||
@Schema(description = "光标闪烁")
|
||||
private Boolean cursorBlink;
|
||||
|
||||
/**
|
||||
* 转为 json
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public JSONObject toJson() {
|
||||
return JSON.parseObject(JSON.toJSONString(this));
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class InteractSettingModel implements IJsonObject {
|
||||
|
||||
@Schema(description = "快速滚动")
|
||||
private Boolean fastScrollModifier;
|
||||
|
||||
@Schema(description = "点击移动光标")
|
||||
private Boolean altClickMovesCursor;
|
||||
|
||||
@Schema(description = "右键选中词条")
|
||||
private Boolean rightClickSelectsWord;
|
||||
|
||||
@Schema(description = "选中词条自动复制")
|
||||
private Boolean selectionChangeCopy;
|
||||
|
||||
@Schema(description = "复制去除空格")
|
||||
private Boolean copyAutoTrim;
|
||||
|
||||
@Schema(description = "粘贴去除空格")
|
||||
private Boolean pasteAutoTrim;
|
||||
|
||||
@Schema(description = "右键粘贴")
|
||||
private Boolean rightClickPaste;
|
||||
|
||||
@Schema(description = "启用右键菜单")
|
||||
private Boolean enableRightClickMenu;
|
||||
|
||||
@Schema(description = "启用响铃")
|
||||
private Boolean enableBell;
|
||||
|
||||
@Schema(description = "单词分隔符")
|
||||
private String wordSeparator;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class PluginsSettingModel implements IJsonObject {
|
||||
|
||||
@Schema(description = "超链接插件")
|
||||
private Boolean enableWeblinkPlugin;
|
||||
|
||||
@Schema(description = "WebGL 渲染插件")
|
||||
private Boolean enableWebglPlugin;
|
||||
|
||||
@Schema(description = "图片渲染插件")
|
||||
private Boolean enableImagePlugin;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class SessionSettingModel implements IJsonObject {
|
||||
|
||||
@Schema(description = "伪终端类型")
|
||||
private String terminalEmulationType;
|
||||
|
||||
@Schema(description = "保存在缓冲区的行数")
|
||||
private Integer scrollBackLine;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.orion.ops.module.infra.handler.preference.strategy;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.orion.net.host.ssh.TerminalType;
|
||||
import com.orion.ops.module.infra.handler.preference.model.TerminalPreferenceModel;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -16,8 +17,9 @@ public class TerminalPreferenceStrategy implements IPreferenceStrategy<TerminalP
|
||||
|
||||
@Override
|
||||
public TerminalPreferenceModel getDefault() {
|
||||
// ...快捷键 ...背景
|
||||
// 默认显示设置
|
||||
JSONObject defaultDisplaySetting = TerminalPreferenceModel.DisplaySettingModel
|
||||
String defaultDisplaySetting = TerminalPreferenceModel.DisplaySettingModel
|
||||
.builder()
|
||||
.fontFamily("_")
|
||||
.fontSize(14)
|
||||
@@ -27,13 +29,44 @@ public class TerminalPreferenceStrategy implements IPreferenceStrategy<TerminalP
|
||||
.cursorStyle("bar")
|
||||
.cursorBlink(true)
|
||||
.build()
|
||||
.toJson();
|
||||
.toJsonString();
|
||||
|
||||
// 默认交互设置
|
||||
String defaultInteractSetting = TerminalPreferenceModel.InteractSettingModel.builder()
|
||||
.fastScrollModifier(true)
|
||||
.altClickMovesCursor(true)
|
||||
.rightClickSelectsWord(false)
|
||||
.selectionChangeCopy(false)
|
||||
.copyAutoTrim(false)
|
||||
.pasteAutoTrim(false)
|
||||
.rightClickPaste(false)
|
||||
.enableRightClickMenu(true)
|
||||
.enableBell(false)
|
||||
.wordSeparator("/\\()\"'` -.,:;<>~!@#$%^&*|+=[]{}~?│")
|
||||
.build()
|
||||
.toJsonString();
|
||||
// 默认插件设置
|
||||
String defaultPluginsSetting = TerminalPreferenceModel.PluginsSettingModel.builder()
|
||||
.enableWeblinkPlugin(true)
|
||||
.enableWebglPlugin(true)
|
||||
.enableImagePlugin(false)
|
||||
.build()
|
||||
.toJsonString();
|
||||
// 默认会话设置
|
||||
String defaultSessionSetting = TerminalPreferenceModel.SessionSettingModel.builder()
|
||||
.terminalEmulationType(TerminalType.XTERM.getType())
|
||||
.scrollBackLine(1000)
|
||||
.build()
|
||||
.toJsonString();
|
||||
// 默认配置
|
||||
return TerminalPreferenceModel.builder()
|
||||
.newConnectionType("group")
|
||||
.theme(new JSONObject())
|
||||
.displaySetting(defaultDisplaySetting)
|
||||
.displaySetting(JSONObject.parseObject(defaultDisplaySetting))
|
||||
.actionBarSetting(new JSONObject())
|
||||
.backgroundSetting(new JSONObject())
|
||||
.interactSetting(JSONObject.parseObject(defaultInteractSetting))
|
||||
.pluginsSetting(JSONObject.parseObject(defaultPluginsSetting))
|
||||
.sessionSetting(JSONObject.parseObject(defaultSessionSetting))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user