Compare commits

...

7 Commits
v2.5.7 ... dev

Author SHA1 Message Date
lijiahangmax
9ae3855def 🔨 主机可搜索. 2026-02-08 00:45:00 +08:00
lijiahangmax
6c3f952693 🔨 优化异常处理逻辑. 2026-02-06 00:13:08 +08:00
lijiahangmax
af330f46a1 🔨 修改字典逻辑. 2026-01-31 23:12:20 +08:00
lijiahangmax
a6cb163486 🔨 优化代码. 2026-01-25 09:43:28 +08:00
lijiahangmax
1b8e2c2fd1 🔨 修改格式化方法. 2026-01-24 10:31:28 +08:00
lijiahangmax
dfea231984 🔨 优化代码. 2026-01-23 15:16:15 +08:00
lijiahangmax
936795791b 🔨 优化代码. 2026-01-23 14:26:38 +08:00
43 changed files with 119 additions and 190 deletions

View File

@@ -1,169 +0,0 @@
# https://github.com/aaPanel/appstore/tree/main/apps/orion_visor
services:
orion-ui:
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-ui:latest
ports:
- ${HOST_IP}:${WEB_HTTP_PORT}:80
environment:
NGINX_SERVICE_HOST: ${NGINX_SERVICE_HOST:-orion-service}
NGINX_SERVICE_PORT: ${NGINX_SERVICE_PORT:-9200}
restart: unless-stopped
depends_on:
orion-service:
condition: service_healthy
networks:
- baota_net
orion-service:
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-service:${VERSION}
privileged: true
ports:
- "9200:9200"
environment:
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-prod}
MYSQL_HOST: orion-mysql
MYSQL_PORT: ${MYSQL_PORT:-3306}
MYSQL_DATABASE: ${MYSQL_DATABASE:-orion_visor}
MYSQL_USER: ${MYSQL_USER:-orion}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-Data@123456}
REDIS_HOST: orion-redis
REDIS_PASSWORD: ${REDIS_PASSWORD:-Data@123456}
REDIS_DATABASE: ${REDIS_DATABASE:-0}
REDIS_DATA_VERSION: ${REDIS_DATA_VERSION:-1}
INFLUXDB_ENABLED: true
INFLUXDB_HOST: orion-influxdb
INFLUXDB_PORT: ${INFLUXDB_PORT:-8086}
INFLUXDB_ORG: ${INFLUXDB_ORG:-orion-visor}
INFLUXDB_BUCKET: ${INFLUXDB_BUCKET:-metrics}
INFLUXDB_TOKEN: ${INFLUXDB_TOKEN:-Data@123456}
GUACD_HOST: orion-guacd
GUACD_PORT: ${GUACD_PORT:-4822}
GUACD_DRIVE_PATH: ${GUACD_DRIVE_PATH:-/drive}
SECRET_KEY: ${SECRET_KEY:-uQeacXV8b3isvKLK}
API_EXPOSE_TOKEN: ${API_EXPOSE_TOKEN:-pmqeHOyZaumHm0Wt}
API_IP_HEADERS: ${API_IP_HEADERS:-X-Forwarded-For,X-Real-IP}
# 这里需要改为具体的服务地址 (宿主机ip)
API_HOST: ${HOST_IP}
# 若 API_HOST 不满足, 可以修改这里 http://<ip>:<port>/orion-visor/api
API_URL: ${API_URL:-}
API_CORS: ${API_CORS:-true}
DEMO_MODE: ${DEMO_MODE:-false}
volumes:
- ${APP_PATH}/service/root-orion:/root/orion
ulimits:
nofile:
soft: 65536
hard: 65536
restart: unless-stopped
healthcheck:
test: [ "CMD", "curl", "http://127.0.0.1:9200/orion-visor/api/server/bootstrap/health" ]
interval: 15s
timeout: 300s
retries: 15
start_period: 3s
depends_on:
orion-mysql:
condition: service_healthy
orion-redis:
condition: service_healthy
orion-influxdb:
condition: service_healthy
labels:
createdBy: "bt_apps"
networks:
- baota_net
orion-mysql:
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-mysql:${VERSION}
privileged: true
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE:-orion_visor}
- MYSQL_USER=${MYSQL_USER:-orion}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-Data@123456}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-Data@123456}
volumes:
- ${APP_PATH}/mysql/var-lib-mysql:/var/lib/mysql
- ${APP_PATH}/mysql/var-lib-mysql-files:/var/lib/mysql-files
restart: unless-stopped
healthcheck:
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/3306" ]
interval: 15s
timeout: 60s
retries: 15
start_period: 3s
labels:
createdBy: "bt_apps"
networks:
- baota_net
orion-redis:
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:${VERSION}
privileged: true
environment:
- REDIS_PASSWORD=${REDIS_PASSWORD:-Data@123456}
volumes:
- ${APP_PATH}/redis/data:/data
command: sh -c "redis-server /usr/local/redis.conf --requirepass $${REDIS_PASSWORD}"
restart: unless-stopped
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
interval: 15s
timeout: 60s
retries: 15
start_period: 3s
labels:
createdBy: "bt_apps"
networks:
- baota_net
orion-influxdb:
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-influxdb:latest
privileged: true
ports:
- "8086:8086"
environment:
DOCKER_INFLUXDB_INIT_MODE: setup
DOCKER_INFLUXDB_INIT_USERNAME: ${INFLUXDB_ADMIN_USERNAME:-admin}
DOCKER_INFLUXDB_INIT_PASSWORD: ${INFLUXDB_ADMIN_PASSWORD:-Data@123456}
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${INFLUXDB_TOKEN:-Data@123456}
DOCKER_INFLUXDB_INIT_ORG: ${INFLUXDB_ORG:-orion-visor}
DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUXDB_BUCKET:-metrics}
volumes:
- ${APP_PATH}/influxdb/data:/var/lib/influxdb2
- ${APP_PATH}/influxdb/config:/etc/influxdb2
restart: unless-stopped
healthcheck:
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/8086" ]
interval: 15s
timeout: 5s
retries: 10
start_period: 10s
networks:
- baota_net
orion-guacd:
image: registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-guacd:latest
ports:
- "4822:4822"
environment:
GUACD_LOG_LEVEL: info
GUACD_LOG_FILE: /var/log/guacd.log
volumes:
- ${APP_PATH}/guacd/drive:${GUACD_DRIVE_PATH:-/drive}
- ${APP_PATH}/guacd/var-logs:/var/log
- ${APP_PATH}/guacd/local-guacamole-lib:/usr/local/guacamole/lib
- ${APP_PATH}/guacd/local-guacamole-extensions:/usr/local/guacamole/extensions
restart: unless-stopped
healthcheck:
test: [ "CMD", "nc", "-vz", "localhost", "4822" ]
interval: 15s
timeout: 5s
retries: 10
start_period: 10s
networks:
- baota_net
networks:
baota_net:
external: true

View File

@@ -135,6 +135,8 @@
}
handleClose();
return true;
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -139,6 +139,8 @@
}
handleClose();
return true;
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -25,6 +25,7 @@ package org.dromara.visor.module.infra.service.impl;
import cn.orionsec.kit.lang.define.wrapper.DataGrid;
import cn.orionsec.kit.lang.utils.Strings;
import cn.orionsec.kit.lang.utils.collect.Lists;
import cn.orionsec.kit.lang.utils.collect.Sets;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -112,21 +113,22 @@ public class DictValueServiceImpl implements DictValueService {
Long id = Assert.notNull(request.getId(), ErrorMessage.ID_MISSING);
DictValueDO record = dictValueDAO.selectById(id);
Assert.notNull(record, ErrorMessage.CONFIG_ABSENT);
// 查询 dictKey 是否存在
DictKeyDO dictKey = dictKeyDAO.selectById(request.getKeyId());
String key = Assert.notNull(dictKey, ErrorMessage.CONFIG_ABSENT).getKeyName();
// 查询 key 是否存在
DictKeyDO oldDictKey = dictKeyDAO.selectById(record.getKeyId());
DictKeyDO newDictKey = dictKeyDAO.selectById(request.getKeyId());
String key = Assert.notNull(newDictKey, ErrorMessage.CONFIG_ABSENT).getKeyName();
// 转换
DictValueDO updateRecord = DictValueConvert.MAPPER.to(request);
// 查询数据是否冲突
this.checkDictValuePresent(updateRecord);
// 更新
OperatorLogs.add(OperatorLogs.KEY_NAME, dictKey.getKeyName());
OperatorLogs.add(OperatorLogs.KEY_NAME, newDictKey.getKeyName());
OperatorLogs.add(OperatorLogs.VALUE, this.getDictValueJson(updateRecord));
updateRecord.setKeyName(key);
int effect = dictValueDAO.updateById(updateRecord);
log.info("DictValueService-updateDictValueById effect: {}", effect);
// 删除缓存
RedisStrings.delete(DictCacheKeyDefine.DICT_VALUE.format(key));
RedisStrings.delete(Sets.of(DictCacheKeyDefine.DICT_VALUE.format(key), DictCacheKeyDefine.DICT_VALUE.format(oldDictKey.getKeyName())));
// 记录历史归档
this.checkRecordHistory(updateRecord, record);
return effect;

View File

@@ -23,9 +23,9 @@
package org.dromara.visor.module.monitor.enums;
import lombok.Getter;
import org.apache.commons.collections4.map.HashedMap;
import org.dromara.visor.module.monitor.constant.MetricsConst;
import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
@@ -129,7 +129,7 @@ public enum MeasurementEnum {
MeasurementEnum(String measurement, boolean hasTags, Consumer<BiConsumer<String, Class<?>>> register) {
this.measurement = measurement;
this.hasTags = hasTags;
this.fields = new HashedMap<>();
this.fields = new HashMap<>();
register.accept(this.fields::put);
}

View File

@@ -4,7 +4,8 @@
:loading="loading"
:multiple="multiple"
placeholder="请选择主机"
allow-clear />
allow-clear
allow-search />
</template>
<script lang="ts">

View File

@@ -4,7 +4,8 @@
:loading="loading"
:multiple="multiple"
placeholder="请选择监控项"
allow-clear />
allow-clear
allow-search />
</template>
<script lang="ts">
@@ -38,7 +39,7 @@
// 初始化选项
const initOptions = async () => {
setLoading(true);
setLoading(true);
try {
const hosts = await cacheStore.loadHosts(props.type);
optionData.value = hosts.filter(s => !props.status || s.status === props.status)

View File

@@ -6,7 +6,22 @@
:disabled="loading"
:filter-option="labelFilter"
:allow-create="allowCreate"
placeholder="请选择配置项" />
placeholder="请选择配置项">
<!-- label -->
<template #label="{ data }">
<span class="option-wrapper">
<span class="label">{{ data.label }}</span>
<span class="code">{{ data.value }}</span>
</span>
</template>
<!-- 选项 -->
<template #option="{ data }">
<span class="option-wrapper">
<span class="label">{{ data.label }}</span>
<span class="code">{{ data.value }}</span>
</span>
</template>
</a-select>
</template>
<script lang="ts">
@@ -82,5 +97,18 @@
</script>
<style lang="less" scoped>
.option-wrapper {
display: flex;
align-items: center;
width: 100%;
.label {
margin-right: 8px;
}
.code {
font-size: 12px;
color: var(--color-text-3);
}
}
</style>

View File

@@ -127,6 +127,8 @@
// 清空
handlerClear();
emits('updated');
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -71,17 +71,15 @@ export function dateFormat(date = new Date(), pattern = YMD_HMS) {
};
let reg = /(y+)/;
if (reg.test(pattern)) {
// @ts-ignore
const match = reg.exec(pattern)[1];
const match = reg.exec(pattern)![1];
pattern = pattern.replace(match, (date.getFullYear() + '').substring(4 - match.length));
}
for (const k in o) {
let reg = new RegExp('(' + k + ')');
if (reg.test(pattern)) {
// @ts-ignore
const match = reg.exec(pattern)[1];
// @ts-ignore
pattern = pattern.replace(match, (match.length === 1) ? o[k] : ('00' + o[k]).substring(('' + o[k]).length));
const match = reg.exec(pattern)![1];
const value = o[k as keyof typeof o];
pattern = pattern.replace(match, match.length === 1 ? String(value) : ('00' + value).slice(-match.length));
}
}
return pattern;
@@ -152,7 +150,7 @@ export const resetObject = (obj: any, ignore: string[] = []) => {
export const objectTruthKeyCount = (obj: any, ignore: string[] = []) => {
return Object.keys(obj)
.filter(s => !ignore.includes(s))
.reduce(function (acc, curr) {
.reduce(function(acc, curr) {
const currVal = obj[curr];
return acc + ~~(currVal !== undefined && currVal !== null && currVal?.length !== 0 && currVal !== '');
}, 0);
@@ -199,7 +197,7 @@ export function detectZoom() {
* 获取唯一的 UUID
*/
export function getUUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = Math.random() * 16 | 0;
const v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);

View File

@@ -137,6 +137,8 @@
// 无数据
Message.warning('当前条件未查询到数据');
}
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -182,6 +182,8 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -232,6 +232,8 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -3,7 +3,7 @@
<a-result class="result" status="403" subtitle="您没有访问该资源的权限" />
<a-space>
<a-button type="primary" @click="() => logout()">重新登录</a-button>
<a-button type="primary" @click="router.push(DEFAULT_ROUTE_NAME)">返回工作台</a-button>
<a-button type="primary" @click="router.push({ name: DEFAULT_ROUTE_NAME })">返回工作台</a-button>
</a-space>
</div>
</template>

View File

@@ -3,7 +3,7 @@
<a-result class="result" status="404" subtitle="糟糕! 页面不见了!" />
<a-space>
<a-button type="primary" @click="() => logout()">重新登录</a-button>
<a-button type="primary" @click="router.push(DEFAULT_ROUTE_NAME)">返回工作台</a-button>
<a-button type="primary" @click="router.push({ name: DEFAULT_ROUTE_NAME })">返回工作台</a-button>
</a-space>
</div>
</template>

View File

@@ -129,6 +129,8 @@
// 无数据
Message.warning('当前条件未查询到数据');
}
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -124,6 +124,8 @@
// 无数据
Message.warning('当前条件未查询到数据');
}
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -357,6 +357,8 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -79,6 +79,8 @@
Message.success('修改成功');
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -225,6 +225,8 @@
Message.success('已开始执行');
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -281,6 +281,8 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -128,6 +128,8 @@
// 无数据
Message.warning('当前条件未查询到数据');
}
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -175,6 +175,8 @@
// 无数据
Message.warning('当前条件未查询到数据');
}
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -104,6 +104,8 @@
emits('handled', { ...formModel.value });
handleClose();
return true;
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -150,6 +150,8 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -397,6 +397,8 @@
}
handleClose();
return true;
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -152,6 +152,8 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -134,6 +134,8 @@
emits('updated');
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -73,6 +73,8 @@
// 清空
handlerClear();
return true;
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -227,6 +227,8 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -204,6 +204,8 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -249,6 +249,8 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -211,6 +211,8 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -104,6 +104,8 @@
}
handleClose();
return true;
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -122,6 +122,8 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -126,6 +126,8 @@
}
handleClose();
return true;
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -127,6 +127,8 @@
extra: value as string
});
Message.success('保存成功');
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -161,6 +161,8 @@
// 无数据
Message.warning('当前条件未查询到数据');
}
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -122,6 +122,8 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -105,6 +105,8 @@
Message.success('分配成功');
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -146,6 +146,8 @@
}
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -93,6 +93,8 @@
Message.success('修改成功');
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -90,6 +90,8 @@
Message.success('修改成功');
// 清空
handlerClear();
} catch (e) {
return false;
} finally {
setLoading(false);
}