Parcourir la source

Compiler.vue 添加"获取编译器版本信息"功能

reghao il y a 2 mois
Parent
commit
6a67ed613f
2 fichiers modifiés avec 44 ajouts et 3 suppressions
  1. 4 0
      src/api/devops.js
  2. 40 3
      src/views/devops/build/Compiler.vue

+ 4 - 0
src/api/devops.js

@@ -168,6 +168,10 @@ export function getCompilerTypes() {
   return get(devopsApi.getCompilerList + '/types')
 }
 
+export function getCompilerVersion(id) {
+  return get(devopsApi.getCompilerList + '/version?id=' + id)
+}
+
 export function addImageBind(form) {
   return post(devopsApi.getCompilerList + '/bind/add', form)
 }

+ 40 - 3
src/views/devops/build/Compiler.vue

@@ -36,7 +36,17 @@
         <el-table-column
           prop="versionCmd"
           label="编译器版本命令"
-        />
+        >
+          <template slot-scope="scope">
+            <span style="margin: 5px">{{ scope.row.versionCmd }}</span>
+            <el-button
+              style="margin: 5px"
+              size="mini"
+              type="success"
+              @click="handleGetVersion(scope.$index, scope.row)"
+            >查看</el-button>
+          </template>
+        </el-table-column>
         <el-table-column
           prop="compilerBinds"
           label="镜像映射"
@@ -174,6 +184,16 @@
         </el-form>
       </template>
     </el-dialog>
+    <el-dialog
+      :title="title"
+      append-to-body
+      :visible.sync="showVersionDialog"
+      center
+    >
+      <template>
+        <span v-html="versionResult" />
+      </template>
+    </el-dialog>
   </el-container>
 </template>
 
@@ -183,7 +203,7 @@ import {
   deleteCompiler,
   deleteImageBind,
   getCompilerList,
-  getCompilerTypes,
+  getCompilerTypes, getCompilerVersion,
   getImageBindList
 } from '@/api/devops'
 
@@ -220,7 +240,11 @@ export default {
         id: 0,
         hostPath: '',
         containerPath: ''
-      }
+      },
+      // **********************************************************************
+      showVersionDialog: false,
+      versionResult: '',
+      title: '编译器版本信息'
     }
   },
   created() {
@@ -277,6 +301,19 @@ export default {
         this.showAddDialog = false
       })
     },
+    handleGetVersion(index, row) {
+      getCompilerVersion(row.id).then(resp => {
+        if (resp.code === 0) {
+          this.versionResult = resp.data
+          this.title = row.name + ' 版本信息'
+          this.showVersionDialog = true
+        } else {
+          this.$message.warning(resp.msg)
+        }
+      }).catch(error => {
+        this.$message.error(error.message)
+      })
+    },
     handleShowImage(index, row) {
       this.dockerBindForm.id = row.id
       this.getImageBindListWrapper(row.id)