Browse Source

应用构建耗时 BuildConsumed 中添加一个 total 字段, 表示应用构建的总耗时

reghao 1 year ago
parent
commit
e31aaa745d

+ 3 - 1
web/src/main/java/cn/reghao/devops/web/mgr/app/model/po/log/BuildConsumed.java

@@ -16,16 +16,18 @@ import javax.persistence.Embeddable;
 @Getter
 @Embeddable
 public class BuildConsumed {
-    // ms 时间戳
     private Long pullConsumed;
     private Long compileConsumed;
     private Long packConsumed;
     private Long pushConsumed;
+    // 单位 second
+    private Long total;
 
     public BuildConsumed(BuildConsumedDto buildConsumedDto) {
         this.pullConsumed = buildConsumedDto.getPullConsumed();
         this.compileConsumed = buildConsumedDto.getCompileConsumed();
         this.packConsumed = buildConsumedDto.getPackConsumed();
         this.pushConsumed = buildConsumedDto.getPushConsumed();
+        this.total = (this.pullConsumed + this.compileConsumed + this.packConsumed + this.pushConsumed)/1000;
     }
 }

+ 5 - 4
web/src/main/resources/templates/devops/app/bd/log/buildlog.html

@@ -14,7 +14,7 @@
                 <th class="sortable">构建结果</th>
                 <th class="sortable" data-field="buildBy">构建用户</th>
                 <th class="sortable" data-field="packagePath">包路径</th>
-                <th class="sortable">构建配置</th>
+                <th class="sortable">构建配置快照</th>
                 <th class="sortable">构建耗时</th>
                 <th>操作</th>
             </tr>
@@ -25,23 +25,24 @@
                 <td th:text="${item.commitId}">版本 ID</td>
                 <td th:text="${item.buildTime}">构建时间</td>
                 <td>
-                    <a class="open-popup" data-title="构建结果" data-size="1000,500" href="#"
+                    <a class="open-popup" data-title="构建结果" data-size="240,180" href="#"
                        th:attr="data-url=@{'/app/bd/build/result?buildLogId='+${item.buildLogId}}">查看</a>
                 </td>
                 <td th:text="${item.buildBy}">构建用户</td>
                 <td th:text="${item.packagePath}">包路径</td>
                 <td>
-                    <a class="open-popup" data-title="构建配置" data-size="1000,500" href="#"
+                    <a class="open-popup" data-title="构建配置" data-size="720,480" href="#"
                        th:attr="data-url=@{'/app/bd/build/config?buildLogId='+${item.buildLogId}}">查看</a>
                 </td>
                 <td>
-                    <a class="open-popup" data-title="构建耗时" data-size="500,200" href="#"
+                    <a class="open-popup" data-title="构建耗时" data-size="720,240" href="#"
                        th:attr="data-url=@{'/app/bd/build/consumed?buildLogId='+${item.buildLogId}}">查看</a>
                 </td>
                 <td>
                     <a class="open-popup" th:attr="data-title=@{${item.appId} + ' 部署列表'}, data-url=@{'/app/bd/deploy?appId=' + ${item.appId} + '&buildLogId=' + ${item.buildLogId}}"
                        data-size="1000,500" href="#">部署</a>
                     <a class="ajax-redirect" th:href="@{'/api/app/bd/packageurl/'+${item.buildLogId}}">下载</a>
+                    <a class="ajax-delete" th:href="@{'/api/app/bd/delete/'+${item.buildLogId}}">删除</a>
                 </td>
             </tr>
             </tbody>

+ 14 - 21
web/src/main/resources/templates/devops/app/bd/log/buildresult.html

@@ -3,26 +3,19 @@
 <head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
 </head>
 <body class="timo-layout-page">
-<div class="layui-card">
-    <div class="layui-bg-gray" style="padding: 30px;">
-        <div class="layui-card-body">
-            <table class="layui-table timo-detail-table">
-                <thead>
-                <tr>
-                    <th class="sortable" data-field="changeType">行号</th>
-                    <th class="sortable" data-field="oldFilePath">内容</th>
-                </tr>
-                </thead>
-                <tbody>
-                <tr th:each="item,stat:${list}">
-                    <td th:text="${stat.index}">行号</td>
-                    <td th:text="${item}">内容</td>
-                </tr>
-                </tbody>
-            </table>
-        </div>
-    </div>
-</div>
-<script th:replace="/common/template :: script"></script>
+<table class="layui-table timo-detail-table">
+    <thead>
+    <tr>
+        <th class="sortable" data-field="changeType">行号</th>
+        <th class="sortable" data-field="oldFilePath">内容</th>
+    </tr>
+    </thead>
+    <tbody>
+    <tr th:each="item,stat:${list}">
+        <td th:text="${stat.index}">行号</td>
+        <td th:text="${item}">内容</td>
+    </tr>
+    </tbody>
+</table>
 </body>
 </html>

+ 10 - 8
web/src/main/resources/templates/devops/app/bd/log/buildtime.html

@@ -6,18 +6,20 @@
     <table class="layui-table timo-detail-table">
         <thead>
         <tr>
-            <th class="sortable" data-field="pullConsumed">更新耗时(ms)</th>
-            <th class="sortable" data-field="compileConsumed">编译耗时(ms)</th>
-            <th class="sortable" data-field="packConsumed">打包耗时(ms)</th>
-            <th class="sortable" data-field="pushConsumed">推送耗时(ms)</th>
+            <th class="sortable" data-field="total">构建耗时(second)</th>
+            <th class="sortable" data-field="pullConsumed">更新(ms)</th>
+            <th class="sortable" data-field="compileConsumed">编译(ms)</th>
+            <th class="sortable" data-field="packConsumed">打包(ms)</th>
+            <th class="sortable" data-field="pushConsumed">推送(ms)</th>
         </tr>
         </thead>
         <tbody>
         <tr>
-            <td th:text="${buildConsumed.pullConsumed}">更新耗时</td>
-            <td th:text="${buildConsumed.compileConsumed}">编译耗时</td>
-            <td th:text="${buildConsumed.packConsumed}">打包耗时</td>
-            <td th:text="${buildConsumed.pushConsumed}">推送耗时</td>
+            <td th:text="${buildConsumed.total}">构建耗时</td>
+            <td th:text="${buildConsumed.pullConsumed}">更新</td>
+            <td th:text="${buildConsumed.compileConsumed}">编译</td>
+            <td th:text="${buildConsumed.packConsumed}">打包</td>
+            <td th:text="${buildConsumed.pushConsumed}">推送</td>
         </tr>
         </tbody>
     </table>