Przeglądaj źródła

修改日志栏大小,添加应用详情日志

wangyi 2 lat temu
rodzic
commit
7faea271c0

+ 1 - 1
src/views/modules/generator/algorithm.vue

@@ -3,7 +3,7 @@
     <el-dialog
       title="镜像制作日志"
       :visible.sync="imagesLogVisible"
-      width="30%"
+      width="60%"
       >
       <div style = "white-space: pre-wrap">{{imagesLog}}</div>
       <span slot="footer" class="dialog-footer">

+ 57 - 2
src/views/modules/generator/createApp/applications-view-detail.vue

@@ -2,7 +2,8 @@
   <el-dialog
     :title="'应用详情'"
     :visible.sync="visible"
-    width="80%"
+    width="60%"
+    :before-close="handleClose"
     @close="cancel"
   >
     <el-form>
@@ -46,6 +47,15 @@
             </el-row>
           </el-card>
         </el-form-item>
+        <el-form-item class="card-header">控制台输出</el-form-item>
+        <el-form-item
+          class="text item"
+        
+        >
+          <el-card shadow="nerver" style="font-size: 15px">
+            <div style = "white-space: pre-wrap" v-loading="loading">{{applicationLog}}</div>
+          </el-card>
+        </el-form-item>
       </el-card>
 
 <!-- 
@@ -164,6 +174,8 @@ export default {
     return {
       //定义可见性,即获取数据成功与否后再可见
       visible: false,
+      timer:null,
+      applicationLog: "正在读取...",
       ingressesVisible: false,
       serviceVisible: false,
       eventsVisible:false,
@@ -187,6 +199,7 @@ export default {
     init(name, version,createTime,applicationType,applicationDescription,parentProjectName) {
       this.name = name;
       this.version = version;//版本号
+      this.applicationLog="正在读取...";
       this.visible = true;
       this.createTime=createTime;
       this.applicationType=applicationType;
@@ -288,6 +301,12 @@ export default {
 
 
       });
+      this.timer=window.setInterval(()=>{
+      setTimeout(()=>{
+        console.log("执行定时任务");
+        this.getOutput();
+      },0)
+      },1000);
     },
     formatMessage(){
     var item=this.eventsData.data.items[0].status;
@@ -314,9 +333,36 @@ export default {
   
 
     },
-
+    getOutput(){
+      this.$http({
+          url: this.$http.adornUrl(
+            `/generator/applications/appRunningLog/${this.name}`
+          ),
+          method: "get",
+          //
+        })
+          .then((res) => {
+            if(res.data.code==500){
+                
+            }
+            
+            this.applicationLog=res.data.log;
+          })
+          .catch((error) => {
+            console.log("获取日志信息错误", error);
+          });
+    },
+    handleClose(){
+      if (this.timer) {
+        clearInterval(this.timer);
+        this.timer = null;
+        
+      }
+      this.visible=false;
+    },
     cancel() {
       this.visible = false;
+      this.timer=null;
       this.ingressesVisible = false;
       this.serviceVisible = false;
       this.eventsVisible=false;
@@ -326,6 +372,15 @@ export default {
       this.eventsData=[];
       this.name = "";
       this.version = "";
+      this.applicationLog="正在读取...";
+    },
+    //切换路由时,清楚定时器
+    beforeRouteLeave(to, from, next){
+      next();
+      if (this.timer) {
+        clearInterval(this.timer);
+        this.timer = null;
+      }
     },
   },
 };

+ 1 - 3
src/views/modules/monitor/components/applicationMonitor/appRunningLog.vue

@@ -8,9 +8,7 @@
     <el-form>
         
     </el-form>
-    <div style = "white-space: pre-wrap" v-loading="loading">
-        {{applicationLog}}
-    </div>
+    <div style = "white-space: pre-wrap" v-loading="loading">{{applicationLog}}</div>
   </el-dialog>
 </template>