Fixing the caching issue
This commit is contained in:
1 parent
ea343f7943
commit
0e172af880
3 files changed
+206
-30
No files matched your search
+107
-7
@@ -228,31 +228,131 @@ code, pre { font-family: var(--font-mono); }
|
|||||||
padding: 20px 24px;
|
padding: 20px 24px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
box-shadow: var(--shadow-sm);
|
box-shadow: var(--shadow-sm);
|
||||||
|
max-width: 860px;
|
||||||
}
|
}
|
||||||
.settings-section h2 {
|
.settings-section h2 {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding-bottom: 12px;
|
padding-bottom: 12px;
|
||||||
border-bottom: 1px solid var(--border);
|
border-bottom: 1px solid var(--border);
|
||||||
margin-bottom: 16px;
|
margin-bottom: 18px;
|
||||||
}
|
}
|
||||||
.settings-section form { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
|
|
||||||
.settings-section label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-muted); }
|
.settings-form { display: flex; flex-direction: column; gap: 18px; }
|
||||||
.settings-section input, .settings-section select, .settings-section textarea {
|
|
||||||
padding: 8px 10px;
|
/* ---- Toggle grid (tabular on/off switches) ---- */
|
||||||
|
.toggle-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
overflow: hidden;
|
||||||
|
background: var(--surface-2);
|
||||||
|
}
|
||||||
|
.toggle-grid.compact .toggle-row { padding: 10px 14px; }
|
||||||
|
.toggle-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
padding: 14px 16px;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
transition: background .15s;
|
||||||
|
}
|
||||||
|
.toggle-row:last-child { border-bottom: none; }
|
||||||
|
.toggle-row:hover { background: var(--surface-3); }
|
||||||
|
.toggle-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
||||||
|
.toggle-title { font-size: 14px; color: var(--text); font-weight: 500; }
|
||||||
|
.toggle-help { font-size: 12px; color: var(--text-dim); }
|
||||||
|
|
||||||
|
/* iOS-style switch */
|
||||||
|
.switch {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
width: 40px;
|
||||||
|
height: 22px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.switch input { opacity: 0; width: 0; height: 0; }
|
||||||
|
.switch .slider {
|
||||||
|
position: absolute;
|
||||||
|
cursor: pointer;
|
||||||
|
inset: 0;
|
||||||
|
background: var(--surface-3);
|
||||||
|
border: 1px solid var(--border-hi);
|
||||||
|
border-radius: 22px;
|
||||||
|
transition: background .2s, border-color .2s;
|
||||||
|
}
|
||||||
|
.switch .slider::before {
|
||||||
|
position: absolute;
|
||||||
|
content: "";
|
||||||
|
height: 16px;
|
||||||
|
width: 16px;
|
||||||
|
left: 2px;
|
||||||
|
top: 2px;
|
||||||
|
background: var(--text-muted);
|
||||||
|
border-radius: 50%;
|
||||||
|
transition: transform .2s, background .2s;
|
||||||
|
}
|
||||||
|
.switch input:checked + .slider {
|
||||||
|
background: var(--accent-hover);
|
||||||
|
border-color: var(--accent-hover);
|
||||||
|
}
|
||||||
|
.switch input:checked + .slider::before {
|
||||||
|
transform: translateX(18px);
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
.switch input:focus-visible + .slider {
|
||||||
|
box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Labeled input rows ---- */
|
||||||
|
.field-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 14px 20px;
|
||||||
|
}
|
||||||
|
.field-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
|
||||||
|
.field-row.wide { grid-column: 1 / -1; }
|
||||||
|
.field-label {
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: .5px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.field-input {
|
||||||
|
padding: 8px 12px;
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
background: var(--surface-2);
|
background: var(--surface-2);
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
border-radius: var(--radius-sm);
|
border-radius: var(--radius-sm);
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
|
transition: border-color .15s, box-shadow .15s;
|
||||||
}
|
}
|
||||||
.settings-section input:focus, .settings-section select:focus, .settings-section textarea:focus {
|
.field-input:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
border-color: var(--accent);
|
border-color: var(--accent);
|
||||||
box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.15);
|
box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.15);
|
||||||
}
|
}
|
||||||
.settings-section button { align-self: flex-start; }
|
.field-input::placeholder { color: var(--text-dim); }
|
||||||
|
|
||||||
|
/* Inline (non-grid) single field row */
|
||||||
|
.settings-form > .field-row { max-width: 280px; }
|
||||||
|
|
||||||
|
.form-bar {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
padding-top: 12px;
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.field-grid { grid-template-columns: 1fr; }
|
||||||
|
.toggle-row { padding: 12px 14px; }
|
||||||
|
}
|
||||||
|
|
||||||
/* ========================================================================
|
/* ========================================================================
|
||||||
Buttons (global)
|
Buttons (global)
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>{% block title %}UPS Dashboard{% endblock %}</title>
|
<title>{% block title %}UPS Dashboard{% endblock %}</title>
|
||||||
<meta name="csrf-token" content="{{ request.cookies.get('csrf_token', '') }}" />
|
<meta name="csrf-token" content="{{ request.cookies.get('csrf_token', '') }}" />
|
||||||
<link rel="stylesheet" href="/static/css/base.css?v=3" />
|
<link rel="stylesheet" href="/static/css/base.css?v=4" />
|
||||||
<link rel="stylesheet" href="/static/css/style.css?v=3" />
|
<link rel="stylesheet" href="/static/css/style.css?v=4" />
|
||||||
{% block head_extra %}{% endblock %}
|
{% block head_extra %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<main class="site-main">
|
<main class="site-main">
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</main>
|
</main>
|
||||||
<script src="/static/js/app.js?v=3"></script>
|
<script src="/static/js/app.js?v=4"></script>
|
||||||
{% block scripts %}{% endblock %}
|
{% block scripts %}{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+96
-20
@@ -7,38 +7,114 @@
|
|||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<section class="settings-section">
|
<section class="settings-section">
|
||||||
<h2>UI / Feature Flags</h2>
|
<h2>UI / Feature Flags</h2>
|
||||||
<form id="ui-form">
|
<form id="ui-form" class="settings-form">
|
||||||
<label><input type="checkbox" name="show_events"> Show events tile</label>
|
<div class="toggle-grid">
|
||||||
<label><input type="checkbox" name="show_energy"> Show energy</label>
|
<div class="toggle-row">
|
||||||
<label><input type="checkbox" name="color_badges"> Colorize badges</label>
|
<div class="toggle-label">
|
||||||
<label><input type="checkbox" name="enable_transfer_burst_alert"> Transfer-burst alerts</label>
|
<span class="toggle-title">Show events tile</span>
|
||||||
<label><input type="checkbox" name="enable_voltage_deviation_alert"> Voltage-deviation alerts</label>
|
<span class="toggle-help">Display the recent-events marquee on each UPS card</span>
|
||||||
<label>Energy cost per kWh ($): <input type="number" step="0.001" min="0" name="energy_cost_per_kwh"></label>
|
</div>
|
||||||
|
<label class="switch"><input type="checkbox" name="show_events"><span class="slider"></span></label>
|
||||||
|
</div>
|
||||||
|
<div class="toggle-row">
|
||||||
|
<div class="toggle-label">
|
||||||
|
<span class="toggle-title">Show energy</span>
|
||||||
|
<span class="toggle-help">Show today's kWh and estimated cost on cards</span>
|
||||||
|
</div>
|
||||||
|
<label class="switch"><input type="checkbox" name="show_energy"><span class="slider"></span></label>
|
||||||
|
</div>
|
||||||
|
<div class="toggle-row">
|
||||||
|
<div class="toggle-label">
|
||||||
|
<span class="toggle-title">Colorize badges</span>
|
||||||
|
<span class="toggle-help">Color-code runtime/watts/headroom pills</span>
|
||||||
|
</div>
|
||||||
|
<label class="switch"><input type="checkbox" name="color_badges"><span class="slider"></span></label>
|
||||||
|
</div>
|
||||||
|
<div class="toggle-row">
|
||||||
|
<div class="toggle-label">
|
||||||
|
<span class="toggle-title">Transfer-burst alerts</span>
|
||||||
|
<span class="toggle-help">Alert when ≥3 ONBATT events occur within an hour</span>
|
||||||
|
</div>
|
||||||
|
<label class="switch"><input type="checkbox" name="enable_transfer_burst_alert"><span class="slider"></span></label>
|
||||||
|
</div>
|
||||||
|
<div class="toggle-row">
|
||||||
|
<div class="toggle-label">
|
||||||
|
<span class="toggle-title">Voltage-deviation alerts</span>
|
||||||
|
<span class="toggle-help">Alert when line voltage deviates >8% from nominal</span>
|
||||||
|
</div>
|
||||||
|
<label class="switch"><input type="checkbox" name="enable_voltage_deviation_alert"><span class="slider"></span></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field-row">
|
||||||
|
<label class="field-label" for="energy-cost">Energy cost per kWh ($)</label>
|
||||||
|
<input class="field-input" id="energy-cost" type="number" step="0.001" min="0" name="energy_cost_per_kwh">
|
||||||
|
</div>
|
||||||
|
<div class="form-bar">
|
||||||
<button type="submit" class="btn btn-primary">Save UI Settings</button>
|
<button type="submit" class="btn btn-primary">Save UI Settings</button>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="settings-section">
|
<section class="settings-section">
|
||||||
<h2>SMTP / Email Alerts</h2>
|
<h2>SMTP / Email Alerts</h2>
|
||||||
<form id="smtp-form">
|
<form id="smtp-form" class="settings-form">
|
||||||
<label>Host <input type="text" name="host" required></label>
|
<div class="field-grid">
|
||||||
<label>Port <input type="number" name="port" min="1" max="65535" required></label>
|
<div class="field-row">
|
||||||
<label>Username <input type="text" name="username"></label>
|
<label class="field-label" for="smtp-host">Host *</label>
|
||||||
<label><input type="checkbox" name="use_tls"> Use STARTTLS</label>
|
<input class="field-input" id="smtp-host" type="text" name="host" required>
|
||||||
<label><input type="checkbox" name="use_ssl"> Use SSL</label>
|
</div>
|
||||||
<label>From <input type="email" name="from_addr"></label>
|
<div class="field-row">
|
||||||
<label>To (comma-separated) <input type="text" name="to_addrs"></label>
|
<label class="field-label" for="smtp-port">Port *</label>
|
||||||
<label>Subject Prefix <input type="text" name="subject_prefix" value="[UPS]"></label>
|
<input class="field-input" id="smtp-port" type="number" name="port" min="1" max="65535" required>
|
||||||
<label>Silent hours start (0-23, optional) <input type="number" name="silent_hours_start" min="0" max="23"></label>
|
</div>
|
||||||
<label>Silent hours end (0-23, optional) <input type="number" name="silent_hours_end" min="0" max="23"></label>
|
<div class="field-row">
|
||||||
<label>Daily summary hour (0-23, optional) <input type="number" name="daily_summary_hour" min="0" max="23"></label>
|
<label class="field-label" for="smtp-user">Username</label>
|
||||||
|
<input class="field-input" id="smtp-user" type="text" name="username">
|
||||||
|
</div>
|
||||||
|
<div class="field-row">
|
||||||
|
<label class="field-label" for="smtp-from">From address</label>
|
||||||
|
<input class="field-input" id="smtp-from" type="email" name="from_addr">
|
||||||
|
</div>
|
||||||
|
<div class="field-row wide">
|
||||||
|
<label class="field-label" for="smtp-to">To (comma-separated)</label>
|
||||||
|
<input class="field-input" id="smtp-to" type="text" name="to_addrs">
|
||||||
|
</div>
|
||||||
|
<div class="field-row">
|
||||||
|
<label class="field-label" for="smtp-subj">Subject prefix</label>
|
||||||
|
<input class="field-input" id="smtp-subj" type="text" name="subject_prefix" value="[UPS]">
|
||||||
|
</div>
|
||||||
|
<div class="field-row">
|
||||||
|
<label class="field-label" for="smtp-sh-start">Silent hours start</label>
|
||||||
|
<input class="field-input" id="smtp-sh-start" type="number" name="silent_hours_start" min="0" max="23" placeholder="0-23">
|
||||||
|
</div>
|
||||||
|
<div class="field-row">
|
||||||
|
<label class="field-label" for="smtp-sh-end">Silent hours end</label>
|
||||||
|
<input class="field-input" id="smtp-sh-end" type="number" name="silent_hours_end" min="0" max="23" placeholder="0-23">
|
||||||
|
</div>
|
||||||
|
<div class="field-row">
|
||||||
|
<label class="field-label" for="smtp-daily">Daily summary hour</label>
|
||||||
|
<input class="field-input" id="smtp-daily" type="number" name="daily_summary_hour" min="0" max="23" placeholder="0-23">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="toggle-grid compact">
|
||||||
|
<div class="toggle-row">
|
||||||
|
<div class="toggle-label"><span class="toggle-title">Use STARTTLS</span></div>
|
||||||
|
<label class="switch"><input type="checkbox" name="use_tls"><span class="slider"></span></label>
|
||||||
|
</div>
|
||||||
|
<div class="toggle-row">
|
||||||
|
<div class="toggle-label"><span class="toggle-title">Use SSL</span></div>
|
||||||
|
<label class="switch"><input type="checkbox" name="use_ssl"><span class="slider"></span></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<p class="muted">Password is read from the <code>SMTP_PASSWORD</code> environment variable and never stored in Redis.</p>
|
<p class="muted">Password is read from the <code>SMTP_PASSWORD</code> environment variable and never stored in Redis.</p>
|
||||||
|
<div class="form-bar">
|
||||||
<button type="submit" class="btn btn-primary">Save SMTP</button>
|
<button type="submit" class="btn btn-primary">Save SMTP</button>
|
||||||
<button type="button" id="test-smtp-btn" class="btn btn-secondary">Send Test Email</button>
|
<button type="button" id="test-smtp-btn" class="btn btn-secondary">Send Test Email</button>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="/static/js/settings.js?v=3"></script>
|
<script src="/static/js/settings.js?v=4"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in new issue
Block a user