Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #41

Merged
merged 14 commits into from
Jul 11, 2024
Merged

Dev #41

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
3 changes: 1 addition & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ on:
pull_request:
branches:
- main
- dev

concurrency:
concurrency:
group: ${{github.workflow}} - ${{github.ref}}
cancel-in-progress: true

Expand Down
7 changes: 7 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* 在使用本项目前,请您仔细阅读免责声明,确保您已充分理解其中的内容

* 本项目采用 APACHE LICENSE 2.0 开源协议,如您需要源码的开发方式,需要遵循以下几点

1. 禁止修改或删除 LICENSE 文件。
2. 不可二次开发或参与同类竞品的开发。
3. 本项目可免费商业使用,商业使用请保留项目源码、出处、描述文件和作者声明等。
6 changes: 3 additions & 3 deletions docker-compose-testing.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.3'
services:
orion-visor-service:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.10
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.11
privileged: true
ports:
- 1081:80
Expand Down Expand Up @@ -32,7 +32,7 @@ services:
- orion-visor-mysql
- orion-visor-redis
orion-visor-mysql:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.10
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.11
privileged: true
ports:
- 3307:3306
Expand All @@ -52,7 +52,7 @@ services:
retries: 10
start_period: 3s
orion-visor-redis:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.10
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.11
privileged: true
ports:
- 6380:6379
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.3'
services:
orion-visor-service:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.10
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-service:2.0.11
privileged: true
ports:
- 1081:80
Expand Down Expand Up @@ -32,7 +32,7 @@ services:
- orion-visor-mysql
- orion-visor-redis
orion-visor-mysql:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.10
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-mysql:2.0.11
privileged: true
ports:
- 3307:3306
Expand All @@ -52,7 +52,7 @@ services:
retries: 10
start_period: 3s
orion-visor-redis:
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.10
image: registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:2.0.11
privileged: true
ports:
- 6380:6379
Expand Down
2 changes: 1 addition & 1 deletion docker-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ docker compose down
if [ "$1" == "demo" ]; then
sed -i 's/DEMO_MODE=false/DEMO_MODE=true/g' docker-compose.yml
fi
docker compose up -d
docker compose up -d --remove-orphans
8 changes: 0 additions & 8 deletions docker/e2e/testsuite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,14 @@ items:
- name: haveUnRead
request:
api: /orion-visor/api/infra/system-message/has-unread
header:
Authorization: Bearer {{.login.data.token}}
- name: queryOperatorLog
request:
api: /orion-visor/api/infra/mine/query-operator-log
method: POST
header:
Authorization: Bearer {{.login.data.token}}
- name: hostList
request:
api: /orion-visor/api/infra/tag/list?type=HOST
header:
Authorization: Bearer {{.login.data.token}}
- name: queryHost
request:
api: /orion-visor/api/asset/host/query
method: POST
header:
Authorization: Bearer {{.login.data.token}}
2 changes: 1 addition & 1 deletion docker/mysql/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
version=2.0.10
version=2.0.11
cp -r ../../sql ./sql
docker build -t orion-visor-mysql:${version} .
rm -rf ./sql
Expand Down
2 changes: 1 addition & 1 deletion docker/redis/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
version=2.0.10
version=2.0.11
docker build -t orion-visor-redis:${version} .
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
docker push registry.cn-hangzhou.aliyuncs.com/lijiahangmax/orion-visor-redis:${version}
2 changes: 1 addition & 1 deletion docker/service/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
version=2.0.10
version=2.0.11
mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar
mv ../../orion-visor-ui/dist ./dist
docker build -t orion-visor-service:${version} .
Expand Down
2 changes: 1 addition & 1 deletion orion-visor-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<url>https://github.com/dromara/orion-visor</url>

<properties>
<revision>2.0.10</revision>
<revision>2.0.11</revision>
<spring.boot.version>2.7.17</spring.boot.version>
<spring.boot.admin.version>2.7.15</spring.boot.admin.version>
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface AppConst extends OrionConst {
/**
* 同 ${orion.version} 迭代时候需要手动更改
*/
String VERSION = "2.0.10";
String VERSION = "2.0.11";

/**
* 同 ${spring.application.name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ public interface ExtraFieldConst extends FieldConst {

String LOG_ID = "logId";

String DARK = "dark";

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public interface FieldConst {

String INFO = "info";

String EXTRA = "extra";

String REL_ID = "relId";

String BEFORE = "before";
Expand Down Expand Up @@ -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";

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public CustomFileFilter(Table table, List<CustomFile> originCustomerFile) {
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()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<a-modal v-model:visible="visible"
body-class="modal-form-large"
modal-class="modal-form-large"
title-align="start"
:title="title"
:top="80"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const columns = [
title: 'id',
dataIndex: 'id',
slotName: 'id',
width: 100,
width: 80,
align: 'left',
fixed: 'left',
}, #foreach($field in ${table.fields})#if("$!field.propertyName" != "id"){
Expand All @@ -15,6 +15,7 @@ const columns = [
slotName: '${field.propertyName}',
align: 'left',
#if(${field.propertyType} == 'String')
minWidth: 238,
ellipsis: true,
tooltip: true,
#elseif(${field.propertyType} == 'Date')
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -15,6 +15,7 @@
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
* 主机终端 api
Expand All @@ -38,7 +39,7 @@ public class HostTerminalController {
@IgnoreLog(IgnoreLogMode.ALL)
@GetMapping("/themes")
@Operation(summary = "获取主机终端主题")
public JSONArray getTerminalThemes() {
public List<HostTerminalThemeVO> getTerminalThemes() {
return hostTerminalService.getTerminalThemes();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@
@Schema(name = "ExecParameterSchemaDTO", description = "命令执行参数 schema 对象")
public class ExecParameterSchemaDTO {

@Schema(description = "参数名称")
@Schema(description = "参数名")
private String name;

@Schema(description = "参数描述")
private String desc;

@Schema(description = "默认值")
private Object defaultValue;

@Schema(description = "值")
@Schema(description = "参数值")
private Object value;

}
Original file line number Diff line number Diff line change
@@ -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;

}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void closeSession(String channelId, String sessionId) {
*
* @param channelId channelId
* @param sessionId sessionId
* @param T T
* @param <T> T
* @return session
*/
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

/**
* 主机终端服务
Expand All @@ -20,7 +22,7 @@ public interface HostTerminalService {
*
* @return themes
*/
JSONArray getTerminalThemes();
List<HostTerminalThemeVO> getTerminalThemes();

/**
* 获取主机终端访问 accessToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -60,7 +60,7 @@ public Long createCommandSnippet(CommandSnippetCreateRequest request) {
// 插入
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;
Expand All @@ -70,7 +70,7 @@ public Long createCommandSnippet(CommandSnippetCreateRequest request) {
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);
Expand All @@ -85,7 +85,7 @@ public Integer updateCommandSnippetById(CommandSnippetUpdateRequest request) {
.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;
Expand Down Expand Up @@ -154,13 +154,13 @@ public Integer setGroupNull(Long userId, Long groupId) {
@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;
Expand Down
Loading