Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
612516db76 |
No files matched your search
@@ -4,6 +4,12 @@
|
||||
|
||||
Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow SemVer.
|
||||
|
||||
## [1.5.2] - 2026-11-15
|
||||
|
||||
### Changed
|
||||
|
||||
- Incidents redesigned after a UX review: ticket page with a sticky header and quick actions, a main column (summary + unified activity timeline of comments and changes) and a sidebar with inline-saved properties and compact technical data; the list is a dense table with one-line underlined tabs, and the empty state offers "See all". No more empty gaps between panels.
|
||||
|
||||
## [1.5.1] - 2026-11-15
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
|
||||
Formato baseado no [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/); versionamento segue SemVer.
|
||||
|
||||
## [1.5.2] - 2026-11-15
|
||||
|
||||
### Alterado
|
||||
|
||||
- Incidentes redesenhados após revisão de UX: página do chamado com cabeçalho fixo e ações rápidas, coluna principal (resumo + linha do tempo única de comentários e alterações) e barra lateral com propriedades salvas na hora e dados técnicos compactos; a lista virou tabela densa com abas numa linha e o estado vazio oferece "Ver todos". Acabaram os vazios entre painéis.
|
||||
|
||||
## [1.5.1] - 2026-11-15
|
||||
|
||||
### Corrigido
|
||||
|
||||
@@ -2,4 +2,4 @@ package app
|
||||
|
||||
// Version is the release version (SemVer). Release builds may override it with
|
||||
// -ldflags "-X .../internal/app.Version=...".
|
||||
var Version = "1.5.1"
|
||||
var Version = "1.5.2"
|
||||
@@ -1,87 +1,171 @@
|
||||
/* Urutau - INCIDENTS page. Ticket text is untrusted: long words wrap, nothing forces horizontal scroll. */
|
||||
/* Urutau - INCIDENTS page. Ticket text is untrusted: long words wrap or truncate, nothing forces horizontal scroll.
|
||||
Spacing scale 4/8/12/16/24; controls 32px; secondary text .8125rem muted. */
|
||||
.inc-page { min-width: 0; }
|
||||
.inc-lead { color: var(--ink-muted); max-width: 70ch; margin: 0 0 var(--s-3); }
|
||||
.inc-hint { font-size: .8125rem; color: var(--ink-muted); overflow-wrap: anywhere; }
|
||||
.inc-author { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-3); }
|
||||
.inc-author label { font-size: .875rem; color: var(--ink-muted); }
|
||||
.inc-author input { width: 12rem; max-width: 100%; min-height: 32px; padding: 3px 10px; }
|
||||
|
||||
.inc-tabs { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-3); }
|
||||
.inc-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-raised); color: var(--ink); cursor: pointer; font: inherit; }
|
||||
.inc-tab:hover { border-color: var(--line-strong); }
|
||||
.inc-tab:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
|
||||
.inc-tab.on { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
|
||||
.inc-n { font-size: .8125rem; color: var(--ink-muted); }
|
||||
.inc-toolbar select { max-width: 100%; }
|
||||
|
||||
.inc-list { display: grid; gap: var(--s-2); }
|
||||
.inc-row {
|
||||
display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: var(--s-2) var(--s-3); align-items: center;
|
||||
padding: var(--s-3) var(--s-4); background: var(--surface-panel); border: 1px solid var(--line); border-left: 4px solid var(--line-strong);
|
||||
border-radius: var(--radius-sm); color: var(--ink); text-decoration: none;
|
||||
}
|
||||
.inc-row:hover { border-color: var(--line-strong); background: var(--surface-raised); }
|
||||
.inc-row:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
|
||||
.inc-sev-critical, .inc-sev-high { border-left-color: var(--danger); }
|
||||
.inc-sev-medium { border-left-color: var(--warn); }
|
||||
.inc-sev-low { border-left-color: var(--info); }
|
||||
.inc-id { font-weight: 600; white-space: nowrap; }
|
||||
.inc-badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
|
||||
.inc-main { min-width: 0; display: grid; gap: 2px; }
|
||||
.inc-title { overflow-wrap: anywhere; }
|
||||
.inc-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; color: var(--ink-muted); min-width: 0; }
|
||||
.inc-route { overflow-wrap: anywhere; }
|
||||
.inc-side { display: grid; gap: 2px; justify-items: end; font-size: .8125rem; color: var(--ink-muted); white-space: nowrap; }
|
||||
|
||||
.inc-back { display: inline-block; margin-bottom: var(--s-3); color: var(--accent); text-decoration: none; }
|
||||
.inc-back:hover { text-decoration: underline; }
|
||||
.inc-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-4); padding: var(--s-3) var(--s-4); background: var(--surface-panel); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: var(--radius-sm); }
|
||||
.inc-h-title { flex: 1 1 100%; margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
|
||||
.inc-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
|
||||
.inc-detail.busy { opacity: .6; pointer-events: none; }
|
||||
.inc-grid { align-items: start; }
|
||||
|
||||
.inc-quick { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-4); }
|
||||
.inc-q-fp:not(:disabled) { border-color: var(--line-strong); }
|
||||
.inc-q-tp:not(:disabled) { border-color: var(--danger); color: var(--danger); }
|
||||
.inc-q-ok:not(:disabled) { border-color: var(--ok); color: var(--ok); }
|
||||
.inc-form { display: grid; gap: var(--s-3); }
|
||||
.inc-two { align-items: start; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
|
||||
.inc-field { display: grid; gap: 4px; min-width: 0; }
|
||||
.inc-field label { font-size: .875rem; font-weight: 600; }
|
||||
.inc-field input[type="text"], .inc-field select, .inc-field textarea, .inc-newc textarea { width: 100%; min-width: 0; box-sizing: border-box; }
|
||||
.inc-link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: .8125rem; }
|
||||
.inc-link:hover { text-decoration: underline; }
|
||||
.inc-link:focus-visible, .inc-title-btn:focus-visible, .inc-tab:focus-visible, .inc-info:focus-visible { outline: 0; box-shadow: var(--focus-ring); border-radius: 4px; }
|
||||
.inc-page .btn, .inc-page select, .inc-page input[type="text"], .inc-page input[type="search"] { min-height: 32px; padding-top: 3px; padding-bottom: 3px; }
|
||||
.inc-page .btn.sm { min-height: 32px; padding: 3px 12px; font-size: .875rem; }
|
||||
.inc-page textarea, .inc-dlg textarea {
|
||||
background: var(--surface-raised); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm);
|
||||
padding: 8px 12px; font: inherit; resize: vertical; min-height: 72px;
|
||||
padding: 8px 12px; font: inherit; resize: vertical; min-height: 64px; width: 100%; box-sizing: border-box;
|
||||
}
|
||||
.inc-page textarea:focus-visible, .inc-dlg textarea:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
|
||||
.inc-check { display: flex; align-items: center; gap: var(--s-2); }
|
||||
.inc-check input { width: 18px; height: 18px; flex: none; }
|
||||
.inc-btns { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: flex-end; margin-top: var(--s-3); }
|
||||
.inc-err { color: var(--danger); margin: var(--s-2) 0 0; }
|
||||
.inc-field { display: grid; gap: 4px; min-width: 0; }
|
||||
.inc-field label { font-size: .875rem; font-weight: 600; }
|
||||
.inc-form { display: grid; gap: var(--s-3); }
|
||||
.inc-field input[type="text"], .inc-field select { width: 100%; box-sizing: border-box; min-width: 0; }
|
||||
.inc-dlg { width: min(34rem, calc(100vw - 32px)); }
|
||||
.inc-btns { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: flex-end; margin-top: var(--s-2); }
|
||||
.inc-err { color: var(--danger); margin: var(--s-2) 0 0; font-size: .875rem; }
|
||||
.inc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-faint); flex: none; display: inline-block; }
|
||||
.inc-d-critical, .inc-d-high { background: var(--danger); }
|
||||
.inc-d-medium { background: var(--warn); }
|
||||
.inc-d-low { background: var(--info); }
|
||||
.inc-id { font-weight: 600; white-space: nowrap; }
|
||||
|
||||
.inc-dl { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 6px var(--s-3); margin: 0; }
|
||||
.inc-dl dt { color: var(--ink-muted); font-size: .8125rem; }
|
||||
.inc-dl dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
|
||||
.inc-key { font-size: .75rem; }
|
||||
|
||||
.inc-comments { list-style: none; margin: 0 0 var(--s-3); padding: 0; display: grid; gap: var(--s-3); }
|
||||
.inc-comments li { padding: var(--s-3); background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-sm); }
|
||||
.inc-c-h { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: baseline; margin-bottom: 4px; }
|
||||
.inc-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
|
||||
.inc-tl { list-style: none; margin: 0; padding: 0 0 0 var(--s-3); border-left: 2px solid var(--line); display: grid; gap: var(--s-3); }
|
||||
.inc-tl li { display: grid; gap: 2px; min-width: 0; }
|
||||
.inc-tl-when { font-size: .75rem; color: var(--ink-muted); }
|
||||
.inc-tl-what { overflow-wrap: anywhere; }
|
||||
.inc-tl-chg { overflow-wrap: anywhere; font-size: .875rem; }
|
||||
.inc-from { color: var(--ink-muted); text-decoration: line-through; }
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.inc-row { grid-template-columns: minmax(0, 1fr); }
|
||||
.inc-side { justify-items: start; grid-auto-flow: column; gap: var(--s-3); }
|
||||
.inc-two { grid-template-columns: minmax(0, 1fr); }
|
||||
.inc-quick .btn { flex: 1 1 100%; white-space: normal; }
|
||||
.inc-tab { flex: 1 1 auto; }
|
||||
/* ---------------- list */
|
||||
.inc-bar { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-4); border-bottom: 1px solid var(--line); }
|
||||
.inc-tabwrap { display: flex; align-items: center; gap: var(--s-2); min-width: 0; flex: 1 1 auto; }
|
||||
.inc-info { color: var(--ink-muted); cursor: help; font-size: 1rem; flex: none; }
|
||||
.inc-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: var(--s-1); min-width: 0; scrollbar-width: thin; }
|
||||
.inc-tab { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 var(--s-3); border: 0; border-bottom: 2px solid transparent; background: none; color: var(--ink-muted); cursor: pointer; font: inherit; font-size: .875rem; white-space: nowrap; flex: none; margin-bottom: -1px; }
|
||||
.inc-tab:hover { color: var(--ink); }
|
||||
.inc-tab.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
|
||||
.inc-tab.zero { opacity: .6; }
|
||||
.inc-n { font-size: .75rem; color: var(--ink-muted); background: var(--surface-raised); border-radius: 999px; padding: 0 6px; }
|
||||
.inc-tab-sep { width: 1px; background: var(--line); margin: 8px var(--s-2); flex: none; }
|
||||
.inc-toolbar { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; padding-bottom: var(--s-2); flex: none; }
|
||||
.inc-search { width: 240px; max-width: 100%; }
|
||||
@media (max-width: 1500px) {
|
||||
.inc-bar { flex-direction: column; align-items: stretch; gap: var(--s-2); border-bottom: 0; }
|
||||
.inc-tabwrap { border-bottom: 1px solid var(--line); }
|
||||
.inc-toolbar { padding-bottom: 0; }
|
||||
.inc-search { flex: 1 1 200px; }
|
||||
}
|
||||
|
||||
.inc-table { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-panel); }
|
||||
.inc-thead, .inc-row {
|
||||
display: grid; grid-template-columns: 10px 72px minmax(0, 1fr) 132px 110px 140px 76px; gap: var(--s-3); align-items: center; padding: 8px var(--s-3);
|
||||
}
|
||||
.inc-thead { border-radius: var(--radius-sm) var(--radius-sm) 0 0; position: sticky; top: var(--topbar-h, 56px); z-index: 2; background: var(--surface-raised); border-bottom: 1px solid var(--line); font-size: .75rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .04em; }
|
||||
.inc-thead .r { text-align: right; }
|
||||
.inc-row { min-height: 44px; box-sizing: border-box; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
|
||||
.inc-row:last-child { border-bottom: 0; }
|
||||
.inc-row:hover { background: var(--surface-raised); }
|
||||
.inc-row:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px var(--accent); }
|
||||
.inc-main { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
|
||||
.inc-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; font-weight: 500; }
|
||||
.inc-rtags { display: inline-flex; gap: 4px; flex: none; }
|
||||
.inc-rtags .chip { margin: 0; font-size: .75rem; }
|
||||
.inc-who, .inc-where { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8125rem; color: var(--ink-muted); min-width: 0; }
|
||||
.inc-where { font-size: .75rem; }
|
||||
.inc-when { text-align: right; font-size: .8125rem; color: var(--ink-muted); white-space: nowrap; }
|
||||
.inc-empty { display: grid; justify-items: center; gap: var(--s-2); padding: 48px var(--s-4); text-align: center; }
|
||||
.inc-results .pgr { margin-top: var(--s-4); }
|
||||
@media (max-width: 720px) {
|
||||
.inc-thead { display: none; }
|
||||
.inc-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-3); padding: var(--s-3); }
|
||||
.inc-row > :nth-child(3) { order: 4; flex: 1 1 100%; }
|
||||
.inc-row > :nth-child(4) { order: 5; flex: none; }
|
||||
.inc-row > :nth-child(5) { order: 6; flex: none; }
|
||||
.inc-row > :nth-child(6) { order: 7; flex: 1 1 100%; }
|
||||
.inc-row > :nth-child(7) { order: 3; margin-left: auto; }
|
||||
.inc-search { width: 100%; flex-basis: 100%; }
|
||||
}
|
||||
|
||||
/* ---------------- detail */
|
||||
.inc-back { display: inline-block; margin-bottom: var(--s-3); color: var(--accent); text-decoration: none; font-size: .875rem; }
|
||||
.inc-back:hover { text-decoration: underline; }
|
||||
.inc-detail.busy { pointer-events: none; }
|
||||
.inc-head { position: sticky; top: var(--topbar-h, 56px); z-index: 5; display: grid; gap: var(--s-2); padding: var(--s-3) 0; margin-bottom: var(--s-4); background: var(--surface-base); border-bottom: 1px solid var(--line); }
|
||||
.inc-h1 { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
|
||||
.inc-h-title { flex: 1 1 auto; margin: 0; font-size: 1.25rem; font-weight: 700; min-width: 0; line-height: 1.3; }
|
||||
.inc-title-btn { all: unset; cursor: text; display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.inc-title-btn:hover { text-decoration: underline dotted; }
|
||||
.inc-title-in { width: 100%; box-sizing: border-box; font-size: 1.125rem; }
|
||||
.inc-quick { display: flex; gap: var(--s-2); flex: none; }
|
||||
.inc-q-tp:not(:disabled) { border-color: var(--danger); color: var(--danger); }
|
||||
.inc-q-ok:not(:disabled) { border-color: var(--ok); color: var(--ok); }
|
||||
.inc-h2 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); min-width: 0; }
|
||||
.inc-h2 .chip { margin: 0; }
|
||||
.inc-metaline { margin-left: var(--s-2); }
|
||||
|
||||
.inc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s-4); align-items: start; max-width: 1280px; }
|
||||
.inc-maincol { display: grid; gap: var(--s-4); min-width: 0; }
|
||||
.inc-aside { display: grid; gap: var(--s-4); position: sticky; top: calc(var(--topbar-h, 56px) + 96px); min-width: 0; align-self: start; }
|
||||
.inc-card { background: var(--surface-panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s-3) var(--s-4); min-width: 0; box-sizing: border-box; }
|
||||
.inc-card h2, .inc-tech summary { margin: 0 0 var(--s-3); font-size: .9375rem; font-weight: 600; }
|
||||
.inc-card-h { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-2); }
|
||||
.inc-card-h h2 { margin: 0; }
|
||||
.inc-summary.empty { background: none; border: 0; padding: 0; }
|
||||
.inc-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
.inc-pre { margin: var(--s-2) 0 0; padding: var(--s-2) var(--s-3); background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius-sm); font: .75rem/1.5 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 12rem; overflow: auto; }
|
||||
|
||||
.inc-prop { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: var(--s-2) var(--s-3); align-items: start; padding: 6px 0; }
|
||||
.inc-prop > label { font-size: .8125rem; color: var(--ink-muted); line-height: 32px; }
|
||||
.inc-prop-c { min-width: 0; }
|
||||
.inc-prop select, .inc-prop input[type="text"] { width: 100%; box-sizing: border-box; min-width: 0; }
|
||||
.inc-stack { display: grid; gap: 4px; }
|
||||
.inc-stack .inc-link { justify-self: start; }
|
||||
.inc-switch { appearance: none; -webkit-appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line-strong); border: 0; position: relative; cursor: pointer; margin: 6px 0 0; transition: background .15s; }
|
||||
.inc-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-base); transition: transform .15s; }
|
||||
.inc-switch:checked { background: var(--accent); }
|
||||
.inc-switch:checked::after { transform: translateX(16px); }
|
||||
.inc-switch:disabled { opacity: .45; cursor: default; }
|
||||
.inc-switch:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
|
||||
|
||||
.inc-tech summary { cursor: pointer; list-style: none; }
|
||||
.inc-tech summary::-webkit-details-marker { display: none; }
|
||||
.inc-tech summary::after { content: "\25BE"; float: right; color: var(--ink-muted); }
|
||||
.inc-tech:not([open]) summary { margin-bottom: 0; }
|
||||
.inc-tech:not([open]) summary::after { content: "\25B8"; }
|
||||
.inc-dl { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 4px var(--s-3); margin: 0; }
|
||||
.inc-dl dt { color: var(--ink-muted); font-size: .75rem; line-height: 20px; }
|
||||
.inc-dl dd { margin: 0; overflow-wrap: anywhere; min-width: 0; font-size: .8125rem; line-height: 20px; }
|
||||
.inc-keyrow { display: flex; gap: var(--s-2); align-items: center; }
|
||||
.inc-key { font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 auto; }
|
||||
|
||||
.inc-newc { display: grid; gap: var(--s-2); margin-bottom: var(--s-3); }
|
||||
.inc-newc-f { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
|
||||
.inc-newc-f .btn { margin-left: auto; }
|
||||
.inc-as { font-size: .8125rem; color: var(--ink-muted); }
|
||||
.inc-as strong { color: var(--ink); }
|
||||
.inc-as-in { width: 9rem; }
|
||||
.inc-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
|
||||
.inc-cmt { display: flex; gap: var(--s-3); padding: var(--s-3); background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-sm); }
|
||||
.inc-av { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8125rem; flex: none; }
|
||||
.inc-cmt-b { min-width: 0; flex: 1; }
|
||||
.inc-c-h { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: baseline; margin-bottom: 2px; }
|
||||
.inc-ev { display: flex; align-items: baseline; gap: var(--s-2); font-size: .8125rem; color: var(--ink-muted); min-width: 0; padding: 0 var(--s-1); }
|
||||
.inc-ev-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); flex: none; align-self: center; display: inline-block; margin-right: var(--s-2); }
|
||||
.inc-ev-t { min-width: 0; overflow-wrap: anywhere; flex: 1; }
|
||||
.inc-ev-chg { display: inline; }
|
||||
.inc-ev-chg .inc-from, .inc-ev-chg strong { display: -webkit-inline-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; vertical-align: bottom; max-width: 100%; }
|
||||
.inc-from { text-decoration: line-through; }
|
||||
.inc-ev-chg strong { color: var(--ink); font-weight: 600; }
|
||||
.inc-ev-when { flex: none; white-space: nowrap; }
|
||||
.inc-grp { display: block; }
|
||||
.inc-grp summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: var(--s-2); }
|
||||
.inc-grp summary::-webkit-details-marker { display: none; }
|
||||
.inc-sub { margin: var(--s-2) 0 0 var(--s-4); }
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.inc-head { position: static; }
|
||||
.inc-layout { display: flex; flex-direction: column; gap: var(--s-4); }
|
||||
.inc-aside { display: contents; position: static; }
|
||||
.inc-props { order: 1; }
|
||||
.inc-maincol { order: 2; width: 100%; }
|
||||
.inc-tech { order: 3; }
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.inc-h1 { flex-wrap: wrap; }
|
||||
.inc-quick { flex: 1 1 100%; order: 5; overflow-x: auto; padding-bottom: 2px; }
|
||||
.inc-quick .btn { flex: none; }
|
||||
.inc-metaline { margin-left: 0; flex-basis: 100%; }
|
||||
}
|
||||
|
||||
.inc-st { min-width: 0; }
|
||||
.inc-st .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
|
||||
.inc-row:last-child { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
|
||||
+308
-203
@@ -158,6 +158,38 @@
|
||||
}
|
||||
});
|
||||
|
||||
// layout v2 strings
|
||||
U.registerI18n({
|
||||
en: {
|
||||
'inc.col.id': 'ID', 'inc.col.title': 'Title', 'inc.col.status': 'Status', 'inc.col.assignee': 'Assignee', 'inc.col.where': 'Server / destination', 'inc.col.seen': 'Last seen',
|
||||
'inc.empty.all': 'View all ({n})',
|
||||
'inc.summary': 'Summary', 'inc.edit.btn': 'Edit', 'inc.save.one': 'Save', 'inc.concl.add': 'Add conclusion', 'inc.detail.label': 'Detail',
|
||||
'inc.activity': 'Activity',
|
||||
'inc.commenting': 'Commenting as', 'inc.author.change': 'Change name', 'inc.comment.hint': 'Ctrl+Enter to send',
|
||||
'inc.props': 'Properties',
|
||||
'inc.assign.me': 'Assign to me',
|
||||
'inc.sup.short': 'Hide identical alerts', 'inc.sup.hint': 'Only for false positive or benign.',
|
||||
'inc.meta': 'opened {a} · updated {b} · {n} occurrences',
|
||||
'inc.h.group': '{who} made {n} changes',
|
||||
'inc.copy': 'Copy', 'inc.copied': 'Copied',
|
||||
'inc.title.edit': 'Edit title'
|
||||
},
|
||||
'pt-BR': {
|
||||
'inc.col.id': 'ID', 'inc.col.title': 'Título', 'inc.col.status': 'Status', 'inc.col.assignee': 'Responsável', 'inc.col.where': 'Servidor / destino', 'inc.col.seen': 'Última vez',
|
||||
'inc.empty.all': 'Ver todos ({n})',
|
||||
'inc.summary': 'Resumo', 'inc.edit.btn': 'Editar', 'inc.save.one': 'Salvar', 'inc.concl.add': 'Adicionar conclusão', 'inc.detail.label': 'Detalhe',
|
||||
'inc.activity': 'Atividade',
|
||||
'inc.commenting': 'Comentando como', 'inc.author.change': 'Alterar nome', 'inc.comment.hint': 'Ctrl+Enter para enviar',
|
||||
'inc.props': 'Propriedades',
|
||||
'inc.assign.me': 'Atribuir a mim',
|
||||
'inc.sup.short': 'Ocultar alertas iguais', 'inc.sup.hint': 'Só para falso positivo ou benigno.',
|
||||
'inc.meta': 'aberto {a} · atualizado {b} · {n} ocorrências',
|
||||
'inc.h.group': '{who} fez {n} alterações',
|
||||
'inc.copy': 'Copiar', 'inc.copied': 'Copiado',
|
||||
'inc.title.edit': 'Editar título'
|
||||
}
|
||||
});
|
||||
|
||||
var root = null, ctx = null, view = null;
|
||||
|
||||
// ------------------------------------------------------------ helpers
|
||||
@@ -168,23 +200,18 @@
|
||||
function statusOf(s) { return pick(STATUSES, s, 'open'); }
|
||||
function sevBadge(s) { s = sevOf(s); return U.ui.badge(t('inc.sev.' + s), SEV_TONE[s]); }
|
||||
function statusBadge(s) { s = statusOf(s); return U.ui.badge(t('inc.status.' + s), STATUS_TONE[s]); }
|
||||
function dot(sev) { return el('span', { class: 'inc-dot inc-d-' + sevOf(sev), title: t('inc.sev.' + sevOf(sev)) }); }
|
||||
function isIP(s) { s = String(s || ''); return /^\d{1,3}(\.\d{1,3}){3}$/.test(s) || (s.indexOf(':') > 0 && /^[0-9a-f:.]+$/i.test(s)); }
|
||||
function tr(key, fallback) { var v = t(key); return v === key ? fallback : v; }
|
||||
function tags(list) { return el('span', { class: 'inc-tags' }, (Array.isArray(list) ? list : []).map(function (x) { return el('span', { class: 'chip' }, String(x)); })); }
|
||||
function tagChips(list, cls) { return (Array.isArray(list) ? list : []).map(function (x) { return el('span', { class: 'chip ' + (cls || '') }, String(x)); }); }
|
||||
function when(ts) { return el('time', { title: ts ? U.fmt.date(ts) : '' }, ts ? U.fmt.ago(ts) : '-'); }
|
||||
function getAuthor() {
|
||||
var v = '';
|
||||
try { v = (localStorage.getItem(AUTHOR_KEY) || '').trim(); } catch (e) { /* storage blocked */ }
|
||||
return v.slice(0, 64);
|
||||
}
|
||||
function setAuthor(v) { try { localStorage.setItem(AUTHOR_KEY, String(v || '').trim().slice(0, 64)); } catch (e) { /* storage blocked */ } }
|
||||
function authorName() { return getAuthor() || 'operator'; }
|
||||
function authorBox() {
|
||||
var inp = el('input', { type: 'text', id: 'inc-author', maxlength: '64', autocomplete: 'name', placeholder: 'operator', 'aria-describedby': 'inc-author-h' });
|
||||
inp.value = getAuthor();
|
||||
inp.addEventListener('input', function () {
|
||||
try { localStorage.setItem(AUTHOR_KEY, inp.value.trim().slice(0, 64)); } catch (e) { /* storage blocked */ }
|
||||
});
|
||||
return el('div', { class: 'inc-author' }, el('label', { for: 'inc-author' }, t('inc.author')), inp, el('span', { id: 'inc-author-h', class: 'inc-hint' }, t('inc.author.hint')));
|
||||
}
|
||||
function field(label, control, hint, id) {
|
||||
return el('div', { class: 'inc-field' }, el('label', { for: id }, label), control, hint ? el('span', { class: 'inc-hint' }, hint) : null);
|
||||
}
|
||||
@@ -230,7 +257,7 @@
|
||||
if (ctx && ctx.host && ctx.host !== 'all') p.host = ctx.host;
|
||||
return p;
|
||||
}
|
||||
var search = el('input', { type: 'search', autocomplete: 'off', placeholder: t('inc.search'), 'aria-label': t('inc.search') });
|
||||
var search = el('input', { type: 'search', class: 'inc-search', autocomplete: 'off', placeholder: t('inc.search'), 'aria-label': t('inc.search') });
|
||||
search.value = cur().q;
|
||||
var sevSel = el('select', { 'aria-label': t('inc.f.severity') });
|
||||
sevSel.appendChild(el('option', { value: '' }, t('inc.sev.all')));
|
||||
@@ -250,51 +277,60 @@
|
||||
sevSel.addEventListener('change', function () { U.setParam('sev', sevSel.value); reload(); });
|
||||
sortSel.addEventListener('change', function () { U.setParam('sort', sortSel.value === 'updated' ? '' : sortSel.value); reload(); });
|
||||
|
||||
host.appendChild(el('p', { class: 'inc-lead' }, t('inc.lead')));
|
||||
host.appendChild(authorBox());
|
||||
host.appendChild(tabsBox);
|
||||
host.appendChild(el('div', { class: 'toolbar inc-toolbar' }, search, sevSel, sortSel, newBtn));
|
||||
var info = el('span', { class: 'inc-info', tabindex: '0', role: 'img', title: t('inc.lead'), 'aria-label': t('inc.lead') }, 'ⓘ');
|
||||
host.appendChild(el('div', { class: 'inc-bar' }, el('div', { class: 'inc-tabwrap' }, info, tabsBox), el('div', { class: 'inc-toolbar' }, search, sevSel, sortSel, newBtn)));
|
||||
host.appendChild(results);
|
||||
|
||||
function paintTabs(f) {
|
||||
clear(tabsBox);
|
||||
var c = counts || {}, total = 0;
|
||||
STATUSES.forEach(function (s) { total += c[s] || 0; });
|
||||
var items = [['active', t('inc.tab.active'), (c.open || 0) + (c.investigating || 0)]]
|
||||
.concat(STATUSES.map(function (s) { return [s, t('inc.status.' + s), c[s] || 0]; }))
|
||||
.concat([['all', t('inc.tab.all'), total]]);
|
||||
var items = [['active', t('inc.tab.active'), (c.open || 0) + (c.investigating || 0)], ['all', t('inc.tab.all'), total], null]
|
||||
.concat(STATUSES.map(function (s) { return [s, t('inc.status.' + s), c[s] || 0]; }));
|
||||
items.forEach(function (it) {
|
||||
var b = el('button', { type: 'button', class: 'inc-tab' + (f.s === it[0] ? ' on' : ''), 'aria-pressed': f.s === it[0] ? 'true' : 'false' },
|
||||
if (!it) { tabsBox.appendChild(el('span', { class: 'inc-tab-sep', 'aria-hidden': 'true' })); return; }
|
||||
var b = el('button', { type: 'button', class: 'inc-tab' + (f.s === it[0] ? ' on' : '') + (counts && !it[2] ? ' zero' : ''), 'aria-pressed': f.s === it[0] ? 'true' : 'false' },
|
||||
el('span', null, it[1]), counts ? el('span', { class: 'inc-n num' }, nf(it[2])) : null);
|
||||
b.addEventListener('click', function () { U.setParam('s', it[0] === 'active' ? '' : it[0]); reload(); });
|
||||
tabsBox.appendChild(b);
|
||||
});
|
||||
}
|
||||
function row(it) {
|
||||
var sev = sevOf(it.severity);
|
||||
var n = it.comment_count || 0;
|
||||
var route = it.workload || it.dst ? [(it.workload || '-'), ' → ', (it.dst || '-') + (it.dport ? ':' + it.dport : '')].join('') : '';
|
||||
var meta = el('div', { class: 'inc-meta' });
|
||||
if (route) meta.appendChild(el('span', { class: 'mono inc-route' }, route));
|
||||
if (it.host) meta.appendChild(el('span', { class: 'chip' }, String(it.host)));
|
||||
var a = el('a', { class: 'inc-row inc-sev-' + sev, href: U.href('incidents', [String(it.id)]) },
|
||||
var where = [it.host ? String(it.host) : '', it.dst ? it.dst + (it.dport ? ':' + it.dport : '') : ''].filter(Boolean).join(' · ');
|
||||
var full = [(it.workload || ''), it.dst ? '→ ' + it.dst + (it.dport ? ':' + it.dport : '') : ''].filter(Boolean).join(' ');
|
||||
var titleLine = el('span', { class: 'inc-main' }, el('strong', { class: 'inc-title', title: String(it.title || it.id) }, String(it.title || it.id)),
|
||||
(it.tags && it.tags.length) ? el('span', { class: 'inc-rtags' }, tagChips(it.tags.slice(0, 3))) : null);
|
||||
return el('a', { class: 'inc-row', href: U.href('incidents', [String(it.id)]), title: full },
|
||||
dot(it.severity),
|
||||
el('span', { class: 'inc-id mono' }, String(it.id)),
|
||||
el('span', { class: 'inc-badges' }, sevBadge(it.severity), statusBadge(it.status)),
|
||||
el('span', { class: 'inc-main' }, el('strong', { class: 'inc-title' }, String(it.title || it.id)), meta),
|
||||
el('span', { class: 'inc-side' },
|
||||
el('span', { class: 'inc-when', title: it.last_seen ? U.fmt.date(it.last_seen) : '' }, t('inc.seen', { when: U.fmt.ago(it.last_seen) })),
|
||||
n ? el('span', { class: 'inc-cm' }, U.pl('inc.comments.n', n)) : null));
|
||||
return a;
|
||||
titleLine,
|
||||
el('span', { class: 'inc-st' }, statusBadge(it.status)),
|
||||
el('span', { class: 'inc-who' }, it.assignee ? String(it.assignee) : '—'),
|
||||
el('span', { class: 'inc-where mono' }, where),
|
||||
el('span', { class: 'inc-when' }, when(it.last_seen)));
|
||||
}
|
||||
function paint(r, f) {
|
||||
clear(results);
|
||||
var items = Array.isArray(r.items) ? r.items : [];
|
||||
if (!items.length) { results.appendChild(U.ui.empty(t('inc.list.empty'), t('inc.list.empty.sub'))); return; }
|
||||
var list = el('div', { class: 'inc-list' });
|
||||
items.forEach(function (it) { list.appendChild(row(it)); });
|
||||
results.appendChild(list);
|
||||
var total = r.total || items.length, pages = Math.max(1, Math.ceil(total / PER_PAGE));
|
||||
var pg = U.ui.pager({ page: f.p, pages: pages, total: total, onPage: function (n) { U.setParam('p', n); load(); window.scrollTo(0, 0); } });
|
||||
var box = el('div', { class: 'inc-table' });
|
||||
results.appendChild(box);
|
||||
if (!items.length) {
|
||||
var c = counts || {}, total = 0;
|
||||
STATUSES.forEach(function (s) { total += c[s] || 0; });
|
||||
var e = el('div', { class: 'inc-empty' }, el('strong', null, t('inc.list.empty')), el('span', { class: 'inc-hint' }, t('inc.list.empty.sub')));
|
||||
if (f.s === 'active' && total > 0) {
|
||||
var all = el('button', { type: 'button', class: 'btn' }, t('inc.empty.all', { n: nf(total) }));
|
||||
all.addEventListener('click', function () { U.setParam('s', 'all'); reload(); });
|
||||
e.appendChild(all);
|
||||
}
|
||||
box.appendChild(e);
|
||||
return;
|
||||
}
|
||||
box.appendChild(el('div', { class: 'inc-thead', 'aria-hidden': 'true' }, el('span'), el('span', null, t('inc.col.id')), el('span', null, t('inc.col.title')), el('span', null, t('inc.col.status')),
|
||||
el('span', null, t('inc.col.assignee')), el('span', null, t('inc.col.where')), el('span', { class: 'r' }, t('inc.col.seen'))));
|
||||
items.forEach(function (it) { box.appendChild(row(it)); });
|
||||
var total2 = r.total || items.length, pages = Math.max(1, Math.ceil(total2 / PER_PAGE));
|
||||
var pg = U.ui.pager({ page: f.p, pages: pages, total: total2, onPage: function (n) { U.setParam('p', n); load(); window.scrollTo(0, 0); } });
|
||||
if (pg) results.appendChild(pg);
|
||||
}
|
||||
function load() {
|
||||
@@ -331,6 +367,8 @@
|
||||
var hostIn = el('input', { type: 'text', id: 'inc-n-host', maxlength: '100' });
|
||||
if (ctx && ctx.host && ctx.host !== 'all') hostIn.value = ctx.host;
|
||||
var tg = el('input', { type: 'text', id: 'inc-n-tags', maxlength: '300' });
|
||||
var who = el('input', { type: 'text', id: 'inc-n-who', maxlength: '64', placeholder: 'operator' });
|
||||
who.value = getAuthor();
|
||||
var ok = el('button', { type: 'button', class: 'btn primary' }, t('inc.new.create'));
|
||||
var cancel = el('button', { type: 'button', class: 'btn' }, t('inc.cancel'));
|
||||
dlg.appendChild(el('h2', { id: 'inc-new-h' }, t('inc.new.title')));
|
||||
@@ -340,7 +378,8 @@
|
||||
field(t('inc.f.detail'), detail, null, 'inc-n-detail'),
|
||||
field(t('inc.f.severity'), sev, null, 'inc-n-sev'),
|
||||
field(t('inc.f.host'), hostIn, null, 'inc-n-host'),
|
||||
field(t('inc.f.tags'), tg, t('inc.f.tags.hint'), 'inc-n-tags')));
|
||||
field(t('inc.f.tags'), tg, t('inc.f.tags.hint'), 'inc-n-tags'),
|
||||
field(t('inc.author'), who, t('inc.author.hint'), 'inc-n-who')));
|
||||
dlg.appendChild(err);
|
||||
dlg.appendChild(el('div', { class: 'unban-btns' }, cancel, ok));
|
||||
function close() { dlg.close(); }
|
||||
@@ -353,6 +392,7 @@
|
||||
var ttl = title.value.trim();
|
||||
if (!ttl) { err.textContent = t('inc.required'); err.hidden = false; title.focus(); return; }
|
||||
ok.disabled = true;
|
||||
setAuthor(who.value);
|
||||
U.apiSend('POST', '/api/v1/incidents', { title: ttl, detail: detail.value.trim(), severity: sev.value, host: hostIn.value.trim(), tags: parseTags(tg.value), author: authorName() }).then(function (r) {
|
||||
close();
|
||||
pollBadge();
|
||||
@@ -373,15 +413,15 @@
|
||||
var seq = 0, on = true, tk = null, busy = false;
|
||||
var box = el('div', { class: 'inc-detail' });
|
||||
host.appendChild(el('a', { class: 'inc-back', href: U.href('incidents') }, '← ' + t('inc.back')));
|
||||
host.appendChild(authorBox());
|
||||
host.appendChild(box);
|
||||
var errBox = el('p', { class: 'inc-err', role: 'alert', hidden: true });
|
||||
|
||||
function url(suffix) { return '/api/v1/incidents/' + encodeURIComponent(id) + (suffix || ''); }
|
||||
function fail(node, key) { node.textContent = t(key); node.hidden = false; }
|
||||
function send(method, suffix, body, errNode, errKey, okKey) {
|
||||
function send(method, suffix, body, errKey, okKey) {
|
||||
if (busy) return;
|
||||
busy = true; box.classList.add('busy');
|
||||
body.author = authorName();
|
||||
errBox.hidden = true;
|
||||
U.apiSend(method, url(suffix), body).then(function () {
|
||||
busy = false; box.classList.remove('busy');
|
||||
if (okKey) U.toast(t(okKey));
|
||||
@@ -389,189 +429,254 @@
|
||||
load(true);
|
||||
}, function (e) {
|
||||
busy = false; box.classList.remove('busy');
|
||||
fail(errNode, e && e.status === 409 ? 'inc.err.suppress' : errKey);
|
||||
errBox.textContent = t(e && e.status === 409 ? 'inc.err.suppress' : errKey);
|
||||
errBox.hidden = false;
|
||||
load(true); // put the controls back to the saved values
|
||||
});
|
||||
}
|
||||
function patch(body) { send('PATCH', '', body, 'inc.err.save', 'inc.saved'); }
|
||||
|
||||
function techRow(dl, k, v) {
|
||||
if (v === undefined || v === null || v === '') return;
|
||||
dl.appendChild(el('dt', null, t(k)));
|
||||
dl.appendChild(el('dd', null, v));
|
||||
}
|
||||
function techPanel(x) {
|
||||
var dl = el('dl', { class: 'inc-dl' });
|
||||
var kind = String(x.kind || '');
|
||||
techRow(dl, 'inc.t.source', tr('inc.source.' + x.source, String(x.source || '')));
|
||||
techRow(dl, 'inc.t.kind', kind ? tr('eg.kind.' + kind, kind) : '');
|
||||
techRow(dl, 'inc.t.workload', x.workload ? el('span', { class: 'mono' }, String(x.workload)) : '');
|
||||
techRow(dl, 'inc.t.dst', x.dst ? (isIP(x.dst) ? el('a', { class: 'mono', href: U.href('ip', [String(x.dst)]) }, String(x.dst)) : el('span', { class: 'mono' }, String(x.dst))) : '');
|
||||
techRow(dl, 'inc.t.port', x.dport ? el('span', { class: 'mono' }, String(x.dport)) : '');
|
||||
techRow(dl, 'inc.t.proto', x.proto ? el('span', { class: 'mono' }, String(x.proto)) : '');
|
||||
techRow(dl, 'inc.t.host', x.host ? String(x.host) : '');
|
||||
techRow(dl, 'inc.t.first', x.first_seen ? U.fmt.date(x.first_seen) : '');
|
||||
techRow(dl, 'inc.t.last', x.last_seen ? U.fmt.date(x.last_seen) : '');
|
||||
techRow(dl, 'inc.t.count', x.count ? nf(x.count) : '');
|
||||
techRow(dl, 'inc.t.created', x.created_at ? U.fmt.date(x.created_at) : '');
|
||||
techRow(dl, 'inc.t.updated', x.updated_at ? U.fmt.date(x.updated_at) : '');
|
||||
techRow(dl, 'inc.t.key', x.key ? el('span', { class: 'mono inc-key' }, String(x.key)) : '');
|
||||
var p = U.ui.panel({ title: t('inc.tech'), cls: 'span-4' }, dl);
|
||||
return p;
|
||||
}
|
||||
|
||||
function histValue(field, v) {
|
||||
if (v === undefined || v === null || v === '' || (Array.isArray(v) && !v.length)) return t('inc.h.empty');
|
||||
if (field === 'status') return tr('inc.status.' + v, String(v));
|
||||
if (field === 'severity') return tr('inc.sev.' + v, String(v));
|
||||
if (field === 'suppress') return t(v === true || v === 'true' ? 'inc.h.on' : 'inc.h.off');
|
||||
if (Array.isArray(v)) return v.join(', ');
|
||||
return String(v);
|
||||
}
|
||||
function histPanel(x) {
|
||||
var hist = Array.isArray(x.history) ? x.history.slice().reverse() : [];
|
||||
var p = U.ui.panel({ title: t('inc.history'), cls: 'span-4' });
|
||||
if (!hist.length) { p.body.appendChild(el('p', { class: 'inc-hint' }, t('inc.history.none'))); return p; }
|
||||
var ol = el('ol', { class: 'inc-tl' });
|
||||
hist.forEach(function (h) {
|
||||
var f = String(h.field || '');
|
||||
var fl = tr('inc.h.field.' + f, f);
|
||||
if (f === 'created') {
|
||||
ol.appendChild(el('li', null,
|
||||
el('span', { class: 'inc-tl-when' }, U.fmt.date(h.at)),
|
||||
el('span', { class: 'inc-tl-what' }, t('inc.h.created', { who: String(h.author || '-'), sev: f === 'created' && h.to === 'flood' ? t('inc.h.flood') : histValue('severity', h.to) }))));
|
||||
return;
|
||||
// ---- header
|
||||
function header(x) {
|
||||
var title = el('h1', { class: 'inc-h-title' });
|
||||
function showTitle() {
|
||||
clear(title);
|
||||
var b = el('button', { type: 'button', class: 'inc-title-btn', title: t('inc.title.edit') }, String(x.title || x.id));
|
||||
b.addEventListener('click', editTitle);
|
||||
title.appendChild(b);
|
||||
}
|
||||
function editTitle() {
|
||||
clear(title);
|
||||
var inp = el('input', { type: 'text', class: 'inc-title-in', maxlength: '200', 'aria-label': t('inc.f.title') });
|
||||
inp.value = String(x.title || '');
|
||||
var done = false;
|
||||
function finish(save) {
|
||||
if (done) return; done = true;
|
||||
var v = inp.value.trim();
|
||||
if (save && v && v !== x.title) patch({ title: v }); else showTitle();
|
||||
}
|
||||
ol.appendChild(el('li', null,
|
||||
el('span', { class: 'inc-tl-when' }, U.fmt.date(h.at)),
|
||||
el('span', { class: 'inc-tl-what' }, t('inc.h.line', { who: String(h.author || '-'), field: fl })),
|
||||
el('span', { class: 'inc-tl-chg' }, el('span', { class: 'inc-from' }, histValue(f, h.from)), ' → ', el('strong', null, histValue(f, h.to)))));
|
||||
});
|
||||
p.body.appendChild(ol);
|
||||
return p;
|
||||
}
|
||||
|
||||
function commentsPanel(x) {
|
||||
var p = U.ui.panel({ title: t('inc.comments'), cls: 'span-8' });
|
||||
var list = Array.isArray(x.comments) ? x.comments : [];
|
||||
if (!list.length) p.body.appendChild(el('p', { class: 'inc-hint' }, t('inc.comments.none')));
|
||||
else {
|
||||
var ul = el('ul', { class: 'inc-comments' });
|
||||
list.forEach(function (c) {
|
||||
ul.appendChild(el('li', null,
|
||||
el('div', { class: 'inc-c-h' }, el('strong', null, String(c.author || '-')), el('span', { class: 'inc-hint' }, c.at ? U.fmt.date(c.at) : '')),
|
||||
el('p', { class: 'inc-text' }, String(c.text || ''))));
|
||||
});
|
||||
p.body.appendChild(ul);
|
||||
inp.addEventListener('keydown', function (e) { if (e.key === 'Enter') finish(true); else if (e.key === 'Escape') finish(false); });
|
||||
inp.addEventListener('blur', function () { finish(true); });
|
||||
title.appendChild(inp);
|
||||
inp.focus(); inp.select();
|
||||
}
|
||||
var ta = el('textarea', { id: 'inc-comment', rows: '3', maxlength: '4000', placeholder: t('inc.comment.ph'), 'aria-label': t('inc.comment.ph') });
|
||||
var err = el('p', { class: 'inc-err', role: 'alert', hidden: true });
|
||||
var add = el('button', { type: 'button', class: 'btn primary' }, t('inc.comment.add'));
|
||||
function submit() {
|
||||
var txt = ta.value.trim();
|
||||
if (!txt) { ta.focus(); return; }
|
||||
err.hidden = true;
|
||||
send('POST', '/comments', { text: txt }, err, 'inc.err.comment', 'inc.comment.added');
|
||||
}
|
||||
add.addEventListener('click', submit);
|
||||
ta.addEventListener('keydown', function (e) { if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) { e.preventDefault(); submit(); } });
|
||||
p.body.appendChild(el('div', { class: 'inc-newc' }, ta, err, el('div', { class: 'inc-btns' }, add)));
|
||||
return p;
|
||||
}
|
||||
|
||||
function formPanel(x) {
|
||||
var title = el('input', { type: 'text', id: 'inc-e-title', maxlength: '200', value: String(x.title || '') });
|
||||
var sev = selectOf('inc-e-sev', SEVS, function (s) { return t('inc.sev.' + s); }, sevOf(x.severity));
|
||||
var st = selectOf('inc-e-status', STATUSES, function (s) { return t('inc.status.' + s); }, statusOf(x.status));
|
||||
var asg = el('input', { type: 'text', id: 'inc-e-asg', maxlength: '64', value: String(x.assignee || '') });
|
||||
var tg = el('input', { type: 'text', id: 'inc-e-tags', maxlength: '300', value: (x.tags || []).join(', ') });
|
||||
var vd = el('textarea', { id: 'inc-e-verdict', rows: '4', maxlength: '4000' });
|
||||
vd.value = String(x.verdict || '');
|
||||
var sup = el('input', { type: 'checkbox', id: 'inc-e-sup' });
|
||||
sup.checked = !!x.suppress;
|
||||
var supHelp = el('span', { class: 'inc-hint', id: 'inc-e-sup-h' });
|
||||
sup.setAttribute('aria-describedby', 'inc-e-sup-h');
|
||||
var err = el('p', { class: 'inc-err', role: 'alert', hidden: true });
|
||||
var save = el('button', { type: 'button', class: 'btn primary' }, t('inc.save'));
|
||||
|
||||
function syncSup() {
|
||||
var okSt = SUPPRESSIBLE.indexOf(st.value) >= 0;
|
||||
sup.disabled = !okSt;
|
||||
if (!okSt) sup.checked = false;
|
||||
supHelp.textContent = t('inc.f.suppress.help') + (okSt ? '' : ' ' + t('inc.f.suppress.off'));
|
||||
}
|
||||
function diff() {
|
||||
var d = {}, ttl = title.value.trim();
|
||||
if (ttl && ttl !== x.title) d.title = ttl;
|
||||
if (sev.value !== sevOf(x.severity)) d.severity = sev.value;
|
||||
if (st.value !== statusOf(x.status)) d.status = st.value;
|
||||
if (asg.value.trim() !== (x.assignee || '')) d.assignee = asg.value.trim();
|
||||
var tl = parseTags(tg.value);
|
||||
if (!sameList(tl, x.tags)) d.tags = tl;
|
||||
if (vd.value.trim() !== (x.verdict || '').trim()) d.verdict = vd.value.trim();
|
||||
if (sup.checked !== !!x.suppress) d.suppress = sup.checked;
|
||||
return d;
|
||||
}
|
||||
function sync() { syncSup(); save.disabled = busy || !Object.keys(diff()).length; }
|
||||
[title, sev, st, asg, tg, vd, sup].forEach(function (c) { c.addEventListener('input', sync); c.addEventListener('change', sync); });
|
||||
sync();
|
||||
save.addEventListener('click', function () {
|
||||
var d = diff();
|
||||
if (!Object.keys(d).length) return;
|
||||
err.hidden = true;
|
||||
send('PATCH', '', d, err, 'inc.err.save', 'inc.saved');
|
||||
});
|
||||
|
||||
showTitle();
|
||||
function quick(label, status, tone) {
|
||||
var b = el('button', { type: 'button', class: 'btn inc-q-' + tone }, label);
|
||||
var b = el('button', { type: 'button', class: 'btn sm inc-q-' + tone }, label);
|
||||
b.disabled = statusOf(x.status) === status;
|
||||
b.addEventListener('click', function () {
|
||||
var d = { status: status };
|
||||
if (x.suppress && SUPPRESSIBLE.indexOf(status) < 0) d.suppress = false;
|
||||
err.hidden = true;
|
||||
send('PATCH', '', d, err, 'inc.err.save', 'inc.saved');
|
||||
patch(d);
|
||||
});
|
||||
return b;
|
||||
}
|
||||
var q = el('div', { class: 'inc-quick', role: 'group', 'aria-label': t('inc.quick') },
|
||||
quick(t('inc.quick.fp'), 'false_positive', 'fp'), quick(t('inc.quick.tp'), 'true_positive', 'tp'), quick(t('inc.quick.resolve'), 'resolved', 'ok'));
|
||||
var meta = el('span', { class: 'inc-hint inc-metaline' }, t('inc.meta', { a: x.created_at ? U.fmt.ago(x.created_at) : '-', b: x.updated_at ? U.fmt.ago(x.updated_at) : '-', n: nf(x.count) }));
|
||||
return el('header', { class: 'inc-head' },
|
||||
el('div', { class: 'inc-h1' }, dot(x.severity), el('span', { class: 'inc-id mono' }, String(x.id)), title, q),
|
||||
el('div', { class: 'inc-h2' }, sevBadge(x.severity), statusBadge(x.status), x.suppress ? el('span', { class: 'chip' }, t('eg.suppressed.chip')) : null, tagChips(x.tags), meta));
|
||||
}
|
||||
|
||||
var supRow = el('div', { class: 'inc-field inc-sup' },
|
||||
el('div', { class: 'inc-check' }, sup, el('label', { for: 'inc-e-sup' }, t('inc.f.suppress'))), supHelp);
|
||||
var p = U.ui.panel({ title: t('inc.edit'), cls: 'span-8' },
|
||||
q,
|
||||
el('div', { class: 'inc-form' },
|
||||
field(t('inc.f.title'), title, null, 'inc-e-title'),
|
||||
el('div', { class: 'inc-two' }, field(t('inc.f.status'), st, null, 'inc-e-status'), field(t('inc.f.severity'), sev, null, 'inc-e-sev')),
|
||||
el('div', { class: 'inc-two' }, field(t('inc.f.assignee'), asg, null, 'inc-e-asg'), field(t('inc.f.tags'), tg, t('inc.f.tags.hint'), 'inc-e-tags')),
|
||||
field(t('inc.f.verdict'), vd, t('inc.f.verdict.hint'), 'inc-e-verdict'),
|
||||
supRow),
|
||||
err, el('div', { class: 'inc-btns' }, save));
|
||||
return p;
|
||||
// ---- properties (each control saves by itself)
|
||||
function propsCard(x) {
|
||||
function row(label, control, id) { return el('div', { class: 'inc-prop' }, el('label', { for: id }, label), el('div', { class: 'inc-prop-c' }, control)); }
|
||||
var st = selectOf('inc-e-status', STATUSES, function (s) { return t('inc.status.' + s); }, statusOf(x.status));
|
||||
var sev = selectOf('inc-e-sev', SEVS, function (s) { return t('inc.sev.' + s); }, sevOf(x.severity));
|
||||
var asg = el('input', { type: 'text', id: 'inc-e-asg', maxlength: '64' });
|
||||
asg.value = String(x.assignee || '');
|
||||
var me = el('button', { type: 'button', class: 'inc-link' }, t('inc.assign.me'));
|
||||
var tg = el('input', { type: 'text', id: 'inc-e-tags', maxlength: '300', 'aria-describedby': 'inc-e-tags-h' });
|
||||
tg.value = (x.tags || []).join(', ');
|
||||
var sup = el('input', { type: 'checkbox', id: 'inc-e-sup', role: 'switch', class: 'inc-switch', 'aria-describedby': 'inc-e-sup-h' });
|
||||
sup.checked = !!x.suppress;
|
||||
sup.disabled = SUPPRESSIBLE.indexOf(statusOf(x.status)) < 0;
|
||||
st.addEventListener('change', function () {
|
||||
var d = { status: st.value };
|
||||
if (x.suppress && SUPPRESSIBLE.indexOf(st.value) < 0) d.suppress = false;
|
||||
patch(d);
|
||||
});
|
||||
sev.addEventListener('change', function () { patch({ severity: sev.value }); });
|
||||
function saveAsg() { var v = asg.value.trim(); if (v !== (x.assignee || '')) patch({ assignee: v }); }
|
||||
asg.addEventListener('change', saveAsg);
|
||||
asg.addEventListener('keydown', function (e) { if (e.key === 'Enter') { e.preventDefault(); asg.blur(); } });
|
||||
me.addEventListener('click', function () { if (authorName() !== (x.assignee || '')) patch({ assignee: authorName() }); });
|
||||
tg.addEventListener('change', function () { var l = parseTags(tg.value); if (!sameList(l, x.tags)) patch({ tags: l }); });
|
||||
tg.addEventListener('keydown', function (e) { if (e.key === 'Enter') { e.preventDefault(); tg.blur(); } });
|
||||
sup.addEventListener('change', function () { patch({ suppress: sup.checked }); });
|
||||
var supHint = el('span', { class: 'inc-hint', id: 'inc-e-sup-h', title: t('inc.f.suppress.help') }, t('inc.sup.hint'));
|
||||
return el('section', { class: 'inc-card inc-props' }, el('h2', null, t('inc.props')),
|
||||
row(t('inc.f.status'), st, 'inc-e-status'),
|
||||
row(t('inc.f.severity'), sev, 'inc-e-sev'),
|
||||
row(t('inc.f.assignee'), el('div', { class: 'inc-stack' }, asg, me), 'inc-e-asg'),
|
||||
row(t('inc.f.tags'), el('div', { class: 'inc-stack' }, tg, el('span', { class: 'inc-hint', id: 'inc-e-tags-h' }, t('inc.f.tags.hint'))), 'inc-e-tags'),
|
||||
row(t('inc.sup.short'), el('div', { class: 'inc-stack' }, sup, supHint), 'inc-e-sup'),
|
||||
errBox);
|
||||
}
|
||||
|
||||
// ---- summary: conclusion + original detail
|
||||
function summaryBlock(x) {
|
||||
var node = el('section', { class: 'inc-card inc-summary' });
|
||||
function render(edit) {
|
||||
clear(node);
|
||||
var has = !!(x.verdict || x.detail);
|
||||
node.classList.toggle('empty', !has && !edit);
|
||||
if (!has && !edit) {
|
||||
var add = el('button', { type: 'button', class: 'btn sm' }, '+ ' + t('inc.concl.add'));
|
||||
add.addEventListener('click', function () { render(true); });
|
||||
node.appendChild(add);
|
||||
return;
|
||||
}
|
||||
var head = el('div', { class: 'inc-card-h' }, el('h2', null, t('inc.summary')));
|
||||
if (!edit) {
|
||||
var eb = el('button', { type: 'button', class: 'btn sm' }, t('inc.edit.btn'));
|
||||
eb.addEventListener('click', function () { render(true); });
|
||||
head.appendChild(eb);
|
||||
}
|
||||
node.appendChild(head);
|
||||
if (edit) {
|
||||
var ta = el('textarea', { rows: '4', maxlength: '4000', 'aria-label': t('inc.f.verdict') });
|
||||
ta.value = String(x.verdict || '');
|
||||
var sv = el('button', { type: 'button', class: 'btn sm primary' }, t('inc.save.one'));
|
||||
var cn = el('button', { type: 'button', class: 'btn sm' }, t('inc.cancel'));
|
||||
sv.addEventListener('click', function () { var v = ta.value.trim(); if (v !== (x.verdict || '').trim()) patch({ verdict: v }); else render(false); });
|
||||
cn.addEventListener('click', function () { render(false); });
|
||||
node.appendChild(ta);
|
||||
node.appendChild(el('div', { class: 'inc-btns' }, cn, sv));
|
||||
setTimeout(function () { ta.focus(); }, 0);
|
||||
} else if (x.verdict) node.appendChild(el('p', { class: 'inc-text' }, String(x.verdict)));
|
||||
if (x.detail) node.appendChild(el('pre', { class: 'inc-pre', 'aria-label': t('inc.detail.label') }, String(x.detail)));
|
||||
}
|
||||
render(false);
|
||||
return node;
|
||||
}
|
||||
|
||||
// ---- activity
|
||||
function histValue(f, v) {
|
||||
if (v === undefined || v === null || v === '' || (Array.isArray(v) && !v.length)) return t('inc.h.empty');
|
||||
if (f === 'status') return tr('inc.status.' + v, String(v));
|
||||
if (f === 'severity') return tr('inc.sev.' + v, String(v));
|
||||
if (f === 'suppress') return t(v === true || v === 'true' ? 'inc.h.on' : 'inc.h.off');
|
||||
if (Array.isArray(v)) return v.join(', ');
|
||||
return String(v);
|
||||
}
|
||||
function histLine(h) {
|
||||
var f = String(h.field || '');
|
||||
var li = el('li', { class: 'inc-ev' }, el('span', { class: 'inc-ev-dot', 'aria-hidden': 'true' }));
|
||||
var body = el('span', { class: 'inc-ev-t' });
|
||||
if (f === 'created') {
|
||||
body.appendChild(document.createTextNode(t('inc.h.created', { who: String(h.author || '-'), sev: h.to === 'flood' ? t('inc.h.flood') : histValue('severity', h.to) })));
|
||||
} else {
|
||||
body.appendChild(document.createTextNode(t('inc.h.line', { who: String(h.author || '-'), field: tr('inc.h.field.' + f, f) }) + ' '));
|
||||
body.appendChild(el('span', { class: 'inc-ev-chg' }, el('span', { class: 'inc-from' }, histValue(f, h.from)), ' → ', el('strong', null, histValue(f, h.to))));
|
||||
}
|
||||
li.appendChild(body);
|
||||
li.appendChild(el('span', { class: 'inc-ev-when' }, when(h.at)));
|
||||
return li;
|
||||
}
|
||||
function commentCard(c) {
|
||||
var a = String(c.author || '-');
|
||||
return el('li', { class: 'inc-cmt' },
|
||||
el('span', { class: 'inc-av', 'aria-hidden': 'true' }, (a.trim().charAt(0) || '?').toUpperCase()),
|
||||
el('div', { class: 'inc-cmt-b' },
|
||||
el('div', { class: 'inc-c-h' }, el('strong', null, a), el('span', { class: 'inc-hint' }, when(c.at))),
|
||||
el('p', { class: 'inc-text' }, String(c.text || ''))));
|
||||
}
|
||||
function composer() {
|
||||
var ta = el('textarea', { id: 'inc-comment', rows: '2', maxlength: '4000', placeholder: t('inc.comment.ph'), 'aria-label': t('inc.comment.ph') });
|
||||
var err = el('p', { class: 'inc-err', role: 'alert', hidden: true });
|
||||
var add = el('button', { type: 'button', class: 'btn sm primary' }, t('inc.comment.add'));
|
||||
var who = el('span', { class: 'inc-as' });
|
||||
function paintWho() {
|
||||
clear(who);
|
||||
var b = el('button', { type: 'button', class: 'inc-link', title: t('inc.author.change'), 'aria-label': t('inc.author.change') }, '✎');
|
||||
b.addEventListener('click', function () {
|
||||
clear(who);
|
||||
var inp = el('input', { type: 'text', class: 'inc-as-in', maxlength: '64', placeholder: 'operator', 'aria-label': t('inc.author') });
|
||||
inp.value = getAuthor();
|
||||
function fin() { setAuthor(inp.value); paintWho(); }
|
||||
inp.addEventListener('keydown', function (e) { if (e.key === 'Enter' || e.key === 'Escape') { e.preventDefault(); fin(); } });
|
||||
inp.addEventListener('blur', fin);
|
||||
who.appendChild(inp); inp.focus();
|
||||
});
|
||||
who.appendChild(document.createTextNode(t('inc.commenting') + ' '));
|
||||
who.appendChild(el('strong', null, authorName()));
|
||||
who.appendChild(document.createTextNode(' '));
|
||||
who.appendChild(b);
|
||||
}
|
||||
paintWho();
|
||||
function submit() {
|
||||
var txt = ta.value.trim();
|
||||
if (!txt) { ta.focus(); return; }
|
||||
send('POST', '/comments', { text: txt }, 'inc.err.comment', 'inc.comment.added');
|
||||
}
|
||||
add.addEventListener('click', submit);
|
||||
ta.addEventListener('focus', function () { ta.rows = 4; });
|
||||
ta.addEventListener('keydown', function (e) { if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) { e.preventDefault(); submit(); } });
|
||||
return el('div', { class: 'inc-newc' }, ta, el('div', { class: 'inc-newc-f' }, who, el('span', { class: 'inc-hint inc-kbd' }, t('inc.comment.hint')), add));
|
||||
}
|
||||
function activity(x) {
|
||||
var evs = [];
|
||||
(x.comments || []).forEach(function (c) { evs.push({ at: c.at || 0, c: c }); });
|
||||
(x.history || []).forEach(function (h) { evs.push({ at: h.at || 0, h: h }); });
|
||||
evs.sort(function (a, b) { return b.at - a.at; });
|
||||
var ul = el('ul', { class: 'inc-feed' });
|
||||
for (var i = 0; i < evs.length; i++) {
|
||||
var e = evs[i];
|
||||
if (e.c) { ul.appendChild(commentCard(e.c)); continue; }
|
||||
// consecutive changes by the same author in the same minute collapse into one expandable line
|
||||
var grp = [e.h];
|
||||
while (i + 1 < evs.length && evs[i + 1].h && evs[i + 1].h.author === e.h.author && String(evs[i + 1].h.field) !== 'created' && String(e.h.field) !== 'created' &&
|
||||
Math.floor(evs[i + 1].at / 60) === Math.floor(e.at / 60)) { grp.push(evs[i + 1].h); i++; }
|
||||
if (grp.length < 2) { ul.appendChild(histLine(e.h)); continue; }
|
||||
var inner = el('ul', { class: 'inc-feed inc-sub' }, grp.map(histLine));
|
||||
ul.appendChild(el('li', { class: 'inc-ev inc-grp' }, el('details', null,
|
||||
el('summary', null, el('span', { class: 'inc-ev-dot', 'aria-hidden': 'true' }), t('inc.h.group', { who: String(e.h.author || '-'), n: grp.length }), ' ', el('span', { class: 'inc-ev-when' }, when(e.at))), inner)));
|
||||
}
|
||||
return el('section', { class: 'inc-card inc-activity' }, el('div', { class: 'inc-card-h' }, el('h2', null, t('inc.activity'))), composer(), evs.length ? ul : null);
|
||||
}
|
||||
|
||||
// ---- technical data
|
||||
function techRow(dl, k, v, cls) {
|
||||
if (v === undefined || v === null || v === '') return;
|
||||
dl.appendChild(el('dt', null, t(k)));
|
||||
dl.appendChild(el('dd', { class: cls || '' }, v));
|
||||
}
|
||||
function techCard(x) {
|
||||
var dl = el('dl', { class: 'inc-dl' });
|
||||
var kind = String(x.kind || '');
|
||||
techRow(dl, 'inc.t.source', tr('inc.source.' + x.source, String(x.source || '')));
|
||||
techRow(dl, 'inc.t.kind', kind ? tr('eg.kind.' + kind, kind) : '');
|
||||
techRow(dl, 'inc.t.workload', x.workload ? String(x.workload) : '', 'mono');
|
||||
techRow(dl, 'inc.t.dst', x.dst ? (isIP(x.dst) ? el('a', { href: U.href('ip', [String(x.dst)]) }, String(x.dst)) : String(x.dst)) : '', 'mono');
|
||||
techRow(dl, 'inc.t.port', x.dport ? String(x.dport) : '', 'mono');
|
||||
techRow(dl, 'inc.t.proto', x.proto ? String(x.proto) : '', 'mono');
|
||||
techRow(dl, 'inc.t.host', x.host ? String(x.host) : '');
|
||||
techRow(dl, 'inc.t.first', x.first_seen ? when(x.first_seen) : '');
|
||||
techRow(dl, 'inc.t.last', x.last_seen ? when(x.last_seen) : '');
|
||||
techRow(dl, 'inc.t.count', x.count ? nf(x.count) : '');
|
||||
if (x.key) {
|
||||
var cp = el('button', { type: 'button', class: 'inc-link', 'aria-label': t('inc.copy') }, t('inc.copy'));
|
||||
cp.addEventListener('click', function () {
|
||||
try { navigator.clipboard.writeText(String(x.key)).then(function () { U.toast(t('inc.copied')); }, function () { }); } catch (e) { /* clipboard blocked */ }
|
||||
});
|
||||
dl.appendChild(el('dt', null, t('inc.t.key')));
|
||||
dl.appendChild(el('dd', { class: 'inc-keyrow' }, el('span', { class: 'mono inc-key', title: String(x.key) }, String(x.key)), cp));
|
||||
}
|
||||
var d = el('details', { class: 'inc-card inc-tech' }, el('summary', null, t('inc.tech')), dl);
|
||||
if (window.innerWidth > 900) d.open = true;
|
||||
return d;
|
||||
}
|
||||
|
||||
function paint() {
|
||||
clear(box);
|
||||
var x = tk;
|
||||
var sev = sevOf(x.severity);
|
||||
var head = el('header', { class: 'inc-head inc-sev-' + sev },
|
||||
el('span', { class: 'inc-id mono' }, String(x.id)),
|
||||
sevBadge(x.severity), statusBadge(x.status),
|
||||
x.suppress ? el('span', { class: 'chip' }, t('eg.suppressed.chip')) : null,
|
||||
el('h2', { class: 'inc-h-title' }, String(x.title || x.id)),
|
||||
tags(x.tags));
|
||||
var grid = el('div', { class: 'grid-12 inc-grid' });
|
||||
grid.appendChild(formPanel(x));
|
||||
grid.appendChild(techPanel(x));
|
||||
if (x.detail) {
|
||||
var dp = U.ui.panel({ title: t('inc.f.detail'), cls: 'span-8' }, el('p', { class: 'inc-text mono' }, String(x.detail)));
|
||||
grid.appendChild(dp);
|
||||
grid.appendChild(histPanel(x));
|
||||
grid.appendChild(commentsPanel(x));
|
||||
} else {
|
||||
grid.appendChild(commentsPanel(x));
|
||||
grid.appendChild(histPanel(x));
|
||||
}
|
||||
box.appendChild(head);
|
||||
box.appendChild(grid);
|
||||
box.appendChild(header(x));
|
||||
var main = el('div', { class: 'inc-maincol' });
|
||||
main.appendChild(summaryBlock(x));
|
||||
main.appendChild(activity(x));
|
||||
box.appendChild(el('div', { class: 'inc-layout' }, main, el('aside', { class: 'inc-aside' }, propsCard(x), techCard(x))));
|
||||
}
|
||||
function load(keepScroll) {
|
||||
var my = ++seq;
|
||||
|
||||
Reference in new issue
Block a user