From 8e5a549c2cad6b716a9e16c22ba46180b430d0d3 Mon Sep 17 00:00:00 2001 From: nessi Date: Thu, 12 Feb 2026 16:37:31 +0100 Subject: [PATCH] Add template variables display and SMTP settings UI updates This commit introduces a new section for template variables in the Admin Users page, improving clarity by listing placeholders available for email templates. It also enhances the SMTP settings interface with clearer organization and additional features like clearing stored passwords. Associated styling updates include new visual elements for template variables and subcards. --- frontend/src/pages/AdminUsersPage.jsx | 301 ++++++++++++++------------ frontend/src/styles.css | 34 +++ 2 files changed, 200 insertions(+), 135 deletions(-) diff --git a/frontend/src/pages/AdminUsersPage.jsx b/frontend/src/pages/AdminUsersPage.jsx index 80359af..ee12dfd 100644 --- a/frontend/src/pages/AdminUsersPage.jsx +++ b/frontend/src/pages/AdminUsersPage.jsx @@ -2,6 +2,21 @@ import React, { useEffect, useState } from "react"; import { apiFetch } from "../api"; import { useAuth } from "../state"; +const TEMPLATE_VARIABLES = [ + "target_name", + "target_id", + "alert_name", + "severity", + "category", + "description", + "message", + "value", + "warning_threshold", + "alert_threshold", + "checked_at", + "alert_key", +]; + export function AdminUsersPage() { const { tokens, refresh, me } = useAuth(); const [users, setUsers] = useState([]); @@ -223,148 +238,164 @@ export function AdminUsersPage() { {smtpInfo &&
{smtpInfo}
}
- +
+

SMTP Settings

+
+ -
- - setEmailSettings({ ...emailSettings, smtp_host: e.target.value })} - /> -
-
- - setEmailSettings({ ...emailSettings, smtp_port: Number(e.target.value || 587) })} - /> -
+
+ + setEmailSettings({ ...emailSettings, smtp_host: e.target.value })} + /> +
+
+ + setEmailSettings({ ...emailSettings, smtp_port: Number(e.target.value || 587) })} + /> +
-
- - setEmailSettings({ ...emailSettings, smtp_username: e.target.value })} - /> -
-
- - setEmailSettings({ ...emailSettings, smtp_password: e.target.value, clear_smtp_password: false })} - /> -
+
+ + setEmailSettings({ ...emailSettings, smtp_username: e.target.value })} + /> +
+
+ + setEmailSettings({ ...emailSettings, smtp_password: e.target.value, clear_smtp_password: false })} + /> +
-
- - setEmailSettings({ ...emailSettings, from_name: e.target.value })} - /> -
-
- - setEmailSettings({ ...emailSettings, from_email: e.target.value })} - /> -
-
- -
- - - +
+ + setEmailSettings({ ...emailSettings, from_name: e.target.value })} + /> +
+
+ + setEmailSettings({ ...emailSettings, from_email: e.target.value })} + /> +
+ +
+ +
+ + + +
+ Select exactly one mode to avoid STARTTLS/SSL conflicts. +
+ +
- Select exactly one mode to avoid STARTTLS/SSL conflicts. -
-
- - - Use placeholders like: {"{target_name}"}, {"{alert_name}"}, {"{severity}"}, {"{description}"}, {"{message}"}, {"{value}"}, {"{warning_threshold}"}, {"{alert_threshold}"}, {"{checked_at}"}, {"{alert_key}"} -
-
- - setEmailSettings({ ...emailSettings, warning_subject_template: e.target.value })} - /> -
-
- - setEmailSettings({ ...emailSettings, alert_subject_template: e.target.value })} - /> -
-
- -