2026-08-23 20:39:22 +03:00
{{define "targets_page"}}
<!doctype html>
< html lang = "ru" >
< head > {{template "html_head" .}}</ head >
< body >
2026-08-26 22:19:42 +03:00
< div class = "bg-grid" ></ div >
2026-08-23 21:58:19 +03:00
< input type = "checkbox" id = "nav-toggle" class = "nav-toggle" >
< div class = "shell" >
{{template "sidebar_nav" .}}
< div >
{{template "topbar_mobile" .}}
< main class = "main" >
2026-08-23 20:39:22 +03:00
< div id = "error-banner" > {{template "banner_inner" .Banner}}</ div >
{{template "targets_content" .}}
</ main >
2026-08-23 21:58:19 +03:00
</ div >
</ div >
2026-08-23 20:39:22 +03:00
</ body >
</ html >
{{end}}
{{define "targets_content"}}
2026-08-23 21:58:19 +03:00
< div class = "topbar" >< h1 > Цели проверки</ h1 ></ div >
< p class = "muted" style = "margin-bottom:16px" > Группа целей — именованный список URL/адресов, на который затем ссылаются типы проверок.</ p >
2026-08-23 20:39:22 +03:00
2026-08-23 21:58:19 +03:00
< div class = "panel" >
2026-08-26 22:19:42 +03:00
< div class = "panel-head" >< h2 > Новая группа целей</ h2 ></ div >
2026-08-23 21:58:19 +03:00
< div class = "panel-body" >
< form hx-post = "/targets" hx-target = "#targets-table-wrap" hx-swap = "innerHTML" hx-on::after-request = "this.reset()" >
< div class = "field-row" >
< div class = "field" style = "flex: 0 1 200px;" >
< label > Имя новой группы</ label >
< input type = "text" name = "name" placeholder = "web" required >
2026-08-23 21:15:31 +03:00
</ div >
2026-08-23 21:58:19 +03:00
< div class = "field" style = "flex: 1 1 380px;" >
< label > Цели (по одной на строку или через запятую)</ label >
< textarea name = "targets" rows = "2" placeholder = "https://hub.docker.com https://github.com" required ></ textarea >
2026-08-23 21:15:31 +03:00
</ div >
2026-08-23 21:58:19 +03:00
< button type = "submit" class = "btn btn-primary" > Создать</ button >
2026-08-23 21:15:31 +03:00
</ div >
2026-08-23 20:39:22 +03:00
</ form >
2026-08-23 21:58:19 +03:00
</ div >
</ div >
2026-08-23 20:39:22 +03:00
< div id = "targets-table-wrap" >
{{template "targets_table" .}}
</ div >
{{end}}
{{define "targets_table"}}
2026-08-23 21:58:19 +03:00
< div class = "panel" >
< div class = "table-scroll" >
< table >
< thead >< tr >< th > Группа</ th >< th > Цели</ th >< th ></ th ></ tr ></ thead >
2026-08-23 20:39:22 +03:00
< tbody >
{{range .Items}}
< tr >
2026-08-23 21:58:19 +03:00
< td class = "mono" data-label = "Группа" > {{.Name}}</ td >
< td data-label = "Цели" >
2026-08-23 21:15:31 +03:00
< form class = "inline-form" hx-put = "/targets/{{.Name}}" hx-target = "#targets-table-wrap" hx-swap = "innerHTML" >
2026-08-23 21:58:19 +03:00
< textarea name = "targets" rows = "2" > {{join .Targets "\n"}}</ textarea >
< button type = "submit" class = "btn btn-ghost btn-sm" > Сохранить</ button >
2026-08-23 20:39:22 +03:00
</ form >
</ td >
2026-08-23 21:58:19 +03:00
< td data-label = "" >
< div class = "actions" >
< button class = "btn btn-danger-ghost btn-sm" hx-delete = "/targets/{{.Name}}" hx-target = "#targets-table-wrap" hx-swap = "innerHTML" hx-confirm = "Удалить группу {{.Name}}?" > Удалить</ button >
</ div >
2026-08-23 20:39:22 +03:00
</ td >
</ tr >
{{end}}
</ tbody >
</ table >
2026-08-23 21:15:31 +03:00
</ div >
2026-08-23 21:58:19 +03:00
</ div >
2026-08-23 20:39:22 +03:00
{{if not .Items}}< p class = "muted" > Групп целей нет.</ p > {{end}}
{{end}}