Skip to content

Commit

Permalink
Add Wingbits Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Putt authored and Robert Putt committed Jul 2, 2024
1 parent 6d56740 commit 2edfd20
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hw_diag/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from hw_diag.views.auth import AUTH
from hw_diag.views.myst import MYST
from hw_diag.views.ttn import TTN
from hw_diag.views.wingbits import WINGBITS
from hw_diag.views.thingsix import THINGSIX
from hw_diag.views.backup_restore import BACKUP_RESTORE
from hw_diag.utilities.quectel import ensure_quectel_health
Expand Down Expand Up @@ -192,6 +193,7 @@ def post_request(resp):
app.register_blueprint(TTN)
app.register_blueprint(THINGSIX)
app.register_blueprint(BACKUP_RESTORE)
app.register_blueprint(WINGBITS)

app.register_blueprint(DIAGNOSTICS)
return app
6 changes: 6 additions & 0 deletions hw_diag/templates/template_hyper.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@
<span> MystNodes </span>
</a>
</li>
<li class="side-nav-item">
<a href="/myst" class="side-nav-link">
<i class="fak fa-plane"></i>
<span> Wingbits </span>
</a>
</li>
<li class="side-nav-item">
<a href="/device_configuration" class="side-nav-link">
<i class="fa-duotone fa-cog"></i>
Expand Down
41 changes: 41 additions & 0 deletions hw_diag/templates/wingbits.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{% extends 'template_hyper.html' %}

{% block title %}Wingbits{% endblock %}

{% block body %}
<div class="content">
<br/>
<script src="https://unpkg.com/h3-js"></script>
<h3 class="text-center mb-4">Wingbits Configuration</h3>

<div class="row mb-4">
<div class="col-12 col-lg-6 mb-4 mb-lg-0">
<div class="card mb-0 h-100 table-responsive">
<table class="table dt-responsive nowrap m-md-2 w-auto">
<tr>
<td><i class="uil uil-sign-alt"></i> Node Name</td>
<td class="text-right">big-topaz-tuna</td>
</tr>
</table>
</div>
</div>
<div class="col-12 col-lg-6 mb-4 mb-lg-0">
<div class="card mb-0 h-100 table-responsive">
<table class="table dt-responsive nowrap m-md-2 w-auto">
<tr>
<td><span class="uil uil-wifi-router icon"></span> SDR Operational</td>
<td class="text-right"><span class="uil uil-check-circle text-success"></span></td>
</tr>
</table>
</div>
</div>
</div>
<div class="text-center">
{% if diagnostics.last_updated %}
<p>Last Updated: {{ diagnostics.last_updated }}</p>
{% else %}
<p>Last Updated: Never</p>
{% endif %}
</div>
</div>
{% endblock %}
34 changes: 34 additions & 0 deletions hw_diag/views/wingbits.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import logging
import os
import time

from flask import Blueprint
from flask import render_template

from hm_pyhelper.logger import get_logger
from hw_diag.utilities.auth import authenticate
from hw_diag.utilities.auth import commercial_fleet_only
from hw_diag.utilities.diagnostics import read_diagnostics_file
from hw_diag.utilities.dashboard_registration import claim_miner_deeplink


logging.basicConfig(level=os.environ.get("LOGLEVEL", "DEBUG"))

LOGGER = get_logger(__name__)
WINGBITS = Blueprint('WINGBITS', __name__)


@WINGBITS.route('/wingbits')
@authenticate
@commercial_fleet_only
def get_wingbits_dashboard():
diagnostics = read_diagnostics_file()
claim_deeplink = claim_miner_deeplink()
now = round(time.time())

return render_template(
'wingbits.html',
diagnostics=diagnostics,
claim_deeplink=claim_deeplink,
now=now
)

0 comments on commit 2edfd20

Please sign in to comment.