diff --git a/internal/i18n/locales/de.json b/internal/i18n/locales/de.json index fc30198..5c8ae9d 100644 --- a/internal/i18n/locales/de.json +++ b/internal/i18n/locales/de.json @@ -135,6 +135,7 @@ "auth.sso.org_placeholder": "Kurzname der Organisation", "auth.sso.submit": "Weiter", "channels.create": "Kanal anlegen", + "channels.created": "Webhook erstellt. Er ist bereits in der Standardgruppe. Kopiere den Signaturschlüssel, bevor du fortfährst.", "channels.delete_confirm": "Diesen Kanal löschen?", "channels.field_access_key": "Zugriffsschlüssel", "channels.field_access_key_id": "AccessKey-ID", @@ -273,6 +274,7 @@ "channels.help_telegram": "Lege mit @BotFather einen Bot an; die Chat-ID einer Gruppe beginnt mit -100.", "channels.intro": "Aktivierte Kanäle erhalten Ausfall- und Entwarnungsmeldungen von Monitoren, die ihren Alertgruppen zugeordnet sind.", "channels.language": "Sprache", + "channels.manage_groups": "Schlüssel kopiert — Alertgruppen verwalten", "channels.new_email": "Neuer E-Mail-Kanal", "channels.new_service": "Weitere Dienste", "channels.new_webhook": "Neuer Webhook", diff --git a/internal/i18n/locales/en.json b/internal/i18n/locales/en.json index 26f66b0..0c30e30 100644 --- a/internal/i18n/locales/en.json +++ b/internal/i18n/locales/en.json @@ -135,6 +135,7 @@ "auth.sso.org_placeholder": "Organization short name", "auth.sso.submit": "Continue", "channels.create": "Create channel", + "channels.created": "Webhook created. It is already in the default alert group. Copy the signing secret before continuing.", "channels.delete_confirm": "Delete this channel?", "channels.field_access_key": "Access key", "channels.field_access_key_id": "AccessKey ID", @@ -273,6 +274,7 @@ "channels.help_telegram": "Create a bot with @BotFather; the chat ID of a group starts with -100.", "channels.intro": "Enabled channels receive outage and recovery alerts from monitors assigned to their alert groups.", "channels.language": "Language", + "channels.manage_groups": "Secret copied — manage alert groups", "channels.new_email": "New email channel", "channels.new_service": "Other services", "channels.new_webhook": "New webhook", diff --git a/internal/web/alert_groups.templ b/internal/web/alert_groups.templ index a19acc5..73bf0d5 100644 --- a/internal/web/alert_groups.templ +++ b/internal/web/alert_groups.templ @@ -32,7 +32,7 @@ templ alertGroupOptions(name string, options []AlertGroupOption) { } templ alertGroupsSettings(v ChannelsView) { -
+
@sectionHeading("alert_groups.title")

{ i18n.T(ctx, "alert_groups.intro") }

diff --git a/internal/web/alert_groups_templ.go b/internal/web/alert_groups_templ.go index c35bb6a..c63cec1 100644 --- a/internal/web/alert_groups_templ.go +++ b/internal/web/alert_groups_templ.go @@ -160,7 +160,7 @@ func alertGroupsSettings(v ChannelsView) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/web/assets/app.js b/internal/web/assets/app.js index 10b6719..7e23821 100644 --- a/internal/web/assets/app.js +++ b/internal/web/assets/app.js @@ -85,6 +85,7 @@ const form = ev.target.closest("form[data-api]"); if (!form) return; ev.preventDefault(); + if (form.dataset.created !== undefined) return; if (form.dataset.confirm && !confirm(form.dataset.confirm)) return; const button = form.querySelector("button[type=submit]"); const body = serialize(form); @@ -112,6 +113,19 @@ input.value = shown; out.hidden = false; input.select(); + if (form.dataset.refreshTarget) { + // Keep the one-time secret visible while refreshing the channel list + // and group choices. A successful create must not be submitted twice. + form.dataset.created = "true"; + const response = await fetch(location.href, { credentials: "same-origin" }); + if (!response.ok) throw new Error("refresh failed"); + const page = new DOMParser().parseFromString(await response.text(), "text/html"); + const selector = form.dataset.refreshTarget; + const updated = page.querySelector(selector); + const current = document.querySelector(selector); + if (!updated || !current) throw new Error("refresh target missing"); + current.replaceWith(updated); + } return; } if (res.data?.status === "totp_required" && totpStep) { @@ -126,7 +140,7 @@ } catch (err) { showError(form, message(err)); } finally { - button && (button.disabled = false); + button && (button.disabled = form.dataset.created !== undefined); } }); diff --git a/internal/web/monitors.templ b/internal/web/monitors.templ index 6909486..f7fd3ff 100644 --- a/internal/web/monitors.templ +++ b/internal/web/monitors.templ @@ -892,34 +892,36 @@ type ChannelsView struct { templ ChannelsPage(p Page, me Me, v ChannelsView) { @consoleShell(p, me) { @settingsHeading("channels.title", "channels.intro") - @alertGroupsSettings(v) - if len(v.Channels) > 0 { -
    - for _, ch := range v.Channels { -
  • - if ch.Enabled { - @statusDot(StatusUp) - } else { - @statusDot(StatusPaused) - } - { ch.Name } - { i18n.T(ctx, "channels.type_"+ch.Type) } - { ch.Target } - if v.CanWrite { - - - - - } -
  • - } -
- } +
+ @alertGroupsSettings(v) + if len(v.Channels) > 0 { +
    + for _, ch := range v.Channels { +
  • + if ch.Enabled { + @statusDot(StatusUp) + } else { + @statusDot(StatusPaused) + } + { ch.Name } + { i18n.T(ctx, "channels.type_"+ch.Type) } + { ch.Target } + if v.CanWrite { + + + + + } +
  • + } +
+ } +
if v.CanWrite {
@sectionHeading("channels.new_webhook") -
+ @formError() @valueField(i18n.T(ctx, "sso.field.name"), "name", "", "Ops", true) @@ -927,7 +929,9 @@ templ ChannelsPage(p Page, me Me, v ChannelsView) { @submit(i18n.T(ctx, "channels.create"))
diff --git a/internal/web/monitors_templ.go b/internal/web/monitors_templ.go index c5a3c11..122a967 100644 --- a/internal/web/monitors_templ.go +++ b/internal/web/monitors_templ.go @@ -4379,17 +4379,21 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 350, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } templ_7745c5c3_Err = alertGroupsSettings(v).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if len(v.Channels) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 350, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 351, "
      ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, ch := range v.Channels { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 351, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 352, "
    • ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4404,149 +4408,149 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 352, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 353, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var208 string templ_7745c5c3_Var208, templ_7745c5c3_Err = templ.JoinStringErrs(ch.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 905, Col: 21} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 906, Col: 22} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var208)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 353, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 354, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var209 string templ_7745c5c3_Var209, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "channels.type_"+ch.Type)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 906, Col: 70} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 907, Col: 71} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var209)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 354, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 355, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var210 string templ_7745c5c3_Var210, templ_7745c5c3_Err = templ.JoinStringErrs(ch.Target) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 907, Col: 77} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 908, Col: 78} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var210)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 355, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 356, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if v.CanWrite { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 356, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 363, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 363, "
    • ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 364, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 364, "
    ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 365, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 365, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 366, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if v.CanWrite { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 366, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 367, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4554,7 +4558,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 367, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 368, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4562,7 +4566,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 368, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 369, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4578,20 +4582,46 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 369, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 371, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var218 string + templ_7745c5c3_Var218, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "channels.created")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 932, Col: 64} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var218)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 372, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var219 string + templ_7745c5c3_Var219, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "channels.manage_groups")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 934, Col: 132} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var219)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 373, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4600,7 +4630,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { return templ_7745c5c3_Err } if v.EmailAvailable { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 371, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 374, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4608,7 +4638,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 372, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 375, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4616,79 +4646,79 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 373, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4696,30 +4726,30 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 382, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 385, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } else { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 383, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 386, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var222 string - templ_7745c5c3_Var222, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.email_not_configured")) + var templ_7745c5c3_Var224 string + templ_7745c5c3_Var224, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "error.email_not_configured")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 956, Col: 79} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 960, Col: 79} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var222)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var224)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 384, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 387, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 385, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 388, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4727,20 +4757,20 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 386, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 389, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var223 string - templ_7745c5c3_Var223, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "channels.service_intro")) + var templ_7745c5c3_Var225 string + templ_7745c5c3_Var225, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "channels.service_intro")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 961, Col: 89} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 965, Col: 89} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var223)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var225)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 387, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 390, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4748,81 +4778,81 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 388, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4830,118 +4860,118 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 397, "
") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - for i, pr := range v.Providers { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 405, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var232 string + templ_7745c5c3_Var232, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "lang."+l)) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 988, Col: 88} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var232)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 406, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 407, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for i, pr := range v.Providers { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 408, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 412, ">") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if pr.Help != "" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 410, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 413, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var232 string - templ_7745c5c3_Var232, templ_7745c5c3_Err = templ.JoinStringErrs(pr.Help) + var templ_7745c5c3_Var234 string + templ_7745c5c3_Var234, templ_7745c5c3_Err = templ.JoinStringErrs(pr.Help) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 993, Col: 54} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 997, Col: 54} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var232)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var234)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 411, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 414, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4952,7 +4982,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 412, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 415, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -4961,7 +4991,7 @@ func ChannelsPage(p Page, me Me, v ChannelsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 413, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 416, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5012,208 +5042,208 @@ func providerField(f ProviderField) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 414, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 441, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5238,85 +5268,85 @@ func groupSelect(name string, groups []GroupOption, selected string, allowNone b } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 439, "") + for _, g := range groups { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 446, "") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 451, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5359,7 +5389,7 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var250 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var252 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -5371,20 +5401,20 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 449, "

← ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 452, "

← ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var251 string - templ_7745c5c3_Var251, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title")) + var templ_7745c5c3_Var253 string + templ_7745c5c3_Var253, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.monitors.title")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1089, Col: 115} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1093, Col: 115} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var251)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var253)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 450, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 453, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5393,69 +5423,69 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { return templ_7745c5c3_Err } if len(v.Groups) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 451, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 467, " ") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 470, " ") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } if v.CanWrite { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 468, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 471, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5563,7 +5593,7 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 469, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 472, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5575,20 +5605,20 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 470, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 475, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5604,14 +5634,14 @@ func GroupsPage(p Page, me Me, v GroupsView) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 473, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 476, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } return nil }) - templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var250), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var252), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5643,7 +5673,7 @@ func pingSection(url string) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 474, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 477, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5651,55 +5681,55 @@ func pingSection(url string) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 475, "

") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var262 string - templ_7745c5c3_Var262, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.ping_intro")) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1144, Col: 83} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var262)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 476, "

")
-		if templ_7745c5c3_Err != nil {
-			return templ_7745c5c3_Err
-		}
-		var templ_7745c5c3_Var263 string
-		templ_7745c5c3_Var263, templ_7745c5c3_Err = templ.JoinStringErrs("curl -fsS -m 10 --retry 3 " + url + "\n")
-		if templ_7745c5c3_Err != nil {
-			return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1145, Col: 137}
-		}
-		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var263))
+		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 478, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var264 string - templ_7745c5c3_Var264, templ_7745c5c3_Err = templ.JoinStringErrs("curl -fsS -m 10 --retry 3 --data-raw \"$output\" " + url + "/fail") + templ_7745c5c3_Var264, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.ping_intro")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1145, Col: 208} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1148, Col: 83} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var264)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 477, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 479, "

")
 		if templ_7745c5c3_Err != nil {
 			return templ_7745c5c3_Err
 		}
 		var templ_7745c5c3_Var265 string
-		templ_7745c5c3_Var265, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.ping_secret"))
+		templ_7745c5c3_Var265, templ_7745c5c3_Err = templ.JoinStringErrs("curl -fsS -m 10 --retry 3 " + url + "\n")
 		if templ_7745c5c3_Err != nil {
-			return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1146, Col: 84}
+			return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1149, Col: 137}
 		}
 		_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var265))
 		if templ_7745c5c3_Err != nil {
 			return templ_7745c5c3_Err
 		}
-		templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 478, "

") + var templ_7745c5c3_Var266 string + templ_7745c5c3_Var266, templ_7745c5c3_Err = templ.JoinStringErrs("curl -fsS -m 10 --retry 3 --data-raw \"$output\" " + url + "/fail") + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1149, Col: 208} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var266)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 480, "

") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var267 string + templ_7745c5c3_Var267, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.ping_secret")) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1150, Col: 84} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var267)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 481, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5745,20 +5775,20 @@ func dbFields(typ string, d DBForm) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 479, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 482, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var267 string - templ_7745c5c3_Var267, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.db_hint")) + var templ_7745c5c3_Var269 string + templ_7745c5c3_Var269, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.db_hint")) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1172, Col: 69} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1176, Col: 69} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var267)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var269)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 480, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 483, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5786,33 +5816,33 @@ func dbFields(typ string, d DBForm) templ.Component { return templ_7745c5c3_Err } if typ != "redis" && typ != "mongodb" { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 481, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5844,56 +5874,56 @@ func secretField(label, name string, set bool) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 484, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -5919,66 +5949,66 @@ func tlsField(value string, modes ...string) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 490, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -6003,20 +6033,20 @@ func brokerFields(typ string, b BrokerForm) templ.Component { } ctx = templ.InitializeContext(ctx) ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 498, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 501, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var279 string - templ_7745c5c3_Var279, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.broker_hint_"+typ)) + var templ_7745c5c3_Var281 string + templ_7745c5c3_Var281, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.broker_hint_"+typ)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1220, Col: 78} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/monitors.templ`, Line: 1224, Col: 78} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var279)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var281)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 499, "

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 502, "

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -6043,66 +6073,66 @@ func brokerFields(typ string, b BrokerForm) templ.Component { return templ_7745c5c3_Err } case "kafka": - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 500, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/web/testdata/webhook.html b/internal/web/testdata/webhook.html new file mode 100644 index 0000000..ebacb7b --- /dev/null +++ b/internal/web/testdata/webhook.html @@ -0,0 +1,43 @@ + +
Old channels
+
+ +

+ +
+

+
+
+