diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2023-03-09 21:19:33 +0200 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2023-03-09 21:19:33 +0200 |
commit | 6f3c2904d18ce25903731d85f2276b398d676abf (patch) | |
tree | a833eea7f933733f1b7fc3cba095fb001108f7b3 /web | |
parent | updater/maintainers: handle maintainer-needed (diff) | |
download | soko-6f3c2904d18ce25903731d85f2276b398d676abf.tar.gz soko-6f3c2904d18ce25903731d85f2276b398d676abf.tar.bz2 soko-6f3c2904d18ce25903731d85f2276b398d676abf.zip |
web/maintainer: optimize spaces and clean logic
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'web')
-rw-r--r-- | web/templates/maintainer/components/bugs.tmpl | 61 | ||||
-rw-r--r-- | web/templates/maintainer/components/packages.tmpl | 85 | ||||
-rw-r--r-- | web/templates/maintainer/components/stabilization.tmpl | 70 | ||||
-rw-r--r-- | web/templates/maintainer/maintainerheader.tmpl | 27 |
4 files changed, 89 insertions, 154 deletions
diff --git a/web/templates/maintainer/components/bugs.tmpl b/web/templates/maintainer/components/bugs.tmpl index f069dad..4d534e6 100644 --- a/web/templates/maintainer/components/bugs.tmpl +++ b/web/templates/maintainer/components/bugs.tmpl @@ -1,36 +1,25 @@ {{define "bugs"}} <div class="row"> <div class="col-md-9"> - {{$security_bugs := 0}} - {{$non_security_bugs := 0}} - {{range getAllBugs .Packages}} - {{if eq .Component "Vulnerabilities"}} - {{$security_bugs = (add $security_bugs 1)}} - {{else}} - {{$non_security_bugs = (add $non_security_bugs 1)}} - {{end}} - {{end}} - - {{$general_bugs := 0}} - {{$stabilization_bugs := 0}} - {{$keywording_bugs := 0}} - {{range getAllBugs .Packages}} - {{if eq .Component "Current packages"}} - {{$general_bugs = (add $general_bugs 1)}} - {{else if eq .Component "Stabilization"}} - {{$stabilization_bugs = (add $stabilization_bugs 1)}} - {{else if eq .Component "Keywording"}} - {{$keywording_bugs = (add $keywording_bugs 1)}} - {{end}} - {{end}} + {{- $general_bugs := 0 -}} + {{- $stabilization_bugs := 0 -}} + {{- $keywording_bugs := 0 -}} + {{- range getAllBugs .Packages -}} + {{- if eq .Component "Current packages" -}} + {{- $general_bugs = (add $general_bugs 1) -}} + {{- else if eq .Component "Stabilization" -}} + {{- $stabilization_bugs = (add $stabilization_bugs 1) -}} + {{- else if eq .Component "Keywording" -}} + {{- $keywording_bugs = (add $keywording_bugs 1) -}} + {{- end -}} + {{- end -}} - - {{if $non_security_bugs}} + {{- if .Maintainer.PackagesInformation.Bugs -}} {{if $general_bugs}} <h3 id="packages" class="mb-4">Bug Reports</h3> <ul class="list-group"> - {{range getAllBugs .Packages}} + {{- range getAllBugs .Packages -}} {{if eq .Component "Current packages"}} <li class="list-group-item"> <div class="row"> @@ -38,20 +27,18 @@ <i class="fa fa-bug" aria-hidden="true"></i> <a href="https://bugs.gentoo.org/{{.Id}}" class="text-dark"><b>{{.Summary}}</b></a> </div> - <div class="col-md-12 text-muted"> - {{.Id}} - Assigned to {{.Assignee}} - </div> + <div class="col-md-12 text-muted">{{.Id}} - Assigned to {{.Assignee}}</div> </div> </li> {{end}} - {{end}} + {{- end -}} </ul> {{end}} {{if $stabilization_bugs}} <h3 id="stabilization" class="my-4">Stabilization Bug Reports</h3> <ul class="list-group"> - {{range getAllBugs .Packages}} + {{- range getAllBugs .Packages -}} {{if eq .Component "Stabilization"}} <li class="list-group-item"> <div class="row"> @@ -59,20 +46,18 @@ <i class="fa fa-bug" aria-hidden="true"></i> <a href="https://bugs.gentoo.org/{{.Id}}" class="text-dark"><b>{{.Summary}}</b></a> </div> - <div class="col-md-12 text-muted"> - {{.Id}} - Assigned to {{.Assignee}} - </div> + <div class="col-md-12 text-muted">{{.Id}} - Assigned to {{.Assignee}}</div> </div> </li> {{end}} - {{end}} + {{- end -}} </ul> {{end}} {{if $keywording_bugs}} <h3 id="keywording" class="my-4">Keywording Bug Reports</h3> <ul class="list-group"> - {{range getAllBugs .Packages}} + {{- range getAllBugs .Packages -}} {{if eq .Component "Keywording"}} <li class="list-group-item"> <div class="row"> @@ -80,13 +65,11 @@ <i class="fa fa-bug" aria-hidden="true"></i> <a href="https://bugs.gentoo.org/{{.Id}}" class="text-dark"><b>{{.Summary}}</b></a> </div> - <div class="col-md-12 text-muted"> - {{.Id}} - Assigned to {{.Assignee}} - </div> + <div class="col-md-12 text-muted">{{.Id}} - Assigned to {{.Assignee}}</div> </div> </li> {{end}} - {{end}} + {{- end -}} </ul> {{end}} {{else}} diff --git a/web/templates/maintainer/components/packages.tmpl b/web/templates/maintainer/components/packages.tmpl index a791fa4..e2ab60d 100644 --- a/web/templates/maintainer/components/packages.tmpl +++ b/web/templates/maintainer/components/packages.tmpl @@ -1,47 +1,30 @@ {{define "packages"}} <div class="row"> <div class="col-md-9"> - {{if .Packages}} - <ul class="list-group"> - {{$category := ""}} - - {{ range .Packages }} - {{ if eq .Category $category}} - <li class="list-group-item"> - <div class="row"> - <div class="col-md-4"> - <a href="/packages/{{.Atom}}" class="text-dark"><b>{{.Atom}}</b></a> - </div> - <div class="col-md-8 text-muted"> - {{.Description}} - </div> - </div> - </li> - {{$category = .Category}} - {{else}} - </ul> - <h3 id="{{.Category}}" class="{{if ne $category ""}}mt-4{{end}}"> - {{$category = .Category}} - {{$category}} - </h3> - <ul class="list-group"> - <li class="list-group-item"> - <div class="row"> - <div class="col-md-4"> - <a href="/packages/{{.Atom}}" class="text-dark"><b>{{.Atom}}</b></a> - </div> - <div class="col-md-8 text-muted"> - {{.Description}} - </div> - </div> - </li> - {{end}} - {{end}} - - - - </ul> - + {{- if .Packages}} + <ul class="list-group"> + {{- $category := "" -}} + {{- range .Packages -}} + {{- if ne .Category $category}} + </ul> + <h3 id="{{.Category}}" class="{{if ne $category ""}}mt-4{{end}}"> + {{- $category = .Category -}} + {{- $category -}} + </h3> + <ul class="list-group"> + {{- end }} + <li class="list-group-item"> + <div class="row"> + <div class="col-md-4"> + <a href="/packages/{{.Atom}}" class="text-dark"><b>{{.Atom}}</b></a> + </div> + <div class="col-md-8 text-muted"> + {{- .Description -}} + </div> + </div> + </li> + {{- end }} + </ul> {{else}} <div class="row"> <div class="col-md-8"> @@ -50,7 +33,7 @@ <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> - {{end}} + {{- end}} </div> <div class="col-md-3 pt-4"> {{if .Maintainer.Project.Description}} @@ -139,16 +122,16 @@ </h4> <div class="collapse show" id="collapseShortcuts"> <dl> - {{$category := (index .Packages 0).Category}} - {{$packageCounter := 0}} - {{ range .Packages }} - {{ if ne .Category $category}} + {{- $category := (index .Packages 0).Category -}} + {{- $packageCounter := 0 -}} + {{- range .Packages -}} + {{- if ne .Category $category }} <dd class="ml-3 mb-0"><a href="#{{$category}}">{{$category}} ({{$packageCounter}})</a></dd> - {{$category = .Category}} - {{$packageCounter = 1}} - {{else}} - {{$packageCounter = add $packageCounter 1}} - {{end}} + {{- $category = .Category -}} + {{- $packageCounter = 1 -}} + {{ else -}} + {{- $packageCounter = add $packageCounter 1 -}} + {{- end -}} {{end}} <dd class="ml-3 mb-0"><a href="#{{$category}}">{{$category}} ({{$packageCounter}})</a></dd> </dl> diff --git a/web/templates/maintainer/components/stabilization.tmpl b/web/templates/maintainer/components/stabilization.tmpl index 7026be5..5c0d9f5 100644 --- a/web/templates/maintainer/components/stabilization.tmpl +++ b/web/templates/maintainer/components/stabilization.tmpl @@ -1,66 +1,48 @@ {{define "stabilization"}} <div class="row"> <div class="col-md-9"> - <h3>Stable Requests</h3> <ul class="timeline"> - {{$stable_requests := 0}} - {{range .Packages}} - {{range $index, $element := .Versions}} - {{ if .PkgCheckResults }} - {{ range .PkgCheckResults }} - {{if eq .Class "StableRequest"}} - {{$stable_requests = (add $stable_requests 1)}} + {{- $stable_requests := 0 -}} + {{- range .Packages -}} + {{- range $index, $element := .Versions -}} + {{- if .PkgCheckResults -}} + {{- range .PkgCheckResults -}} + {{ if eq .Class "StableRequest" }} + {{- $stable_requests = (add $stable_requests 1) }} <li> <ul class="list-group"> <li class="list-group-item"> <a href="/packages/{{.Category}}/{{.Package}}" class="text-dark"><strong>{{.Category}}/{{.Package}}-{{.Version}}</strong></a><br/> <span class="kk-version kk-cell-sep-right text-muted"> - {{ .Message }} + {{- .Message -}} </span> </li> </ul> </li> {{end}} - {{end}} - {{end}} - {{end}} - {{end}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} </ul> {{if eq $stable_requests 0}} <div class="text-center w-100"><i>- No Stable Requests found -</i></div> {{end}} - - {{$security_bugs := 0}} - {{$non_security_bugs := 0}} - {{range getAllBugs .Packages}} - {{if eq .Component "Vulnerabilities"}} - {{$security_bugs = (add $security_bugs 1)}} - {{else}} - {{$non_security_bugs = (add $non_security_bugs 1)}} - {{end}} - {{end}} - - {{$general_bugs := 0}} - {{$stabilization_bugs := 0}} - {{$keywording_bugs := 0}} - {{range getAllBugs .Packages}} - {{if eq .Component "Current packages"}} - {{$general_bugs = (add $general_bugs 1)}} - {{else if eq .Component "Stabilization"}} - {{$stabilization_bugs = (add $stabilization_bugs 1)}} - {{else if eq .Component "Keywording"}} - {{$keywording_bugs = (add $keywording_bugs 1)}} - {{end}} - {{end}} + {{- $stabilization_bugs := 0 -}} + {{- range getAllBugs .Packages -}} + {{- if eq .Component "Stabilization" -}} + {{- $stabilization_bugs = (add $stabilization_bugs 1) -}} + {{- end -}} + {{- end -}} - {{if $non_security_bugs}} - {{if $stabilization_bugs}} + {{if .Maintainer.PackagesInformation.Bugs -}} + {{- if $stabilization_bugs}} <h3 id="stabilization" class="my-4">Stabilization Bug Reports</h3> <ul class="list-group"> - {{range getAllBugs .Packages}} + {{- range getAllBugs .Packages -}} {{if eq .Component "Stabilization"}} <li class="list-group-item"> <div class="row"> @@ -69,15 +51,15 @@ <a href="https://bugs.gentoo.org/{{.Id}}" class="text-dark"><b>{{.Summary}}</b></a> </div> <div class="col-md-12 text-muted"> - {{.Id}} - Assigned to {{.Assignee}} + {{- .Id}} - Assigned to {{.Assignee -}} </div> </div> </li> - {{end}} - {{end}} + {{end -}} + {{- end -}} </ul> - {{end}} - {{end}} + {{- end -}} + {{- end}} </div> <div class="col-md-3 pt-4"> <h4 class=""> diff --git a/web/templates/maintainer/maintainerheader.tmpl b/web/templates/maintainer/maintainerheader.tmpl index f0866c4..03411fe 100644 --- a/web/templates/maintainer/maintainerheader.tmpl +++ b/web/templates/maintainer/maintainerheader.tmpl @@ -3,7 +3,6 @@ <div class="container"> <div class="row"> <div class="col-12"> - <div class="row mt-3"> <div class="col-md-5"> <h1 class="stick-top kk-package-title" id="package-title"> @@ -27,27 +26,15 @@ <!-- TODO --> </p> </div> - - {{- $security_bugs := 0 -}} - {{- $non_security_bugs := 0 -}} - {{- range .Packages -}} - {{range .Bugs}} - {{if eq .Component "Vulnerabilities"}} - {{$security_bugs = (add $security_bugs 1)}} - {{else}} - {{$non_security_bugs = (add $non_security_bugs 1)}} - {{end}} - {{end}} - {{- end -}} <div class="col-md-12 pt-4 mt-1"> <nav class="nav kk-package-nav"> - <a class="nav-link {{if eq .PageName "packages"}}active{{end}}" href="/maintainer/{{if .Maintainer.Email}}{{.Maintainer.Email}}{{else}}maintainer-needed{{end}}"><i class="fa fa-info mr-1" aria-hidden="true"></i> Packages <span class="ml-1 badge badge-pill kk-misc-badge">{{len .Packages}}</span></a> - <a class="nav-link {{if eq .PageName "stabilization"}}active{{end}}" href="/maintainer/{{if .Maintainer.Email}}{{.Maintainer.Email}}{{else}}maintainer-needed{{end}}/stabilization"><i class="fa fa-check-circle-o mr-1" aria-hidden="true"></i> Stabilization <span class="ml-1 badge badge-pill kk-misc-badge">{{.Maintainer.PackagesInformation.StableRequests}}</span></a> - <a class="nav-link {{if eq .PageName "outdated"}}active{{end}}" href="/maintainer/{{if .Maintainer.Email}}{{.Maintainer.Email}}{{else}}maintainer-needed{{end}}/outdated"><i class="fa fa-tag mr-1" aria-hidden="true"></i> Outdated <span class="ml-1 badge badge-pill kk-misc-badge">{{.Maintainer.PackagesInformation.Outdated}}</span></a> - <a class="nav-link {{if eq .PageName "pull-requests"}}active{{end}}" href="/maintainer/{{if .Maintainer.Email}}{{.Maintainer.Email}}{{else}}maintainer-needed{{end}}/pull-requests"><span class="octicon octicon-git-pull-request opticon-resource-icon ml-1"></span> Pull requests <span class="ml-1 badge badge-pill kk-misc-badge">{{.Maintainer.PackagesInformation.PullRequests}}</span></a> - <a class="nav-link {{if eq .PageName "bugs"}}active{{end}}" href="/maintainer/{{if .Maintainer.Email}}{{.Maintainer.Email}}{{else}}maintainer-needed{{end}}/bugs"><i class="fa fa-bug" aria-hidden="true"></i> Bugs <span class="ml-1 badge badge-pill kk-misc-badge">{{.Maintainer.PackagesInformation.Bugs}}</span></a> - <a class="nav-link {{if eq .PageName "security"}}active{{end}}" href="/maintainer/{{if .Maintainer.Email}}{{.Maintainer.Email}}{{else}}maintainer-needed{{end}}/security"><i class="fa fa-shield" aria-hidden="true"></i> Security <span class="ml-1 badge badge-pill kk-misc-badge">{{.Maintainer.PackagesInformation.SecurityBugs}}</span></a> - <a class="nav-link {{if eq .PageName "changelog"}}active{{end}}" href="/maintainer/{{if .Maintainer.Email}}{{.Maintainer.Email}}{{else}}maintainer-needed{{end}}/changelog"><i class="fa fa-fw fa-history"></i> Changelog</a> + <a class="nav-link {{if eq .PageName "packages"}}active{{end}}" href="/maintainer/{{.Maintainer.Email}}"><i class="fa fa-info mr-1" aria-hidden="true"></i> Packages <span class="ml-1 badge badge-pill kk-misc-badge">{{len .Packages}}</span></a> + <a class="nav-link {{if eq .PageName "stabilization"}}active{{end}}" href="/maintainer/{{.Maintainer.Email}}/stabilization"><i class="fa fa-check-circle-o mr-1" aria-hidden="true"></i> Stabilization <span class="ml-1 badge badge-pill kk-misc-badge">{{.Maintainer.PackagesInformation.StableRequests}}</span></a> + <a class="nav-link {{if eq .PageName "outdated"}}active{{end}}" href="/maintainer/{{.Maintainer.Email}}/outdated"><i class="fa fa-tag mr-1" aria-hidden="true"></i> Outdated <span class="ml-1 badge badge-pill kk-misc-badge">{{.Maintainer.PackagesInformation.Outdated}}</span></a> + <a class="nav-link {{if eq .PageName "pull-requests"}}active{{end}}" href="/maintainer/{{.Maintainer.Email}}/pull-requests"><span class="octicon octicon-git-pull-request opticon-resource-icon ml-1"></span> Pull requests <span class="ml-1 badge badge-pill kk-misc-badge">{{.Maintainer.PackagesInformation.PullRequests}}</span></a> + <a class="nav-link {{if eq .PageName "bugs"}}active{{end}}" href="/maintainer/{{.Maintainer.Email}}/bugs"><i class="fa fa-bug" aria-hidden="true"></i> Bugs <span class="ml-1 badge badge-pill kk-misc-badge">{{.Maintainer.PackagesInformation.Bugs}}</span></a> + <a class="nav-link {{if eq .PageName "security"}}active{{end}}" href="/maintainer/{{.Maintainer.Email}}/security"><i class="fa fa-shield" aria-hidden="true"></i> Security <span class="ml-1 badge badge-pill kk-misc-badge">{{.Maintainer.PackagesInformation.SecurityBugs}}</span></a> + <a class="nav-link {{if eq .PageName "changelog"}}active{{end}}" href="/maintainer/{{.Maintainer.Email}}/changelog"><i class="fa fa-fw fa-history"></i> Changelog</a> </nav> </div> </div> |