Added put workflow into client

MAX31855-EH
chrono 2013-11-24 19:42:19 +01:00
rodzic fed75881d4
commit 66fbe2f79d
1 zmienionych plików z 43 dodań i 5 usunięć

Wyświetl plik

@ -48,12 +48,18 @@
<div class="panel panel-default">
<div class="panel-heading">
<select id="e2" style="margin-top: 5px">
</select>
<select id="e2" style="margin-top: 5px"></select>
<div id="saveas" class="input-group" style="display:none">
<input id="form_profile_name" type="text" class="form-control" />
<span class="input-group-btn">
<button class="btn btn-success" type="button" onclick="saveProfile();">Save</button>
</span>
</div><!-- /input-group -->
<div class="btn-group btn-group-sm pull-right">
<button type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span></button>
<button type="button" class="btn btn-default" ><span class="glyphicon glyphicon-pencil"></span></button>
<!--<button type="button" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span></button>-->
<button type="button" class="btn btn-default" onclick="enterEditMode()"><span class="glyphicon glyphicon-pencil"></span></button>
</div>
</div>
@ -61,6 +67,7 @@
<div id="graph_container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</div>
</div>
<div id="drag"></div>
@ -130,6 +137,37 @@ function abortTask() {
}
function enterEditMode() {
//$('#e2').hide();
$('#saveas').show();
$('#e2').select2('container').hide();
$('#form_profile_name').attr('value', profiles[selected_profile].name);
}
function saveProfile() {
name = $('#form_profile_name').attr('value')
console.log('Trying to save profile: ' + name);
var rawdata = graph.series[0].data;
var data = [];
for(var i=0; i<rawdata.length;i++)
{
data.push([rawdata[i].x, rawdata[i].y]);
}
var profile = { "type": "profile", "data": data, "name": name }
var put = { "cmd": "PUT", "profile": profile }
var put_cmd = JSON.stringify(put);
ws_storage.send(put_cmd);
console.log('came to this: ' + put_cmd);
}
var state = "IDLE";
var graph;
var profiles = [];
@ -518,7 +556,7 @@ $(function() {
}
},
chart: {
type: 'spline',
type: 'line',
renderTo: 'graph_container',
animation: true,
zoomType: 'x',