summaryrefslogtreecommitdiff
path: root/web-static
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-07-23 01:46:32 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-07-23 01:46:32 (GMT)
commit39fd9dd2c8156c9a9f9abc23e6f5398770e44f5d (patch)
treecd6e6af7387f284f596473dbc97cfa846007a544 /web-static
parent732438e3042d299c6dd7c096ba2eaa20035d8466 (diff)
some cleanup and imrpovments (mainly in the javasctipt test sites
Diffstat (limited to 'web-static')
-rw-r--r--web-static/socket.html51
-rw-r--r--web-static/upload-form.html29
-rw-r--r--web-static/upload.html69
3 files changed, 111 insertions, 38 deletions
diff --git a/web-static/socket.html b/web-static/socket.html
index 9b118ac..9781e81 100644
--- a/web-static/socket.html
+++ b/web-static/socket.html
@@ -17,6 +17,19 @@
margin-bottom: 1em;
}
+ #progress {
+ background-color: white;
+ border: 1px solid;
+ padding: 1em;
+ font-family: monospace;
+ margin-top: 2em;
+ margin-bottom: 0em;
+ }
+
+ #progress span.caption {
+ font-weight: bold;
+ }
+
td {
text-align: right;
}
@@ -60,6 +73,9 @@
$('#sessionid').val(msg.ID);
buttonsRunning();
break;
+ case "progress":
+ repaintProgress(msg.PROGRESS_STEP_NAME, msg.PROGRESS, msg.TITLE, msg.CART_NUMBER, msg.CUT_NUMBER);
+ break;
case "done":
case "error":
this.sock.close();
@@ -110,23 +126,32 @@
}
function buttonsIdle() {
- $('#buttonrun').removeAttr('disabled')
- $('#buttonreconnect').removeAttr('disabled')
- $('#buttondetach').attr('disabled','disabled')
- $('#buttoncancel').attr('disabled','disabled')
+ $('#buttonrun').removeAttr('disabled');
+ $('#buttonreconnect').removeAttr('disabled');
+ $('#buttondetach').attr('disabled','disabled');
+ $('#buttoncancel').attr('disabled','disabled');
}
function buttonsRunning() {
- $('#buttonrun').attr('disabled','disabled')
- $('#buttonreconnect').attr('disabled','disabled')
- $('#buttondetach').removeAttr('disabled')
- $('#buttoncancel').removeAttr('disabled')
+ $('#buttonrun').attr('disabled','disabled');
+ $('#buttonreconnect').attr('disabled','disabled');
+ $('#buttondetach').removeAttr('disabled');
+ $('#buttoncancel').removeAttr('disabled');
+ }
+
+ function repaintProgress(step, value, title, cart, cut) {
+ $('#progress_step').text("'" + step + "'");
+ $('#progress_value').text(Math.round(value*100)/100 + "%");
+ $('#progress_title').text("'" + title + "'");
+ $('#progress_cart').text(cart);
+ $('#progress_cut').text(cut);
}
function init() {
$('#sessionid').val("");
buttonsIdle();
- $('#buttonlist').removeAttr('disabled','disabled')
+ repaintProgress("", 0, "", 0, 0);
+ $('#buttonlist').removeAttr('disabled','disabled');
}
</script>
</head>
@@ -154,6 +179,14 @@
<input id="sessionid" type="text" size="45">
<button id="buttonreconnect" onclick="reconnect()">reconnect</button>
<button id="buttoncancel" onclick="cancel()">cancel</button>
+ <div id="progress">
+ <span class="caption">Step/Value:</span>
+ <span id="progress_step"></span> / <span id="progress_value"></span>
+ <span class="caption">Title</span>
+ <span id="progress_title"></span>
+ <span class="caption">Cart/Cut</span>
+ <span id="progress_cart"></span> / <span id="progress_cut"></span>
+ </div>
<div id="rawmsg" class="data"></div>
</div>
</body>
diff --git a/web-static/upload-form.html b/web-static/upload-form.html
deleted file mode 100644
index 5353f95..0000000
--- a/web-static/upload-form.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- <title>rhimportd File Upload</title>
- <style type="text/css">
- body {
- background-color: #555;
- }
-
- td.label {
- text-align: right;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <h1>rhimportd File Upload</h1>
- <form class="form-upload" method="post" action="/public/upload" enctype="multipart/form-data">
- <table>
- <tr><td class="label">Username</td><td><input type="text" name="LOGIN_NAME" size="20" value="heslinki" /></td></tr>
- <tr><td class="label">Session</td><td><input type="text" name="SESSION_ID" size="45" /></td></tr>
- <tr><td class="label">File</td><td><input type="file" name="FILENAME" /></td></tr>
- <tr><td>&nbsp;</td><td><input type="submit" name="submit" value="Submit"></td></tr>
- </table>
- </form>
- </div>
- </body>
-</html>
diff --git a/web-static/upload.html b/web-static/upload.html
new file mode 100644
index 0000000..39cfa57
--- /dev/null
+++ b/web-static/upload.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>rhimportd File Upload</title>
+ <style type="text/css">
+ body {
+ background-color: #555;
+ }
+
+ div.data {
+ background-color: white;
+ border: 1px solid;
+ padding: 1em;
+ font-family: monospace;
+ margin-top: 1em;
+ margin-bottom: 1em;
+ }
+
+ td.label {
+ text-align: right;
+ }
+ </style>
+ <script src="jquery.min.js"></script>
+ <script type="text/javascript">
+ function upload() {
+ $('#buttonupload').attr('disabled','disabled');
+
+ var cmdData = new FormData();
+ cmdData.append("LOGIN_NAME", $('#username').val());
+ cmdData.append("SESSION_ID", $('#sessionid').val());
+ cmdData.append("FILENAME", $('#file').get(0).files[0]);
+ var command = {
+ type: "POST",
+ contentType: false,
+ processData: false,
+ data: cmdData,
+ dataType: 'json',
+ error: function(req, status, err) { result({StatusText: status, ErrorString: err}); },
+ success: function(data, status, req) { result(data); }
+ };
+ $.ajax('/public/upload', command);
+
+ }
+
+ function result(data) {
+ $('#result').text(JSON.stringify(data));
+ $('#buttonupload').removeAttr('disabled','disabled');
+ }
+
+ function init() {
+ $('#sessionid').val("");
+ result({})
+ }
+ </script>
+ </head>
+ <body onload="init()">
+ <div class="container">
+ <h1>rhimportd File Upload</h1>
+ <table>
+ <tr><td class="label">Username</td><td><input id="username" type="text" size="20" value="heslinki" /></td></tr>
+ <tr><td class="label">Session</td><td><input id="sessionid" type="text" size="45" /></td></tr>
+ <tr><td class="label">File</td><td><input id="file" type="file" /></td></tr>
+ <tr><td>&nbsp;</td><td><button id="buttonupload" onclick="upload()">upload</button></td></tr>
+ </table>
+ <div id="result" class="data"></div>
+ </div>
+ </body>
+</html>