|
|
@@ -76,8 +76,15 @@
|
|
|
width="50%">
|
|
|
<div class="dialog-content">
|
|
|
<el-form :model="configForm" label-width="120px" ref="configFormRef">
|
|
|
- <el-form-item label="文件路径" prop="filePath" :rules="[{ required: true, message: '请输入文件路径', trigger: 'blur' }]">
|
|
|
- <el-input v-model="configForm.filePath" placeholder="请输入文件路径"></el-input>
|
|
|
+ <el-form-item label="流水线" prop="filePath" :rules="[{ required: true, message: '请选择流水线', trigger: 'change' }]">
|
|
|
+ <el-select v-model="configForm.filePath" placeholder="请选择流水线" style="width: 100%">
|
|
|
+ <el-option
|
|
|
+ v-for="item in pipelineList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="修改方式" prop="modifyMethod" :rules="[{ required: true, message: '请选择修改方式', trigger: 'change' }]">
|
|
|
<el-select v-model="configForm.modifyMethod" placeholder="请选择修改方式" style="width: 100%">
|
|
|
@@ -99,14 +106,10 @@
|
|
|
<el-dialog
|
|
|
title="项目分析"
|
|
|
v-model="analysisDialogVisible"
|
|
|
- width="60%"
|
|
|
+ width="30%"
|
|
|
:fullscreen="showAnalysisResult">
|
|
|
<div class="dialog-content" v-if="!showAnalysisResult">
|
|
|
- <el-form :model="analysisForm" label-width="120px" ref="analysisFormRef">
|
|
|
- <el-form-item label="项目路径" prop="projectPath" :rules="[{ required: true, message: '请输入项目路径', trigger: 'blur' }]">
|
|
|
- <el-input v-model="analysisForm.projectPath" placeholder="请输入项目路径,例如: E:/codes/MyProject"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
+ <p>确认开始进行项目分析?</p>
|
|
|
</div>
|
|
|
<div v-else class="analysis-result">
|
|
|
<div v-if="analysisLoading" class="analysis-loading">
|
|
|
@@ -120,7 +123,7 @@
|
|
|
<template #footer>
|
|
|
<span class="dialog-footer">
|
|
|
<el-button @click="closeAnalysisDialog">{{ showAnalysisResult ? '关闭' : '取消' }}</el-button>
|
|
|
- <el-button v-if="!showAnalysisResult" type="primary" :loading="analysisLoading" @click="submitProjectAnalysis">开始分析</el-button>
|
|
|
+ <el-button v-if="!showAnalysisResult" type="primary" :loading="analysisLoading" @click="submitProjectAnalysis">确认分析</el-button>
|
|
|
<el-button v-else type="primary" @click="saveAnalysis">保存分析结果</el-button>
|
|
|
</span>
|
|
|
</template>
|
|
|
@@ -137,7 +140,7 @@
|
|
|
<el-form-item label="选择文件路径">
|
|
|
<el-input
|
|
|
v-model="selectedFile"
|
|
|
- placeholder="请输入或选择文件的完整路径,例如: E:/project/src/main.js"
|
|
|
+ placeholder="请输入文件的相对路径,例如: src/main.js"
|
|
|
clearable>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
@@ -168,9 +171,10 @@
|
|
|
import { CHANGE_DETAIL, CONVERSATION_DETAIL } from '@/router/name';
|
|
|
import axios from 'axios';
|
|
|
import marked from 'marked';
|
|
|
+import { PipelineAPI } from '@/api';
|
|
|
|
|
|
export default {
|
|
|
- name: 'ConfigPatch.vue',
|
|
|
+ name: 'ConfigFile',
|
|
|
data() {
|
|
|
return {
|
|
|
changeList: [],
|
|
|
@@ -189,10 +193,8 @@ export default {
|
|
|
submitting: false,
|
|
|
showAnalysisResult: false,
|
|
|
analysisLoading: false,
|
|
|
- analysisForm: {
|
|
|
- projectPath: '',
|
|
|
- },
|
|
|
formattedAnalysisResult: '',
|
|
|
+ pipelineList: [],
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
@@ -268,9 +270,23 @@ export default {
|
|
|
filePath: '',
|
|
|
modifyMethod: '',
|
|
|
};
|
|
|
+ // 获取流水线列表
|
|
|
+ this.fetchPipelineList();
|
|
|
// 打开对话框
|
|
|
this.dialogVisible = true;
|
|
|
},
|
|
|
+ async fetchPipelineList() {
|
|
|
+ try {
|
|
|
+ const pipelines = await PipelineAPI.getPipelinesByProjectId(this.$store.state.workspace.currentProjectId);
|
|
|
+ this.pipelineList = pipelines.map((item) => ({
|
|
|
+ id: item.id,
|
|
|
+ name: item.name,
|
|
|
+ }));
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取流水线列表失败:', error);
|
|
|
+ this.$message.error('获取流水线列表失败,请稍后重试');
|
|
|
+ }
|
|
|
+ },
|
|
|
saveConfig() {
|
|
|
this.$refs.configFormRef.validate(async (valid) => {
|
|
|
if (!valid) {
|
|
|
@@ -312,10 +328,6 @@ export default {
|
|
|
// 这里可以加载提交信息
|
|
|
},
|
|
|
analyzeProject() {
|
|
|
- // 重置表单
|
|
|
- this.analysisForm = {
|
|
|
- projectPath: '',
|
|
|
- };
|
|
|
this.showAnalysisResult = false;
|
|
|
this.formattedAnalysisResult = '';
|
|
|
this.analysisDialogVisible = true;
|
|
|
@@ -452,39 +464,31 @@ export default {
|
|
|
this.formattedAnalysisResult = '';
|
|
|
},
|
|
|
async submitProjectAnalysis() {
|
|
|
- this.$refs.analysisFormRef.validate(async (valid) => {
|
|
|
- if (!valid) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- this.analysisLoading = true;
|
|
|
- const { projectPath } = this.analysisForm;
|
|
|
-
|
|
|
- const response = await axios.post('http://localhost:8080/api/project/analyze', projectPath, {
|
|
|
- headers: {
|
|
|
- 'Content-Type': 'application/json',
|
|
|
- },
|
|
|
- });
|
|
|
+ try {
|
|
|
+ this.analysisLoading = true;
|
|
|
+ const response = await axios.post('http://localhost:8080/api/project/analyze', null, {
|
|
|
+ headers: {
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
+ },
|
|
|
+ });
|
|
|
|
|
|
- if (response.data) {
|
|
|
- // 使用marked库将Markdown格式转换为HTML
|
|
|
- this.formattedAnalysisResult = marked.parse(response.data);
|
|
|
- this.showAnalysisResult = true;
|
|
|
- } else {
|
|
|
- this.$message.warning('获取分析结果为空');
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error('项目分析失败:', error);
|
|
|
- let errorMessage = error.message || '未知错误';
|
|
|
- if (error.response && error.response.data) {
|
|
|
- errorMessage = error.response.data;
|
|
|
- }
|
|
|
- this.$message.error(`项目分析失败: ${errorMessage}`);
|
|
|
- } finally {
|
|
|
- this.analysisLoading = false;
|
|
|
+ if (response.data) {
|
|
|
+ // 使用marked库将Markdown格式转换为HTML
|
|
|
+ this.formattedAnalysisResult = marked.parse(response.data);
|
|
|
+ this.showAnalysisResult = true;
|
|
|
+ } else {
|
|
|
+ this.$message.warning('获取分析结果为空');
|
|
|
}
|
|
|
- });
|
|
|
+ } catch (error) {
|
|
|
+ console.error('项目分析失败:', error);
|
|
|
+ let errorMessage = error.message || '未知错误';
|
|
|
+ if (error.response && error.response.data) {
|
|
|
+ errorMessage = error.response.data;
|
|
|
+ }
|
|
|
+ this.$message.error(`项目分析失败: ${errorMessage}`);
|
|
|
+ } finally {
|
|
|
+ this.analysisLoading = false;
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
};
|