<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="/favicon.ico">
<LINK rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/html5.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/respond.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/PIE_IE678.js"></script>
<![endif]-->
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/skin/default/skin.css" rel="stylesheet" type="text/css" id="skin" />
<link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/style.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>系统机器列表</title>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
		系统管理 <span class="c-gray en">&gt;</span> 系统机器监控 <a class="btn btn-success radius r mr-20"
			style="line-height: 1.6em; margin-top: 3px"
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
	<div class="pd-20">
	<form id="adminlist" >
		<table class="table table-border table-bordered table-bg">
			<thead>
				<tr>
					<th scope="col" colspan="9">系统机器列表</th>
				</tr>
				<tr class="text-c">
					<th width="250">应用名称</th>
					<th width="90">应用所处IP</th>
					<th width="150">配置端口</th>
					<th width="130">状态</th>
					<th width="130">ZK节点名称</th>
					<th width="130">操作</th>
				</tr>
			</thead>
			<tbody>
				<c:choose>
					<c:when test="${! (empty list) }">
						<c:forEach items="${list }" var="info">
							<tr class="text-c">
								<td>${info.applicationName }</td>
								<td>${info.host }</td>
								<td>${info.port }</td>
								<td>${info.state == 0 ? "运行中" : (info.state == 1 ? "关闭中" : "已经关闭") }</td>
								<td>${info.path }</td>
								<td>
									<c:if test="${info.state == 0 }">
										<input class="btn btn-primary radius" onclick="cancelApp('${info.path}')" type="button" value="&nbsp;关闭&nbsp;">
									</c:if>
								</td>
						</c:forEach>
					</c:when>
					<c:otherwise>
						<tr class="text-c">
							<td colspan="5">
								暂时没有机器，请检查!
							</td>
						</tr>
					</c:otherwise>
				</c:choose>
			</tbody>
		</table>
	</div>
	<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/layer/1.9.3/layer.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.admin.js"></script>
	<script type="text/javascript">
		function cancelApp(path) {
			layer.confirm('确认要修改状态吗？',function(index){
				$.ajax({
			        url: '${pageContext.request.contextPath }/admin/system/cancal_service/' + path,
			        type: "POST",
			        dataType: "json",
			        data: {"data":new Date().getTime()},
			        error:function(data){
			      	  layer.msg(data.status,{icon: 5,time:2000});
			        },
			        success:  function(data){
			        	location.replace(location.href);
			        }
			    });
			});
		}
	</script>
</body>
</html>