feat(web): Webhooks page + ALERTS nav group

New /webhooks admin page with table-based subscription management:
- CREATE WEBHOOK (inline form row — no modal) with simple-event
  checkboxes (AttackerDetail / DeckyStatus / SystemStatus) that
  expand to bus-topic patterns server-side, and an advanced-mode
  textarea for raw NATS-style patterns.
- Bulk-select + DELETE SELECTED with two-click arm pattern.
- Per-row test-ping (zap), pencil edit, and delete actions.
- Last-fired timestamp column.
- Yellow banner surfacing insecure_url warnings (WH-03): http:// is
  allowed but flagged so operators see it on every page load.
- Post-create secret modal — the secret is shown exactly once with
  a COPY button and a clear "won't see this again" notice.

Sidebar nav regrouped: /live-logs and /webhooks now live under a new
ALERTS NavGroup (Bell icon). The alertCount badge rides the Live
Logs sub-item. Command palette gains a "Webhooks" GO TO entry with
the `G W` chord.

Side-fix: useFocusSearch.ts was failing the build under
verbatimModuleSyntax (pre-existing, unrelated). Split the React
import to satisfy tsc; no behavioural change.
This commit is contained in:
2026-04-24 16:03:53 -04:00
parent c2ff8d1a4f
commit 59c405d9e5
6 changed files with 851 additions and 12 deletions

View File

@@ -0,0 +1,239 @@
.webhooks-page {
display: flex;
flex-direction: column;
gap: 24px;
}
.webhooks-header {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 16px;
border-bottom: 1px solid var(--border-color);
}
.webhooks-header h2 {
margin: 0;
font-size: 0.95rem;
letter-spacing: 2px;
text-transform: uppercase;
color: var(--text-color);
}
.webhooks-header-actions {
display: flex;
gap: 12px;
}
.webhooks-warning-banner {
background: rgba(224, 160, 64, 0.1);
border: 1px solid var(--warn);
color: var(--warn);
padding: 10px 16px;
font-size: 0.78rem;
letter-spacing: 1px;
display: flex;
align-items: center;
gap: 10px;
}
.webhooks-empty {
padding: 48px;
text-align: center;
opacity: 0.5;
font-size: 0.82rem;
letter-spacing: 1.5px;
border: 1px dashed var(--border-color);
}
.webhooks-table-wrap {
overflow-x: auto;
}
.webhooks-table {
width: 100%;
border-collapse: collapse;
font-size: 0.8rem;
}
.webhooks-table thead {
font-size: 0.65rem;
letter-spacing: 1.5px;
opacity: 0.6;
}
.webhooks-table th,
.webhooks-table td {
padding: 10px 12px;
text-align: left;
border-bottom: 1px solid rgba(48, 54, 61, 0.5);
vertical-align: middle;
}
.webhooks-table tbody tr:hover {
background: rgba(0, 255, 65, 0.03);
}
.webhooks-table .col-check {
width: 32px;
}
.webhooks-table .col-actions {
width: 140px;
}
.wh-url-cell {
font-family: var(--font-mono);
max-width: 260px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.wh-chip {
font-size: 0.68rem;
padding: 2px 6px;
border: 1px solid var(--accent-tint-30, rgba(0, 255, 65, 0.3));
background: var(--accent-tint-10, rgba(0, 255, 65, 0.1));
color: var(--accent-color);
letter-spacing: 0.5px;
font-family: var(--font-mono);
margin-right: 4px;
display: inline-block;
}
.wh-chip.status-disabled {
border-color: var(--border-color);
color: var(--text-color);
background: transparent;
opacity: 0.6;
}
.wh-chip.status-fail {
border-color: var(--alert, #ff4d4d);
background: rgba(255, 77, 77, 0.12);
color: var(--alert, #ff4d4d);
}
.wh-chip.status-warn {
border-color: var(--warn, #e0a040);
background: rgba(224, 160, 64, 0.1);
color: var(--warn, #e0a040);
}
.wh-actions {
display: flex;
gap: 6px;
}
/* Inline create / edit form, rendered as an expanded row. */
.wh-form-row td {
padding: 20px 12px;
background: rgba(0, 0, 0, 0.2);
}
.wh-form-grid {
display: grid;
grid-template-columns: 1fr 2fr;
gap: 14px;
max-width: 900px;
}
.wh-form-grid label {
font-size: 0.65rem;
letter-spacing: 1px;
opacity: 0.6;
align-self: center;
}
.wh-form-grid input[type="text"],
.wh-form-grid input[type="url"],
.wh-form-grid input[type="password"],
.wh-form-grid textarea {
background: #0d1117;
border: 1px solid var(--border-color);
color: var(--text-color);
padding: 8px 12px;
font-family: inherit;
font-size: 0.82rem;
width: 100%;
box-sizing: border-box;
}
.wh-form-grid textarea {
min-height: 80px;
font-family: var(--font-mono);
}
.wh-form-grid .wh-checkbox-group {
display: flex;
gap: 16px;
flex-wrap: wrap;
}
.wh-form-grid .wh-checkbox-group label {
font-size: 0.78rem;
letter-spacing: 0.5px;
opacity: 1;
display: flex;
align-items: center;
gap: 6px;
cursor: pointer;
}
.wh-form-buttons {
grid-column: 1 / -1;
display: flex;
gap: 10px;
justify-content: flex-end;
padding-top: 8px;
border-top: 1px dashed var(--border-color);
}
.wh-secret-modal-backdrop {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.wh-secret-modal {
background: var(--secondary-color);
border: 1px solid var(--violet);
box-shadow: 0 0 24px rgba(238, 130, 238, 0.4);
padding: 28px;
max-width: 560px;
width: 100%;
font-family: var(--font-mono);
}
.wh-secret-modal h3 {
margin: 0 0 12px 0;
color: var(--violet);
letter-spacing: 2px;
font-size: 0.9rem;
}
.wh-secret-modal .wh-secret-warn {
color: var(--warn);
font-size: 0.78rem;
margin-bottom: 16px;
}
.wh-secret-modal .wh-secret-value {
background: #0d1117;
border: 1px solid var(--border-color);
padding: 10px 12px;
font-size: 0.85rem;
word-break: break-all;
margin-bottom: 16px;
}
.wh-secret-modal .wh-secret-actions {
display: flex;
gap: 10px;
justify-content: flex-end;
}