Skip to content
This repository has been archived by the owner on Oct 26, 2020. It is now read-only.

Commit

Permalink
Add data point count to collection manager view
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie- committed Aug 2, 2018
1 parent b4ecccf commit 56eb96f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions iot/templates/manage.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ <h4 class="title">Remove Data Collections</h4>
<tr>
<th>ID</th>
<th>Name</th>
<th>Data Points</th>
<th width="100%"></th>
</tr>
</thead>
Expand All @@ -36,6 +37,7 @@ <h4 class="title">Remove Data Collections</h4>
<tr>
<td>{{ e }}</td>
<td>{% if e in settings %}{{ settings[e]['name'] }}{% endif %}</td>
<td>{{ settings[e]['qty'] }}</td>
<td>
<button type="button" class="invisi-btn" onclick="removeCollection('{{ e }}')" title="Remove Collection" style="margin-left:auto;margin-right:0;display:block;">
<i class="icon-md text-danger fa fa-trash"></i>
Expand Down
2 changes: 2 additions & 0 deletions iot/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def route_manage():
settings = {}
for e in [{k: v for k, v in d.items() if k != '_id'} for d in db.get().settings.find()]:
settings.update(e)
for e in settings: # Add number of data points for each collection to it's settings
settings[e].update({'qty': db.get()[e].count()})
return flask.render_template('manage.html', title='Manage Collections', collections=collections, settings=settings)


Expand Down

0 comments on commit 56eb96f

Please sign in to comment.