feat: support tickets between accounts and platform admins
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 7m0s
ci / test (pull_request) Successful in 12m1s
ci / build (pull_request) Successful in 18m14s
ci / image (pull_request) Successful in 5m9s
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 7m0s
ci / test (pull_request) Successful in 12m1s
ci / build (pull_request) Successful in 18m14s
ci / image (pull_request) Successful in 5m9s
Accounts open tickets under Support and admins answer them under Admin → Support tickets. - A ticket is open while it waits for the admins and answered while it waits for the account. Either side can close or reopen it, and a reply reopens it. - The admins are mailed about new tickets and replies, and the account about answers. - A ticket can name the active organization and point at a monitor, notification channel, alert group, status page or incident in it. Each must be something the account can read. - Next to the conversation, admins see the account at a glance: state, sign-in, organizations with their limits and usage, and open tickets. - Admins switch support off and limit how many tickets an account has open at once. - Suspended accounts and those yet to accept the terms reach support too; a suspended account opens one ticket. - Tickets are part of the account export and are deleted with the account. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
9fc3c6b050
commit
f3d402705e
25 files changed
+5296
-451
No files matched your search
+12
-2
@@ -222,7 +222,12 @@ templ ConsentPage(p Page, me Me, docs []LegalLink, versions, next string) {
|
||||
</label>
|
||||
@submit(i18n.T(ctx, "consent.submit"))
|
||||
</form>
|
||||
<p class="mt-6 text-sm"><button data-logout class="underline underline-offset-2">{ i18n.T(ctx, "console.nav.logout") }</button></p>
|
||||
<p class="mt-6 flex flex-wrap gap-x-4 text-sm">
|
||||
if me.Support {
|
||||
<a href="/support" class="underline underline-offset-2">{ i18n.T(ctx, "support.contact") }</a>
|
||||
}
|
||||
<button data-logout class="underline underline-offset-2">{ i18n.T(ctx, "console.nav.logout") }</button>
|
||||
</p>
|
||||
<div class="mt-12 border-t border-rule pt-6">
|
||||
<p class="mb-6 text-sm text-muted">{ i18n.T(ctx, "consent.decline") }</p>
|
||||
@accountDataBody(me)
|
||||
@@ -246,7 +251,12 @@ templ SuspendedPage(p Page, me Me, reason string) {
|
||||
<p class="mb-6 border-l-2 border-down pl-3 text-sm">{ reason }</p>
|
||||
}
|
||||
<p class="mb-6 text-sm text-muted">{ i18n.T(ctx, "suspended.options") }</p>
|
||||
<p class="mb-10 text-sm"><button data-logout class="underline underline-offset-2">{ i18n.T(ctx, "console.nav.logout") }</button></p>
|
||||
<p class="mb-10 flex flex-wrap gap-x-4 text-sm">
|
||||
if me.Support {
|
||||
<a href="/support" class="underline underline-offset-2">{ i18n.T(ctx, "support.contact") }</a>
|
||||
}
|
||||
<button data-logout class="underline underline-offset-2">{ i18n.T(ctx, "console.nav.logout") }</button>
|
||||
</p>
|
||||
@accountDataBody(me)
|
||||
</main>
|
||||
}
|
||||
|
||||
+104
-58
@@ -1292,33 +1292,56 @@ func ConsentPage(p Page, me Me, docs []LegalLink, versions, next string) templ.C
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, "</form><p class=\"mt-6 text-sm\"><button data-logout class=\"underline underline-offset-2\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 85, "</form><p class=\"mt-6 flex flex-wrap gap-x-4 text-sm\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var64 string
|
||||
templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 225, Col: 119}
|
||||
if me.Support {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "<a href=\"/support\" class=\"underline underline-offset-2\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var64 string
|
||||
templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "support.contact"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 227, Col: 93}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, "</a> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 86, "</button></p><div class=\"mt-12 border-t border-rule pt-6\"><p class=\"mb-6 text-sm text-muted\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, "<button data-logout class=\"underline underline-offset-2\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var65 string
|
||||
templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "consent.decline"))
|
||||
templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 227, Col: 71}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 229, Col: 96}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var65))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 87, "</p>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, "</button></p><div class=\"mt-12 border-t border-rule pt-6\"><p class=\"mb-6 text-sm text-muted\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var66 string
|
||||
templ_7745c5c3_Var66, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "consent.decline"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 232, Col: 71}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var66))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 90, "</p>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -1326,7 +1349,7 @@ func ConsentPage(p Page, me Me, docs []LegalLink, versions, next string) templ.C
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 88, "</div></main>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "</div></main>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -1359,7 +1382,7 @@ func SuspendedPage(p Page, me Me, reason string) templ.Component {
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var67 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Var68 := 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 {
|
||||
@@ -1371,7 +1394,7 @@ func SuspendedPage(p Page, me Me, reason string) templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 89, "<main class=\"mx-auto mt-[8vh] w-full max-w-xl px-6 pb-16\"><div class=\"mb-10 flex items-center justify-between\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "<main class=\"mx-auto mt-[8vh] w-full max-w-xl px-6 pb-16\"><div class=\"mb-10 flex items-center justify-between\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -1383,82 +1406,105 @@ func SuspendedPage(p Page, me Me, reason string) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 90, "</div><h1 class=\"mb-4 text-xl font-semibold\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var68 string
|
||||
templ_7745c5c3_Var68, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, p.TitleID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 243, Col: 66}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var68))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 91, "</h1><p class=\"mb-2 text-sm\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "</div><h1 class=\"mb-4 text-xl font-semibold\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var69 string
|
||||
templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "suspended.intro"))
|
||||
templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, p.TitleID))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 244, Col: 59}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 248, Col: 66}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var69))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 92, "</p>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "</h1><p class=\"mb-2 text-sm\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var70 string
|
||||
templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "suspended.intro"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 249, Col: 59}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 95, "</p>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if reason != "" {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 93, "<p class=\"mb-6 border-l-2 border-down pl-3 text-sm\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 96, "<p class=\"mb-6 border-l-2 border-down pl-3 text-sm\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var70 string
|
||||
templ_7745c5c3_Var70, templ_7745c5c3_Err = templ.JoinStringErrs(reason)
|
||||
var templ_7745c5c3_Var71 string
|
||||
templ_7745c5c3_Var71, templ_7745c5c3_Err = templ.JoinStringErrs(reason)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 246, Col: 64}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 251, Col: 64}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var70))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var71))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 94, "</p>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 97, "</p>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 95, "<p class=\"mb-6 text-sm text-muted\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var71 string
|
||||
templ_7745c5c3_Var71, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "suspended.options"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 248, Col: 72}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var71))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 96, "</p><p class=\"mb-10 text-sm\"><button data-logout class=\"underline underline-offset-2\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 98, "<p class=\"mb-6 text-sm text-muted\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var72 string
|
||||
templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout"))
|
||||
templ_7745c5c3_Var72, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "suspended.options"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 249, Col: 120}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 253, Col: 72}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var72))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 97, "</button></p>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 99, "</p><p class=\"mb-10 flex flex-wrap gap-x-4 text-sm\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if me.Support {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 100, "<a href=\"/support\" class=\"underline underline-offset-2\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var73 string
|
||||
templ_7745c5c3_Var73, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "support.contact"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 256, Col: 93}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var73))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 101, "</a> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 102, "<button data-logout class=\"underline underline-offset-2\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var74 string
|
||||
templ_7745c5c3_Var74, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "console.nav.logout"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/auth.templ`, Line: 258, Col: 96}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var74))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 103, "</button></p>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -1466,13 +1512,13 @@ func SuspendedPage(p Page, me Me, reason string) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 98, "</main>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 104, "</main>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
templ_7745c5c3_Err = Layout(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var67), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = Layout(p).Render(templ.WithChildren(ctx, templ_7745c5c3_Var68), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ type Me struct {
|
||||
// DeletesOrgs names the organizations the account is the last owner
|
||||
// of; deleting it deletes them, with all their monitors.
|
||||
DeletesOrgs []string
|
||||
// Support is set while accounts can open support tickets.
|
||||
Support bool
|
||||
}
|
||||
|
||||
// Org is one entry of the organization switcher.
|
||||
@@ -79,6 +81,9 @@ templ consoleShell(p Page, me Me) {
|
||||
}
|
||||
</nav>
|
||||
<nav class="flex flex-col gap-3 border-t border-rule pt-3 lg:ml-auto lg:flex-row lg:items-center lg:gap-5 lg:whitespace-nowrap lg:border-0 lg:pt-0">
|
||||
if me.Support {
|
||||
<a href="/support" class="text-muted hover:text-ink">{ i18n.T(ctx, "support.title") }</a>
|
||||
}
|
||||
<a href="/settings" class="text-muted hover:text-ink">{ i18n.T(ctx, "console.nav.settings") }</a>
|
||||
if me.IsAdmin {
|
||||
<a href="/admin" class="font-medium hover:underline">{ i18n.T(ctx, "console.nav.admin") }</a>
|
||||
|
||||
+332
-307
File diff suppressed because it is too large.
Load diff
@@ -403,6 +403,7 @@ templ adminLinks() {
|
||||
<a href="/admin/orgs" class="underline underline-offset-2">{ i18n.T(ctx, "orgs.title") }</a>
|
||||
<a href="/admin/audit" class="underline underline-offset-2">{ i18n.T(ctx, "audit.platform_title") }</a>
|
||||
<a href="/admin/legal" class="underline underline-offset-2">{ i18n.T(ctx, "legal.platform_title") }</a>
|
||||
<a href="/admin/support" class="underline underline-offset-2">{ i18n.T(ctx, "support.admin_title") }</a>
|
||||
</p>
|
||||
}
|
||||
|
||||
|
||||
@@ -1896,7 +1896,20 @@ func adminLinks() templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 149, "</a></p>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 149, "</a> <a href=\"/admin/support\" class=\"underline underline-offset-2\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var97 string
|
||||
templ_7745c5c3_Var97, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "support.admin_title"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 406, Col: 100}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var97))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 150, "</a></p>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -1921,7 +1934,7 @@ func AdminStatusPagesPage(p Page, me Me, v ModerationView) templ.Component {
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var98 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Var99 := 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 {
|
||||
@@ -1933,20 +1946,20 @@ func AdminStatusPagesPage(p Page, me Me, v ModerationView) templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 150, "<p class=\"mb-4 text-sm\"><a href=\"/admin\" class=\"text-muted hover:text-ink\">← ")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 151, "<p class=\"mb-4 text-sm\"><a href=\"/admin\" class=\"text-muted hover:text-ink\">← ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var99 string
|
||||
templ_7745c5c3_Var99, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "admin.title"))
|
||||
var templ_7745c5c3_Var100 string
|
||||
templ_7745c5c3_Var100, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "admin.title"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 411, Col: 109}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 412, Col: 109}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var99))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var100))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 151, "</a></p>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 152, "</a></p>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -1956,7 +1969,7 @@ func AdminStatusPagesPage(p Page, me Me, v ModerationView) templ.Component {
|
||||
}
|
||||
return nil
|
||||
})
|
||||
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var98), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var99), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -1981,7 +1994,7 @@ func AdminOrgsPage(p Page, me Me, v OrgsView) templ.Component {
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var101 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Var102 := 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 {
|
||||
@@ -1993,20 +2006,20 @@ func AdminOrgsPage(p Page, me Me, v OrgsView) templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 152, "<p class=\"mb-4 text-sm\"><a href=\"/admin\" class=\"text-muted hover:text-ink\">← ")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 153, "<p class=\"mb-4 text-sm\"><a href=\"/admin\" class=\"text-muted hover:text-ink\">← ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var102 string
|
||||
templ_7745c5c3_Var102, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "admin.title"))
|
||||
var templ_7745c5c3_Var103 string
|
||||
templ_7745c5c3_Var103, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "admin.title"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 418, Col: 109}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 419, Col: 109}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var102))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var103))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 153, "</a></p>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 154, "</a></p>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -2016,7 +2029,7 @@ func AdminOrgsPage(p Page, me Me, v OrgsView) templ.Component {
|
||||
}
|
||||
return nil
|
||||
})
|
||||
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var101), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = consoleShell(p, me).Render(templ.WithChildren(ctx, templ_7745c5c3_Var102), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -2043,173 +2056,173 @@ func agentInstall(in InstallView) templ.Component {
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 154, "<div data-install data-channel=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var104 string
|
||||
templ_7745c5c3_Var104, templ_7745c5c3_Err = templruntime.NewAttributeExpression(in.Channel).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 426, Col: 44}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var104)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 155, "\" class=\"mt-6 border-t border-rule pt-4\"><h3 class=\"mb-2 text-sm font-medium\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 155, "<div data-install data-channel=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var105 string
|
||||
templ_7745c5c3_Var105, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.install_heading"))
|
||||
templ_7745c5c3_Var105, templ_7745c5c3_Err = templruntime.NewAttributeExpression(in.Channel).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 427, Col: 78}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 427, Col: 44}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var105))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var105)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 156, "</h3><label class=\"mb-1 flex items-center gap-2 text-sm\"><input type=\"checkbox\" data-install-auto checked class=\"accent-ink\"> ")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 156, "\" class=\"mt-6 border-t border-rule pt-4\"><h3 class=\"mb-2 text-sm font-medium\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var106 string
|
||||
templ_7745c5c3_Var106, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.install_auto"))
|
||||
templ_7745c5c3_Var106, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.install_heading"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 430, Col: 39}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 428, Col: 78}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var106))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 157, "</label><p class=\"mb-4 ml-6 text-xs text-muted\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 157, "</h3><label class=\"mb-1 flex items-center gap-2 text-sm\"><input type=\"checkbox\" data-install-auto checked class=\"accent-ink\"> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var107 string
|
||||
templ_7745c5c3_Var107, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.install_auto_hint"))
|
||||
templ_7745c5c3_Var107, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.install_auto"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 432, Col: 83}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 431, Col: 39}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var107))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 158, "</p><p class=\"mb-1 text-xs font-medium uppercase tracking-wider text-muted\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 158, "</label><p class=\"mb-4 ml-6 text-xs text-muted\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var108 string
|
||||
templ_7745c5c3_Var108, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.install_oneliner"))
|
||||
templ_7745c5c3_Var108, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.install_auto_hint"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 433, Col: 114}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 433, Col: 83}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var108))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 159, "</p><pre data-install-fill=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 159, "</p><p class=\"mb-1 text-xs font-medium uppercase tracking-wider text-muted\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var109 string
|
||||
templ_7745c5c3_Var109, templ_7745c5c3_Err = templruntime.NewAttributeExpression("curl -fsSL " + in.ScriptURL + " | sudo sh -s -- {kind} --token {token}{manual}").Resolve(ctx)
|
||||
templ_7745c5c3_Var109, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.install_oneliner"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 434, Col: 107}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 434, Col: 114}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var109)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var109))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 160, "\" class=\"mb-1 overflow-x-auto whitespace-pre-wrap break-all border border-rule p-2 font-mono text-xs\"></pre><p data-install-kind=\"statuspage\" class=\"mb-4 text-xs text-muted\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 160, "</p><pre data-install-fill=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var110 string
|
||||
templ_7745c5c3_Var110, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.install_statuspage_hint"))
|
||||
templ_7745c5c3_Var110, templ_7745c5c3_Err = templruntime.NewAttributeExpression("curl -fsSL " + in.ScriptURL + " | sudo sh -s -- {kind} --token {token}{manual}").Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 435, Col: 115}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 435, Col: 107}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var110))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var110)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 161, "</p><details class=\"mt-4\"><summary class=\"cursor-pointer text-sm\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 161, "\" class=\"mb-1 overflow-x-auto whitespace-pre-wrap break-all border border-rule p-2 font-mono text-xs\"></pre><p data-install-kind=\"statuspage\" class=\"mb-4 text-xs text-muted\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var111 string
|
||||
templ_7745c5c3_Var111, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.install_compose"))
|
||||
templ_7745c5c3_Var111, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.install_statuspage_hint"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 437, Col: 82}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 436, Col: 115}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var111))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 162, "</summary> ")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 162, "</p><details class=\"mt-4\"><summary class=\"cursor-pointer text-sm\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var112 string
|
||||
templ_7745c5c3_Var112, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.install_compose"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 438, Col: 82}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var112))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 163, "</summary> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, kind := range []string{"checker", "statuspage"} {
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 163, "<div data-install-kind=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var112 string
|
||||
templ_7745c5c3_Var112, templ_7745c5c3_Err = templruntime.NewAttributeExpression(kind).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 439, Col: 33}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var112)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 164, "\" class=\"mt-3\"><p class=\"mb-1 font-mono text-xs text-muted\">compose.yaml</p><pre class=\"mb-3 max-h-64 overflow-auto border border-rule p-2 font-mono text-xs\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 164, "<div data-install-kind=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var113 string
|
||||
templ_7745c5c3_Var113, templ_7745c5c3_Err = templ.JoinStringErrs(in.Compose[kind])
|
||||
templ_7745c5c3_Var113, templ_7745c5c3_Err = templruntime.NewAttributeExpression(kind).Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 441, Col: 105}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 440, Col: 33}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var113))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var113)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 165, "</pre><p class=\"mb-1 font-mono text-xs text-muted\">.env</p><pre data-install-fill=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 165, "\" class=\"mt-3\"><p class=\"mb-1 font-mono text-xs text-muted\">compose.yaml</p><pre class=\"mb-3 max-h-64 overflow-auto border border-rule p-2 font-mono text-xs\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var114 string
|
||||
templ_7745c5c3_Var114, templ_7745c5c3_Err = templruntime.NewAttributeExpression("UPTIME_API_URL=" + in.APIURL + "\nUPTIME_AGENT_TOKEN={token}\nUPTIME_AGENT_IMAGE=" + in.Image + "\nUPTIME_AGENT_TAG={tag}").Resolve(ctx)
|
||||
templ_7745c5c3_Var114, templ_7745c5c3_Err = templ.JoinStringErrs(in.Compose[kind])
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 443, Col: 153}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 442, Col: 105}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var114)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var114))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 166, "\" class=\"overflow-x-auto border border-rule p-2 font-mono text-xs\"></pre><p class=\"mt-2 text-xs text-muted\">")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 166, "</pre><p class=\"mb-1 font-mono text-xs text-muted\">.env</p><pre data-install-fill=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var115 string
|
||||
templ_7745c5c3_Var115, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.install_compose_hint"))
|
||||
templ_7745c5c3_Var115, templ_7745c5c3_Err = templruntime.NewAttributeExpression("UPTIME_API_URL=" + in.APIURL + "\nUPTIME_AGENT_TOKEN={token}\nUPTIME_AGENT_IMAGE=" + in.Image + "\nUPTIME_AGENT_TAG={tag}").Resolve(ctx)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 444, Col: 84}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 444, Col: 153}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var115))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var115)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 167, "</p></div>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 167, "\" class=\"overflow-x-auto border border-rule p-2 font-mono text-xs\"></pre><p class=\"mt-2 text-xs text-muted\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var116 string
|
||||
templ_7745c5c3_Var116, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "agents.install_compose_hint"))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/regions.templ`, Line: 445, Col: 84}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var116))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 168, "</p></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 168, "</details></div>")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 169, "</details></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
@@ -0,0 +1,413 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
||||
)
|
||||
|
||||
// SupportTicket is a ticket as the support pages show it; User and Org
|
||||
// are filled for admins.
|
||||
type SupportTicket struct {
|
||||
ID, Subject, Status string
|
||||
User, Org string
|
||||
Updated string
|
||||
References []SupportReference
|
||||
Messages []SupportMessage
|
||||
}
|
||||
|
||||
// SupportReference is something a ticket points at; Kind is org, monitor,
|
||||
// channel, alert_group, status_page or incident.
|
||||
type SupportReference struct {
|
||||
Kind, Name string
|
||||
}
|
||||
|
||||
// SupportMessage is one message of a ticket, rendered from Markdown.
|
||||
type SupportMessage struct {
|
||||
FromStaff bool
|
||||
// Author is the admin who answered, for admins only.
|
||||
Author string
|
||||
HTML string
|
||||
At string
|
||||
}
|
||||
|
||||
// SupportOptions are what of the active organization a new ticket can
|
||||
// point at; Org is empty without one.
|
||||
type SupportOptions struct {
|
||||
Org string
|
||||
Monitors, Channels, AlertGroups, StatusPages, Incidents []SupportOption
|
||||
}
|
||||
|
||||
// SupportOption is one choice of SupportOptions.
|
||||
type SupportOption struct {
|
||||
ID, Name string
|
||||
}
|
||||
|
||||
// SupportSettings are how the platform runs support, for its admins.
|
||||
type SupportSettings struct {
|
||||
Enabled bool
|
||||
MaxOpen int
|
||||
}
|
||||
|
||||
// SupportAccount is what admins see about the account behind a ticket.
|
||||
type SupportAccount struct {
|
||||
ID, Email, Name, Created, Locale string
|
||||
Verified, TOTP, Password, Admin bool
|
||||
Suspended bool
|
||||
SuspendedReason string
|
||||
OrgsOwned, OrgLimit int
|
||||
OpenTickets int64
|
||||
Orgs []SupportOrg
|
||||
}
|
||||
|
||||
// SupportOrg is an organization of the account with its limits; Current
|
||||
// marks the one the ticket names. Limits of 0 are unlimited.
|
||||
type SupportOrg struct {
|
||||
Name, Slug string
|
||||
Owner, Current, Suspended bool
|
||||
SuspendedReason string
|
||||
Monitors, MonitorLimit int
|
||||
StatusPages, StatusPageLimit int
|
||||
RegionsPerMonitor int
|
||||
}
|
||||
|
||||
// SupportStatuses are the states of a ticket, in the order admins filter
|
||||
// them.
|
||||
var SupportStatuses = []string{"open", "answered", "closed"}
|
||||
|
||||
var supportFilters = append(append([]string{}, SupportStatuses...), "all")
|
||||
|
||||
// supportBase is where the support pages live for staff or the account.
|
||||
func supportBase(staff bool) string {
|
||||
if staff {
|
||||
return "/admin/support"
|
||||
}
|
||||
return "/support"
|
||||
}
|
||||
|
||||
func supportAPI(t SupportTicket, staff bool) string {
|
||||
return supportBase(staff) + "/tickets/" + t.ID
|
||||
}
|
||||
|
||||
// usageText shows used of limit, ∞ for no limit.
|
||||
func usageText(used, limit int) string {
|
||||
if limit <= 0 {
|
||||
return strconv.Itoa(used) + " / ∞"
|
||||
}
|
||||
return strconv.Itoa(used) + " / " + strconv.Itoa(limit)
|
||||
}
|
||||
|
||||
templ supportStatusLabel(status string) {
|
||||
<span
|
||||
class={ "whitespace-nowrap border px-1.5 py-0.5 font-mono text-xs",
|
||||
templ.KV("border-down text-down", status == "open"),
|
||||
templ.KV("border-up text-up", status == "answered"),
|
||||
templ.KV("border-rule text-muted", status == "closed") }
|
||||
>{ i18n.T(ctx, "support.status."+status) }</span>
|
||||
}
|
||||
|
||||
templ supportList(tickets []SupportTicket, base string, staff bool) {
|
||||
<ul class="divide-y divide-rule border-y border-rule text-sm">
|
||||
for _, t := range tickets {
|
||||
<li>
|
||||
<a href={ templ.SafeURL(base + t.ID) } class="flex flex-wrap items-center gap-x-4 gap-y-1 py-3 hover:bg-rule/30">
|
||||
@supportStatusLabel(t.Status)
|
||||
<span class="order-last min-w-0 basis-full truncate font-medium sm:order-none sm:flex-1 sm:basis-0">{ t.Subject }</span>
|
||||
if staff {
|
||||
<span class="order-last min-w-0 basis-full truncate text-muted sm:order-none sm:basis-auto">
|
||||
{ t.User }
|
||||
if t.Org != "" {
|
||||
{ " · " + t.Org }
|
||||
}
|
||||
</span>
|
||||
}
|
||||
<span class="ml-auto font-mono text-xs text-muted">{ t.Updated }</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
|
||||
templ supportSelect(labelID, name string, opts []SupportOption) {
|
||||
if len(opts) > 0 {
|
||||
<label class="mb-3 block">
|
||||
<span class="mb-1 block text-xs text-muted">{ i18n.T(ctx, labelID) }</span>
|
||||
<select name={ name } class="w-full border border-rule bg-transparent px-2 py-1.5 text-sm">
|
||||
<option value="">{ "– " + i18n.T(ctx, "support.attach_none") }</option>
|
||||
for _, o := range opts {
|
||||
<option value={ o.ID }>{ o.Name }</option>
|
||||
}
|
||||
</select>
|
||||
</label>
|
||||
}
|
||||
}
|
||||
|
||||
templ SupportPage(p Page, me Me, tickets []SupportTicket, opts SupportOptions) {
|
||||
@consoleShell(p, me) {
|
||||
@settingsHeading("support.title", "support.intro")
|
||||
<div class="grid gap-12 md:grid-cols-[1fr_22rem]">
|
||||
<section>
|
||||
@sectionHeading("support.mine")
|
||||
if len(tickets) == 0 {
|
||||
<p class="border-y border-rule py-10 text-center text-sm text-muted">{ i18n.T(ctx, "support.none") }</p>
|
||||
} else {
|
||||
@supportList(tickets, "/support/", false)
|
||||
}
|
||||
</section>
|
||||
<aside>
|
||||
@sectionHeading("support.new")
|
||||
<form data-api="/support/tickets" data-next="/support/" data-next-from="id">
|
||||
@formError()
|
||||
<label class="mb-4 block">
|
||||
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "support.subject") }</span>
|
||||
<input name="subject" required maxlength="200" class="w-full border border-rule bg-transparent px-2.5 py-1.5 outline-none focus:border-ink"/>
|
||||
</label>
|
||||
<div class="mb-4">
|
||||
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "support.message") }</span>
|
||||
@MarkdownEditor("message", "", 8, 10000, MarkdownInline)
|
||||
</div>
|
||||
if opts.Org != "" {
|
||||
<details class="mb-4 border border-rule p-3">
|
||||
<summary class="cursor-pointer text-sm">{ i18n.T(ctx, "support.attach") }</summary>
|
||||
<p class="mt-2 mb-3 text-xs text-muted">{ i18n.T(ctx, "support.attach_hint") }</p>
|
||||
@checkbox(i18n.T(ctx, "support.attach_org", "Org", opts.Org), "attach_org", false)
|
||||
@supportSelect("support.ref.monitor", "monitor_id", opts.Monitors)
|
||||
@supportSelect("support.ref.channel", "channel_id", opts.Channels)
|
||||
@supportSelect("support.ref.alert_group", "alert_group_id", opts.AlertGroups)
|
||||
@supportSelect("support.ref.status_page", "status_page_id", opts.StatusPages)
|
||||
@supportSelect("support.ref.incident", "incident_id", opts.Incidents)
|
||||
</details>
|
||||
}
|
||||
@submit(i18n.T(ctx, "support.send"))
|
||||
</form>
|
||||
</aside>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
templ SupportDisabledPage(p Page, me Me) {
|
||||
@consoleShell(p, me) {
|
||||
@settingsHeading("support.title", "")
|
||||
<p class="border-y border-rule py-10 text-center text-sm text-muted">{ i18n.T(ctx, "support.disabled") }</p>
|
||||
}
|
||||
}
|
||||
|
||||
templ supportReferences(refs []SupportReference) {
|
||||
if len(refs) > 0 {
|
||||
<dl class="mb-8 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 border-y border-rule py-3 text-sm">
|
||||
for _, r := range refs {
|
||||
<dt class="text-muted">{ i18n.T(ctx, "support.ref."+r.Kind) }</dt>
|
||||
<dd class="min-w-0 break-words">{ r.Name }</dd>
|
||||
}
|
||||
</dl>
|
||||
}
|
||||
}
|
||||
|
||||
templ supportFlag(on bool, yesID, noID string) {
|
||||
if on {
|
||||
<span class="text-up">{ i18n.T(ctx, yesID) }</span>
|
||||
} else {
|
||||
<span class="text-muted">{ i18n.T(ctx, noID) }</span>
|
||||
}
|
||||
}
|
||||
|
||||
// supportAccountBox gives admins the account behind a ticket at a glance.
|
||||
templ supportAccountBox(a SupportAccount) {
|
||||
<aside class="self-start border border-rule p-4 text-sm">
|
||||
@sectionHeading("support.account")
|
||||
<dl class="grid grid-cols-[auto_1fr] gap-x-4 gap-y-1">
|
||||
<dt class="text-muted">{ i18n.T(ctx, "support.account.email") }</dt>
|
||||
<dd class="min-w-0 break-all">{ a.Email }</dd>
|
||||
if a.Name != "" {
|
||||
<dt class="text-muted">{ i18n.T(ctx, "support.account.name") }</dt>
|
||||
<dd class="min-w-0 break-words">{ a.Name }</dd>
|
||||
}
|
||||
<dt class="text-muted">{ i18n.T(ctx, "support.account.created") }</dt>
|
||||
<dd class="font-mono text-xs">{ a.Created }</dd>
|
||||
<dt class="text-muted">{ i18n.T(ctx, "support.account.state") }</dt>
|
||||
<dd>
|
||||
if a.Suspended {
|
||||
<span class="text-down">{ i18n.T(ctx, "support.account.suspended") }</span>
|
||||
if a.SuspendedReason != "" {
|
||||
<span class="text-muted">{ " · " + a.SuspendedReason }</span>
|
||||
}
|
||||
} else {
|
||||
<span class="text-up">{ i18n.T(ctx, "support.account.active") }</span>
|
||||
}
|
||||
</dd>
|
||||
<dt class="text-muted">{ i18n.T(ctx, "support.account.email_verified") }</dt>
|
||||
<dd>
|
||||
@supportFlag(a.Verified, "support.yes", "support.no")
|
||||
</dd>
|
||||
<dt class="text-muted">{ i18n.T(ctx, "support.account.sign_in") }</dt>
|
||||
<dd>
|
||||
if a.Password {
|
||||
{ i18n.T(ctx, "support.account.password") }
|
||||
} else {
|
||||
{ i18n.T(ctx, "support.account.sso_only") }
|
||||
}
|
||||
if a.TOTP {
|
||||
{ " · 2FA" }
|
||||
}
|
||||
</dd>
|
||||
if a.Admin {
|
||||
<dt class="text-muted">{ i18n.T(ctx, "support.account.role") }</dt>
|
||||
<dd class="font-medium">{ i18n.T(ctx, "console.nav.admin") }</dd>
|
||||
}
|
||||
if a.Locale != "" {
|
||||
<dt class="text-muted">{ i18n.T(ctx, "support.account.locale") }</dt>
|
||||
<dd class="font-mono text-xs">{ a.Locale }</dd>
|
||||
}
|
||||
<dt class="text-muted">{ i18n.T(ctx, "support.account.orgs_owned") }</dt>
|
||||
<dd class="font-mono text-xs">{ usageText(a.OrgsOwned, a.OrgLimit) }</dd>
|
||||
<dt class="text-muted">{ i18n.T(ctx, "support.account.open_tickets") }</dt>
|
||||
<dd class="font-mono text-xs">{ strconv.FormatInt(a.OpenTickets, 10) }</dd>
|
||||
<dt class="text-muted">{ "ID" }</dt>
|
||||
<dd class="min-w-0 break-all font-mono text-xs text-muted">{ a.ID }</dd>
|
||||
</dl>
|
||||
if len(a.Orgs) > 0 {
|
||||
<h3 class="mt-6 mb-2 text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "support.account.orgs") }</h3>
|
||||
<ul class="space-y-3">
|
||||
for _, o := range a.Orgs {
|
||||
<li class={ "border-l-2 pl-3", templ.KV("border-ink", o.Current), templ.KV("border-rule", !o.Current) }>
|
||||
<p class="flex flex-wrap items-baseline gap-x-2">
|
||||
<span class="font-medium">{ o.Name }</span>
|
||||
<span class="font-mono text-xs text-muted">{ o.Slug }</span>
|
||||
if o.Owner {
|
||||
<span class="text-xs">{ i18n.T(ctx, "support.account.owner") }</span>
|
||||
}
|
||||
if o.Current {
|
||||
<span class="text-xs text-muted">{ i18n.T(ctx, "support.account.this_ticket") }</span>
|
||||
}
|
||||
</p>
|
||||
if o.Suspended {
|
||||
<p class="text-xs text-down">
|
||||
{ i18n.T(ctx, "support.account.org_suspended") }
|
||||
if o.SuspendedReason != "" {
|
||||
{ " · " + o.SuspendedReason }
|
||||
}
|
||||
</p>
|
||||
}
|
||||
<p class="mt-1 font-mono text-xs text-muted">
|
||||
{ i18n.T(ctx, "support.account.monitors") + " " + usageText(o.Monitors, o.MonitorLimit) }
|
||||
{ " · " + i18n.T(ctx, "support.account.status_pages") + " " + usageText(o.StatusPages, o.StatusPageLimit) }
|
||||
{ " · " + i18n.T(ctx, "support.account.regions") + " " + limitText(ctx, o.RegionsPerMonitor) }
|
||||
</p>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
</aside>
|
||||
}
|
||||
|
||||
// SupportTicketPage shows a ticket's conversation to its account or, with
|
||||
// the account's details, to the admins.
|
||||
templ SupportTicketPage(p Page, me Me, t SupportTicket, account *SupportAccount) {
|
||||
@consoleShell(p, me) {
|
||||
<p class="mb-2 text-sm"><a href={ templ.SafeURL(supportBase(account != nil)) } class="text-muted hover:text-ink">{ "← " + i18n.T(ctx, "support.all") }</a></p>
|
||||
<h1 class="mb-2 break-words text-xl font-semibold">{ t.Subject }</h1>
|
||||
<div class="mb-6 flex flex-wrap items-center gap-x-4 gap-y-1 text-sm">
|
||||
@supportStatusLabel(t.Status)
|
||||
if account != nil {
|
||||
<span>{ t.User }</span>
|
||||
}
|
||||
</div>
|
||||
<div class={ templ.KV("grid gap-10 lg:grid-cols-[1fr_20rem]", account != nil) }>
|
||||
<div class="min-w-0">
|
||||
@supportReferences(t.References)
|
||||
<ol class="mb-10 space-y-4">
|
||||
for _, m := range t.Messages {
|
||||
<li class={ "border p-4", templ.KV("border-rule", !m.FromStaff), templ.KV("border-ink bg-rule/20", m.FromStaff) }>
|
||||
<p class="mb-2 flex flex-wrap items-baseline gap-x-3 text-xs">
|
||||
<span class="font-medium">
|
||||
switch {
|
||||
case m.FromStaff && m.Author != "":
|
||||
{ i18n.T(ctx, "support.from_staff") + " · " + m.Author }
|
||||
case m.FromStaff:
|
||||
{ i18n.T(ctx, "support.from_staff") }
|
||||
case account != nil:
|
||||
{ t.User }
|
||||
default:
|
||||
{ i18n.T(ctx, "support.from_you") }
|
||||
}
|
||||
</span>
|
||||
<span class="font-mono text-muted">{ m.At }</span>
|
||||
</p>
|
||||
<div class="legal-text break-words text-sm">
|
||||
@templ.Raw(m.HTML)
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
</ol>
|
||||
<section class="max-w-2xl">
|
||||
@sectionHeading("support.reply")
|
||||
if t.Status == "closed" && account == nil {
|
||||
<p class="mb-4 text-sm text-muted">{ i18n.T(ctx, "support.closed_hint") }</p>
|
||||
}
|
||||
<form data-api={ supportAPI(t, account != nil) + "/messages" } data-next={ supportBase(account != nil) + "/" + t.ID }>
|
||||
@formError()
|
||||
<div class="mb-4">
|
||||
@MarkdownEditor("message", "", 6, 10000, MarkdownInline)
|
||||
</div>
|
||||
@submit(i18n.T(ctx, "support.send"))
|
||||
</form>
|
||||
<form data-api={ supportAPI(t, account != nil) + "/status" } data-method="put" data-next={ supportBase(account != nil) + "/" + t.ID } class="mt-6">
|
||||
@formError()
|
||||
if t.Status == "closed" {
|
||||
<input type="hidden" name="status" value="open"/>
|
||||
<button type="submit" class="text-sm text-muted underline underline-offset-2 hover:text-ink">{ i18n.T(ctx, "support.reopen") }</button>
|
||||
} else {
|
||||
<input type="hidden" name="status" value="closed"/>
|
||||
<button type="submit" class="text-sm text-muted underline underline-offset-2 hover:text-ink">{ i18n.T(ctx, "support.close") }</button>
|
||||
}
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
if account != nil {
|
||||
@supportAccountBox(*account)
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
templ AdminSupportPage(p Page, me Me, tickets []SupportTicket, filter string, settings SupportSettings) {
|
||||
@consoleShell(p, me) {
|
||||
@settingsHeading("support.admin_title", "support.admin_intro")
|
||||
@adminLinks()
|
||||
<details class="mb-8 border border-rule p-4" open?={ !settings.Enabled }>
|
||||
<summary class="cursor-pointer text-sm">
|
||||
{ i18n.T(ctx, "support.settings") }
|
||||
if settings.Enabled {
|
||||
<span class="ml-2 text-up">{ i18n.T(ctx, "support.settings.on") }</span>
|
||||
} else {
|
||||
<span class="ml-2 text-down">{ i18n.T(ctx, "support.settings.off") }</span>
|
||||
}
|
||||
</summary>
|
||||
<form data-api="/admin/support/settings" data-method="put" class="mt-4 max-w-md">
|
||||
@formError()
|
||||
@checkbox(i18n.T(ctx, "support.settings.enabled"), "enabled", settings.Enabled)
|
||||
<p class="-mt-2 mb-4 ml-6 text-xs text-muted">{ i18n.T(ctx, "support.settings.enabled_hint") }</p>
|
||||
<label class="mb-4 block">
|
||||
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "support.settings.max_open") }</span>
|
||||
<input name="max_open_tickets" data-number type="number" min="0" max="1000" value={ strconv.Itoa(settings.MaxOpen) } class="w-32 border border-rule bg-transparent px-2.5 py-1.5 outline-none focus:border-ink"/>
|
||||
<span class="mt-1 block text-xs text-muted">{ i18n.T(ctx, "support.settings.max_open_hint") }</span>
|
||||
</label>
|
||||
@submit(i18n.T(ctx, "support.settings.save"))
|
||||
</form>
|
||||
</details>
|
||||
<nav class="mb-4 flex flex-wrap gap-x-4 gap-y-1 text-sm" aria-label={ i18n.T(ctx, "support.filter") }>
|
||||
for _, f := range supportFilters {
|
||||
if f == filter {
|
||||
<span class="font-medium" aria-current="true">{ i18n.T(ctx, "support.filter."+f) }</span>
|
||||
} else {
|
||||
<a href={ templ.SafeURL("/admin/support?status=" + f) } class="text-muted hover:text-ink">{ i18n.T(ctx, "support.filter."+f) }</a>
|
||||
}
|
||||
}
|
||||
</nav>
|
||||
if len(tickets) == 0 {
|
||||
<p class="border-y border-rule py-10 text-center text-sm text-muted">{ i18n.T(ctx, "support.none_admin") }</p>
|
||||
} else {
|
||||
@supportList(tickets, "/admin/support/", true)
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user