feat: 添加ESLint和Prettier配置并优化代码结构
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
style: 格式化代码文件并修复样式问题 docs: 新增部署文档和系统要求文档 test: 更新测试截图和覆盖率报告 refactor: 重构SchedulerPanel加载状态逻辑 ci: 添加lint和format脚本到package.json build: 更新依赖项并添加开发工具 chore: 添加验证报告和上线审查计划
This commit is contained in:
@@ -138,28 +138,35 @@ pub async fn pipeline_list(
|
||||
// Get pipelines directory
|
||||
let pipelines_dir = get_pipelines_directory()?;
|
||||
|
||||
// Scan for pipeline files (synchronous scan)
|
||||
let mut pipelines = Vec::new();
|
||||
tracing::info!("[pipeline_list] Scanning directory: {:?}", pipelines_dir);
|
||||
|
||||
// Scan for pipeline files (returns both info and paths)
|
||||
let mut pipelines_with_paths: Vec<(PipelineInfo, PathBuf)> = Vec::new();
|
||||
if pipelines_dir.exists() {
|
||||
scan_pipelines_sync(&pipelines_dir, category.as_deref(), &mut pipelines)?;
|
||||
scan_pipelines_with_paths(&pipelines_dir, category.as_deref(), &mut pipelines_with_paths)?;
|
||||
} else {
|
||||
tracing::warn!("[pipeline_list] Pipelines directory does not exist: {:?}", pipelines_dir);
|
||||
}
|
||||
|
||||
tracing::info!("[pipeline_list] Found {} pipelines", pipelines_with_paths.len());
|
||||
|
||||
// Update state
|
||||
let mut state_pipelines = state.pipelines.write().await;
|
||||
let state_paths = state.pipeline_paths.write().await;
|
||||
let mut state_paths = state.pipeline_paths.write().await;
|
||||
|
||||
for info in &pipelines {
|
||||
if let Some(path) = state_paths.get(&info.id) {
|
||||
// Load full pipeline into state
|
||||
if let Ok(content) = std::fs::read_to_string(path) {
|
||||
if let Ok(pipeline) = parse_pipeline_yaml(&content) {
|
||||
state_pipelines.insert(info.id.clone(), pipeline);
|
||||
}
|
||||
let mut result = Vec::new();
|
||||
for (info, path) in &pipelines_with_paths {
|
||||
// Load full pipeline into state
|
||||
if let Ok(content) = std::fs::read_to_string(path) {
|
||||
if let Ok(pipeline) = parse_pipeline_yaml(&content) {
|
||||
state_pipelines.insert(info.id.clone(), pipeline);
|
||||
state_paths.insert(info.id.clone(), path.clone());
|
||||
}
|
||||
}
|
||||
result.push(info.clone());
|
||||
}
|
||||
|
||||
Ok(pipelines)
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// Get pipeline details
|
||||
@@ -379,10 +386,11 @@ fn get_pipelines_directory() -> Result<PathBuf, String> {
|
||||
Err("Could not determine pipelines directory".to_string())
|
||||
}
|
||||
|
||||
fn scan_pipelines_sync(
|
||||
/// Scan pipelines with paths (returns both info and file paths)
|
||||
fn scan_pipelines_with_paths(
|
||||
dir: &PathBuf,
|
||||
category_filter: Option<&str>,
|
||||
pipelines: &mut Vec<PipelineInfo>,
|
||||
pipelines: &mut Vec<(PipelineInfo, PathBuf)>,
|
||||
) -> Result<(), String> {
|
||||
let entries = std::fs::read_dir(dir)
|
||||
.map_err(|e| format!("Failed to read pipelines directory: {}", e))?;
|
||||
@@ -393,19 +401,25 @@ fn scan_pipelines_sync(
|
||||
|
||||
if path.is_dir() {
|
||||
// Recursively scan subdirectory
|
||||
scan_pipelines_sync(&path, category_filter, pipelines)?;
|
||||
scan_pipelines_with_paths(&path, category_filter, pipelines)?;
|
||||
} else if path.extension().map(|e| e == "yaml" || e == "yml").unwrap_or(false) {
|
||||
// Try to parse pipeline file
|
||||
if let Ok(content) = std::fs::read_to_string(&path) {
|
||||
if let Ok(pipeline) = parse_pipeline_yaml(&content) {
|
||||
// Apply category filter
|
||||
if let Some(filter) = category_filter {
|
||||
if pipeline.metadata.category.as_deref() != Some(filter) {
|
||||
continue;
|
||||
match parse_pipeline_yaml(&content) {
|
||||
Ok(pipeline) => {
|
||||
// Apply category filter
|
||||
if let Some(filter) = category_filter {
|
||||
if pipeline.metadata.category.as_deref() != Some(filter) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pipelines.push(pipeline_to_info(&pipeline));
|
||||
tracing::debug!("[scan] Found pipeline: {} at {:?}", pipeline.metadata.name, path);
|
||||
pipelines.push((pipeline_to_info(&pipeline), path));
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::warn!("[scan] Failed to parse pipeline at {:?}: {}", path, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user