<%@ Page Language="c#" Inherits="WebApp.Wpdcc.watchOperateState" CodeBehind="watchOperateState.aspx.cs" %>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>watchOperateState</title>
    <!--#include file = "../assets/head.htm" -->
    

</head>
<body class="no-skin">
    <form id="Form1" method="post" runat="server">
    <div class="main-content-inner">
    <div class="page-content">
        <div class="page-header">
			<h1>
				<small>
				    请求队列
					<i class="ace-icon fa fa-angle-double-right"></i>
				</small>
			</h1>
		</div>
        <div class="row">
            <div class="col-xs-12">
                <div><asp:Label ID="watchWaitQueue" runat="server">正在监视等待队列</asp:Label></div>
            </div>
        </div>
        <div class="page-header">
			<h1>
				<small>
				    完成队列
					<i class="ace-icon fa fa-angle-double-right"></i>
				</small>
			</h1>
		</div>
        <div class="row">
            <div class="col-xs-12">
                <div><asp:Label ID="watchFinishQueue" runat="server">正在监视完成队列</asp:Label></div>
                </div>
        </div>
    </div>
    </div>
    </form>

    <script type="text/javascript">
    setInterval("operateList();",5000); 
    </script>
    <script language="javascript" type="text/javascript">

        function ReceiveServerData(result) {
            if (result != "") {
                var rows = result.split("$$");
                var html = [];
                var html1 = [];
                var j = 0;
                for (var i = 0; i < rows.length; i++) {
                    var row = rows[i].split("$");
                    if (row[3] != "0" && row[3] != "1") {
                        html[html.length] = "<tr>" + "<td>" + row[11] + "</td>" + "<td>" + operate(row[2]) + "</td>" + "<td>" + row[7] + "</td>" + "<td>" + row[9] + "</td>" + "<td>" + row[10] + "</td>" + "</tr>";
                    }
                    document.getElementById("watchFinishQueue").innerHTML = "<table class=\"table table-striped table-bordered\" ><tr><td>站点</td><td>请求操作</td><td>状态</td><td>响应时间</td><td>完成时间</td></tr>" + html.join("") + "</table>";
                }
                for (var i = rows.length - 1; i >= 0 ; i--) {
                    var row = rows[i].split("$");
                    if (row[3] == "0" || row[3] == "1") {
                        j++;
                        html1[html1.length] = "<tr>" + "<td>" + j + "</td>" + "<td>" + row[11] + "</td>" + "<td>" + operate(row[2]) + "</td>" + "<td>" + row[7] + "</td>" + "<td>" + (row[6] == "null" ? "" : row[6]) + "</td>" + "<td>" + row[8] + "</td>" + "<td>" + (row[9] == "null" ? "" : row[9]) + "</td>" + "</tr>";
                    }
                    document.getElementById("watchWaitQueue").innerHTML = "<table class=\"table table-striped table-bordered\" ><tr><td>编号</td><td>站点</td><td>请求操作</td><td>状态</td><td>执行操作</td><td>请求时间</td><td>响应时间</td></tr>" + html1.join("") + "</table>";
                }
            }
        }

        function operate(i) {
            var op;
            switch (i) {
                case "0":
                    op = "建站";
                    break;
                case "1":
                    op = "运行网站";
                    break;
                case "2":
                    op = "停止网站";
                    break;
                case "3":
                    op = "删除网站";
                    break;
                case "4":
                    op = "统计磁盘空间";
                    break;
                case "5":
                    op = "备份数据";
                    break;
                case "6":
                    op = "恢复数据";
                    break;
                case "7":
                    op = "清除数据";
                    break;
                case "8":
                    op = "撤消删除";
                    break;
                case "9":
                    op = "编辑站点信息";
                    break;
                case "10":
                    op = "WEB服务迁移";
                    break;
                case "11":
                    op = "数据库迁移";
                    break;
                case "12":
                    op = "WEB服务空间统计";
                    break;
                case "13":
                    op = "删除子站备份包";
                    break;
                case "14":
                    op = "删除源站点";
                    break;
                case "15":
                    op = "删除源数据库";
                    break;
            }
            return op;

        }


        function operateList() {
            arg = 1;

            <% =callback%>
        }
    </script>
</body>
</html>
