Skip to content

Commit

Permalink
Merge pull request #274 from gyorilab/add-node-counter
Browse files Browse the repository at this point in the history
Add total node count to DKG homepage
  • Loading branch information
bgyori authored Jan 24, 2024
2 parents f3922af + 01ae8e5 commit 253ee42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions mira/dkg/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ <h4>Grounding</h4>
</p>
<h3>Summary</h3>
<div>
<p>
The DKG has {{ "{:,}".format(node_total) }} nodes.
This is broken down by the following namespaces/metaclasses:
</p>
{% for item, count in node_counter.most_common() %}
<span class="badge bg-primary" style="margin-top: 2px;">
{{ item }}: {{ "{:,}".format(count) }}
Expand Down
5 changes: 4 additions & 1 deletion mira/dkg/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
@ui_blueprint.route("/", methods=["GET"])
def home():
"""Render the home page."""
node_counter = client.get_node_counter()
node_total = sum(node_counter.values())
return render_template(
"home.html",
number_terms=len(grounder.entries),
node_counter=client.get_node_counter(),
node_counter=node_counter,
node_total=node_total,
)


Expand Down

0 comments on commit 253ee42

Please sign in to comment.