Add description field to profiles

pull/193/head
Steve 2024-08-25 00:22:13 -06:00
rodzic a2b3071e4e
commit fcf255914d
2 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -50,6 +50,7 @@ function updateProfile(id)
{
selected_profile = id;
selected_profile_name = profiles[id].name;
selected_profile_description = profiles[id].description;
var job_seconds = profiles[id].data.length === 0 ? 0 : parseInt(profiles[id].data[profiles[id].data.length-1][0]);
var kwh = (3850*job_seconds/3600/1000).toFixed(2);
var cost = (kwh*kwh_rate).toFixed(2);
@ -270,6 +271,7 @@ function enterEditMode()
$('#btn_controls').hide();
console.log(profiles);
$('#form_profile_name').val(profiles[selected_profile].name);
$('#form_profile_description').val(profiles[selected_profile].description);
graph.profile.points.show = true;
graph.profile.draggable = true;
graph.plot = $.plot("#graph_container", [ graph.profile, graph.live ], getOptions());
@ -329,6 +331,7 @@ function toggleTable()
function saveProfile()
{
name = $('#form_profile_name').val();
description = $('#form_profile_description').val();
var rawdata = graph.plot.getData()[0].data
var data = [];
var last = -1;
@ -358,7 +361,7 @@ function saveProfile()
last = rawdata[i][0];
}
var profile = { "type": "profile", "data": data, "name": name }
var profile = { "type": "profile", "data": data, "name": name, "description": description }
var put = { "cmd": "PUT", "profile": profile }
var put_cmd = JSON.stringify(put);

Wyświetl plik

@ -74,6 +74,10 @@
<button id="btn_exit" type="button" class="btn btn-default" onclick="leaveEditMode()"><span class="glyphicon glyphicon-remove"></span></button>
</span>
</div>
<div class="input-group">
<span class="input-group-addon">Schedule Description</span>
<input id="form_profile_description" type="text" class="form-control" />
</div>
<div class="btn-group btn-group-sm" style="margin-top: 10px">
<button id="btn_newPoint" type="button" class="btn btn-default" onclick="newPoint()"><span class="glyphicon glyphicon-plus"></span></button>
<button id="btn_delPoint" type="button" class="btn btn-default" onclick="delPoint()"><span class="glyphicon glyphicon-minus"></span></button>