Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add description field to profiles #193

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion public/assets/js/picoreflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down