Procházet zdrojové kódy

fix: 与后端接口对齐

hkshu12 před 5 roky
rodič
revize
7ef2797a0f
3 změnil soubory, kde provedl 25 přidání a 7 odebrání
  1. 14 2
      mock/routers/pipeline.js
  2. 9 3
      src/api/pipeline.ts
  3. 2 2
      src/views/Project/Pipeline.vue

+ 14 - 2
mock/routers/pipeline.js

@@ -65,7 +65,7 @@ router.put('/config', (req, res) => {
   res.json(wrapper('success'));
 });
 
-router.get('/history/list', (req, res) => {
+router.get('/record/list', (req, res) => {
   res.json(wrapper(
     Mock.mock(
       {
@@ -92,7 +92,19 @@ router.get('/history/list', (req, res) => {
   ));
 });
 
-router.get('/history/details', (req, res) => {
+router.get('/record', (req, res) => {
+  res.json(wrapper(
+    Mock.mock({
+      'id|+5': 101,
+      pipelineId: 100,
+      'result|1': ['成功', '失败', '执行中'],
+      startTime: Random.datetime(),
+      username: 'hkshu12',
+    }).data,
+  ));
+});
+
+router.get('/record/details', (req, res) => {
   res.json(wrapper(`2021-03-16 00:01:58.621  INFO 20584 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
 2021-03-16 00:01:58.622  INFO 20584 --- [           main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
 2021-03-16 00:01:58.634  INFO 20584 --- [           main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)

+ 9 - 3
src/api/pipeline.ts

@@ -31,13 +31,19 @@ export const updatePipeline = (updatePipelinePayload: UpdatePipelinePayload) =>
 
 export const getPipelineTemplates = () => axios.get(`${PIPELINE_PREFIX}/templates`);
 
-export const getPipelineHistoryDetail = (historyId: number) => axios.get(`${PIPELINE_PREFIX}/history/details`, {
+export const getPipelineRecord = (recordId: number) => axios.get(`${PIPELINE_PREFIX}/record`, {
   params: {
-    historyId,
+    recordId,
   },
 });
 
-export const getPipelineHistory = (pipeline: PipelinePayload) => axios.get(`${PIPELINE_PREFIX}/history/list`, {
+export const getPipelineRecordDetail = (recordId: number) => axios.get(`${PIPELINE_PREFIX}/record/details`, {
+  params: {
+    recordId,
+  },
+});
+
+export const getPipelineRecordList = (pipeline: PipelinePayload) => axios.get(`${PIPELINE_PREFIX}/record/list`, {
   params: pipeline,
 });
 

+ 2 - 2
src/views/Project/Pipeline.vue

@@ -328,12 +328,12 @@ export default {
         }
         case 'detail': {
           this.showPipelineDetailModal = true;
-          this.detail = await PipelineAPI.getPipelineHistoryDetail(id);
+          this.detail = await PipelineAPI.getPipelineRecordDetail(id);
           break;
         }
         case 'history': {
           this.showPipelineHistoryModal = true;
-          this.pipelineHistory = await PipelineAPI.getPipelineHistory({
+          this.pipelineHistory = await PipelineAPI.getPipelineRecordList({
             projectId: this.$store.state.workspace.currentProjectId,
             pipelineId: id,
           });