Skip to content

Commit

Permalink
Feature #7: Added simple Arduino-formatted UUID variables that can be…
Browse files Browse the repository at this point in the history
… pasted into their devices' code
  • Loading branch information
fryarludwig committed Apr 2, 2017
1 parent ce97def commit 157416f
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 82 deletions.
25 changes: 14 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
beautifulsoup4==4.5.1
coverage==4.2
Django==1.10.3
appdirs==1.4.3
beautifulsoup4==4.5.3
coverage==4.3.4
Django==1.10.6
django-autocomplete-light==3.2.1
django-bootstrap-form==3.2.1
django-crispy-forms==1.6.1
django-discover-runner==1.0
django-filter==1.0.0
django-formset-js==0.5.0
django-jquery-js==2.1.4
django-webtest==1.8.0
django-jquery-js==3.1.1
django-webtest==1.9.1
django-widget-tweaks==1.4.1
djangorestframework==3.5.3
Markdown==2.6.7
djangorestframework==3.6.2
Markdown==2.6.8
mysqlclient==1.3.9
packaging==16.8
psycopg2==2.7.1
pyparsing==2.2.0
six==1.10.0
waitress==1.0.1
WebOb==1.6.2
WebTest==2.0.23
waitress==1.0.2
WebOb==1.7.2
WebTest==2.0.27
118 changes: 116 additions & 2 deletions src/dataloaderinterface/static/dataloaderinterface/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ div.map-info {
padding: 7px 15px;
}


.control-row {
clear: both;
}
Expand Down Expand Up @@ -803,4 +802,119 @@ a.orange:hover {

#btn-login {
background-color: rgb(101, 101, 101);
}
}

div.code-display-controls {
position: inherit;
float: right;
width: 40%;
margin: 20px -200px 5px 30px;
}


span.clickable-float-left {
background-color: #FFFFFF;
position: inherit;
float: left;
padding: 10px 12px 8px 12px;
margin: 10px 0px 5px 0px;
font-size: 14px;
font-weight: 400;
line-height: 1;
color: #555;
text-align: center;
border: 1px solid #ccc;
border-right: 0px;
border-radius: 2px;
box-sizing: border-box;
text-shadow: none;
-webkit-transition: all 0.2s;
transition: all 0.2s;
}

i.clickable-float-left {
font-size: 20px;
margin-top: -2px;
margin-right: 3px;
color: #555;
vertical-align: middle;
-webkit-transition: all 0.2s; /* Safari */
transition: all 0.2s;
}

span.code-copy-right {
background-color: #FFFFFF;
position: inherit;
float: left;
padding: 12px 12px 10px 14px;
margin: 10px 5px 5px -3px;
font-size: 14px;
font-weight: 400;
line-height: 1;
color: #555;
text-align: center;
border: 1px solid #ccc;
border-radius: 2px;
border-left: 0px;
box-sizing: border-box;
text-shadow: none;
-webkit-transition: all 0.2s;
transition: all 0.2s;
}

span.clickable-float-left:hover, span.clickable-copy-right:hover {
background-color: #eee;
color: #444444;
border-color: #aaaaaa;
cursor: pointer;
}

.noselect {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome and Opera */
}

textarea#code-output {
width: 1060px;
position: relative;
height: 150px;
padding: 8px 4px;
margin-left: auto;
margin-right: auto;
text-align: left;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 4px;
color: #00072d;
font-family: monospace;
font-size: 14px;
font-style: normal;
font-variant: normal;
font-weight: 400;
line-height: 20px;
outline: none;
background: #eee;
resize: none;
overflow: auto;
animation: move 2s ease;
}

#site-table-header {
text-align: center;
font-weight: 500;
font-size: 14px;
}

#table-background-accent {
background-color: rgba(98, 132, 62, 0.70);
position: inherit;
float: left;
width: 515px;
height: 6px;
margin: -35px -25px -40px -25px; /* Displays on top */
/*margin: 8px -25px -15px -25px;*/ /* Displays on bottom */
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ $(document).ready(function () {
});
});


function initMap() {
var defaultZoomLevel = 18;
var latitude = parseFloat($('#site-latitude').val());
Expand Down Expand Up @@ -115,9 +114,9 @@ function fixViewPort() {
}
}


$(document).ready(function() {
$('nav .menu-sites-list').addClass('active');
$('textarea#code-output').hide();

var resizeTimer;
var timeSeriesData = JSON.parse(document.getElementById('sensors-data').innerHTML);
Expand All @@ -141,5 +140,11 @@ $(document).ready(function() {
}, 500);
});

$('#code-visiblity-toggle').click( function () {
$('textarea#code-output').slideToggle();
}
);

// $('div#code-output-div').hide();
drawSparklinePlots(timeSeriesData);
});
Original file line number Diff line number Diff line change
Expand Up @@ -26,46 +26,24 @@
{{ sampling_feature.sampling_feature_code }}
{% endif %}
</div>

{% if messages %}
{% for message in messages %}
<p>{{ message }}</p>
{% endfor %}
{% endif %}


{% if object.user_id == request.user.odm2user.id %}
<div class="row site-tokens">
<div class="col-xs-12">
<div class="input-group input-group-copy">
<span class="input-group-addon"><i class="material-icons">local_offer</i> Registration Token</span>
<input type="text" id="authToken" class="form-control click-select-all" readonly
aria-label="Registration Token"
value="{{ object.authentication_token }}">
<span class="input-group-addon clipboard-copy btn-copy"
data-target="authToken">Copy</span>
</div>
<br>

<div class="input-group input-group-copy">
<span class="input-group-addon"><i class="material-icons">settings_remote</i> Sampling Feature UUID</span>
<input type="text" id="featureUUID" class="form-control click-select-all" readonly
aria-label="Sampling Feature UUID"
value="{{ sampling_feature.sampling_feature_uuid }}">
<span class="input-group-addon clipboard-copy btn-copy"
data-target="featureUUID">Copy</span>
</div>
</div>
</div>
{% endif %}
</header>


<div class="row">
<div class="registration-data col-xs-12 col-sm-6">
{# Deployment fields #}
<table class="mdl-data-table mdl-js-data-table mdl-data-table-no-hover full-width">
<tr>
<td class="mdl-data-table__cell--non-numeric" id="site-table-header" colspan="2">
Details for {{ sampling_feature.sampling_feature_code }}
<div id="table-background-accent"></div>
</td>
</tr>

<table class="mdl-data-table mdl-js-data-table mdl-data-table-no-hover">
<tr>
<td class="mdl-data-table__cell--non-numeric">Deployment By</td>
<td class="mdl-data-table__cell--non-numeric">{{ affiliation }}</td>
Expand Down Expand Up @@ -96,14 +74,6 @@
<td class="mdl-data-table__cell--non-numeric">Site Type</td>
<td class="mdl-data-table__cell--non-numeric">{{ site.site_type_id }}</td>
</tr>

{# is this really necessary? it's gonna be the same method always. #}
{# <tr>#}
{# <td class="mdl-data-table__cell--non-numeric">Deployment Method</td>#}
{# <td class="mdl-data-table__cell--non-numeric"><span>{{ deployment.method }}</span></td>#}
{# </tr>#}


</table>
</div>

Expand All @@ -112,10 +82,21 @@
<input type="hidden" id="site-latitude" value="{{ site.latitude }}">
<input type="hidden" id="site-longitude" value="{{ site.longitude }}">
</div>
</div>

{% if object.user_id == request.user.odm2user.id %}
<div class="device-code" id="code-output-div">
<textarea class="form-control click-select-all" id="code-output" readonly style="display: none">
const char *REGISTRATION_TOKEN = "{{ object.authentication_token }}"; // Device registration token
const char *SAMPLING_FEATURE = "{{ sampling_feature.sampling_feature_uuid }}"; // Sampling feature UUID
const char *UUIDs[] = // UUID array for device sensors
{{% for feature_action in feature_actions %} {% with feature_action.results.all.0 as result %}
"{{ result.result_uuid }}"{% if not forloop.last %}, {% else %} {% endif %} // {{ result.variable.variable_name_id }} ({{ result.variable.variable_code }}){% endwith %}{% endfor %}
};</textarea>
</div>
{% endif %}
</div>
<div class="row">
<div class="col-xs-12">
<div class="col-xs-5">
<table>
<tr>
<td><i class="material-icons text-muted">query_builder</i>&nbsp;&nbsp;</td>
Expand All @@ -125,6 +106,17 @@
<div class="text-muted section-subtitle">Last measurement: </div>
</div>


{% if object.user_id == request.user.odm2user.id %}
<div class="code-display-controls">
<span class="clickable-float-left noselect" id="code-visiblity-toggle">
<i class="material-icons clickable-float-left">code</i>
View code snippet
</span>
<span class="code-copy-right clipboard-copy btn-copy noselect" data-target="code-output">Copy</span>
</div>
{% endif %}

<div class="sparkline-plots col-xs-12">
<div class="alert alert-info" role="alert">Only last 24 hours shown on sparkline plots
and tables
Expand Down Expand Up @@ -163,30 +155,7 @@
<div id="graph{{ forloop.counter0 }}" class="graph-container"></div>
</td>
</tr>

{# {% with result.timeseriesresult.values.all.last as latest_value %}#}
{# {% if latest_value %}#}
{# #}
{# {% else %}#}
{# <tr><td><span class="no-data-message">NOTHING TO LOOK AT HERE!</span></td></tr>#}
{# {% endif %}#}
{# {% endwith %}#}

</table>

{% if object.user_id == request.user.odm2user.id %}
<div class="mdl-card__actions mdl-card--border mdl-card__supporting-text result-uuid">
<div class="input-group input-group-copy">
<span class="input-group-addon">Result UUID</span>
<input type="text" id="resultUUID{{ forloop.counter }}"
class="form-control click-select-all" readonly
aria-label="Amount (to the nearest dollar)"
value="{{ result.result_uuid }}">
<span class="input-group-addon clipboard-copy btn-copy"
data-target="resultUUID{{ forloop.counter }}">Copy</span>
</div>
</div>
{% endif %}
</div>
</div>
{% endwith %}
Expand All @@ -209,11 +178,6 @@ <h4 class="mdl-dialog__title"></h4>

<div class="mdl-dialog__content">
<div class="measurements-table">
{# <button data-result-id#}
{# class="mdl-button mdl-js-button mdl-button--raised mdl-button--accent mdl-js-ripple-effect pull-right download-data-button">#}
{# <i class="fa fa-download" aria-hidden="true"></i> Download <span#}
{# class="variable-name"></span> Raw Data#}
{# </button>#}
{% for feature_action in feature_actions %}
{% with feature_action.results.all.0 as result %}
<table class="mdl-data-table mdl-shadow--2dp data-values" cellspacing="0"
Expand Down

0 comments on commit 157416f

Please sign in to comment.