浏览代码

还原误删 stat/index1 和 stat/index2 两个 html 页面

reghao 8 月之前
父节点
当前提交
78cfc55823

+ 116 - 0
mgr/src/main/resources/templates/devops/app/stat/index1.html

@@ -0,0 +1,116 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org"
+      xmlns:mo="https://gitee.com/aun/Timo">
+<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
+    <link rel="stylesheet" th:href="@{/lib/zTree_v3/css/zTreeStyle/zTreeStyle.css}" type="text/css">
+</head>
+
+<body class="timo-layout-page">
+<div class="layui-card">
+    <div class="layui-card-header timo-card-header">
+        <span><i class="fa fa-bars"></i> 应用运行状态</span>
+        <i class="layui-icon layui-icon-refresh refresh-btn"></i>
+    </div>
+    <div class="layui-card-body">
+        <div class="layui-row timo-card-screen put-row">
+            <div class="pull-left layui-form-pane">
+                <div class="layui-inline">
+                    <label class="layui-form-label">环境</label>
+                    <div class="layui-input-block timo-search-status">
+                        <select id="getPageByEnv" class="timo-search-select" name="env" onchange="getPageByCriteria()"
+                                mo:dict="ENVIRONMENT" mo-selected="${env}"></select>
+                    </div>
+                </div>
+                <div class="layui-inline">
+                    <label class="layui-form-label">类型</label>
+                    <div class="layui-input-block timo-search-status">
+                        <select id="getPageByAppType" class="timo-search-select" name="type" onchange="getPageByCriteria()"
+                                mo:dict="APP_TYPE" mo-selected="${type}"></select>
+                    </div>
+                </div>
+                <div class="layui-inline timo-search-box">
+                    <label class="layui-form-label">应用名</label>
+                    <div class="layui-input-block">
+                        <input type="text" name="appName" th:value="${param.appName}" placeholder="请输入应用名"
+                               autocomplete="off" class="layui-input">
+                    </div>
+                </div>
+                <div class="layui-inline">
+                    <button class="layui-btn timo-search-btn">
+                        <i class="fa fa-search"></i>
+                    </button>
+                </div>
+            </div>
+        </div>
+        <div class="timo-table-wrap">
+            <table class="layui-table timo-table">
+                <thead>
+                <tr>
+                    <th class="sortable" data-field="appName">应用</th>
+                    <th class="sortable" data-field="bindPorts">监听端口</th>
+                    <th class="sortable" data-field="packagePath">包路径</th>
+                    <th class="sortable" data-field="totalDeployed">部署数量</th>
+                    <th>运行状态</th>
+                </tr>
+                </thead>
+                <tbody>
+                <tr th:each="item:${list}">
+                    <td>
+                        <a class="open-popup" data-title="应用配置详情" data-size="1000,500" href="#"
+                           th:text="${item.appName}" th:attr="data-url=@{'/app/config/app/detail/'+${item.appId}}"></a>
+                    </td>
+                    <td th:text="${item.bindPorts}">监听端口</td>
+                    <td th:text="${item.packagePath}">部署数量</td>
+                    <td style="color: red" th:text="${item.totalDeployed}">部署数量</td>
+                    <td>
+                        <a class="open-popup"
+                           th:attr="data-title=${item.appName} + ' - 运行状态', data-url=@{'/app/stat/detail/'+${item.appId}}"
+                           data-size="1200,500" href="#">查看
+                        </a>
+                    </td>
+                </tr>
+                </tbody>
+            </table>
+        </div>
+        <div th:replace="/common/fragment :: page"></div>
+    </div>
+</div>
+<script th:replace="/common/template :: script"></script>
+<script type="text/javascript" th:src="@{/js/plugins/jquery-2.2.4.min.js}"></script>
+<script type="text/javascript">
+    function getPageByCriteria() {
+        var envSelectedOption = $("#getPageByEnv option:selected")
+        var envParam = envSelectedOption.text()
+
+        var typeSelectedOption = $("#getPageByAppType option:selected")
+        var typeParam = typeSelectedOption.text()
+
+        url = '?env=' + envParam + '&type=' + typeParam
+        window.location.href = window.location.pathname + url;
+    }
+
+    function getPageByEnv() {
+        var selectedOption = $("#getPageByEnv option:selected")
+        var param = selectedOption.text()
+        url = '?env=' + param
+        window.location.href = window.location.pathname + url;
+    }
+
+    function getPageByAppType() {
+        var selectedOption = $("#getPageByAppType option:selected")
+        var param = selectedOption.text()
+        url = '?appType=' + param
+        window.location.href = window.location.pathname + url;
+    }
+
+    $(".app-status").each(function () {
+        var text = $(this).text().trim()
+        if (text === 'Online') {
+            $(this).css("color", "#009688")
+        } else {
+            $(this).css("color", "#ff0000")
+        }
+    })
+</script>
+</body>
+</html>

+ 56 - 0
mgr/src/main/resources/templates/devops/app/stat/index2.html

@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org">
+<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
+    <link rel="stylesheet" th:href="@{/lib/zTree_v3/css/zTreeStyle/zTreeStyle.css}" type="text/css">
+</head>
+<body class="timo-layout-page">
+<div class="layui-card">
+    <div class="layui-card-body">
+        <div class="timo-table-wrap">
+            <table class="layui-table timo-table">
+                <thead>
+                <tr>
+                    <th class="sortable" data-field="machineIpv4">机器地址</th>
+                    <th class="sortable" data-field="packagePath">使用的包</th>
+                    <th class="sortable" data-field="status">运行状态</th>
+                    <th class="sortable" data-field="startTime">启动时间</th>
+                    <th class="sortable" data-field="pid">PID</th>
+                    <th class="sortable" data-field="lastCheck">上次检查</th>
+                    <th>操作</th>
+                </tr>
+                </thead>
+                <tbody>
+                <tr th:each="item:${list}">
+                    <td th:text="${item.machineIpv4}">机器地址</td>
+                    <td th:text="${item.packagePath}">包路径</td>
+                    <td class="app-status" th:text="${item.status}">运行状态</td>
+                    <td th:text="${item.startTime}">启动时间</td>
+                    <td th:text="${item.pid}">PID</td>
+                    <td th:text="${item.lastCheck}">上次检查</td>
+                    <td>
+                        <a class="ajax-post" th:href="@{'/api/app/status/restart/'+${item.appId}+'/'+${item.machineId}}">重启</a>
+                        <a class="ajax-post" th:href="@{'/api/app/status/stop/'+${item.appId}+'/'+${item.machineId}}">停止</a>
+                        <a class="ajax-post" th:href="@{'/api/app/status/start/'+${item.appId}+'/'+${item.machineId}}">启动</a>
+                        <a class="ajax-get" th:href="@{'/api/app/status/'+${item.appId}+'/'+${item.machineId}}">当前状态</a>
+                    </td>
+                </tr>
+                </tbody>
+            </table>
+        </div>
+    </div>
+</div>
+
+<script th:replace="/common/template :: script"></script>
+<script type="text/javascript" th:src="@{/js/plugins/jquery-2.2.4.min.js}"></script>
+<script type="text/javascript">
+    $(".app-status").each(function () {
+        var text = $(this).text().trim()
+        if (text === '运行中') {
+            $(this).css("color", "#009688")
+        } else {
+            $(this).css("color", "#ff0000")
+        }
+    })
+</script>
+</body>
+</html>