aboutsummaryrefslogtreecommitdiff
blob: b60190365af8f980cf3b81756adc15db88b6aa28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
package components

import "soko/pkg/models"
import "strconv"

templ bugsList(title string, component models.BugComponent, bugs []*models.Bug, titleClass, id string) {
	<h3 id={ id } class={ titleClass }>{ title }</h3>
	<ul class="list-group">
		for _, bug := range bugs {
			if bug.MatchesComponent(component) {
				<li class="list-group-item">
					<div class="row">
						<div class="col-md-12">
							<i class="fa fa-bug" aria-hidden="true"></i>
							<a href={ templ.URL("https://bugs.gentoo.org/" + bug.Id) } class="text-dark"><b>{ bug.Summary }</b></a>
						</div>
						<div class="col-md-12 text-muted">
							{ bug.Id } - Assigned to { bug.Assignee }
						</div>
					</div>
				</li>
			}
		}
	</ul>
}

func bugAtomLink(atom string) templ.SafeURL {
	if atom == "" {
		return templ.URL("https://bugs.gentoo.org/")
	}
	return templ.URL("https://bugs.gentoo.org/enter_bug.cgi?product=Gentoo Linux&component=Current packages&short_desc=" + atom + ": <ADD SUMMARY HERE>")
}

templ Bugs(atom string, generalCount, stabilizationCount, keywordingCount int, bugs []*models.Bug) {
	<div class="row">
		<div class="col-md-9">
			if len(bugs) > 0 {
				if generalCount > 0 {
					@bugsList("Bug Reports", models.BugComponentGeneral, bugs, "mb-4", "packages")
				}
				if stabilizationCount > 0 {
					@bugsList("Stabilization Bug Reports", models.BugComponentStabilization, bugs, "my-4", "stabilization")
				}
				if keywordingCount > 0 {
					@bugsList("Keywording Bug Reports", models.BugComponentKeywording, bugs, "my-4", "keywording")
				}
			} else {
				<div class="row pt-5">
					<div class="col-md-4">
						<img style="width: 100%;" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/Larry-the-cow-full.svg/1200px-Larry-the-cow-full.svg.png"/>
					</div>
					<div class="col-md-8 pt-3">
						<h2>Good job! There are no bugs.</h2>
						<span>You think something is missing here? <br/> Start with filling a <a href={ bugAtomLink(atom) }>new bug</a>.</span>
					</div>
				</div>
			}
		</div>
		<div class="col-md-3 pt-5">
			<h4 class="">
				<a class="collapseLink" style="color:#000000;" data-toggle="collapse" href="#collapseDescription" role="button" aria-expanded="false" aria-controls="collapseDescription">
					Description
				</a>
			</h4>
			<div class="collapse show" id="collapseDescription">
				<span class="text-muted">
					Gentoo Bugzilla is where we track bugs of Gentoo and its packages; you are welcome to report, confirm and resolve bugs:
					<ul>
						<li><a href={ bugAtomLink(atom) }>File a new Bug</a></li>
						<li><a href="https://bugs.gentoo.org/">Confirm a bug</a></li>
						<li><a href="https://wiki.gentoo.org/wiki/Bugday">Participate in our monthly Bugday</a></li>
					</ul>
				</span>
			</div>
			<h4 class="">
				<a class="collapseLink" style="color:#000000;" data-toggle="collapse" href="#collapseShortcuts" role="button" aria-expanded="false" aria-controls="collapseShortcuts">
					Shortcuts
				</a>
			</h4>
			<div class="collapse show" id="collapseShortcuts">
				<ul>
					<li>
						<a
							if generalCount > 0 {
								href="#packages"
							}
						>
							Packages Bugs ({ strconv.Itoa(generalCount) })
						</a>
					</li>
					<li>
						<a
							if stabilizationCount > 0 {
								href="#stabilization"
							}
						>
							Stabilization Bugs ({ strconv.Itoa(stabilizationCount) })
						</a>
					</li>
					<li>
						<a
							if keywordingCount > 0 {
								href="#keywording"
							}
						>
							Keywording Bugs ({ strconv.Itoa(keywordingCount) })
						</a>
					</li>
				</ul>
			</div>
		</div>
	</div>
}

func securityBugAtomLink(atom string) templ.SafeURL {
	if atom == "" {
		return templ.URL("https://bugs.gentoo.org/enter_bug.cgi?product=Gentoo Security&component=Vulnerabilities")
	}
	return templ.URL("https://bugs.gentoo.org/enter_bug.cgi?product=Gentoo Security&component=Vulnerabilities&short_desc=" + atom + ": <ADD SUMMARY HERE>")
}

templ SecurityBugs(atom string, bugs []*models.Bug) {
	<div class="row">
		<div class="col-md-9">
			if len(bugs) > 0 {
				@bugsList("Security Bug Reports", models.BugComponentVulnerabilities, bugs, "mb-4", "security")
			} else {
				<div class="row pt-5">
					<div class="col-md-4">
						<img style="width: 100%;" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/Larry-the-cow-full.svg/1200px-Larry-the-cow-full.svg.png"/>
					</div>
					<div class="col-md-8 pt-3">
						<h2>There are no open security bugs.</h2>
						<span>You think something is missing here? <br/> Start with filling a <a href={ securityBugAtomLink(atom) }>new security bug</a>.</span>
					</div>
				</div>
			}
		</div>
		<div class="col-md-3 pt-5">
			<h4>
				<a class="collapseLink" style="color:#000000;" data-toggle="collapse" href="#collapseDescription" role="button" aria-expanded="false" aria-controls="collapseDescription">
					Contact Information
				</a>
			</h4>
			<div class="collapse show" id="collapseDescription">
				<span class="text-muted">
					Please file new vulnerability reports on <a href={ securityBugAtomLink(atom) }>Gentoo Bugzilla</a> and assign them to the Gentoo Security product and Vulnerabilities component.
				</span>
			</div>
		</div>
	</div>
}