✨ 主机终端主题从字典中获取.
This commit is contained in:
2
.github/workflows/e2e.yaml
vendored
2
.github/workflows/e2e.yaml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
- main
|
||||
- dev
|
||||
|
||||
concurrency:
|
||||
concurrency:
|
||||
group: ${{github.workflow}} - ${{github.ref}}
|
||||
cancel-in-progress: true
|
||||
|
||||
|
||||
@@ -43,4 +43,6 @@ public interface ExtraFieldConst extends FieldConst {
|
||||
|
||||
String LOG_ID = "logId";
|
||||
|
||||
String DARK = "dark";
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ public interface FieldConst {
|
||||
|
||||
String INFO = "info";
|
||||
|
||||
String EXTRA = "extra";
|
||||
|
||||
String REL_ID = "relId";
|
||||
|
||||
String BEFORE = "before";
|
||||
@@ -59,10 +61,24 @@ public interface FieldConst {
|
||||
|
||||
String TIME = "time";
|
||||
|
||||
String ISSUE = "issue";
|
||||
|
||||
String EXPIRE = "expire";
|
||||
|
||||
String LOCATION = "location";
|
||||
|
||||
String USER_AGENT = "userAgent";
|
||||
|
||||
String ERROR_MESSAGE = "errorMessage";
|
||||
|
||||
String UUID = "uuid";
|
||||
|
||||
String REDIRECT = "redirect";
|
||||
|
||||
String SCHEMA = "schema";
|
||||
|
||||
String FILTER = "filter";
|
||||
|
||||
String LICENSE = "license";
|
||||
|
||||
}
|
||||
|
||||
@@ -38,13 +38,13 @@ public class CustomFileFilter {
|
||||
public List<CustomFile> doFilter() {
|
||||
// 生成文件副本
|
||||
List<CustomFile> files = originCustomerFile.stream().map(s ->
|
||||
new CustomFile.Builder()
|
||||
.enableFileOverride()
|
||||
.templatePath(s.getTemplatePath())
|
||||
.filePath(s.getFilePath())
|
||||
.fileName(s.getFileName())
|
||||
.packageName(s.getPackageName())
|
||||
.build())
|
||||
new CustomFile.Builder()
|
||||
.enableFileOverride()
|
||||
.templatePath(s.getTemplatePath())
|
||||
.filePath(s.getFilePath())
|
||||
.fileName(s.getFileName())
|
||||
.packageName(s.getPackageName())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
// 不生成对外 api 文件
|
||||
if (!table.isEnableProviderApi()) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.orion.visor.module.asset.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.orion.visor.framework.log.core.annotation.IgnoreLog;
|
||||
import com.orion.visor.framework.log.core.enums.IgnoreLogMode;
|
||||
import com.orion.visor.framework.web.core.annotation.RestWrapper;
|
||||
import com.orion.visor.module.asset.entity.vo.HostTerminalThemeVO;
|
||||
import com.orion.visor.module.asset.service.HostTerminalService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 主机终端 api
|
||||
@@ -38,7 +39,7 @@ public class HostTerminalController {
|
||||
@IgnoreLog(IgnoreLogMode.ALL)
|
||||
@GetMapping("/themes")
|
||||
@Operation(summary = "获取主机终端主题")
|
||||
public JSONArray getTerminalThemes() {
|
||||
public List<HostTerminalThemeVO> getTerminalThemes() {
|
||||
return hostTerminalService.getTerminalThemes();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.orion.visor.module.asset.entity.vo;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 主机终端主题 视图响应对象
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/7/4 19:27
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Schema(name = "HostTerminalThemeVO", description = "主机终端主题 视图响应对象")
|
||||
public class HostTerminalThemeVO {
|
||||
|
||||
@Schema(description = "主题名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "是否为暗色")
|
||||
private Boolean dark;
|
||||
|
||||
@Schema(description = "主题 schema")
|
||||
private JSONObject schema;
|
||||
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.orion.visor.module.asset.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.orion.net.host.SessionStore;
|
||||
import com.orion.visor.module.asset.entity.domain.HostDO;
|
||||
import com.orion.visor.module.asset.entity.dto.HostTerminalAccessDTO;
|
||||
import com.orion.visor.module.asset.entity.dto.HostTerminalConnectDTO;
|
||||
import com.orion.visor.module.asset.entity.vo.HostTerminalThemeVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 主机终端服务
|
||||
@@ -20,7 +22,7 @@ public interface HostTerminalService {
|
||||
*
|
||||
* @return themes
|
||||
*/
|
||||
JSONArray getTerminalThemes();
|
||||
List<HostTerminalThemeVO> getTerminalThemes();
|
||||
|
||||
/**
|
||||
* 获取主机终端访问 accessToken
|
||||
|
||||
@@ -51,7 +51,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
@Override
|
||||
public Long createCommandSnippet(CommandSnippetCreateRequest request) {
|
||||
Long userId = SecurityUtils.getLoginUserId();
|
||||
log.info("CommandSnippetService-createCommandSnippet request: {}" , JSON.toJSONString(request));
|
||||
log.info("CommandSnippetService-createCommandSnippet request: {}", JSON.toJSONString(request));
|
||||
// 转换
|
||||
CommandSnippetDO record = CommandSnippetConvert.MAPPER.to(request);
|
||||
record.setUserId(userId);
|
||||
@@ -60,7 +60,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
// 插入
|
||||
int effect = commandSnippetDAO.insert(record);
|
||||
Long id = record.getId();
|
||||
log.info("CommandSnippetService-createCommandSnippet id: {}, effect: {}" , id, effect);
|
||||
log.info("CommandSnippetService-createCommandSnippet id: {}, effect: {}", id, effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
return id;
|
||||
@@ -70,7 +70,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
public Integer updateCommandSnippetById(CommandSnippetUpdateRequest request) {
|
||||
Long id = Valid.notNull(request.getId(), ErrorMessage.ID_MISSING);
|
||||
Long userId = SecurityUtils.getLoginUserId();
|
||||
log.info("CommandSnippetService-updateCommandSnippetById id: {}, request: {}" , id, JSON.toJSONString(request));
|
||||
log.info("CommandSnippetService-updateCommandSnippetById id: {}, request: {}", id, JSON.toJSONString(request));
|
||||
// 查询
|
||||
CommandSnippetDO record = commandSnippetDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
@@ -85,7 +85,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
.eq(CommandSnippetDO::getId, id)
|
||||
.eq(CommandSnippetDO::getUserId, userId);
|
||||
int effect = commandSnippetDAO.update(null, update);
|
||||
log.info("CommandSnippetService-updateCommandSnippetById effect: {}" , effect);
|
||||
log.info("CommandSnippetService-updateCommandSnippetById effect: {}", effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
return effect;
|
||||
@@ -154,13 +154,13 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
@Override
|
||||
public Integer deleteCommandSnippetById(Long id) {
|
||||
Long userId = SecurityUtils.getLoginUserId();
|
||||
log.info("CommandSnippetService-deleteCommandSnippetById id: {}" , id);
|
||||
log.info("CommandSnippetService-deleteCommandSnippetById id: {}", id);
|
||||
// 检查数据是否存在
|
||||
CommandSnippetDO record = commandSnippetDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 删除
|
||||
int effect = commandSnippetDAO.deleteById(id);
|
||||
log.info("CommandSnippetService-deleteCommandSnippetById id: {}, effect: {}" , id, effect);
|
||||
log.info("CommandSnippetService-deleteCommandSnippetById id: {}, effect: {}", id, effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId), id);
|
||||
return effect;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.orion.visor.module.asset.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.orion.lang.exception.AuthenticationException;
|
||||
import com.orion.lang.id.UUIds;
|
||||
import com.orion.lang.utils.Exceptions;
|
||||
import com.orion.lang.utils.Strings;
|
||||
import com.orion.lang.utils.io.StreamReaders;
|
||||
import com.orion.net.host.SessionHolder;
|
||||
import com.orion.net.host.SessionStore;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.constant.ExtraFieldConst;
|
||||
import com.orion.visor.framework.common.security.LoginUser;
|
||||
import com.orion.visor.framework.common.utils.CryptoUtils;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
@@ -24,6 +24,7 @@ import com.orion.visor.module.asset.entity.domain.HostIdentityDO;
|
||||
import com.orion.visor.module.asset.entity.domain.HostKeyDO;
|
||||
import com.orion.visor.module.asset.entity.dto.HostTerminalAccessDTO;
|
||||
import com.orion.visor.module.asset.entity.dto.HostTerminalConnectDTO;
|
||||
import com.orion.visor.module.asset.entity.vo.HostTerminalThemeVO;
|
||||
import com.orion.visor.module.asset.enums.*;
|
||||
import com.orion.visor.module.asset.handler.host.config.model.HostSshConfigModel;
|
||||
import com.orion.visor.module.asset.handler.host.extra.model.HostSshExtraModel;
|
||||
@@ -31,14 +32,15 @@ import com.orion.visor.module.asset.service.HostConfigService;
|
||||
import com.orion.visor.module.asset.service.HostExtraService;
|
||||
import com.orion.visor.module.asset.service.HostTerminalService;
|
||||
import com.orion.visor.module.infra.api.DataPermissionApi;
|
||||
import com.orion.visor.module.infra.api.DictValueApi;
|
||||
import com.orion.visor.module.infra.enums.DataPermissionTypeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 主机连接服务
|
||||
@@ -51,7 +53,7 @@ import java.util.Optional;
|
||||
@Service
|
||||
public class HostTerminalServiceImpl implements HostTerminalService {
|
||||
|
||||
private static final String TERMINAL_PATH = "/theme/terminal.theme.json";
|
||||
private static final String THEME_DICT_KEY = "terminalTheme";
|
||||
|
||||
@Resource
|
||||
private HostConfigService hostConfigService;
|
||||
@@ -74,15 +76,19 @@ public class HostTerminalServiceImpl implements HostTerminalService {
|
||||
@Resource
|
||||
private DataPermissionApi dataPermissionApi;
|
||||
|
||||
@Resource
|
||||
private DictValueApi dictValueApi;
|
||||
|
||||
@Override
|
||||
public JSONArray getTerminalThemes() {
|
||||
try (InputStream in = HostTerminalService.class.getResourceAsStream(TERMINAL_PATH)) {
|
||||
Valid.notNull(in, ErrorMessage.CONFIG_ABSENT);
|
||||
byte[] bytes = StreamReaders.readAllBytes(in);
|
||||
return JSONArray.parseArray(new String(bytes));
|
||||
} catch (Exception e) {
|
||||
throw Exceptions.ioRuntime(e);
|
||||
}
|
||||
public List<HostTerminalThemeVO> getTerminalThemes() {
|
||||
List<JSONObject> themes = dictValueApi.getDictValue(THEME_DICT_KEY);
|
||||
return themes.stream()
|
||||
.map(s -> HostTerminalThemeVO.builder()
|
||||
.name(s.getString(ExtraFieldConst.LABEL))
|
||||
.dark(s.getBoolean(ExtraFieldConst.DARK))
|
||||
.schema(s.getJSONObject(ExtraFieldConst.VALUE))
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,8 +14,8 @@ import com.orion.lang.utils.time.Dates;
|
||||
import com.orion.visor.framework.biz.operator.log.core.utils.OperatorLogs;
|
||||
import com.orion.visor.framework.common.annotation.Keep;
|
||||
import com.orion.visor.framework.common.constant.Const;
|
||||
import com.orion.visor.framework.common.enums.EndpointDefine;
|
||||
import com.orion.visor.framework.common.constant.ErrorMessage;
|
||||
import com.orion.visor.framework.common.enums.EndpointDefine;
|
||||
import com.orion.visor.framework.common.file.FileClient;
|
||||
import com.orion.visor.framework.common.security.LoginUser;
|
||||
import com.orion.visor.framework.common.utils.Valid;
|
||||
@@ -39,8 +39,8 @@ import com.orion.visor.module.asset.enums.HostConfigTypeEnum;
|
||||
import com.orion.visor.module.asset.enums.UploadTaskFileStatusEnum;
|
||||
import com.orion.visor.module.asset.enums.UploadTaskStatusEnum;
|
||||
import com.orion.visor.module.asset.handler.host.upload.FileUploadTasks;
|
||||
import com.orion.visor.module.asset.handler.host.upload.model.FileUploadFileItemDTO;
|
||||
import com.orion.visor.module.asset.handler.host.upload.manager.FileUploadTaskManager;
|
||||
import com.orion.visor.module.asset.handler.host.upload.model.FileUploadFileItemDTO;
|
||||
import com.orion.visor.module.asset.handler.host.upload.task.IFileUploadTask;
|
||||
import com.orion.visor.module.asset.handler.host.upload.uploader.IFileUploader;
|
||||
import com.orion.visor.module.asset.service.AssetAuthorizedDataService;
|
||||
|
||||
@@ -1,338 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "Dracula",
|
||||
"dark": true,
|
||||
"schema": {
|
||||
"background": "#1E1F29",
|
||||
"foreground": "#F8F8F2",
|
||||
"cursor": "#BBBBBB",
|
||||
"selectionBackground": "#44475A",
|
||||
"black": "#000000",
|
||||
"red": "#FF5555",
|
||||
"green": "#50FA7B",
|
||||
"yellow": "#F1FA8C",
|
||||
"blue": "#BD93F9",
|
||||
"cyan": "#8BE9FD",
|
||||
"white": "#BBBBBB",
|
||||
"brightBlack": "#555555",
|
||||
"brightRed": "#FF5555",
|
||||
"brightGreen": "#50FA7B",
|
||||
"brightYellow": "#F1FA8C",
|
||||
"brightBlue": "#BD93F9",
|
||||
"brightCyan": "#8BE9FD",
|
||||
"brightWhite": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Atom",
|
||||
"dark": true,
|
||||
"schema": {
|
||||
"background": "#161719",
|
||||
"foreground": "#C5C8C6",
|
||||
"cursor": "#D0D0D0",
|
||||
"selectionBackground": "#444444",
|
||||
"black": "#000000",
|
||||
"red": "#FD5FF1",
|
||||
"green": "#87C38A",
|
||||
"yellow": "#FFD7B1",
|
||||
"blue": "#85BEFD",
|
||||
"cyan": "#85BEFD",
|
||||
"white": "#E0E0E0",
|
||||
"brightBlack": "#000000",
|
||||
"brightRed": "#FD5FF1",
|
||||
"brightGreen": "#94FA36",
|
||||
"brightYellow": "#F5FFA8",
|
||||
"brightBlue": "#96CBFE",
|
||||
"brightCyan": "#85BEFD",
|
||||
"brightWhite": "#E0E0E0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "catppuccin-mocha",
|
||||
"dark": true,
|
||||
"schema": {
|
||||
"background": "#1E1E2E",
|
||||
"foreground": "#CDD6F4",
|
||||
"cursor": "#F5E0DC",
|
||||
"selectionBackground": "#585B70",
|
||||
"black": "#45475A",
|
||||
"red": "#F38BA8",
|
||||
"green": "#A6E3A1",
|
||||
"yellow": "#F9E2AF",
|
||||
"blue": "#89B4FA",
|
||||
"cyan": "#94E2D5",
|
||||
"white": "#BAC2DE",
|
||||
"brightBlack": "#585B70",
|
||||
"brightRed": "#F38BA8",
|
||||
"brightGreen": "#A6E3A1",
|
||||
"brightYellow": "#F9E2AF",
|
||||
"brightBlue": "#89B4FA",
|
||||
"brightCyan": "#94E2D5",
|
||||
"brightWhite": "#A6ADC8"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "MaterialDesignColors",
|
||||
"dark": true,
|
||||
"schema": {
|
||||
"background": "#1D262A",
|
||||
"foreground": "#E7EBED",
|
||||
"cursor": "#EAEAEA",
|
||||
"selectionBackground": "#4E6A78",
|
||||
"black": "#435B67",
|
||||
"red": "#FC3841",
|
||||
"green": "#5CF19E",
|
||||
"yellow": "#FED032",
|
||||
"blue": "#37B6FF",
|
||||
"cyan": "#59FFD1",
|
||||
"white": "#FFFFFF",
|
||||
"brightBlack": "#A1B0B8",
|
||||
"brightRed": "#FC746D",
|
||||
"brightGreen": "#ADF7BE",
|
||||
"brightYellow": "#FEE16C",
|
||||
"brightBlue": "#70CFFF",
|
||||
"brightCyan": "#9AFFE6",
|
||||
"brightWhite": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "catppuccin-macchiato",
|
||||
"dark": true,
|
||||
"schema": {
|
||||
"background": "#24273A",
|
||||
"foreground": "#CAD3F5",
|
||||
"cursor": "#F4DBD6",
|
||||
"selectionBackground": "#5B6078",
|
||||
"black": "#494D64",
|
||||
"red": "#ED8796",
|
||||
"green": "#A6DA95",
|
||||
"yellow": "#EED49F",
|
||||
"blue": "#8AADF4",
|
||||
"cyan": "#8BD5CA",
|
||||
"white": "#B8C0E0",
|
||||
"brightBlack": "#5B6078",
|
||||
"brightRed": "#ED8796",
|
||||
"brightGreen": "#A6DA95",
|
||||
"brightYellow": "#EED49F",
|
||||
"brightBlue": "#8AADF4",
|
||||
"brightCyan": "#8BD5CA",
|
||||
"brightWhite": "#A5ADCB"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "OneHalfDark",
|
||||
"dark": true,
|
||||
"schema": {
|
||||
"background": "#282C34",
|
||||
"foreground": "#DCDFE4",
|
||||
"cursor": "#A3B3CC",
|
||||
"selectionBackground": "#474E5D",
|
||||
"black": "#282C34",
|
||||
"red": "#E06C75",
|
||||
"green": "#98C379",
|
||||
"yellow": "#E5C07B",
|
||||
"blue": "#61AFEF",
|
||||
"cyan": "#56B6C2",
|
||||
"white": "#DCDFE4",
|
||||
"brightBlack": "#282C34",
|
||||
"brightRed": "#E06C75",
|
||||
"brightGreen": "#98C379",
|
||||
"brightYellow": "#E5C07B",
|
||||
"brightBlue": "#61AFEF",
|
||||
"brightCyan": "#56B6C2",
|
||||
"brightWhite": "#DCDFE4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Apple System Colors",
|
||||
"dark": true,
|
||||
"schema": {
|
||||
"background": "#1E1E1E",
|
||||
"foreground": "#FFFFFF",
|
||||
"cursor": "#98989D",
|
||||
"selectionBackground": "#3F638B",
|
||||
"black": "#1A1A1A",
|
||||
"red": "#CC372E",
|
||||
"green": "#26A439",
|
||||
"yellow": "#CDAC08",
|
||||
"blue": "#0869CB",
|
||||
"cyan": "#479EC2",
|
||||
"white": "#98989D",
|
||||
"brightBlack": "#464646",
|
||||
"brightRed": "#FF453A",
|
||||
"brightGreen": "#32D74B",
|
||||
"brightYellow": "#FFD60A",
|
||||
"brightBlue": "#0A84FF",
|
||||
"brightCyan": "#76D6FF",
|
||||
"brightWhite": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Builtin Tango Light",
|
||||
"dark": false,
|
||||
"schema": {
|
||||
"background": "#FFFFFF",
|
||||
"foreground": "#000000",
|
||||
"cursor": "#000000",
|
||||
"selectionBackground": "#B5D5FF",
|
||||
"black": "#000000",
|
||||
"red": "#CC0000",
|
||||
"green": "#4E9A06",
|
||||
"yellow": "#C4A000",
|
||||
"blue": "#3465A4",
|
||||
"cyan": "#06989A",
|
||||
"white": "#D3D7CF",
|
||||
"brightBlack": "#555753",
|
||||
"brightRed": "#EF2929",
|
||||
"brightGreen": "#8AE234",
|
||||
"brightYellow": "#FCE94F",
|
||||
"brightBlue": "#729FCF",
|
||||
"brightCyan": "#34E2E2",
|
||||
"brightWhite": "#EEEEEC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Duotone Dark",
|
||||
"dark": true,
|
||||
"schema": {
|
||||
"background": "#1F1D27",
|
||||
"foreground": "#B7A1FF",
|
||||
"cursor": "#FF9839",
|
||||
"selectionBackground": "#353147",
|
||||
"black": "#1F1D27",
|
||||
"red": "#D9393E",
|
||||
"green": "#2DCD73",
|
||||
"yellow": "#D9B76E",
|
||||
"blue": "#FFC284",
|
||||
"cyan": "#2488FF",
|
||||
"white": "#B7A1FF",
|
||||
"brightBlack": "#353147",
|
||||
"brightRed": "#D9393E",
|
||||
"brightGreen": "#2DCD73",
|
||||
"brightYellow": "#D9B76E",
|
||||
"brightBlue": "#FFC284",
|
||||
"brightCyan": "#2488FF",
|
||||
"brightWhite": "#EAE5FF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "BlulocoLight",
|
||||
"dark": false,
|
||||
"schema": {
|
||||
"background": "#F9F9F9",
|
||||
"foreground": "#373A41",
|
||||
"cursor": "#F32759",
|
||||
"selectionBackground": "#DAF0FF",
|
||||
"black": "#373A41",
|
||||
"red": "#D52753",
|
||||
"green": "#23974A",
|
||||
"yellow": "#DF631C",
|
||||
"blue": "#275FE4",
|
||||
"cyan": "#27618D",
|
||||
"white": "#BABBC2",
|
||||
"brightBlack": "#676A77",
|
||||
"brightRed": "#FF6480",
|
||||
"brightGreen": "#3CBC66",
|
||||
"brightYellow": "#C5A332",
|
||||
"brightBlue": "#0099E1",
|
||||
"brightCyan": "#6D93BB",
|
||||
"brightWhite": "#D3D3D3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Chester",
|
||||
"dark": true,
|
||||
"schema": {
|
||||
"background": "#2C3643",
|
||||
"foreground": "#FFFFFF",
|
||||
"cursor": "#B4B1B1",
|
||||
"selectionBackground": "#67747C",
|
||||
"black": "#080200",
|
||||
"red": "#FA5E5B",
|
||||
"green": "#16C98D",
|
||||
"yellow": "#FFC83F",
|
||||
"blue": "#288AD6",
|
||||
"cyan": "#28DDDE",
|
||||
"white": "#E7E7E7",
|
||||
"brightBlack": "#6F6B68",
|
||||
"brightRed": "#FA5E5B",
|
||||
"brightGreen": "#16C98D",
|
||||
"brightYellow": "#FEEF6D",
|
||||
"brightBlue": "#278AD6",
|
||||
"brightCyan": "#27DEDE",
|
||||
"brightWhite": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CLRS",
|
||||
"dark": false,
|
||||
"schema": {
|
||||
"background": "#FFFFFF",
|
||||
"foreground": "#262626",
|
||||
"cursor": "#6FD3FC",
|
||||
"selectionBackground": "#6FD3FC",
|
||||
"black": "#000000",
|
||||
"red": "#F8282A",
|
||||
"green": "#328A5D",
|
||||
"yellow": "#FA701D",
|
||||
"blue": "#135CD0",
|
||||
"cyan": "#33C3C1",
|
||||
"white": "#B3B3B3",
|
||||
"brightBlack": "#555753",
|
||||
"brightRed": "#FB0416",
|
||||
"brightGreen": "#2CC631",
|
||||
"brightYellow": "#FDD727",
|
||||
"brightBlue": "#1670FF",
|
||||
"brightCyan": "#3AD5CE",
|
||||
"brightWhite": "#EEEEEC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Calamity",
|
||||
"dark": true,
|
||||
"schema": {
|
||||
"background": "#2F2833",
|
||||
"foreground": "#D5CED9",
|
||||
"cursor": "#D5CED9",
|
||||
"selectionBackground": "#7E6C88",
|
||||
"black": "#2F2833",
|
||||
"red": "#FC644D",
|
||||
"green": "#A5F69C",
|
||||
"yellow": "#E9D7A5",
|
||||
"blue": "#3B79C7",
|
||||
"cyan": "#74D3DE",
|
||||
"white": "#D5CED9",
|
||||
"brightBlack": "#7E6C88",
|
||||
"brightRed": "#FC644D",
|
||||
"brightGreen": "#A5F69C",
|
||||
"brightYellow": "#E9D7A5",
|
||||
"brightBlue": "#3B79C7",
|
||||
"brightCyan": "#74D3DE",
|
||||
"brightWhite": "#FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Tomorrow",
|
||||
"dark": false,
|
||||
"schema": {
|
||||
"background": "#FFFFFF",
|
||||
"foreground": "#4D4D4C",
|
||||
"cursor": "#4D4D4C",
|
||||
"selectionBackground": "#D6D6D6",
|
||||
"black": "#000000",
|
||||
"red": "#C82829",
|
||||
"green": "#718C00",
|
||||
"yellow": "#EAB700",
|
||||
"blue": "#4271AE",
|
||||
"cyan": "#3E999F",
|
||||
"white": "#FFFFFF",
|
||||
"brightBlack": "#000000",
|
||||
"brightRed": "#C82829",
|
||||
"brightGreen": "#718C00",
|
||||
"brightYellow": "#EAB700",
|
||||
"brightBlue": "#4271AE",
|
||||
"brightCyan": "#3E999F",
|
||||
"brightWhite": "#FFFFFF"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -66,8 +66,15 @@ public class TerminalThemeGenerator {
|
||||
arr.sort(Comparator.comparing(s -> schemaFilter.indexOf(s.getName())));
|
||||
}
|
||||
// 打印 json
|
||||
String json = JSON.toJSONString(arr, colorFilter);
|
||||
System.out.println("\n\n" + json);
|
||||
System.out.println();
|
||||
for (TerminalTheme theme : arr) {
|
||||
System.out.println("name: " + theme.name);
|
||||
System.out.println("dark: " + theme.dark);
|
||||
System.out.println("value: \n" + JSON.toJSONString(theme.schema, colorFilter));
|
||||
System.out.println();
|
||||
}
|
||||
// String json = JSON.toJSONString(arr, colorFilter);
|
||||
// System.out.println("\n" + json);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.orion.visor.module.infra.api;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 字典配置值 对外服务
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/7/4 18:54
|
||||
*/
|
||||
public interface DictValueApi {
|
||||
|
||||
/**
|
||||
* 查询字典配置值
|
||||
*
|
||||
* @param key key
|
||||
* @return rows
|
||||
*/
|
||||
List<JSONObject> getDictValue(String key);
|
||||
|
||||
/**
|
||||
* 查询字典配置值
|
||||
*
|
||||
* @param keys keys
|
||||
* @return rows
|
||||
*/
|
||||
Map<String, List<JSONObject>> getDictValueList(List<String> keys);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.orion.visor.module.infra.api.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.orion.visor.module.infra.api.DictValueApi;
|
||||
import com.orion.visor.module.infra.service.DictValueService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 字典配置值 对外服务实现类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/7/4 18:55
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DictValueApiImpl implements DictValueApi {
|
||||
|
||||
@Resource
|
||||
private DictValueService dictValueService;
|
||||
|
||||
@Override
|
||||
public List<JSONObject> getDictValue(String key) {
|
||||
return dictValueService.getDictValue(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<JSONObject>> getDictValueList(List<String> keys) {
|
||||
return dictValueService.getDictValueList(keys);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,8 +25,8 @@ public class DictValueOperatorType extends InitializingOperatorTypes {
|
||||
@Override
|
||||
public OperatorType[] types() {
|
||||
return new OperatorType[]{
|
||||
new OperatorType(L, CREATE, "创建字典配置值 <sb>${keyName}</sb>: <sb>${label}</sb> | <sb>${value}</sb>"),
|
||||
new OperatorType(M, UPDATE, "更新字典配置值 <sb>${keyName}</sb>: <sb>${label}</sb> | <sb>${value}</sb>"),
|
||||
new OperatorType(L, CREATE, "创建字典配置值 <sb>${keyName}</sb> - <sb>${label}</sb> | <sb>${value}</sb>"),
|
||||
new OperatorType(M, UPDATE, "更新字典配置值 <sb>${keyName}</sb> - <sb>${label}</sb> | <sb>${value}</sb>"),
|
||||
new OperatorType(H, DELETE, "删除字典配置值 <sb>${value}</sb>"),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.orion.visor.module.infra.enums;
|
||||
|
||||
import com.orion.lang.utils.convert.Converts;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
@@ -53,7 +51,7 @@ public enum DictValueTypeEnum {
|
||||
@Override
|
||||
public Object parse(String s) {
|
||||
try {
|
||||
return Converts.toBoolean(s);
|
||||
return Boolean.valueOf(s);
|
||||
} catch (Exception e) {
|
||||
return super.parse(s);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,14 @@ public interface DictValueService {
|
||||
*/
|
||||
Integer rollbackDictValueById(DictValueRollbackRequest request);
|
||||
|
||||
/**
|
||||
* 查询字典配置值
|
||||
*
|
||||
* @param key key
|
||||
* @return rows
|
||||
*/
|
||||
List<JSONObject> getDictValue(String key);
|
||||
|
||||
/**
|
||||
* 查询字典配置值
|
||||
*
|
||||
|
||||
@@ -73,7 +73,7 @@ public class DictValueServiceImpl implements DictValueService {
|
||||
// 查询数据是否冲突
|
||||
this.checkDictValuePresent(record);
|
||||
// 插入
|
||||
OperatorLogs.add(OperatorLogs.KEY_NAME, dictKey);
|
||||
OperatorLogs.add(OperatorLogs.KEY_NAME, dictKey.getKeyName());
|
||||
record.setKeyName(key);
|
||||
int effect = dictValueDAO.insert(record);
|
||||
Long id = record.getId();
|
||||
@@ -98,7 +98,7 @@ public class DictValueServiceImpl implements DictValueService {
|
||||
// 查询数据是否冲突
|
||||
this.checkDictValuePresent(updateRecord);
|
||||
// 更新
|
||||
OperatorLogs.add(OperatorLogs.KEY_NAME, dictKey);
|
||||
OperatorLogs.add(OperatorLogs.KEY_NAME, dictKey.getKeyName());
|
||||
OperatorLogs.add(OperatorLogs.VALUE, this.getDictValueJson(updateRecord));
|
||||
updateRecord.setKeyName(key);
|
||||
int effect = dictValueDAO.updateById(updateRecord);
|
||||
@@ -142,6 +142,18 @@ public class DictValueServiceImpl implements DictValueService {
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> getDictValue(String key) {
|
||||
// 查询字典值
|
||||
Map<String, List<JSONObject>> values = this.getDictValueList(Lists.singleton(key));
|
||||
List<JSONObject> value = values.get(key);
|
||||
if (value == null) {
|
||||
return Lists.newList();
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<JSONObject>> getDictValueList(List<String> keys) {
|
||||
Map<String, List<JSONObject>> result = new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user