Adds run status to dashboard. Fixes type in run status db script
This commit is contained in:
42
.idea/workspace.xml
generated
42
.idea/workspace.xml
generated
@@ -2,8 +2,10 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="28cc251f-c94f-44ee-a66d-77aaab6e3483" name="Default" comment="">
|
<list default="true" id="28cc251f-c94f-44ee-a66d-77aaab6e3483" name="Default" comment="">
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java" afterPath="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java" />
|
||||||
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java" afterPath="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java" />
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/www/pocwww/pocwww/__init__.py" afterPath="$PROJECT_DIR$/www/pocwww/pocwww/__init__.py" />
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/www/pocwww/pocwww/__init__.py" afterPath="$PROJECT_DIR$/www/pocwww/pocwww/__init__.py" />
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/www/pocwww/pocwww/templates/gaugeoff_all.jinja2" afterPath="$PROJECT_DIR$/www/pocwww/pocwww/templates/gaugeoff_all.jinja2" />
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/www/pocwww/pocwww/json.py" afterPath="$PROJECT_DIR$/www/pocwww/pocwww/json.py" />
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/www/pocwww/pocwww/templates/layout.jinja2" afterPath="$PROJECT_DIR$/www/pocwww/pocwww/templates/layout.jinja2" />
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/www/pocwww/pocwww/templates/layout.jinja2" afterPath="$PROJECT_DIR$/www/pocwww/pocwww/templates/layout.jinja2" />
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/www/pocwww/pocwww/views.py" afterPath="$PROJECT_DIR$/www/pocwww/pocwww/views.py" />
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/www/pocwww/pocwww/views.py" afterPath="$PROJECT_DIR$/www/pocwww/pocwww/views.py" />
|
||||||
</list>
|
</list>
|
||||||
@@ -107,11 +109,11 @@
|
|||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="Well.java" pinned="false" current-in-tab="false">
|
<file leaf-file-name="Well.java" pinned="false" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java">
|
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="0">
|
<state relative-caret-position="385">
|
||||||
<caret line="26" column="28" lean-forward="false" selection-start-line="26" selection-start-column="28" selection-end-line="26" selection-end-column="28" />
|
<caret line="1019" column="47" lean-forward="false" selection-start-line="1019" selection-start-column="47" selection-end-line="1019" selection-end-column="47" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
@@ -182,11 +184,11 @@
|
|||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="Database.java" pinned="false" current-in-tab="true">
|
<file leaf-file-name="Database.java" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java">
|
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="1029">
|
<state relative-caret-position="2610">
|
||||||
<caret line="194" column="55" lean-forward="false" selection-start-line="194" selection-start-column="55" selection-end-line="194" selection-end-column="55" />
|
<caret line="232" column="29" lean-forward="false" selection-start-line="232" selection-start-column="29" selection-end-line="232" selection-end-column="29" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
@@ -623,10 +625,10 @@
|
|||||||
<option value="$PROJECT_DIR$/build.gradle" />
|
<option value="$PROJECT_DIR$/build.gradle" />
|
||||||
<option value="$PROJECT_DIR$/poc.service.txt" />
|
<option value="$PROJECT_DIR$/poc.service.txt" />
|
||||||
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Measurement.java" />
|
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Measurement.java" />
|
||||||
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java" />
|
|
||||||
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/CLScanner.java" />
|
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/CLScanner.java" />
|
||||||
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/IOControl.java" />
|
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/IOControl.java" />
|
||||||
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/POC.java" />
|
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/POC.java" />
|
||||||
|
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java" />
|
||||||
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java" />
|
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
@@ -1399,16 +1401,6 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="0">
|
|
||||||
<caret line="26" column="28" lean-forward="false" selection-start-line="26" selection-start-column="28" selection-end-line="26" selection-end-column="28" />
|
|
||||||
<folding>
|
|
||||||
<element signature="imports" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/CLScanner.java">
|
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/CLScanner.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="-735">
|
<state relative-caret-position="-735">
|
||||||
@@ -1419,8 +1411,18 @@
|
|||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java">
|
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="1029">
|
<state relative-caret-position="2610">
|
||||||
<caret line="194" column="55" lean-forward="false" selection-start-line="194" selection-start-column="55" selection-end-line="194" selection-end-column="55" />
|
<caret line="232" column="29" lean-forward="false" selection-start-line="232" selection-start-column="29" selection-end-line="232" selection-end-column="29" />
|
||||||
|
<folding>
|
||||||
|
<element signature="imports" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="385">
|
||||||
|
<caret line="1019" column="47" lean-forward="false" selection-start-line="1019" selection-start-column="47" selection-end-line="1019" selection-end-column="47" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ public class Database {
|
|||||||
|
|
||||||
Document doc = new Document("status", runStatus)
|
Document doc = new Document("status", runStatus)
|
||||||
.append("initiator", initiator)
|
.append("initiator", initiator)
|
||||||
.append("timesstamp", Date.from(ZonedDateTime.now().toInstant()));
|
.append("timestamp", Date.from(ZonedDateTime.now().toInstant()));
|
||||||
collection.insertOne(doc);
|
collection.insertOne(doc);
|
||||||
return collection.count();
|
return collection.count();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1017,6 +1017,7 @@ public class Well {
|
|||||||
pointCounter = -1;
|
pointCounter = -1;
|
||||||
if (strokesSinceStart > startupStrokes){
|
if (strokesSinceStart > startupStrokes){
|
||||||
runStatus = RUNSTATUS_RUNNING;
|
runStatus = RUNSTATUS_RUNNING;
|
||||||
|
db.newRunStatus("Running", "startup");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runStatus == RUNSTATUS_RUNNING) {
|
if (runStatus == RUNSTATUS_RUNNING) {
|
||||||
|
|||||||
@@ -137,8 +137,12 @@ def main(global_config, **settings):
|
|||||||
config.add_route('welltests_all', '/welltests')
|
config.add_route('welltests_all', '/welltests')
|
||||||
config.add_route('json_welltests_all', '/json/welltests')
|
config.add_route('json_welltests_all', '/json/welltests')
|
||||||
|
|
||||||
|
config.add_route('runstatus', '/runstatus')
|
||||||
|
config.add_route('json_runstatus', '/json/runstatus')
|
||||||
|
|
||||||
# JSON-ONLY ROUTES
|
# JSON-ONLY ROUTES
|
||||||
config.add_route('json_lastcard', "/json/lastcard")
|
config.add_route('json_lastcard', "/json/lastcard")
|
||||||
|
config.add_route('json_runstatusnow', "/json/runstatusnow")
|
||||||
|
|
||||||
config.add_route('json_valuesbetween_wparams', "/json/values/between/{startdt}/{enddt}")
|
config.add_route('json_valuesbetween_wparams', "/json/values/between/{startdt}/{enddt}")
|
||||||
config.add_route('json_valuesbetween', "/json/values/between")
|
config.add_route('json_valuesbetween', "/json/values/between")
|
||||||
|
|||||||
@@ -102,3 +102,14 @@ def json_singlevaluedaterange(request):
|
|||||||
}}
|
}}
|
||||||
]))[0]
|
]))[0]
|
||||||
return {'first_date': date_limits['first'], 'last_date': date_limits['last']}
|
return {'first_date': date_limits['first'], 'last_date': date_limits['last']}
|
||||||
|
|
||||||
|
|
||||||
|
@view_config(route_name="json_runstatusnow", renderer="prettyjson")
|
||||||
|
def json_runstatusnow(request):
|
||||||
|
status = False
|
||||||
|
try:
|
||||||
|
status = list(request.db['runStatus'].find().sort("timestamp", -1).limit(1))[0]
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return {'runstatus': status}
|
||||||
|
|||||||
@@ -61,6 +61,8 @@
|
|||||||
<li {% if (navgroup == 'cards') %}class="visible-xs-inline active" {% else %} class="visible-xs-inline" {% endif %}><a href="/cards">Cards</a></li>
|
<li {% if (navgroup == 'cards') %}class="visible-xs-inline active" {% else %} class="visible-xs-inline" {% endif %}><a href="/cards">Cards</a></li>
|
||||||
<li {% if (navgroup == 'values') %}class="visible-xs-inline active" {% else %} class="visible-xs-inline" {% endif %}><a href="/values">Values</a></li>
|
<li {% if (navgroup == 'values') %}class="visible-xs-inline active" {% else %} class="visible-xs-inline" {% endif %}><a href="/values">Values</a></li>
|
||||||
<li {% if (navgroup == 'gaugeoff') %}class="visible-xs-inline active" {% else %} class="visible-xs-inline" {% endif %}><a href="/gaugeoff">Gauge-Off</a></li>
|
<li {% if (navgroup == 'gaugeoff') %}class="visible-xs-inline active" {% else %} class="visible-xs-inline" {% endif %}><a href="/gaugeoff">Gauge-Off</a></li>
|
||||||
|
<li {% if (navgroup == 'fluidshots') %}class="visible-xs-inline active" {% else %} class="visible-xs-inline" {% endif %}><a href="/fluidshots">Fluid Shots</a></li>
|
||||||
|
<li {% if (navgroup == 'welltests') %}class="visible-xs-inline active" {% else %} class="visible-xs-inline" {% endif %}><a href="/welltests">Well Tests</a></li>
|
||||||
<li><a href="/configuration">Configuration</a></li>
|
<li><a href="/configuration">Configuration</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -70,6 +72,11 @@
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-3 col-md-2 sidebar">
|
<div class="col-sm-3 col-md-2 sidebar">
|
||||||
|
<h3 class="allcaps" style="text-align:center">Run Status</h3>
|
||||||
|
<h4 style="text-align:center"><span id="runstatus"></span></h4>
|
||||||
|
<h5 style="text-align:center">at <span id="runstatustimestamp"></span></h5>
|
||||||
|
<h5 style="text-align:center"><a class="btn btn-primary" href="/runstatus">History</a></h5>
|
||||||
|
<hr />
|
||||||
<ul class="nav nav-sidebar">
|
<ul class="nav nav-sidebar">
|
||||||
<li {% if (navgroup == 'dashboard') %}class="active"{% endif %}><a href="/">Dashboard</a></li>
|
<li {% if (navgroup == 'dashboard') %}class="active"{% endif %}><a href="/">Dashboard</a></li>
|
||||||
<li {% if (navgroup == 'cards') %}class="active"{% endif %}><a href="/cards">Cards</a></li>
|
<li {% if (navgroup == 'cards') %}class="active"{% endif %}><a href="/cards">Cards</a></li>
|
||||||
@@ -102,4 +109,19 @@
|
|||||||
================================================== -->
|
================================================== -->
|
||||||
<!-- Placed at the end of the document so the pages load faster -->
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function setRunStatus(data){
|
||||||
|
$("#runstatus").text(data.runstatus.status);
|
||||||
|
$("#runstatustimestamp").text(data.runstatus.timestamp);
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
dataType: 'json',
|
||||||
|
url: "/json/runstatusnow",
|
||||||
|
success: setRunStatus
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
35
www/pocwww/pocwww/templates/runstatus.jinja2
Normal file
35
www/pocwww/pocwww/templates/runstatus.jinja2
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{% extends "layout.jinja2" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<h2>Run Status Log</h2>
|
||||||
|
{% if data|length > 0 %}
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Timestamp</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Initiator</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for d in data %}
|
||||||
|
<tr>
|
||||||
|
<td>{{d.timestamp | datetime('medium')}}</td>
|
||||||
|
<td>{{d.status}}</td>
|
||||||
|
<td>{{d.initiator}}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<h3>No fluid shots yet...</h3>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock content %}
|
||||||
@@ -113,3 +113,10 @@ def fluidshots_all(request):
|
|||||||
def welltests_all(request):
|
def welltests_all(request):
|
||||||
welltests = list(request.db['wellTests'].find())
|
welltests = list(request.db['wellTests'].find())
|
||||||
return {'navgroup': 'welltests', 'data': welltests}
|
return {'navgroup': 'welltests', 'data': welltests}
|
||||||
|
|
||||||
|
|
||||||
|
@view_config(route_name="runstatus", renderer="templates/runstatus.jinja2")
|
||||||
|
@view_config(route_name="json_runstatus", renderer="prettyjson")
|
||||||
|
def welltests_all(request):
|
||||||
|
runStatuses = list(request.db['runStatus'].find())
|
||||||
|
return {'navgroup': 'runstatus', 'data': runStatuses}
|
||||||
|
|||||||
Reference in New Issue
Block a user