status.ftl 5.32 KB
Newer Older
1
<#import "/spring.ftl" as spring />
2 3 4 5
<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
6 7 8
<!--[if gt IE 8]><!-->
<html class="no-js"> <!--<![endif]-->
<head>
9
    <base href="<@spring.url basePath/>">
10 11 12 13 14 15
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Eureka</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">

16
    <link rel="stylesheet" href="eureka/css/wro.css">
17
</head>
18

19
<body id="one">
20
    <#include "header.ftl">
21
<div class="container-fluid xd-container">
22
      <#include "navbar.ftl">
23 24
    <h1>Instances currently registered with Eureka</h1>
    <table id='instances' class="table table-striped table-hover">
25
        <thead>
26 27 28 29 30 31
        <tr>
            <th>Application</th>
            <th>AMIs</th>
            <th>Availability Zones</th>
            <th>Status</th>
        </tr>
32 33 34 35 36
        </thead>
        <tbody>
          <#if apps?has_content>
            <#list apps as app>
              <tr>
37 38
                  <td><b>${app.name}</b></td>
                  <td>
39
                  <#list app.amiCounts as amiCount>
40
                      <b>${amiCount.key}</b> (${amiCount.value})<#if amiCount_has_next>,</#if>
41
                  </#list>
42 43
                  </td>
                  <td>
44
                  <#list app.zoneCounts as zoneCount>
45
                      <b>${zoneCount.key}</b> (${zoneCount.value})<#if zoneCount_has_next>,</#if>
46
                  </#list>
47 48
                  </td>
                  <td>
49 50 51 52
                  <#list app.instanceInfos as instanceInfo>
                    <#if instanceInfo.isNotUp>
                      <font color=red size=+1><b>
                    </#if>
53
                      <b>${instanceInfo.status}</b> (${instanceInfo.instances?size}) -
54 55 56 57
                    <#if instanceInfo.isNotUp>
                      </b></font>
                    </#if>
                    <#list instanceInfo.instances as instance>
赵天增 committed
58
                        <span hidden>${app.name}</span>
59
                        <#if instance.isHref>
Andrei Sfat committed
60
                        <a href="${instance.url}" target="_blank">${instance.id}</a>
61 62
                        <#else>
                            ${instance.id}
赵天增 committed
63
                        </#if>
赵天增 committed
64
                        <button class="cc" type="button">关闭</button>
赵天增 committed
65
                        <#if instance_has_next>,</#if>
66 67
                    </#list>
                  </#list>
68
                  </td>
69 70 71
              </tr>
            </#list>
          <#else>
72 73 74
            <tr>
                <td colspan="4">No instances available</td>
            </tr>
75 76 77
          </#if>

        </tbody>
78
    </table>
79

80
    <h1>General Info</h1>
81

82
    <table id='generalInfo' class="table table-striped table-hover">
83
        <thead>
84 85 86 87
        <tr>
            <th>Name</th>
            <th>Value</th>
        </tr>
88 89 90 91
        </thead>
        <tbody>
          <#list statusInfo.generalStats?keys as stat>
            <tr>
92 93
                <td>${stat}</td>
                <td>${statusInfo.generalStats[stat]!""}</td>
94 95 96 97
            </tr>
          </#list>
          <#list statusInfo.applicationStats?keys as stat>
            <tr>
98 99
                <td>${stat}</td>
                <td>${statusInfo.applicationStats[stat]!""}</td>
100 101 102
            </tr>
          </#list>
        </tbody>
103
    </table>
104

105
    <h1>Instance Info</h1>
106

107
    <table id='instanceInfo' class="table table-striped table-hover">
108
        <thead>
109 110 111 112
        <tr>
            <th>Name</th>
            <th>Value</th>
        </tr>
113 114 115
        <thead>
        <tbody>
          <#list instanceInfo?keys as key>
116 117 118 119
          <tr>
              <td>${key}</td>
              <td>${instanceInfo[key]!""}</td>
          </tr>
120 121
          </#list>
        </tbody>
122 123 124 125 126
    </table>
</div>
<script type="text/javascript" src="eureka/js/wro.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
赵天增 committed
127 128 129 130 131 132
        function domainURI(str) {
            var durl = /http:\/\/([^\/]+)\//i;
            domain = str.match(durl);
            return domain[1];
        }

赵天增 committed
133
        $('.cc').click(function () {
134
            debugger;
赵天增 committed
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
            var instance = $(this).prev().text();
            console.log(instance);
            var appName = $(this).prev().prev().text();
            console.log(appName);
            var stopUrl = domainURI($(this).prev().attr("href"));
            console.log(stopUrl);
            var host = window.location.href;
            $.ajax({
                url: host + 'eureka/apps/' + appName + '/' + instance,
                type: 'DELETE',
                success: function () {
                    alert("从eureka删除实例成功");
                },
                error: function () {
                    alert("删除失败")
                }
            });
            $.ajax({
                url: "http://"+stopUrl+'/actuator/shutdown',
                type: 'POST',
                success: function () {
                    alert("停止实例成功");
                },
                error: function () {
                    alert("删除失败")
                }
            });
162
        });
赵天增 committed
163

164 165 166 167 168
        $('table.stripeable tr:odd').addClass('odd');
        $('table.stripeable tr:even').addClass('even');
    });
</script>
</body>
169
</html>