Преглед изворни кода

Merge branch 'hotfix/zhouweilu' of SEEC-II-FrontEnd-Team/SEEC-II-FrontEnd into master

ZhouWeilu пре 7 година
родитељ
комит
7decc7a42e

+ 8 - 13
src/views/student/Code/ProjectDetail/DeployDetail.vue

@@ -37,7 +37,7 @@
         </div>
       </div>
       <button
-        :class="['button', 'block', 'is-link', { 'is-loading': isRunning }]"
+        :class="['button', 'block', 'is-link', { 'is-loading': isRunning || deployButtonDisabled }]"
         @click="startDeploy"
         style="margin-top: 20px;"
       >
@@ -116,7 +116,8 @@ export default {
       latestMirrorIdList: [],
       radio: -1,
       isfetchLog: false,
-      latestDeployId: 0
+      latestDeployId: 0,
+      deployButtonDisabled: false
     };
   },
   props: {
@@ -131,13 +132,6 @@ export default {
   },
   watch: {
     projectDetail: function() {
-      // console.log(newVal);
-      //获取最新一次部署详细信息
-      // if (newVal.latestDeploy && newVal.latestDeploy.id) {
-      //   // this.haveDeployRecord = true;
-      //
-      //   // this.getDeployLogInfo(this.projectDetail.latestDeploy.id);
-      // }
       this.getLatestDeployInfo();
       this.getLatestBuildInfo(this.projectDetail && this.projectDetail.id, 5);
       this.getLastNDeployInfoList(
@@ -199,11 +193,13 @@ export default {
     },
     //开始部署
     startDeploy() {
+      this.deployButtonDisabled = true;
       if (this.radio == -1) {
         this.$toast.open({
           message: "请先选择镜像",
           type: "is-danger"
         });
+        this.deployButtonDisabled = false;
         return;
       } else {
         let mirrorId = this.getSelectedMirrorId();
@@ -214,6 +210,7 @@ export default {
           replicas: 1
         })
           .then(res => {
+            this.deployButtonDisabled = false;
             if (res.data.status == "SUCCESS") {
               this.$toast.open({
                 message: "不要重复部署哦~",
@@ -221,18 +218,16 @@ export default {
               });
               return;
             }
-            // console.log(res);
             this.$toast.open({
               message: "开始部署",
               type: "is-success"
             });
             this.isRunning = true;
             this.deployInfo = res.data;
-            // setTimeout(() => {
-            //   this.getLatestDeployInfo(this.projectDetail.latestDeploy.id);
-            // }, 1000);
+            this.latestDeployId = res.data.id;
           })
           .catch(e => {
+            this.deployButtonDisabled = false;
             this.$toast.open({
               message: e.message || "服务器未知错误",
               type: "is-danger"

+ 2 - 1
src/views/student/Code/ProjectDetail/Test/FunctionalTestDetail.vue

@@ -18,7 +18,8 @@
         页面测试 #{{ testDetail.id }}
       </template>
       <template slot="content">
-        <pass-tag :pass="testDetail.passAll" />
+        <pass-tag v-if="testDetail.status == 1" :pass="testDetail.passAll" />
+        <b-tag v-else type="is-warning">RUNNING</b-tag>
       </template>
       <template slot="extraContent">
         <div class="tag">{{ displayUnixTime(testDetail.time) }}</div>

+ 10 - 2
src/views/student/Code/ProjectDetail/Test/UnitTestDetail.vue

@@ -18,7 +18,8 @@
         单元测试 #{{ testDetail.id }}
       </template>
       <template slot="content">
-        <pass-tag :pass="testDetail.passAll" />
+        <pass-tag v-if="testDetail.status == 1" :pass="testDetail.passAll" />
+        <b-tag v-else type="is-warning">RUNNING</b-tag>
       </template>
       <template slot="extraContent">
         <div class="tag">{{ displayUnixTime(testDetail.time) }}</div>
@@ -69,8 +70,15 @@ import { getUnitTestDetail } from "@/api/codehw";
 import timeMixins from "@/mixins/time";
 import PassTag from "@/views/student/Code/ProjectDetail/components/PassTag";
 import PageSectionLoading from "@/components/PageBody/PageSectionLoading/index";
+import BTag from "buefy/src/components/tag/Tag";
 export default {
-  components: { PageSectionLoading, PassTag, PageBody, PageHeader },
+  components: {
+    BTag,
+    PageSectionLoading,
+    PassTag,
+    PageBody,
+    PageHeader
+  },
   data() {
     return {
       testDetail: { detail: [] },

+ 4 - 0
src/views/student/Code/ProjectDetail/TestDetail.vue

@@ -16,6 +16,7 @@
         >
           <div><strong>UNIT TEST : #</strong> {{ item.id }}</div>
           <pass-tag v-if="item.status == 1" :pass="item.passAll" />
+          <b-tag v-else type="is-warning">RUNNING</b-tag>
           <span style="padding-left: 10px">{{
             displayUnixTime(item.time)
           }}</span>
@@ -53,6 +54,7 @@
         >
           <div><strong>FUNCTIONAL TEST : #</strong> {{ item.id }}</div>
           <pass-tag v-if="item.status == 1" :pass="item.passAll" />
+          <b-tag v-else type="is-warning">RUNNING</b-tag>
           <span style="padding-left: 10px">{{
             displayUnixTime(item.time)
           }}</span>
@@ -67,9 +69,11 @@ import PassTag from "@/views/student/Code/ProjectDetail/components/PassTag";
 import timeMixins from "@/mixins/time";
 import { makeFunctionalTest } from "@/api/codehw";
 import PageSectionLoading from "@/components/PageBody/PageSectionLoading/index";
+import BTag from "buefy/src/components/tag/Tag";
 
 export default {
   components: {
+    BTag,
     PageSectionLoading,
     PassTag
   },