123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
- <title>IBM AI Server Viewer 1.0</title>
- <style>
- table {
- border-collapse: collapse;
- }
- th, td {
- border: 1px solid gray;
- padding-left: 5px;
- padding-right: 10px;
- padding-top: 2px;
- padding-bottom: 2px;
- }
- th {
- text-align: left;
- }
- td {
- text-align: center;
- }
- </style>
- <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
- <script type="text/javascript">
- function refreshStatus() {
- $.get("/api/service/status",function(data, status){
- data = JSON.parse(data);
- var result = data.content;
- $("#datas tr:gt(1)").remove();
- $.each(result, function (i, n) {
- var ss = result[i];
- var row = $("#template").clone();
- row.find("#name").text(ss.name);
- row.id = "tr"+i;
- row.show();
- var st="";
- if (ss.status == 0) {
- st = "<font color='green'>Running</font>";
- } else {
- st = "<font color='green'>Stopped</font>";
- }
- row.find("#status").html(st);
- row.find("#connections").text(ss.connections);
- row.find("#times").text(ss.times);
- row.find("#timestamp").text(new Date(parseInt(ss.timestamp)*1000).toLocaleString());
- row.appendTo("#datas");
- });
- $('#template').hide();
- });
- }
- function refreshLog() {
- $.get("/api/service/log",function(data, status){
- $('#log').html(data);
- });
- }
- $(document).ready(function(){
- $("#btnStatus").click(function(){
- refreshStatus();
- });
- $("#btnLog").click(function(){
- // $.ajax({
- // url: '/api/pred',
- // method: 'POST',
- // // dataType: 'json',
- // data: "{ \"catagory\":\"SS\", \"type\":\"SS\", \"status\":\"SS\", \"magnification\":\"SS\", \"func\":\"SS\", \"src_img_path\":\"D:\\\\py-faster-rcnn\\\\data\\\\demo\\\\000456测试.jpg\" }",
- // success: function(json) {
- // console.log("post rsp: ", json);
- // $('#result1').html(json);
- // }
- // });
- refreshLog();
- });
- });
- $(window).load(function(){
- refreshStatus();
- refreshLog();
- });
- // websocket
- var websocket = new WebSocket('ws://' + location.host + '/ws');
- websocket.onopen = function (ev) {
- console.log(ev.data);
- };
- websocket.onerror = function (ev) {
- console.log(ev.data);
- };
- websocket.onclose = function (ev) {
- console.log(ev.data);
- };
- websocket.onmessage = function (ev) {
- console.log(ev.data);
- document.getElementById("ws_text").innerHTML = ev.data;
- };
- window.onload = function () {
- document.getElementById('send_button').onclick = function (ev) {
- var msg = document.getElementById('send_input').value;
- websocket.send(msg);
- };
- };
- </script>
- </head>
- <body>
- <h3>IBM AI Server Overview 1.0</h3>
- <label>Service Status:</label>
- <button id="btnStatus">Refresh</button>
- <table id="datas">
- <tr id="0">
- <th>Service Name</th>
- <th>Running Status</th>
- <th>Connection(s)</th>
- <th>Exec Times</th>
- <th>Starting Time</th>
- <!--<th>Action</th>-->
- </tr>
- <tr id="template">
- <th id="name"></th>
- <td id="status"></td>
- <td id="connections"></td>
- <td id="times"></td>
- <td id="timestamp"></td>
- <!--<td><a href="">Stop</a> <a href="">Restart</a></td>-->
- </tr>
- </table>
- <h4>AI Service:</h4>
- <label>Model Count:</label> <span id="result1"> </span>
- <label>Running Model:</label> <span id="result2"> </span>
- <div style="clear:both" />
- <label>Logs:</label>
- <button id="btnLog">Refresh</button>
- <div style="clear:both" />
- <textarea id="log" style="width:100%;" name="yj" rows="20"></textarea>
- </body>
- </html>
|