From cd7adafe7d31f442473a9ae60c8408b0bd853e62 Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Mon, 4 Dec 2023 16:35:09 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20=E2=80=94=20Add=20autorefresh?= =?UTF-8?q?=20feature=20on=20dashboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- argos/server/static/styles.css | 11 ++++ argos/server/templates/index.html | 99 +++++++++++++++++++++++++++---- 2 files changed, 100 insertions(+), 10 deletions(-) diff --git a/argos/server/static/styles.css b/argos/server/static/styles.css index f1d80a8..29ec6d5 100644 --- a/argos/server/static/styles.css +++ b/argos/server/static/styles.css @@ -15,3 +15,14 @@ code { margin-top: 0; margin-bottom: 1rem; } + +.inline-label { + display: inline-block; +} +.initial-width { + width: initial !important; +} +#auto-refresh-form, +#refresh-delay-li { + display: none; +} diff --git a/argos/server/templates/index.html b/argos/server/templates/index.html index e1b41bf..3ff4a39 100644 --- a/argos/server/templates/index.html +++ b/argos/server/templates/index.html @@ -1,28 +1,107 @@ {% extends "base.html" %} +{% block title %}

Dashboard

{% endblock %} {% block content %}
-

- {{ agents | length }} agent{% if agents| length > 1 %}s{% endif %} -

+
-
✅ OK
- {{ counts_dict['ok'] }} +
+ {{ counts_dict['unknown'] }}
-
⚠️ Warning
- {{ counts_dict['warning'] }} +
+ {{ counts_dict['ok'] }}
-
❌ Critical
- {{ counts_dict['critical'] }} +
⚠️
+ {{ counts_dict['warning'] }} +
+
+
+ {{ counts_dict['critical'] }}

- Details + + Domains +

+ {% endblock %} From c4bbda52a5fc372b66b150f705689253bc25fc54 Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Tue, 12 Dec 2023 08:22:54 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=8E=A8=F0=9F=94=A5=20=E2=80=94=20Don?= =?UTF-8?q?=E2=80=99t=20use=20js=20for=20auto-refresh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- argos/server/routes/views.py | 9 +++- argos/server/static/styles.css | 5 +- argos/server/templates/base.html | 7 ++- argos/server/templates/index.html | 78 ++++++++----------------------- 4 files changed, 36 insertions(+), 63 deletions(-) diff --git a/argos/server/routes/views.py b/argos/server/routes/views.py index 287168d..b126b59 100644 --- a/argos/server/routes/views.py +++ b/argos/server/routes/views.py @@ -18,7 +18,12 @@ templates = Jinja2Templates(directory="argos/server/templates") @route.get("/") -async def get_severity_counts(request: Request, db: Session = Depends(get_db)): +async def get_severity_counts( + request: Request, + db: Session = Depends(get_db), + refresh: bool = False, + delay: int = 15 +): """Shows the number of results per severity""" counts_dict = await queries.get_severity_counts(db) @@ -30,6 +35,8 @@ async def get_severity_counts(request: Request, db: Session = Depends(get_db)): "request": request, "counts_dict": counts_dict, "agents": agents, + "refresh": refresh, + "delay": delay, }, ) diff --git a/argos/server/static/styles.css b/argos/server/static/styles.css index 29ec6d5..e4e5764 100644 --- a/argos/server/static/styles.css +++ b/argos/server/static/styles.css @@ -22,7 +22,6 @@ code { .initial-width { width: initial !important; } -#auto-refresh-form, -#refresh-delay-li { - display: none; +#refresh-form { + margin-bottom: 0; } diff --git a/argos/server/templates/base.html b/argos/server/templates/base.html index 25837d4..f4b6829 100644 --- a/argos/server/templates/base.html +++ b/argos/server/templates/base.html @@ -5,7 +5,12 @@ Argos - + {% if refresh %} + + {% endif %} +
diff --git a/argos/server/templates/index.html b/argos/server/templates/index.html index 3ff4a39..93ee3dc 100644 --- a/argos/server/templates/index.html +++ b/argos/server/templates/index.html @@ -10,16 +10,31 @@ -
    +
    • - +
    • -
    • +
    • +
    • +
      + +
      +
    @@ -34,7 +49,7 @@ {{ counts_dict['ok'] }}
    -
    ⚠️
    +
    ⚠️
    {{ counts_dict['warning'] }}
    @@ -51,57 +66,4 @@

    - {% endblock %}