diff --git a/hw_diag/app.py b/hw_diag/app.py index 0dc8cdce..6a11eac4 100644 --- a/hw_diag/app.py +++ b/hw_diag/app.py @@ -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 @@ -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 diff --git a/hw_diag/templates/template_hyper.html b/hw_diag/templates/template_hyper.html index d61bb138..5d8332f3 100644 --- a/hw_diag/templates/template_hyper.html +++ b/hw_diag/templates/template_hyper.html @@ -132,6 +132,12 @@ MystNodes +
  • + + + Wingbits + +
  • diff --git a/hw_diag/templates/wingbits.html b/hw_diag/templates/wingbits.html new file mode 100644 index 00000000..9bd5e0ab --- /dev/null +++ b/hw_diag/templates/wingbits.html @@ -0,0 +1,41 @@ +{% extends 'template_hyper.html' %} + +{% block title %}Wingbits{% endblock %} + +{% block body %} +
    +
    + +

    Wingbits Configuration

    + +
    +
    +
    + + + + + +
    Node Namebig-topaz-tuna
    +
    +
    +
    +
    + + + + + +
    SDR Operational
    +
    +
    +
    +
    + {% if diagnostics.last_updated %} +

    Last Updated: {{ diagnostics.last_updated }}

    + {% else %} +

    Last Updated: Never

    + {% endif %} +
    +
    +{% endblock %} diff --git a/hw_diag/views/wingbits.py b/hw_diag/views/wingbits.py new file mode 100644 index 00000000..00c3b07c --- /dev/null +++ b/hw_diag/views/wingbits.py @@ -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 + )