source: src/main/webapp/running.xhtml@ 19

Last change on this file since 19 was 1, checked in by bart, 5 years ago

Initial Release

File size: 2.7 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
3<head>
4<title>Running Negotiations</title>
5<link rel="stylesheet" type="text/css" href="css/list.css" />
6
7</head>
8<body>
9 <div class="noscript">
10 <h2 style="color: #ff0000">Seems your browser doesn't support
11 Javascript! Websockets rely on Javascript being enabled. Please
12 enable Javascript and reload this page!</h2>
13 </div>
14 <h1>Currently running Negotiations</h1>
15
16 <table>
17 <thead>
18 <th align="left">Negotiation ID</th>
19 </thead>
20 <tbody id="sessionsTable">
21 </tbody>
22 </table>
23</body>
24
25<!-- Script to get/update the SESSIONS list and put it into the table. -->
26<script type="application/javascript">
27
28
29
30 <![CDATA[
31 "use strict";
32
33 var ws = null;
34
35 function connect() {
36 var target = 'ws://'+location.host+"/"+location.pathname.split("/")[1]+'/websocket/running';
37 if ('WebSocket' in window) {
38 ws = new WebSocket(target);
39 } else if ('MozWebSocket' in window) {
40 ws = new MozWebSocket(target);
41 } else {
42 alert('WebSocket is not supported by this browser. Please use a newer browser');
43 return;
44 }
45 ws.onopen = function () {
46 // whatever.
47 };
48 ws.onmessage = function (event) {
49 update(JSON.parse(event.data));
50 };
51 ws.onclose = function (event) {
52 alert('Info: Server closed connection. Code: ' + event.code + (event.reason == "" ? "" : ", Reason: " + event.reason));
53 };
54 }
55
56 /*
57 @param sessions a list of IDs (Strings).
58 */
59 function update(sessions) {
60 var table = document.getElementById("sessionsTable");
61 table.innerHTML="";
62 for(var session of sessions) {
63 var row = table.insertRow(-1); //-1 = end
64 row.insertCell(0).innerHTML = session;
65 }
66
67 }
68
69 ]]>
70
71</script>
72
73
74<script type="application/javascript">
75
76 <![CDATA[
77 "use strict";
78 /*
79 This is called when the window DOM is loaded. window.onload runs BEFORE the window is loaded
80 and therefore is too early to remove the noscript message.
81 */
82 document.addEventListener("DOMContentLoaded", function() {
83 // Remove elements with "noscript" class - <noscript> is not allowed in XHTML
84 var noscripts = document.getElementsByClassName("noscript");
85 for (var i = 0; i < noscripts.length; i++) {
86 noscripts[i].parentNode.removeChild(noscripts[i]);
87 }
88 connect();
89
90 }, false);
91 ]]>
92
93</script>
94
95
96</html>
Note: See TracBrowser for help on using the repository browser.