From 2cd982c20146c15d063f035a402e665f3ea7bd1e Mon Sep 17 00:00:00 2001 From: chrono Date: Sun, 24 Nov 2013 17:56:41 +0100 Subject: [PATCH] add task management --- public/index.html | 50 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/public/index.html b/public/index.html index 1e6987d..44a6614 100644 --- a/public/index.html +++ b/public/index.html @@ -107,6 +107,14 @@ background-image: linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%); background: #fafafa; } +.modal-footer { + margin-top: 0; +} + +.modal-body .table { + margin-bottom: 0; +} + @@ -173,20 +181,20 @@ background-image: linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%); @@ -208,9 +216,19 @@ function updateProgress(percentage){ } +function runTask() { + var test = { + "cmd": "RUN", + "profile": profile[selected_profile] + } + ws_control.send(JSON.stringify(test)); +} + + var state = "IDLE"; var graph; var profiles = []; +var selected_profile = 0; var host = "ws://" + window.location.hostname + ":8080"; @@ -257,27 +275,33 @@ ws_storage.onopen = function() console.log("Parsed profile:" + profiles); + //delete old options in select $('#e2') .find('option') .remove() .end(); - + // fill select with new options from websocket for (var i=0; i'+profile.name+''); - } - + $('#e2').select2('val', '0'); + update_profile(0); } + + console.log('Requesting stored profiles'); ws_storage.send('GET'); + + + + } @@ -291,12 +315,18 @@ $("#e2").select2({ }); - $("#e2").on("change", function(e) { - console.log('Profile selected:' + e); + update_profile(e.val); }); +function update_profile(id) { + console.log('Profile selected:' + profiles[id].name); + selected_profile = id; + $('#sel_prof').html(profiles[id].name); + console.log(graph.series); + graph.series[0].setData(profiles[id].data); +} Highcharts.theme = {