// Code generated by qtc from "web.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.

//line app/vmalert/web.qtpl:1
package main

//line app/vmalert/web.qtpl:3
import (
	"net/http"
	"sort"
	"time"

	"github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/notifier"
	"github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/tpl"
	"github.com/VictoriaMetrics/VictoriaMetrics/app/vmalert/vmalertutil"
)

//line app/vmalert/web.qtpl:13
import (
	qtio422016 "io"

	qt422016 "github.com/valyala/quicktemplate"
)

//line app/vmalert/web.qtpl:13
var (
	_ = qtio422016.Copy
	_ = qt422016.AcquireByteBuffer
)

//line app/vmalert/web.qtpl:13
func StreamControls(qw422016 *qt422016.Writer, prefix, currentIcon, currentText string, icons, filters map[string]string, search bool) {
//line app/vmalert/web.qtpl:13
	qw422016.N().S(`
    <div class="btn-toolbar mb-3" role="toolbar">
        <div class="d-flex gap-2 justify-content-between w-100">
            <div class="d-flex gap-2 align-items-center">
                <a class="btn btn-outline-dark d-flex align-items-center" role="button" onclick="actionAll(true)">
                    <span class="d-none d-md-block">Collapse All</span>
                    <svg class="d-md-none" height="20" width="20">
                        <use href="`)
//line app/vmalert/web.qtpl:20
	qw422016.E().S(prefix)
//line app/vmalert/web.qtpl:20
	qw422016.N().S(`static/icons/icons.svg#collapse"/>
                    </svg>
                </a>
                <a class="btn btn-outline-dark d-flex align-items-center" role="button" onclick="actionAll(false)">
                    <span class="d-none d-md-block">Expand All</span>
                    <svg class="d-md-none" width="20" height="20">
                        <use href="`)
//line app/vmalert/web.qtpl:26
	qw422016.E().S(prefix)
//line app/vmalert/web.qtpl:26
	qw422016.N().S(`static/icons/icons.svg#expand"/>
                    </svg>
                </a>
                `)
//line app/vmalert/web.qtpl:29
	if len(filters) > 0 {
//line app/vmalert/web.qtpl:29
		qw422016.N().S(`
                    <span class="d-none d-md-inline-block">Filter by status:</span>
                    <svg class="d-md-none" width="20" height="20">
                        <use href="`)
//line app/vmalert/web.qtpl:32
		qw422016.E().S(prefix)
//line app/vmalert/web.qtpl:32
		qw422016.N().S(`static/icons/icons.svg#filter">
                    </svg>
                    <div class="dropdown">
                        <button
                            class="btn btn-outline-dark dropdown-toggle d-flex justify-content-between align-items-center"
                            type="button"
                            data-bs-toggle="dropdown"
                            aria-expanded="false"
                        >
                            <span class="d-none d-md-inline-block">`)
//line app/vmalert/web.qtpl:41
		qw422016.E().S(currentText)
//line app/vmalert/web.qtpl:41
		qw422016.N().S(`</span>
                            <svg class="d-md-none" width="22" height="22">
                                <use href="`)
//line app/vmalert/web.qtpl:43
		qw422016.E().S(prefix)
//line app/vmalert/web.qtpl:43
		qw422016.N().S(`static/icons/icons.svg#`)
//line app/vmalert/web.qtpl:43
		qw422016.E().S(currentIcon)
//line app/vmalert/web.qtpl:43
		qw422016.N().S(`"/>
                            </svg>
                        </button>
                        <ul class="dropdown-menu">
                            `)
//line app/vmalert/web.qtpl:47
		for key, title := range filters {
//line app/vmalert/web.qtpl:47
			qw422016.N().S(`
                                `)
//line app/vmalert/web.qtpl:48
			if title != currentText {
//line app/vmalert/web.qtpl:48
				qw422016.N().S(`
                                    <li>
                                        <a class="dropdown-item" onclick="groupFilter('`)
//line app/vmalert/web.qtpl:50
				qw422016.E().S(key)
//line app/vmalert/web.qtpl:50
				qw422016.N().S(`')">
                                            <span class="d-none d-md-inline-block">`)
//line app/vmalert/web.qtpl:51
				qw422016.E().S(title)
//line app/vmalert/web.qtpl:51
				qw422016.N().S(`</span>
                                            <svg class="d-md-none" width="22" height="22">
                                                <use href="`)
//line app/vmalert/web.qtpl:53
				qw422016.E().S(prefix)
//line app/vmalert/web.qtpl:53
				qw422016.N().S(`static/icons/icons.svg#`)
//line app/vmalert/web.qtpl:53
				qw422016.E().S(icons[key])
//line app/vmalert/web.qtpl:53
				qw422016.N().S(`"/>
                                            </svg>
                                        </a>
                                    </li>
                                `)
//line app/vmalert/web.qtpl:57
			}
//line app/vmalert/web.qtpl:57
			qw422016.N().S(`
                            `)
//line app/vmalert/web.qtpl:58
		}
//line app/vmalert/web.qtpl:58
		qw422016.N().S(`
                        </ul>
                    </div>
                `)
//line app/vmalert/web.qtpl:61
	}
//line app/vmalert/web.qtpl:61
	qw422016.N().S(`
            </div>
            `)
//line app/vmalert/web.qtpl:63
	if search {
//line app/vmalert/web.qtpl:63
		qw422016.N().S(`
                <div class="input-group flex-grow-1 justify-content-end">
                    <span class="input-group-text">
                        <svg height="25" width="20">
                            <use href="`)
//line app/vmalert/web.qtpl:67
		qw422016.E().S(prefix)
//line app/vmalert/web.qtpl:67
		qw422016.N().S(`static/icons/icons.svg#search">
                        </svg>
                    </span>
                    <input id="search" placeholder="Filter by group, rule or labels" type="text" class="form-control"/>
                </div>
            `)
//line app/vmalert/web.qtpl:72
	}
//line app/vmalert/web.qtpl:72
	qw422016.N().S(`
        </div>
    </div>
`)
//line app/vmalert/web.qtpl:75
}

//line app/vmalert/web.qtpl:75
func WriteControls(qq422016 qtio422016.Writer, prefix, currentIcon, currentText string, icons, filters map[string]string, search bool) {
//line app/vmalert/web.qtpl:75
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmalert/web.qtpl:75
	StreamControls(qw422016, prefix, currentIcon, currentText, icons, filters, search)
//line app/vmalert/web.qtpl:75
	qt422016.ReleaseWriter(qw422016)
//line app/vmalert/web.qtpl:75
}

//line app/vmalert/web.qtpl:75
func Controls(prefix, currentIcon, currentText string, icons, filters map[string]string, search bool) string {
//line app/vmalert/web.qtpl:75
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmalert/web.qtpl:75
	WriteControls(qb422016, prefix, currentIcon, currentText, icons, filters, search)
//line app/vmalert/web.qtpl:75
	qs422016 := string(qb422016.B)
//line app/vmalert/web.qtpl:75
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmalert/web.qtpl:75
	return qs422016
//line app/vmalert/web.qtpl:75
}

//line app/vmalert/web.qtpl:77
func StreamWelcome(qw422016 *qt422016.Writer, r *http.Request) {
//line app/vmalert/web.qtpl:77
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:78
	tpl.StreamHeader(qw422016, r, navItems, "vmalert", getLastConfigError())
//line app/vmalert/web.qtpl:78
	qw422016.N().S(`
    <p>
        API:<br>
        `)
//line app/vmalert/web.qtpl:81
	for _, p := range apiLinks {
//line app/vmalert/web.qtpl:81
		qw422016.N().S(`
            `)
//line app/vmalert/web.qtpl:82
		p, doc := p[0], p[1]

//line app/vmalert/web.qtpl:82
		qw422016.N().S(`
            <a href="`)
//line app/vmalert/web.qtpl:83
		qw422016.E().S(p)
//line app/vmalert/web.qtpl:83
		qw422016.N().S(`">`)
//line app/vmalert/web.qtpl:83
		qw422016.E().S(p)
//line app/vmalert/web.qtpl:83
		qw422016.N().S(`</a> - `)
//line app/vmalert/web.qtpl:83
		qw422016.E().S(doc)
//line app/vmalert/web.qtpl:83
		qw422016.N().S(`<br/>
        `)
//line app/vmalert/web.qtpl:84
	}
//line app/vmalert/web.qtpl:84
	qw422016.N().S(`
        `)
//line app/vmalert/web.qtpl:85
	if r.Header.Get("X-Forwarded-For") == "" {
//line app/vmalert/web.qtpl:85
		qw422016.N().S(`
            System:<br>
            `)
//line app/vmalert/web.qtpl:87
		for _, p := range systemLinks {
//line app/vmalert/web.qtpl:87
			qw422016.N().S(`
                `)
//line app/vmalert/web.qtpl:88
			p, doc := p[0], p[1]

//line app/vmalert/web.qtpl:88
			qw422016.N().S(`
                <a href="`)
//line app/vmalert/web.qtpl:89
			qw422016.E().S(p)
//line app/vmalert/web.qtpl:89
			qw422016.N().S(`">`)
//line app/vmalert/web.qtpl:89
			qw422016.E().S(p)
//line app/vmalert/web.qtpl:89
			qw422016.N().S(`</a> - `)
//line app/vmalert/web.qtpl:89
			qw422016.E().S(doc)
//line app/vmalert/web.qtpl:89
			qw422016.N().S(`<br/>
            `)
//line app/vmalert/web.qtpl:90
		}
//line app/vmalert/web.qtpl:90
		qw422016.N().S(`
        `)
//line app/vmalert/web.qtpl:91
	}
//line app/vmalert/web.qtpl:91
	qw422016.N().S(`
    </p>
    `)
//line app/vmalert/web.qtpl:93
	tpl.StreamFooter(qw422016, r)
//line app/vmalert/web.qtpl:93
	qw422016.N().S(`
`)
//line app/vmalert/web.qtpl:94
}

//line app/vmalert/web.qtpl:94
func WriteWelcome(qq422016 qtio422016.Writer, r *http.Request) {
//line app/vmalert/web.qtpl:94
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmalert/web.qtpl:94
	StreamWelcome(qw422016, r)
//line app/vmalert/web.qtpl:94
	qt422016.ReleaseWriter(qw422016)
//line app/vmalert/web.qtpl:94
}

//line app/vmalert/web.qtpl:94
func Welcome(r *http.Request) string {
//line app/vmalert/web.qtpl:94
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmalert/web.qtpl:94
	WriteWelcome(qb422016, r)
//line app/vmalert/web.qtpl:94
	qs422016 := string(qb422016.B)
//line app/vmalert/web.qtpl:94
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmalert/web.qtpl:94
	return qs422016
//line app/vmalert/web.qtpl:94
}

//line app/vmalert/web.qtpl:96
func StreamListGroups(qw422016 *qt422016.Writer, r *http.Request, groups []*apiGroup, filter string) {
//line app/vmalert/web.qtpl:96
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:98
	prefix := vmalertutil.Prefix(r.URL.Path)
	filters := map[string]string{
		"":          "All",
		"unhealthy": "Unhealthy",
		"nomatch":   "No Match",
	}
	icons := map[string]string{
		"":          "all",
		"unhealthy": "unhealthy",
		"nomatch":   "nomatch",
	}
	currentText := filters[filter]
	currentIcon := icons[filter]

//line app/vmalert/web.qtpl:111
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:112
	tpl.StreamHeader(qw422016, r, navItems, "Groups", getLastConfigError())
//line app/vmalert/web.qtpl:112
	qw422016.N().S(`
        `)
//line app/vmalert/web.qtpl:113
	StreamControls(qw422016, prefix, currentIcon, currentText, icons, filters, true)
//line app/vmalert/web.qtpl:113
	qw422016.N().S(`
        `)
//line app/vmalert/web.qtpl:114
	if len(groups) > 0 {
//line app/vmalert/web.qtpl:114
		qw422016.N().S(`
            `)
//line app/vmalert/web.qtpl:115
		for _, g := range groups {
//line app/vmalert/web.qtpl:115
			qw422016.N().S(`
                <div id="group-`)
//line app/vmalert/web.qtpl:116
			qw422016.E().S(g.ID)
//line app/vmalert/web.qtpl:116
			qw422016.N().S(`" class="d-flex w-100 border-0 flex-column group-items`)
//line app/vmalert/web.qtpl:116
			if g.Unhealthy > 0 {
//line app/vmalert/web.qtpl:116
				qw422016.N().S(` alert-danger`)
//line app/vmalert/web.qtpl:116
			}
//line app/vmalert/web.qtpl:116
			qw422016.N().S(`">
                    <span class="d-flex justify-content-between">
                        <a href="#group-`)
//line app/vmalert/web.qtpl:118
			qw422016.E().S(g.ID)
//line app/vmalert/web.qtpl:118
			qw422016.N().S(`">`)
//line app/vmalert/web.qtpl:118
			qw422016.E().S(g.Name)
//line app/vmalert/web.qtpl:118
			if g.Type != "prometheus" {
//line app/vmalert/web.qtpl:118
				qw422016.N().S(` (`)
//line app/vmalert/web.qtpl:118
				qw422016.E().S(g.Type)
//line app/vmalert/web.qtpl:118
				qw422016.N().S(`)`)
//line app/vmalert/web.qtpl:118
			}
//line app/vmalert/web.qtpl:118
			qw422016.N().S(` (every `)
//line app/vmalert/web.qtpl:118
			qw422016.N().FPrec(g.Interval, 0)
//line app/vmalert/web.qtpl:118
			qw422016.N().S(`s) #</a>
                        <span
                            class="flex-grow-1 d-flex justify-content-end"
                            role="button"
                            data-bs-toggle="collapse"
                            data-bs-target="#sub-`)
//line app/vmalert/web.qtpl:123
			qw422016.E().S(g.ID)
//line app/vmalert/web.qtpl:123
			qw422016.N().S(`"
                        >
                            <span class="d-flex gap-2">
                                `)
//line app/vmalert/web.qtpl:126
			if g.Unhealthy > 0 {
//line app/vmalert/web.qtpl:126
				qw422016.N().S(`<span class="badge bg-danger" title="Number of rules with status Error">`)
//line app/vmalert/web.qtpl:126
				qw422016.N().D(g.Unhealthy)
//line app/vmalert/web.qtpl:126
				qw422016.N().S(`</span> `)
//line app/vmalert/web.qtpl:126
			}
//line app/vmalert/web.qtpl:126
			qw422016.N().S(`
                                `)
//line app/vmalert/web.qtpl:127
			if g.NoMatch > 0 {
//line app/vmalert/web.qtpl:127
				qw422016.N().S(`<span class="badge bg-warning" title="Number of rules with status NoMatch">`)
//line app/vmalert/web.qtpl:127
				qw422016.N().D(g.NoMatch)
//line app/vmalert/web.qtpl:127
				qw422016.N().S(`</span> `)
//line app/vmalert/web.qtpl:127
			}
//line app/vmalert/web.qtpl:127
			qw422016.N().S(`
                                <span class="badge bg-success" title="Number of rules with status Ok">`)
//line app/vmalert/web.qtpl:128
			qw422016.N().D(g.Healthy)
//line app/vmalert/web.qtpl:128
			qw422016.N().S(`</span>
                            </span>
                        </span>
                    </span>
                    <span
                        class="d-flex flex-column row-gap-2 mb-2"
                        role="button"
                        data-bs-toggle="collapse"
                        data-bs-target="#sub-`)
//line app/vmalert/web.qtpl:136
			qw422016.E().S(g.ID)
//line app/vmalert/web.qtpl:136
			qw422016.N().S(`"
                    >
                        <span class="fs-6 text-start w-100 fw-lighter">`)
//line app/vmalert/web.qtpl:138
			qw422016.E().S(g.File)
//line app/vmalert/web.qtpl:138
			qw422016.N().S(`</span>
                        `)
//line app/vmalert/web.qtpl:139
			if len(g.Params) > 0 {
//line app/vmalert/web.qtpl:139
				qw422016.N().S(`
                            <span class="fs-6 text-start w-100 d-flex justify-content-between fw-lighter">
                                <span>Extra params</span>
                                <span class="d-flex align-items-center gap-2">
                                    `)
//line app/vmalert/web.qtpl:143
				for _, param := range g.Params {
//line app/vmalert/web.qtpl:143
					qw422016.N().S(`
                                        <span class="badge bg-primary">`)
//line app/vmalert/web.qtpl:144
					qw422016.E().S(param)
//line app/vmalert/web.qtpl:144
					qw422016.N().S(`</span>
                                    `)
//line app/vmalert/web.qtpl:145
				}
//line app/vmalert/web.qtpl:145
				qw422016.N().S(`
                                </span>
                            </span>
                        `)
//line app/vmalert/web.qtpl:148
			}
//line app/vmalert/web.qtpl:148
			qw422016.N().S(`
                        `)
//line app/vmalert/web.qtpl:149
			if len(g.Headers) > 0 {
//line app/vmalert/web.qtpl:149
				qw422016.N().S(`
                            <span class="fs-6 text-start w-100 d-flex justify-content-between fw-lighter">
                                <span>Extra headers</span>
                                <span class="d-flex align-items-center gap-2">
                                    `)
//line app/vmalert/web.qtpl:153
				for _, header := range g.Headers {
//line app/vmalert/web.qtpl:153
					qw422016.N().S(`
                                        <span class="badge bg-primary label">`)
//line app/vmalert/web.qtpl:154
					qw422016.E().S(header)
//line app/vmalert/web.qtpl:154
					qw422016.N().S(`</span>
                                    `)
//line app/vmalert/web.qtpl:155
				}
//line app/vmalert/web.qtpl:155
				qw422016.N().S(`
                                </span>
                            </span>
                        `)
//line app/vmalert/web.qtpl:158
			}
//line app/vmalert/web.qtpl:158
			qw422016.N().S(`
                    </span>
                    <div class="collapse sub-items" id="sub-`)
//line app/vmalert/web.qtpl:160
			qw422016.E().S(g.ID)
//line app/vmalert/web.qtpl:160
			qw422016.N().S(`">
                        <table class="table table-striped table-hover table-sm">
                            <thead>
                                <tr>
                                    <th scope="col" class="w-60">Rule</th>
                                    <th scope="col" class="w-20" class="text-center" title="How many series were produced by the rule">Series</th>
                                    <th scope="col" class="w-20" class="text-center" title="How many seconds ago rule was executed">Updated</th>
                                </tr>
                            </thead>
                            <tbody>
                                `)
//line app/vmalert/web.qtpl:170
			for _, r := range g.Rules {
//line app/vmalert/web.qtpl:170
				qw422016.N().S(`
                                    <tr class="sub-item`)
//line app/vmalert/web.qtpl:171
				if r.LastError != "" {
//line app/vmalert/web.qtpl:171
					qw422016.N().S(` alert-danger`)
//line app/vmalert/web.qtpl:171
				}
//line app/vmalert/web.qtpl:171
				qw422016.N().S(`">
                                        <td>
                                            <div class="row">
                                                <div class="col-12 mb-2">
                                                    `)
//line app/vmalert/web.qtpl:175
				if r.Type == "alerting" {
//line app/vmalert/web.qtpl:175
					qw422016.N().S(`
                                                        `)
//line app/vmalert/web.qtpl:176
					if r.KeepFiringFor > 0 {
//line app/vmalert/web.qtpl:176
						qw422016.N().S(`
                                                            <b>alert:</b> `)
//line app/vmalert/web.qtpl:177
						qw422016.E().S(r.Name)
//line app/vmalert/web.qtpl:177
						qw422016.N().S(` (for: `)
//line app/vmalert/web.qtpl:177
						qw422016.E().V(r.Duration)
//line app/vmalert/web.qtpl:177
						qw422016.N().S(` seconds, keep_firing_for: `)
//line app/vmalert/web.qtpl:177
						qw422016.E().V(r.KeepFiringFor)
//line app/vmalert/web.qtpl:177
						qw422016.N().S(` seconds)
                                                        `)
//line app/vmalert/web.qtpl:178
					} else {
//line app/vmalert/web.qtpl:178
						qw422016.N().S(`
                                                            <b>alert:</b> `)
//line app/vmalert/web.qtpl:179
						qw422016.E().S(r.Name)
//line app/vmalert/web.qtpl:179
						qw422016.N().S(` (for: `)
//line app/vmalert/web.qtpl:179
						qw422016.E().V(r.Duration)
//line app/vmalert/web.qtpl:179
						qw422016.N().S(` seconds)
                                                        `)
//line app/vmalert/web.qtpl:180
					}
//line app/vmalert/web.qtpl:180
					qw422016.N().S(`
                                                    `)
//line app/vmalert/web.qtpl:181
				} else {
//line app/vmalert/web.qtpl:181
					qw422016.N().S(`
                                                        <b>record:</b> `)
//line app/vmalert/web.qtpl:182
					qw422016.E().S(r.Name)
//line app/vmalert/web.qtpl:182
					qw422016.N().S(`
                                                    `)
//line app/vmalert/web.qtpl:183
				}
//line app/vmalert/web.qtpl:183
				qw422016.N().S(`
                                                    |
                                                    `)
//line app/vmalert/web.qtpl:185
				streamseriesFetchedWarn(qw422016, prefix, r)
//line app/vmalert/web.qtpl:185
				qw422016.N().S(`
                                                    <span><a target="_blank" href="`)
//line app/vmalert/web.qtpl:186
				qw422016.E().S(prefix + r.WebLink())
//line app/vmalert/web.qtpl:186
				qw422016.N().S(`">Details</a></span>
                                                </div>
                                                <div class="col-12">
                                                    <code><pre>`)
//line app/vmalert/web.qtpl:189
				qw422016.E().S(r.Query)
//line app/vmalert/web.qtpl:189
				qw422016.N().S(`</pre></code>
                                                </div>
                                                <div class="col-12 mb-2">
                                                    `)
//line app/vmalert/web.qtpl:192
				if len(r.Labels) > 0 {
//line app/vmalert/web.qtpl:192
					qw422016.N().S(` <b>Labels:</b>`)
//line app/vmalert/web.qtpl:192
				}
//line app/vmalert/web.qtpl:192
				qw422016.N().S(`
                                                    `)
//line app/vmalert/web.qtpl:193
				for k, v := range r.Labels {
//line app/vmalert/web.qtpl:193
					qw422016.N().S(`
                                                        <span class="ms-1 badge bg-primary label">`)
//line app/vmalert/web.qtpl:194
					qw422016.E().S(k)
//line app/vmalert/web.qtpl:194
					qw422016.N().S(`=`)
//line app/vmalert/web.qtpl:194
					qw422016.E().S(v)
//line app/vmalert/web.qtpl:194
					qw422016.N().S(`</span>
                                                    `)
//line app/vmalert/web.qtpl:195
				}
//line app/vmalert/web.qtpl:195
				qw422016.N().S(`
                                                </div>
                                                `)
//line app/vmalert/web.qtpl:197
				if r.LastError != "" {
//line app/vmalert/web.qtpl:197
					qw422016.N().S(`
                                                    <div class="col-12">
                                                        <b>Error:</b>
                                                        <div class="error-cell">
                                                            `)
//line app/vmalert/web.qtpl:201
					qw422016.E().S(r.LastError)
//line app/vmalert/web.qtpl:201
					qw422016.N().S(`
                                                        </div>
                                                    </div>
                                                `)
//line app/vmalert/web.qtpl:204
				}
//line app/vmalert/web.qtpl:204
				qw422016.N().S(`
                                            </div>
                                        </td>
                                        <td class="text-center">`)
//line app/vmalert/web.qtpl:207
				qw422016.N().D(r.LastSamples)
//line app/vmalert/web.qtpl:207
				qw422016.N().S(`</td>
                                        <td class="text-center">`)
//line app/vmalert/web.qtpl:208
				qw422016.N().FPrec(time.Since(r.LastEvaluation).Seconds(), 3)
//line app/vmalert/web.qtpl:208
				qw422016.N().S(`s ago</td>
                                    </tr>
                                `)
//line app/vmalert/web.qtpl:210
			}
//line app/vmalert/web.qtpl:210
			qw422016.N().S(`
                            </tbody>
                        </table>
                    </div>
                </div>
            `)
//line app/vmalert/web.qtpl:215
		}
//line app/vmalert/web.qtpl:215
		qw422016.N().S(`
        `)
//line app/vmalert/web.qtpl:216
	} else {
//line app/vmalert/web.qtpl:216
		qw422016.N().S(`
            <div>
                <p>No groups...</p>
            </div>
        `)
//line app/vmalert/web.qtpl:220
	}
//line app/vmalert/web.qtpl:220
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:221
	tpl.StreamFooter(qw422016, r)
//line app/vmalert/web.qtpl:221
	qw422016.N().S(`
`)
//line app/vmalert/web.qtpl:222
}

//line app/vmalert/web.qtpl:222
func WriteListGroups(qq422016 qtio422016.Writer, r *http.Request, groups []*apiGroup, filter string) {
//line app/vmalert/web.qtpl:222
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmalert/web.qtpl:222
	StreamListGroups(qw422016, r, groups, filter)
//line app/vmalert/web.qtpl:222
	qt422016.ReleaseWriter(qw422016)
//line app/vmalert/web.qtpl:222
}

//line app/vmalert/web.qtpl:222
func ListGroups(r *http.Request, groups []*apiGroup, filter string) string {
//line app/vmalert/web.qtpl:222
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmalert/web.qtpl:222
	WriteListGroups(qb422016, r, groups, filter)
//line app/vmalert/web.qtpl:222
	qs422016 := string(qb422016.B)
//line app/vmalert/web.qtpl:222
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmalert/web.qtpl:222
	return qs422016
//line app/vmalert/web.qtpl:222
}

//line app/vmalert/web.qtpl:225
func StreamListAlerts(qw422016 *qt422016.Writer, r *http.Request, groupAlerts []groupAlerts) {
//line app/vmalert/web.qtpl:225
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:226
	prefix := vmalertutil.Prefix(r.URL.Path)

//line app/vmalert/web.qtpl:226
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:227
	tpl.StreamHeader(qw422016, r, navItems, "Alerts", getLastConfigError())
//line app/vmalert/web.qtpl:227
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:228
	StreamControls(qw422016, prefix, "", "", nil, nil, true)
//line app/vmalert/web.qtpl:228
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:229
	if len(groupAlerts) > 0 {
//line app/vmalert/web.qtpl:229
		qw422016.N().S(`
         `)
//line app/vmalert/web.qtpl:230
		for _, ga := range groupAlerts {
//line app/vmalert/web.qtpl:230
			qw422016.N().S(`
             `)
//line app/vmalert/web.qtpl:232
			g := ga.Group
			var keys []string
			alertsByRule := make(map[string][]*apiAlert)
			for _, alert := range ga.Alerts {
				if len(alertsByRule[alert.RuleID]) < 1 {
					keys = append(keys, alert.RuleID)
				}
				alertsByRule[alert.RuleID] = append(alertsByRule[alert.RuleID], alert)
			}
			sort.Strings(keys)

//line app/vmalert/web.qtpl:242
			qw422016.N().S(`
             <div class="d-flex w-100 flex-column group-items alert-danger">
                 <span id="group-`)
//line app/vmalert/web.qtpl:244
			qw422016.E().S(g.ID)
//line app/vmalert/web.qtpl:244
			qw422016.N().S(`" class="d-flex justify-content-between">
                     <a href="#group-`)
//line app/vmalert/web.qtpl:245
			qw422016.E().S(g.ID)
//line app/vmalert/web.qtpl:245
			qw422016.N().S(`">`)
//line app/vmalert/web.qtpl:245
			qw422016.E().S(g.Name)
//line app/vmalert/web.qtpl:245
			if g.Type != "prometheus" {
//line app/vmalert/web.qtpl:245
				qw422016.N().S(` (`)
//line app/vmalert/web.qtpl:245
				qw422016.E().S(g.Type)
//line app/vmalert/web.qtpl:245
				qw422016.N().S(`)`)
//line app/vmalert/web.qtpl:245
			}
//line app/vmalert/web.qtpl:245
			qw422016.N().S(`</a>
                     <span
                         class="flex-grow-1 d-flex justify-content-end"
                         role="button"
                         data-bs-toggle="collapse"
                         data-bs-target="#sub-`)
//line app/vmalert/web.qtpl:250
			qw422016.E().S(g.ID)
//line app/vmalert/web.qtpl:250
			qw422016.N().S(`"
                     >
                         <span class="badge bg-danger" title="Number of active alerts">`)
//line app/vmalert/web.qtpl:252
			qw422016.N().D(len(ga.Alerts))
//line app/vmalert/web.qtpl:252
			qw422016.N().S(`</span>
                     </span>
                 </span>
                 <span>
                     <span
                         class="fs-6 text-start w-100 fw-lighter"
                         role="button" 
                         data-bs-toggle="collapse"
                         data-bs-target="#sub-`)
//line app/vmalert/web.qtpl:260
			qw422016.E().S(g.ID)
//line app/vmalert/web.qtpl:260
			qw422016.N().S(`"
                     >`)
//line app/vmalert/web.qtpl:261
			qw422016.E().S(g.File)
//line app/vmalert/web.qtpl:261
			qw422016.N().S(`</span>
                 </span>
                 <div class="collapse sub-items" id="sub-`)
//line app/vmalert/web.qtpl:263
			qw422016.E().S(g.ID)
//line app/vmalert/web.qtpl:263
			qw422016.N().S(`">
                     `)
//line app/vmalert/web.qtpl:264
			for _, ruleID := range keys {
//line app/vmalert/web.qtpl:264
				qw422016.N().S(`
                         `)
//line app/vmalert/web.qtpl:266
				defaultAR := alertsByRule[ruleID][0]
				var labelKeys []string
				for k := range defaultAR.Labels {
					labelKeys = append(labelKeys, k)
				}
				sort.Strings(labelKeys)

//line app/vmalert/web.qtpl:272
				qw422016.N().S(`
                         <br>
                         <div class="sub-item">
                             <b>alert:</b> `)
//line app/vmalert/web.qtpl:275
				qw422016.E().S(defaultAR.Name)
//line app/vmalert/web.qtpl:275
				qw422016.N().S(` (`)
//line app/vmalert/web.qtpl:275
				qw422016.N().D(len(alertsByRule[ruleID]))
//line app/vmalert/web.qtpl:275
				qw422016.N().S(`)
                             | <span><a target="_blank" href="`)
//line app/vmalert/web.qtpl:276
				qw422016.E().S(defaultAR.SourceLink)
//line app/vmalert/web.qtpl:276
				qw422016.N().S(`">Source</a></span>
                             <br>
                             <b>expr:</b><code><pre>`)
//line app/vmalert/web.qtpl:278
				qw422016.E().S(defaultAR.Expression)
//line app/vmalert/web.qtpl:278
				qw422016.N().S(`</pre></code>
                             <table class="table table-striped table-hover table-sm">
                                 <thead>
                                     <tr>
                                         <th scope="col">Labels</th>
                                         <th scope="col">State</th>
                                         <th scope="col">Active at</th>
                                         <th scope="col">Value</th>
                                         <th scope="col">Link</th>
                                     </tr>
                                 </thead>
                                 <tbody>
                                     `)
//line app/vmalert/web.qtpl:290
				for _, ar := range alertsByRule[ruleID] {
//line app/vmalert/web.qtpl:290
					qw422016.N().S(`
                                         <tr>
                                             <td>
                                                 `)
//line app/vmalert/web.qtpl:293
					for _, k := range labelKeys {
//line app/vmalert/web.qtpl:293
						qw422016.N().S(`
                                                     <span class="ms-1 badge bg-primary label">`)
//line app/vmalert/web.qtpl:294
						qw422016.E().S(k)
//line app/vmalert/web.qtpl:294
						qw422016.N().S(`=`)
//line app/vmalert/web.qtpl:294
						qw422016.E().S(ar.Labels[k])
//line app/vmalert/web.qtpl:294
						qw422016.N().S(`</span>
                                                 `)
//line app/vmalert/web.qtpl:295
					}
//line app/vmalert/web.qtpl:295
					qw422016.N().S(`
                                             </td>
                                             <td>`)
//line app/vmalert/web.qtpl:297
					streambadgeState(qw422016, ar.State)
//line app/vmalert/web.qtpl:297
					qw422016.N().S(`</td>
                                             <td>
                                                 `)
//line app/vmalert/web.qtpl:299
					qw422016.E().S(ar.ActiveAt.Format("2006-01-02T15:04:05Z07:00"))
//line app/vmalert/web.qtpl:299
					qw422016.N().S(`
                                                 `)
//line app/vmalert/web.qtpl:300
					if ar.Restored {
//line app/vmalert/web.qtpl:300
						streambadgeRestored(qw422016)
//line app/vmalert/web.qtpl:300
					}
//line app/vmalert/web.qtpl:300
					qw422016.N().S(`
                                                 `)
//line app/vmalert/web.qtpl:301
					if ar.Stabilizing {
//line app/vmalert/web.qtpl:301
						streambadgeStabilizing(qw422016)
//line app/vmalert/web.qtpl:301
					}
//line app/vmalert/web.qtpl:301
					qw422016.N().S(`
                                             </td>
                                             <td>`)
//line app/vmalert/web.qtpl:303
					qw422016.E().S(ar.Value)
//line app/vmalert/web.qtpl:303
					qw422016.N().S(`</td>
                                             <td><a href="`)
//line app/vmalert/web.qtpl:304
					qw422016.E().S(prefix + ar.WebLink())
//line app/vmalert/web.qtpl:304
					qw422016.N().S(`">Details</a></td>
                                         </tr>
                                     `)
//line app/vmalert/web.qtpl:306
				}
//line app/vmalert/web.qtpl:306
				qw422016.N().S(`
                                 </tbody>
                             </table>
                         </div>
                     `)
//line app/vmalert/web.qtpl:310
			}
//line app/vmalert/web.qtpl:310
			qw422016.N().S(`
                 </div>
             </div>
         `)
//line app/vmalert/web.qtpl:313
		}
//line app/vmalert/web.qtpl:313
		qw422016.N().S(`
     `)
//line app/vmalert/web.qtpl:314
	} else {
//line app/vmalert/web.qtpl:314
		qw422016.N().S(`
         <div>
             <p>No active alerts...</p>
         </div>
     `)
//line app/vmalert/web.qtpl:318
	}
//line app/vmalert/web.qtpl:318
	qw422016.N().S(`
     `)
//line app/vmalert/web.qtpl:319
	tpl.StreamFooter(qw422016, r)
//line app/vmalert/web.qtpl:319
	qw422016.N().S(`
`)
//line app/vmalert/web.qtpl:320
}

//line app/vmalert/web.qtpl:320
func WriteListAlerts(qq422016 qtio422016.Writer, r *http.Request, groupAlerts []groupAlerts) {
//line app/vmalert/web.qtpl:320
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmalert/web.qtpl:320
	StreamListAlerts(qw422016, r, groupAlerts)
//line app/vmalert/web.qtpl:320
	qt422016.ReleaseWriter(qw422016)
//line app/vmalert/web.qtpl:320
}

//line app/vmalert/web.qtpl:320
func ListAlerts(r *http.Request, groupAlerts []groupAlerts) string {
//line app/vmalert/web.qtpl:320
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmalert/web.qtpl:320
	WriteListAlerts(qb422016, r, groupAlerts)
//line app/vmalert/web.qtpl:320
	qs422016 := string(qb422016.B)
//line app/vmalert/web.qtpl:320
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmalert/web.qtpl:320
	return qs422016
//line app/vmalert/web.qtpl:320
}

//line app/vmalert/web.qtpl:322
func StreamListTargets(qw422016 *qt422016.Writer, r *http.Request, targets map[notifier.TargetType][]notifier.Target) {
//line app/vmalert/web.qtpl:322
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:323
	prefix := vmalertutil.Prefix(r.URL.Path)

//line app/vmalert/web.qtpl:323
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:324
	tpl.StreamHeader(qw422016, r, navItems, "Notifiers", getLastConfigError())
//line app/vmalert/web.qtpl:324
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:325
	StreamControls(qw422016, prefix, "", "", nil, nil, false)
//line app/vmalert/web.qtpl:325
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:326
	if len(targets) > 0 {
//line app/vmalert/web.qtpl:326
		qw422016.N().S(`
        `)
//line app/vmalert/web.qtpl:328
		var keys []string
		for key := range targets {
			keys = append(keys, string(key))
		}
		sort.Strings(keys)

//line app/vmalert/web.qtpl:333
		qw422016.N().S(`
        `)
//line app/vmalert/web.qtpl:334
		for i := range keys {
//line app/vmalert/web.qtpl:334
			qw422016.N().S(`
            `)
//line app/vmalert/web.qtpl:336
			typeK, ns := keys[i], targets[notifier.TargetType(keys[i])]
			count := len(ns)

//line app/vmalert/web.qtpl:338
			qw422016.N().S(`
            <div class="d-flex w-100 flex-column group-items">
                <span class="d-flex justify-content-between" id="group-`)
//line app/vmalert/web.qtpl:340
			qw422016.E().S(typeK)
//line app/vmalert/web.qtpl:340
			qw422016.N().S(`">
                    <a href="#group-`)
//line app/vmalert/web.qtpl:341
			qw422016.E().S(typeK)
//line app/vmalert/web.qtpl:341
			qw422016.N().S(`">`)
//line app/vmalert/web.qtpl:341
			qw422016.E().S(typeK)
//line app/vmalert/web.qtpl:341
			qw422016.N().S(` (`)
//line app/vmalert/web.qtpl:341
			qw422016.N().D(count)
//line app/vmalert/web.qtpl:341
			qw422016.N().S(`)</a>
                    <span
                        class="flex-grow-1"
                        role="button"
                        data-bs-toggle="collapse"
                        data-bs-target="#sub-`)
//line app/vmalert/web.qtpl:346
			qw422016.E().S(typeK)
//line app/vmalert/web.qtpl:346
			qw422016.N().S(`"
                    ></span>
                </span>
                <div id="sub-`)
//line app/vmalert/web.qtpl:349
			qw422016.E().S(typeK)
//line app/vmalert/web.qtpl:349
			qw422016.N().S(`" class="collapse show sub-items">
                    <table class="table table-striped table-hover table-sm">
                        <thead>
                            <tr class="sub-item">
                                <th scope="col">Labels</th>
                                <th scope="col">Address</th>
                            </tr>
                        </thead>
                        <tbody>
                            `)
//line app/vmalert/web.qtpl:358
			for _, n := range ns {
//line app/vmalert/web.qtpl:358
				qw422016.N().S(`
                                <tr>
                                    <td>
                                        `)
//line app/vmalert/web.qtpl:361
				for _, l := range n.Labels.GetLabels() {
//line app/vmalert/web.qtpl:361
					qw422016.N().S(`
                                            <span class="ms-1 badge bg-primary">`)
//line app/vmalert/web.qtpl:362
					qw422016.E().S(l.Name)
//line app/vmalert/web.qtpl:362
					qw422016.N().S(`=`)
//line app/vmalert/web.qtpl:362
					qw422016.E().S(l.Value)
//line app/vmalert/web.qtpl:362
					qw422016.N().S(`</span>
                                        `)
//line app/vmalert/web.qtpl:363
				}
//line app/vmalert/web.qtpl:363
				qw422016.N().S(`
                                    </td>
                                    <td>`)
//line app/vmalert/web.qtpl:365
				qw422016.E().S(n.Notifier.Addr())
//line app/vmalert/web.qtpl:365
				qw422016.N().S(`</td>
                                </tr>
                            `)
//line app/vmalert/web.qtpl:367
			}
//line app/vmalert/web.qtpl:367
			qw422016.N().S(`
                        </tbody>
                    </table>
                </div>
            </div>
        `)
//line app/vmalert/web.qtpl:372
		}
//line app/vmalert/web.qtpl:372
		qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:373
	} else {
//line app/vmalert/web.qtpl:373
		qw422016.N().S(`
        <div>
            <p>No targets...</p>
        </div>
    `)
//line app/vmalert/web.qtpl:377
	}
//line app/vmalert/web.qtpl:377
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:378
	tpl.StreamFooter(qw422016, r)
//line app/vmalert/web.qtpl:378
	qw422016.N().S(`
`)
//line app/vmalert/web.qtpl:379
}

//line app/vmalert/web.qtpl:379
func WriteListTargets(qq422016 qtio422016.Writer, r *http.Request, targets map[notifier.TargetType][]notifier.Target) {
//line app/vmalert/web.qtpl:379
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmalert/web.qtpl:379
	StreamListTargets(qw422016, r, targets)
//line app/vmalert/web.qtpl:379
	qt422016.ReleaseWriter(qw422016)
//line app/vmalert/web.qtpl:379
}

//line app/vmalert/web.qtpl:379
func ListTargets(r *http.Request, targets map[notifier.TargetType][]notifier.Target) string {
//line app/vmalert/web.qtpl:379
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmalert/web.qtpl:379
	WriteListTargets(qb422016, r, targets)
//line app/vmalert/web.qtpl:379
	qs422016 := string(qb422016.B)
//line app/vmalert/web.qtpl:379
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmalert/web.qtpl:379
	return qs422016
//line app/vmalert/web.qtpl:379
}

//line app/vmalert/web.qtpl:381
func StreamAlert(qw422016 *qt422016.Writer, r *http.Request, alert *apiAlert) {
//line app/vmalert/web.qtpl:381
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:382
	prefix := vmalertutil.Prefix(r.URL.Path)

//line app/vmalert/web.qtpl:382
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:383
	tpl.StreamHeader(qw422016, r, navItems, "", getLastConfigError())
//line app/vmalert/web.qtpl:383
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:385
	var labelKeys []string
	for k := range alert.Labels {
		labelKeys = append(labelKeys, k)
	}
	sort.Strings(labelKeys)
	var annotationKeys []string
	for k := range alert.Annotations {
		annotationKeys = append(annotationKeys, k)
	}
	sort.Strings(annotationKeys)

//line app/vmalert/web.qtpl:395
	qw422016.N().S(`
    <div class="display-6 pb-3 mb-3">Alert: `)
//line app/vmalert/web.qtpl:396
	qw422016.E().S(alert.Name)
//line app/vmalert/web.qtpl:396
	qw422016.N().S(`<span class="ms-2 badge `)
//line app/vmalert/web.qtpl:396
	if alert.State == "firing" {
//line app/vmalert/web.qtpl:396
		qw422016.N().S(`bg-danger`)
//line app/vmalert/web.qtpl:396
	} else {
//line app/vmalert/web.qtpl:396
		qw422016.N().S(` bg-warning text-dark`)
//line app/vmalert/web.qtpl:396
	}
//line app/vmalert/web.qtpl:396
	qw422016.N().S(`">`)
//line app/vmalert/web.qtpl:396
	qw422016.E().S(alert.State)
//line app/vmalert/web.qtpl:396
	qw422016.N().S(`</span></div>
    <div class="container border-bottom p-2">
      <div class="row">
        <div class="col-2">
          Active at
        </div>
        <div class="col">
          `)
//line app/vmalert/web.qtpl:403
	qw422016.E().S(alert.ActiveAt.Format("2006-01-02T15:04:05Z07:00"))
//line app/vmalert/web.qtpl:403
	qw422016.N().S(`
        </div>
      </div>
      </div>
    <div class="container border-bottom p-2">
      <div class="row">
        <div class="col-2">
          Expr
        </div>
        <div class="col">
          <code><pre>`)
//line app/vmalert/web.qtpl:413
	qw422016.E().S(alert.Expression)
//line app/vmalert/web.qtpl:413
	qw422016.N().S(`</pre></code>
        </div>
      </div>
    </div>
    <div class="container border-bottom p-2">
      <div class="row">
        <div class="col-2">
          Labels
        </div>
        <div class="col">
           `)
//line app/vmalert/web.qtpl:423
	for _, k := range labelKeys {
//line app/vmalert/web.qtpl:423
		qw422016.N().S(`
                <span class="m-1 badge bg-primary">`)
//line app/vmalert/web.qtpl:424
		qw422016.E().S(k)
//line app/vmalert/web.qtpl:424
		qw422016.N().S(`=`)
//line app/vmalert/web.qtpl:424
		qw422016.E().S(alert.Labels[k])
//line app/vmalert/web.qtpl:424
		qw422016.N().S(`</span>
          `)
//line app/vmalert/web.qtpl:425
	}
//line app/vmalert/web.qtpl:425
	qw422016.N().S(`
        </div>
      </div>
    </div>
    <div class="container border-bottom p-2">
      <div class="row">
        <div class="col-2">
          Annotations
        </div>
        <div class="col">
           `)
//line app/vmalert/web.qtpl:435
	for _, k := range annotationKeys {
//line app/vmalert/web.qtpl:435
		qw422016.N().S(`
                <b>`)
//line app/vmalert/web.qtpl:436
		qw422016.E().S(k)
//line app/vmalert/web.qtpl:436
		qw422016.N().S(`:</b><br>
                <p>`)
//line app/vmalert/web.qtpl:437
		qw422016.E().S(alert.Annotations[k])
//line app/vmalert/web.qtpl:437
		qw422016.N().S(`</p>
          `)
//line app/vmalert/web.qtpl:438
	}
//line app/vmalert/web.qtpl:438
	qw422016.N().S(`
        </div>
      </div>
    </div>
    <div class="container border-bottom p-2">
      <div class="row">
        <div class="col-2">
          Group
        </div>
        <div class="col">
           <a target="_blank" href="`)
//line app/vmalert/web.qtpl:448
	qw422016.E().S(prefix)
//line app/vmalert/web.qtpl:448
	qw422016.N().S(`groups#group-`)
//line app/vmalert/web.qtpl:448
	qw422016.E().S(alert.GroupID)
//line app/vmalert/web.qtpl:448
	qw422016.N().S(`">`)
//line app/vmalert/web.qtpl:448
	qw422016.E().S(alert.GroupID)
//line app/vmalert/web.qtpl:448
	qw422016.N().S(`</a>
        </div>
      </div>
    </div>
     <div class="container border-bottom p-2">
      <div class="row">
        <div class="col-2">
          Source link
        </div>
        <div class="col">
           <a target="_blank" href="`)
//line app/vmalert/web.qtpl:458
	qw422016.E().S(alert.SourceLink)
//line app/vmalert/web.qtpl:458
	qw422016.N().S(`">Link</a>
        </div>
      </div>
    </div>
    `)
//line app/vmalert/web.qtpl:462
	tpl.StreamFooter(qw422016, r)
//line app/vmalert/web.qtpl:462
	qw422016.N().S(`

`)
//line app/vmalert/web.qtpl:464
}

//line app/vmalert/web.qtpl:464
func WriteAlert(qq422016 qtio422016.Writer, r *http.Request, alert *apiAlert) {
//line app/vmalert/web.qtpl:464
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmalert/web.qtpl:464
	StreamAlert(qw422016, r, alert)
//line app/vmalert/web.qtpl:464
	qt422016.ReleaseWriter(qw422016)
//line app/vmalert/web.qtpl:464
}

//line app/vmalert/web.qtpl:464
func Alert(r *http.Request, alert *apiAlert) string {
//line app/vmalert/web.qtpl:464
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmalert/web.qtpl:464
	WriteAlert(qb422016, r, alert)
//line app/vmalert/web.qtpl:464
	qs422016 := string(qb422016.B)
//line app/vmalert/web.qtpl:464
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmalert/web.qtpl:464
	return qs422016
//line app/vmalert/web.qtpl:464
}

//line app/vmalert/web.qtpl:467
func StreamRuleDetails(qw422016 *qt422016.Writer, r *http.Request, rule apiRule) {
//line app/vmalert/web.qtpl:467
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:468
	prefix := vmalertutil.Prefix(r.URL.Path)

//line app/vmalert/web.qtpl:468
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:469
	tpl.StreamHeader(qw422016, r, navItems, "", getLastConfigError())
//line app/vmalert/web.qtpl:469
	qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:471
	var labelKeys []string
	for k := range rule.Labels {
		labelKeys = append(labelKeys, k)
	}
	sort.Strings(labelKeys)

	var annotationKeys []string
	for k := range rule.Annotations {
		annotationKeys = append(annotationKeys, k)
	}
	sort.Strings(annotationKeys)

	var seriesFetchedEnabled bool
	var seriesFetchedWarning bool
	for _, u := range rule.Updates {
		if u.SeriesFetched != nil {
			seriesFetchedEnabled = true
			if *u.SeriesFetched == 0 && u.Samples == 0 {
				seriesFetchedWarning = true
			}
		}
	}

//line app/vmalert/web.qtpl:494
	qw422016.N().S(`
    <div class="display-6 pb-3 mb-3">Rule: `)
//line app/vmalert/web.qtpl:495
	qw422016.E().S(rule.Name)
//line app/vmalert/web.qtpl:495
	qw422016.N().S(`<span class="ms-2 badge `)
//line app/vmalert/web.qtpl:495
	if rule.Health != "ok" {
//line app/vmalert/web.qtpl:495
		qw422016.N().S(`bg-danger`)
//line app/vmalert/web.qtpl:495
	} else {
//line app/vmalert/web.qtpl:495
		qw422016.N().S(` bg-success text-dark`)
//line app/vmalert/web.qtpl:495
	}
//line app/vmalert/web.qtpl:495
	qw422016.N().S(`">`)
//line app/vmalert/web.qtpl:495
	qw422016.E().S(rule.Health)
//line app/vmalert/web.qtpl:495
	qw422016.N().S(`</span></div>
    <div class="container border-bottom p-2">
      <div class="row">
        <div class="col-2">
          Expr
        </div>
        <div class="col">
          <code><pre>`)
//line app/vmalert/web.qtpl:502
	qw422016.E().S(rule.Query)
//line app/vmalert/web.qtpl:502
	qw422016.N().S(`</pre></code>
        </div>
      </div>
    </div>
    `)
//line app/vmalert/web.qtpl:506
	if rule.Type == "alerting" {
//line app/vmalert/web.qtpl:506
		qw422016.N().S(`
    <div class="container border-bottom p-2">
      <div class="row">
        <div class="col-2">
          For
        </div>
        <div class="col">
         `)
//line app/vmalert/web.qtpl:513
		qw422016.E().V(rule.Duration)
//line app/vmalert/web.qtpl:513
		qw422016.N().S(` seconds
        </div>
      </div>
    </div>
    `)
//line app/vmalert/web.qtpl:517
		if rule.KeepFiringFor > 0 {
//line app/vmalert/web.qtpl:517
			qw422016.N().S(`
    <div class="container border-bottom p-2">
      <div class="row">
        <div class="col-2">
          Keep firing for
        </div>
        <div class="col">
         `)
//line app/vmalert/web.qtpl:524
			qw422016.E().V(rule.KeepFiringFor)
//line app/vmalert/web.qtpl:524
			qw422016.N().S(` seconds
        </div>
      </div>
    </div>
    `)
//line app/vmalert/web.qtpl:528
		}
//line app/vmalert/web.qtpl:528
		qw422016.N().S(`
    `)
//line app/vmalert/web.qtpl:529
	}
//line app/vmalert/web.qtpl:529
	qw422016.N().S(`
    <div class="container border-bottom p-2">
      <div class="row">
        <div class="col-2">
          Labels
        </div>
        <div class="col">
          `)
//line app/vmalert/web.qtpl:536
	for _, k := range labelKeys {
//line app/vmalert/web.qtpl:536
		qw422016.N().S(`
                <span class="m-1 badge bg-primary">`)
//line app/vmalert/web.qtpl:537
		qw422016.E().S(k)
//line app/vmalert/web.qtpl:537
		qw422016.N().S(`=`)
//line app/vmalert/web.qtpl:537
		qw422016.E().S(rule.Labels[k])
//line app/vmalert/web.qtpl:537
		qw422016.N().S(`</span>
          `)
//line app/vmalert/web.qtpl:538
	}
//line app/vmalert/web.qtpl:538
	qw422016.N().S(`
        </div>
      </div>
    </div>
    `)
//line app/vmalert/web.qtpl:542
	if rule.Type == "alerting" {
//line app/vmalert/web.qtpl:542
		qw422016.N().S(`
    <div class="container border-bottom p-2">
      <div class="row">
        <div class="col-2">
          Annotations
        </div>
        <div class="col">
          `)
//line app/vmalert/web.qtpl:549
		for _, k := range annotationKeys {
//line app/vmalert/web.qtpl:549
			qw422016.N().S(`
                <b>`)
//line app/vmalert/web.qtpl:550
			qw422016.E().S(k)
//line app/vmalert/web.qtpl:550
			qw422016.N().S(`:</b><br>
                <p>`)
//line app/vmalert/web.qtpl:551
			qw422016.E().S(rule.Annotations[k])
//line app/vmalert/web.qtpl:551
			qw422016.N().S(`</p>
          `)
//line app/vmalert/web.qtpl:552
		}
//line app/vmalert/web.qtpl:552
		qw422016.N().S(`
        </div>
      </div>
    </div>
    <div class="container border-bottom p-2">
      <div class="row">
        <div class="col-2">
          Debug
        </div>
        <div class="col">
           `)
//line app/vmalert/web.qtpl:562
		qw422016.E().V(rule.Debug)
//line app/vmalert/web.qtpl:562
		qw422016.N().S(`
        </div>
      </div>
    </div>
    `)
//line app/vmalert/web.qtpl:566
	}
//line app/vmalert/web.qtpl:566
	qw422016.N().S(`
    <div class="container border-bottom p-2">
      <div class="row">
        <div class="col-2">
          Group
        </div>
        <div class="col">
           <a target="_blank" href="`)
//line app/vmalert/web.qtpl:573
	qw422016.E().S(prefix)
//line app/vmalert/web.qtpl:573
	qw422016.N().S(`groups#group-`)
//line app/vmalert/web.qtpl:573
	qw422016.E().S(rule.GroupID)
//line app/vmalert/web.qtpl:573
	qw422016.N().S(`">`)
//line app/vmalert/web.qtpl:573
	qw422016.E().S(rule.GroupID)
//line app/vmalert/web.qtpl:573
	qw422016.N().S(`</a>
        </div>
      </div>
    </div>

    <br>
    `)
//line app/vmalert/web.qtpl:579
	if seriesFetchedWarning {
//line app/vmalert/web.qtpl:579
		qw422016.N().S(`
    <div class="alert alert-warning" role="alert">
       <strong>Warning:</strong> some of updates have "Series fetched" equal to 0.<br>
       It might be that either this data is missing in the datasource or there is a typo in rule's expression.
       For example, <strong>foo{label="bar"} > 0</strong> could never trigger because <strong>foo{label="bar"}</strong>
       metric doesn't exist.
       <br>
       Rule's expressions without time series selector, like <strong>expr: 42</strong> or <strong>expr: time()</strong>
       aren't fetching time series from datasource, so they could have "Series fetched" equal to 0 and this won't be a problem.
       <br>
       See more details about this detection <a target="_blank" href="https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4039">here</a>.
    </div>
    `)
//line app/vmalert/web.qtpl:591
	}
//line app/vmalert/web.qtpl:591
	qw422016.N().S(`
    <div class="display-6 pb-3">Last `)
//line app/vmalert/web.qtpl:592
	qw422016.N().D(len(rule.Updates))
//line app/vmalert/web.qtpl:592
	qw422016.N().S(`/`)
//line app/vmalert/web.qtpl:592
	qw422016.N().D(rule.MaxUpdates)
//line app/vmalert/web.qtpl:592
	qw422016.N().S(` updates</span>:</div>
        <table class="table table-striped table-hover table-sm">
            <thead>
                <tr>
                    <th scope="col" title="The time when event was created">Updated at</th>
                    <th scope="col" class="w-10 text-center" title="How many series expression returns. Each series will represent an alert.">Series returned</th>
                    `)
//line app/vmalert/web.qtpl:598
	if seriesFetchedEnabled {
//line app/vmalert/web.qtpl:598
		qw422016.N().S(`<th scope="col" class="w-10 text-center" title="How many series were scanned by datasource during the evaluation">Series fetched</th>`)
//line app/vmalert/web.qtpl:598
	}
//line app/vmalert/web.qtpl:598
	qw422016.N().S(`
                    <th scope="col" class="w-10 text-center" title="How many seconds request took">Duration</th>
                    <th scope="col" class="text-center" title="Time used for rule execution">Executed at</th>
                    <th scope="col" class="text-center" title="cURL command with request example">cURL</th>
                </tr>
            </thead>
            <tbody>

     `)
//line app/vmalert/web.qtpl:606
	for _, u := range rule.Updates {
//line app/vmalert/web.qtpl:606
		qw422016.N().S(`
             <tr`)
//line app/vmalert/web.qtpl:607
		if u.Err != nil {
//line app/vmalert/web.qtpl:607
			qw422016.N().S(` class="alert-danger"`)
//line app/vmalert/web.qtpl:607
		}
//line app/vmalert/web.qtpl:607
		qw422016.N().S(`>
                 <td>
                    <span class="badge bg-primary rounded-pill me-3" title="Updated at">`)
//line app/vmalert/web.qtpl:609
		qw422016.E().S(u.Time.Format(time.RFC3339))
//line app/vmalert/web.qtpl:609
		qw422016.N().S(`</span>
                 </td>
                 <td class="text-center">`)
//line app/vmalert/web.qtpl:611
		qw422016.N().D(u.Samples)
//line app/vmalert/web.qtpl:611
		qw422016.N().S(`</td>
                 `)
//line app/vmalert/web.qtpl:612
		if seriesFetchedEnabled {
//line app/vmalert/web.qtpl:612
			qw422016.N().S(`<td class="text-center">`)
//line app/vmalert/web.qtpl:612
			if u.SeriesFetched != nil {
//line app/vmalert/web.qtpl:612
				qw422016.N().D(*u.SeriesFetched)
//line app/vmalert/web.qtpl:612
			}
//line app/vmalert/web.qtpl:612
			qw422016.N().S(`</td>`)
//line app/vmalert/web.qtpl:612
		}
//line app/vmalert/web.qtpl:612
		qw422016.N().S(`
                 <td class="text-center">`)
//line app/vmalert/web.qtpl:613
		qw422016.N().FPrec(u.Duration.Seconds(), 3)
//line app/vmalert/web.qtpl:613
		qw422016.N().S(`s</td>
                 <td class="text-center">`)
//line app/vmalert/web.qtpl:614
		qw422016.E().S(u.At.Format(time.RFC3339))
//line app/vmalert/web.qtpl:614
		qw422016.N().S(`</td>
                 <td>
                    <textarea class="curl-area" rows="1" onclick="this.focus();this.select()">`)
//line app/vmalert/web.qtpl:616
		qw422016.E().S(u.Curl)
//line app/vmalert/web.qtpl:616
		qw422016.N().S(`</textarea>
                </td>
             </tr>
          </li>
          `)
//line app/vmalert/web.qtpl:620
		if u.Err != nil {
//line app/vmalert/web.qtpl:620
			qw422016.N().S(`
             <tr`)
//line app/vmalert/web.qtpl:621
			if u.Err != nil {
//line app/vmalert/web.qtpl:621
				qw422016.N().S(` class="alert-danger"`)
//line app/vmalert/web.qtpl:621
			}
//line app/vmalert/web.qtpl:621
			qw422016.N().S(`>
               <td colspan="`)
//line app/vmalert/web.qtpl:622
			if seriesFetchedEnabled {
//line app/vmalert/web.qtpl:622
				qw422016.N().S(`6`)
//line app/vmalert/web.qtpl:622
			} else {
//line app/vmalert/web.qtpl:622
				qw422016.N().S(`5`)
//line app/vmalert/web.qtpl:622
			}
//line app/vmalert/web.qtpl:622
			qw422016.N().S(`">
                   <span class="alert-danger">`)
//line app/vmalert/web.qtpl:623
			qw422016.E().V(u.Err)
//line app/vmalert/web.qtpl:623
			qw422016.N().S(`</span>
               </td>
             </tr>
          `)
//line app/vmalert/web.qtpl:626
		}
//line app/vmalert/web.qtpl:626
		qw422016.N().S(`
     `)
//line app/vmalert/web.qtpl:627
	}
//line app/vmalert/web.qtpl:627
	qw422016.N().S(`

    `)
//line app/vmalert/web.qtpl:629
	tpl.StreamFooter(qw422016, r)
//line app/vmalert/web.qtpl:629
	qw422016.N().S(`
`)
//line app/vmalert/web.qtpl:630
}

//line app/vmalert/web.qtpl:630
func WriteRuleDetails(qq422016 qtio422016.Writer, r *http.Request, rule apiRule) {
//line app/vmalert/web.qtpl:630
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmalert/web.qtpl:630
	StreamRuleDetails(qw422016, r, rule)
//line app/vmalert/web.qtpl:630
	qt422016.ReleaseWriter(qw422016)
//line app/vmalert/web.qtpl:630
}

//line app/vmalert/web.qtpl:630
func RuleDetails(r *http.Request, rule apiRule) string {
//line app/vmalert/web.qtpl:630
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmalert/web.qtpl:630
	WriteRuleDetails(qb422016, r, rule)
//line app/vmalert/web.qtpl:630
	qs422016 := string(qb422016.B)
//line app/vmalert/web.qtpl:630
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmalert/web.qtpl:630
	return qs422016
//line app/vmalert/web.qtpl:630
}

//line app/vmalert/web.qtpl:634
func streambadgeState(qw422016 *qt422016.Writer, state string) {
//line app/vmalert/web.qtpl:634
	qw422016.N().S(`
`)
//line app/vmalert/web.qtpl:636
	badgeClass := "bg-warning text-dark"
	if state == "firing" {
		badgeClass = "bg-danger"
	}

//line app/vmalert/web.qtpl:640
	qw422016.N().S(`
<span class="badge `)
//line app/vmalert/web.qtpl:641
	qw422016.E().S(badgeClass)
//line app/vmalert/web.qtpl:641
	qw422016.N().S(`">`)
//line app/vmalert/web.qtpl:641
	qw422016.E().S(state)
//line app/vmalert/web.qtpl:641
	qw422016.N().S(`</span>
`)
//line app/vmalert/web.qtpl:642
}

//line app/vmalert/web.qtpl:642
func writebadgeState(qq422016 qtio422016.Writer, state string) {
//line app/vmalert/web.qtpl:642
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmalert/web.qtpl:642
	streambadgeState(qw422016, state)
//line app/vmalert/web.qtpl:642
	qt422016.ReleaseWriter(qw422016)
//line app/vmalert/web.qtpl:642
}

//line app/vmalert/web.qtpl:642
func badgeState(state string) string {
//line app/vmalert/web.qtpl:642
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmalert/web.qtpl:642
	writebadgeState(qb422016, state)
//line app/vmalert/web.qtpl:642
	qs422016 := string(qb422016.B)
//line app/vmalert/web.qtpl:642
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmalert/web.qtpl:642
	return qs422016
//line app/vmalert/web.qtpl:642
}

//line app/vmalert/web.qtpl:644
func streambadgeRestored(qw422016 *qt422016.Writer) {
//line app/vmalert/web.qtpl:644
	qw422016.N().S(`
<span class="badge bg-warning text-dark" title="Alert state was restored after the service restart from remote storage">restored</span>
`)
//line app/vmalert/web.qtpl:646
}

//line app/vmalert/web.qtpl:646
func writebadgeRestored(qq422016 qtio422016.Writer) {
//line app/vmalert/web.qtpl:646
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmalert/web.qtpl:646
	streambadgeRestored(qw422016)
//line app/vmalert/web.qtpl:646
	qt422016.ReleaseWriter(qw422016)
//line app/vmalert/web.qtpl:646
}

//line app/vmalert/web.qtpl:646
func badgeRestored() string {
//line app/vmalert/web.qtpl:646
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmalert/web.qtpl:646
	writebadgeRestored(qb422016)
//line app/vmalert/web.qtpl:646
	qs422016 := string(qb422016.B)
//line app/vmalert/web.qtpl:646
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmalert/web.qtpl:646
	return qs422016
//line app/vmalert/web.qtpl:646
}

//line app/vmalert/web.qtpl:648
func streambadgeStabilizing(qw422016 *qt422016.Writer) {
//line app/vmalert/web.qtpl:648
	qw422016.N().S(`
<span class="badge bg-warning text-dark" title="This firing state is kept because of `)
//line app/vmalert/web.qtpl:648
	qw422016.N().S("`")
//line app/vmalert/web.qtpl:648
	qw422016.N().S(`keep_firing_for`)
//line app/vmalert/web.qtpl:648
	qw422016.N().S("`")
//line app/vmalert/web.qtpl:648
	qw422016.N().S(`">stabilizing</span>
`)
//line app/vmalert/web.qtpl:650
}

//line app/vmalert/web.qtpl:650
func writebadgeStabilizing(qq422016 qtio422016.Writer) {
//line app/vmalert/web.qtpl:650
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmalert/web.qtpl:650
	streambadgeStabilizing(qw422016)
//line app/vmalert/web.qtpl:650
	qt422016.ReleaseWriter(qw422016)
//line app/vmalert/web.qtpl:650
}

//line app/vmalert/web.qtpl:650
func badgeStabilizing() string {
//line app/vmalert/web.qtpl:650
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmalert/web.qtpl:650
	writebadgeStabilizing(qb422016)
//line app/vmalert/web.qtpl:650
	qs422016 := string(qb422016.B)
//line app/vmalert/web.qtpl:650
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmalert/web.qtpl:650
	return qs422016
//line app/vmalert/web.qtpl:650
}

//line app/vmalert/web.qtpl:652
func streamseriesFetchedWarn(qw422016 *qt422016.Writer, prefix string, r apiRule) {
//line app/vmalert/web.qtpl:652
	qw422016.N().S(`
`)
//line app/vmalert/web.qtpl:653
	if isNoMatch(r) {
//line app/vmalert/web.qtpl:653
		qw422016.N().S(`
<svg
    data-bs-toggle="tooltip"
    title="No match! This rule's last evaluation hasn't selected any time series from the datasource.
    It might be that either this data is missing in the datasource or there is a typo in rule's expression.
    See more in Details."
    width="18" height="18" fill="currentColor" class="bi bi-exclamation-triangle-fill flex-shrink-0 me-2" role="img" aria-label="Warning:">
       <use href="`)
//line app/vmalert/web.qtpl:660
		qw422016.E().S(prefix)
//line app/vmalert/web.qtpl:660
		qw422016.N().S(`static/icons/icons.svg#exclamation"/>
</svg>
`)
//line app/vmalert/web.qtpl:662
	}
//line app/vmalert/web.qtpl:662
	qw422016.N().S(`
`)
//line app/vmalert/web.qtpl:663
}

//line app/vmalert/web.qtpl:663
func writeseriesFetchedWarn(qq422016 qtio422016.Writer, prefix string, r apiRule) {
//line app/vmalert/web.qtpl:663
	qw422016 := qt422016.AcquireWriter(qq422016)
//line app/vmalert/web.qtpl:663
	streamseriesFetchedWarn(qw422016, prefix, r)
//line app/vmalert/web.qtpl:663
	qt422016.ReleaseWriter(qw422016)
//line app/vmalert/web.qtpl:663
}

//line app/vmalert/web.qtpl:663
func seriesFetchedWarn(prefix string, r apiRule) string {
//line app/vmalert/web.qtpl:663
	qb422016 := qt422016.AcquireByteBuffer()
//line app/vmalert/web.qtpl:663
	writeseriesFetchedWarn(qb422016, prefix, r)
//line app/vmalert/web.qtpl:663
	qs422016 := string(qb422016.B)
//line app/vmalert/web.qtpl:663
	qt422016.ReleaseByteBuffer(qb422016)
//line app/vmalert/web.qtpl:663
	return qs422016
//line app/vmalert/web.qtpl:663
}

//line app/vmalert/web.qtpl:666
func isNoMatch(r apiRule) bool {
	return r.LastSamples == 0 && r.LastSeriesFetched != nil && *r.LastSeriesFetched == 0
}
