feat(steady): 实现稳态校验任务功能重构
- 添加influxdb配置支持和资源文件打包 - 实现校验任务表格组件和相关工具函数 - 重构校验工作台为任务创建对话框模式 - 实现校验详情面板支持多种异常类型展示 - 更新校验概览表格显示任务基本信息 - 优化校验查询参数和API接口定义 - 实现搜索表单组件化和过滤功能增强
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { resolveRuntimeStrategy } = require('./path-utils');
|
||||
const { resolvePackagedRuntime, resolveRuntimeStrategy } = require('./path-utils');
|
||||
|
||||
/**
|
||||
* 配置文件生成器
|
||||
@@ -10,17 +10,15 @@ class ConfigGenerator {
|
||||
constructor() {
|
||||
// 开发环境:项目根目录
|
||||
// 打包后:应用根目录(最终交付目录)
|
||||
const isDev = !process.resourcesPath;
|
||||
const baseDir = isDev
|
||||
? path.join(__dirname, '..')
|
||||
: path.dirname(process.resourcesPath);
|
||||
const runtime = resolvePackagedRuntime();
|
||||
const baseDir = runtime.baseDir;
|
||||
const pathStrategy = resolveRuntimeStrategy(baseDir);
|
||||
|
||||
// 开发环境:build/extraResources/java
|
||||
// 打包后:resources/extraResources/java
|
||||
this.javaPath = isDev
|
||||
this.javaPath = !runtime.isPackaged
|
||||
? path.join(baseDir, 'build', 'extraResources', 'java')
|
||||
: path.join(process.resourcesPath, 'extraResources', 'java');
|
||||
: path.join(runtime.resourcesPath, 'extraResources', 'java');
|
||||
this.templatePath = path.join(this.javaPath, 'application.yml.template');
|
||||
this.configPath = path.join(this.javaPath, 'application.yml');
|
||||
this.pathStrategy = pathStrategy;
|
||||
@@ -48,6 +46,7 @@ class ConfigGenerator {
|
||||
* 生成配置文件
|
||||
* @param {object} options - 配置选项
|
||||
* @param {number} options.mysqlPort - MySQL 端口
|
||||
* @param {number} options.influxdbPort - InfluxDB 端口
|
||||
* @param {number} options.javaPort - Java 应用端口
|
||||
* @param {number} options.websocketPort - WebSocket 端口
|
||||
* @param {string} options.mysqlPassword - MySQL 密码
|
||||
@@ -77,6 +76,11 @@ class ConfigGenerator {
|
||||
template = template.replace(/\{\{MYSQL_PORT\}\}/g, options.mysqlPort);
|
||||
template = template.replace(/localhost:3306/g, `localhost:${options.mysqlPort}`);
|
||||
}
|
||||
if (options.influxdbPort) {
|
||||
template = template.replace(/\{\{INFLUXDB_PORT\}\}/g, options.influxdbPort);
|
||||
template = template.replace(/127\.0\.0\.1:18086/g, `127.0.0.1:${options.influxdbPort}`);
|
||||
template = template.replace(/localhost:18086/g, `localhost:${options.influxdbPort}`);
|
||||
}
|
||||
if (options.javaPort) {
|
||||
template = template.replace(/port:\s*18092/g, `port: ${options.javaPort}`);
|
||||
}
|
||||
@@ -96,6 +100,7 @@ class ConfigGenerator {
|
||||
console.log('[ConfigGenerator] Path mode:', this.pathStrategy.usesSafePaths ? 'safe-data-root' : 'app-local-data');
|
||||
console.log('[ConfigGenerator] Data path:', this.dataPath);
|
||||
console.log('[ConfigGenerator] MySQL port:', options.mysqlPort || 3306);
|
||||
console.log('[ConfigGenerator] InfluxDB port:', options.influxdbPort || 18086);
|
||||
console.log('[ConfigGenerator] MySQL password:', options.mysqlPassword || 'njcnpqs');
|
||||
console.log('[ConfigGenerator] Java port:', options.javaPort || 18093);
|
||||
console.log('[ConfigGenerator] WebSocket port:', options.websocketPort || 7778);
|
||||
@@ -104,6 +109,7 @@ class ConfigGenerator {
|
||||
configPath: this.configPath,
|
||||
dataPath: this.dataPath,
|
||||
mysqlPort: options.mysqlPort || 3306,
|
||||
influxdbPort: options.influxdbPort || 18086,
|
||||
javaPort: options.javaPort || 18093,
|
||||
websocketPort: options.websocketPort || 7778
|
||||
});
|
||||
@@ -142,15 +148,13 @@ class ConfigGenerator {
|
||||
*/
|
||||
copyBuiltInTemplates() {
|
||||
try {
|
||||
const isDev = !process.resourcesPath;
|
||||
const baseDir = isDev
|
||||
? path.join(__dirname, '..')
|
||||
: path.dirname(process.resourcesPath);
|
||||
const runtime = resolvePackagedRuntime();
|
||||
const baseDir = runtime.baseDir;
|
||||
|
||||
// 内置模板源路径
|
||||
const templateSource = isDev
|
||||
const templateSource = !runtime.isPackaged
|
||||
? path.join(baseDir, 'build', 'extraResources', 'templates')
|
||||
: path.join(process.resourcesPath, 'extraResources', 'templates');
|
||||
: path.join(runtime.resourcesPath, 'extraResources', 'templates');
|
||||
|
||||
// 目标路径:用户数据目录/template/
|
||||
const templateDest = path.join(this.dataPath, 'template');
|
||||
|
||||
Reference in New Issue
Block a user