| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 var restartz = document.getElementById("restartServer"); | |
| 6 restartz.onclick = restartServer; | |
| 7 | |
| 8 var stopz = document.getElementById("stopServer"); | |
| 9 stopz.onclick = stopServer; | |
| 10 | |
| 11 var adminzReq; | |
| 12 var adminzStatus = document.getElementById("adminzStatus"); | |
| 13 | |
| 14 var statuzTimer; | |
| 15 | |
| 16 function showStatus() { | |
| 17 if (adminzReq.readyState == 4) { | |
| 18 if (adminzReq.status == 200) { | |
| 19 adminzStatus.value = adminzReq.responseText; | |
| 20 } else { | |
| 21 adminzStatus.value = "Error " + adminzReq.status; | |
| 22 } | |
| 23 } | |
| 24 clearTimer(); | |
| 25 statuzTimer = window.setTimeout("adminzStatus.value=''", 2000); | |
| 26 } | |
| 27 | |
| 28 function clearTimer() { | |
| 29 if (statuzTimer) { | |
| 30 window.clearTimeout(statuzTimer); | |
| 31 statuzTimer = null; | |
| 32 } | |
| 33 } | |
| 34 | |
| 35 function restartServer(event) { | |
| 36 clearTimer(); | |
| 37 adminzReq = new XMLHttpRequest(); | |
| 38 adminzReq.onreadystatechange = showStatus; | |
| 39 adminzReq.open("POST", "/adm/restart"); | |
| 40 adminzStatus.value = "Restarting..."; | |
| 41 adminzReq.send(); | |
| 42 } | |
| 43 | |
| 44 function stopServer(event) { | |
| 45 clearTimer(); | |
| 46 adminzReq = new XMLHttpRequest(); | |
| 47 adminzReq.onreadystatechange = showStatus; | |
| 48 adminzReq.open("POST", "/adm/stop"); | |
| 49 adminzStatus.value = "Stopping..."; | |
| 50 adminzReq.send(); | |
| 51 } | |
| OLD | NEW |