From 96ce402f9f0a75ada1a0a95a5218685b78b4f3dc Mon Sep 17 00:00:00 2001 From: Allan Eising Date: Wed, 14 May 2025 17:22:27 +0200 Subject: [PATCH] Update dashboard and audit view --- .../frontend/templates/audit/inner.html.j2 | 60 +++- .../frontend/templates/dashboard.html | 306 ++++++++++++------ .../src/sshecret_admin/static/css/main.css | 24 ++ .../src/sshecret_backend/audit.py | 2 +- 4 files changed, 298 insertions(+), 94 deletions(-) diff --git a/packages/sshecret-admin/src/sshecret_admin/frontend/templates/audit/inner.html.j2 b/packages/sshecret-admin/src/sshecret_admin/frontend/templates/audit/inner.html.j2 index 2c1848f..ca353b5 100644 --- a/packages/sshecret-admin/src/sshecret_admin/frontend/templates/audit/inner.html.j2 +++ b/packages/sshecret-admin/src/sshecret_admin/frontend/templates/audit/inner.html.j2 @@ -79,7 +79,65 @@ > - {{ entry.timestamp }} +

{{ entry.timestamp }}

+ + + + + diff --git a/packages/sshecret-admin/src/sshecret_admin/frontend/templates/dashboard.html b/packages/sshecret-admin/src/sshecret_admin/frontend/templates/dashboard.html index 740f740..8c717eb 100644 --- a/packages/sshecret-admin/src/sshecret_admin/frontend/templates/dashboard.html +++ b/packages/sshecret-admin/src/sshecret_admin/frontend/templates/dashboard.html @@ -1,133 +1,255 @@ {% extends "/dashboard/_base.html" %} {% block content %} -
+
+
+

Welcome to Sshecret

+
+ + +
+
+
-

Stats

+

Stats

-
Clients
+
Clients
{{ stats.clients }}
-
Secrets
+
Secrets
{{ stats.secrets }}
-
Audit Events
+
Audit Events
{{ stats.audit_events }}
-
- - -

Last Login Events

{% if last_login_events.total > 0 %} - - - - - - - - - - - {% for entry in last_login_events.results | list %} - - - - - - - - +
TimestampSubsystemClient/UsernameOrigin
- {{ entry.timestamp }} - - {{ entry.subsystem }} - - {% if entry.client_name %} - {{ entry.client_name }} - {% elif entry.data.username %} - {{ entry.data.username }} - {% endif %} - - - {{ entry.origin }} -
+ + + + + + - {% endfor %} - -
TimestampSubsystemClient/UsernameOrigin
- {% else %} -

No entries

- {% endif %} + + + {% for entry in last_login_events.results | list %} + + +

{{ entry.timestamp }} +

+ + + + + + + + + {{ entry.subsystem }} + + + + {% if entry.client_name %} + {{ entry.client_name }} + {% elif entry.data.username %} + {{ entry.data.username }} + {% endif %} + + + + + {{ entry.origin }} + + + {% endfor %} + + + {% else %} +

No entries

+ {% endif %}

Last Audit Events

{% if last_audit_events.total > 0 %} - - - - - - - - - - - {% for entry in last_audit_events.results | list %} - - - - - - - - +
TimestampSubsystemMessageOrigin
- {{ entry.timestamp }} - - {{ entry.subsystem }} - - {{ entry.message }} - - {{ entry.origin }} -
+ + + + + + - {% endfor %} - -
TimestampSubsystemMessageOrigin
- {% else %} -

No entries

- {% endif %} + + + {% for entry in last_audit_events.results | list %} + + +

{{ entry.timestamp }}

+ + + + + + + + + + {{ entry.subsystem }} + + + + {{ entry.message }} + + + + {{ entry.origin }} + + + {% endfor %} + + + {% else %} +

No entries

+ {% endif %}
+ {% include '/clients/drawer_client_create.html.j2' %} {% include '/secrets/drawer_secret_create.html.j2' %} +
{% endblock %} diff --git a/packages/sshecret-admin/src/sshecret_admin/static/css/main.css b/packages/sshecret-admin/src/sshecret_admin/static/css/main.css index fc00079..352298d 100644 --- a/packages/sshecret-admin/src/sshecret_admin/static/css/main.css +++ b/packages/sshecret-admin/src/sshecret_admin/static/css/main.css @@ -1465,6 +1465,9 @@ .py-6 { padding-block: calc(var(--spacing) * 6); } + .py-8 { + padding-block: calc(var(--spacing) * 8); + } .py-12 { padding-block: calc(var(--spacing) * 12); } @@ -1804,6 +1807,10 @@ --tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)); box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); } + .shadow-xs { + --tw-shadow: 0 1px 2px 0 var(--tw-shadow-color, rgb(0 0 0 / 0.05)); + box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); + } .shadow-black { --tw-shadow-color: #000; @supports (color: color-mix(in lab, red, red)) { @@ -2832,6 +2839,18 @@ line-height: var(--tw-leading, var(--text-lg--line-height)); } } + .md\:text-sm { + @media (width >= 48rem) { + font-size: var(--text-sm); + line-height: var(--tw-leading, var(--text-sm--line-height)); + } + } + .md\:text-xs { + @media (width >= 48rem) { + font-size: var(--text-xs); + line-height: var(--tw-leading, var(--text-xs--line-height)); + } + } .md\:hover\:bg-transparent { @media (width >= 48rem) { &:hover { @@ -2980,6 +2999,11 @@ padding-block: calc(var(--spacing) * 0); } } + .lg\:py-16 { + @media (width >= 64rem) { + padding-block: calc(var(--spacing) * 16); + } + } .lg\:pr-3 { @media (width >= 64rem) { padding-right: calc(var(--spacing) * 3); diff --git a/packages/sshecret-backend/src/sshecret_backend/audit.py b/packages/sshecret-backend/src/sshecret_backend/audit.py index 3f0b0be..6593143 100644 --- a/packages/sshecret-backend/src/sshecret_backend/audit.py +++ b/packages/sshecret-backend/src/sshecret_backend/audit.py @@ -177,7 +177,7 @@ def audit_delete_secret( secret_id=secret.id, client_name=client.name, client_id=client.id, - message="Deleted secret.", + message="Secret removed from client", ) _write_audit_log(session, request, entry, commit)