final changes for search-function

This commit is contained in:
cnachtigall1991
2021-09-20 22:05:34 +02:00
parent 4ca9bea711
commit 0058dcff41

View File

@@ -1,166 +1,121 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1" name="viewport" /> <meta content="width=device-width, initial-scale=1" name="viewport"/>
<!-- Bootstrap CSS --> <!-- Bootstrap CSS -->
<link <link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css"
crossorigin="anonymous" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" rel="stylesheet"/>
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css"
integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We"
rel="stylesheet"
/>
<link <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet"/>
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css"
rel="stylesheet"
/>
<title>ALHP Status</title> <title>ALHP Status</title>
</head> </head>
<body> <body>
<nav class="navbar navbar-expand-lg sticky-top navbar-light bg-info mb-5"> <nav class="navbar navbar-expand-lg sticky-top navbar-light bg-info mb-5">
<div class="container"> <div class="container">
<div class="d-flex justify-content-start"> <div class="d-flex justify-content-start">
<span class="navbar-brand align-middle">ALHP Status</span> <span class="navbar-brand align-middle">ALHP Status</span>
<span class="navbar-text"> <span class="navbar-text">
<a <a href="https://git.harting.dev/anonfunc/ALHP.GO" class="align-middle position-absolute"><i
href="https://git.harting.dev/anonfunc/ALHP.GO" class="bi bi-github h4"></i></a>
class="align-middle position-absolute"
><i class="bi bi-github h4"></i
></a>
</span> </span>
</div> </div>
<div class="d-flex justify-content-end"> <div class="d-flex justify-content-end">
<input <input type="search" placeholder="Search for packages.." class="form-control" id="table-sort-input"
type="search" onkeyup="searchFilter()" title="Type in a name"/>
placeholder="Search for packages.."
class="form-control"
id="table-sort-input"
onkeyup="searchFilter()"
placeholder="Search for names.."
title="Type in a name"
/>
</div> </div>
</div> </div>
</nav> </nav>
<div class="container"> <div class="container">
{{range $march := .March}} {{range $march := .March}}
<h3>{{$march.Name}}</h3> <h3>{{$march.Name}}</h3>
<div class="accordion" id="accordion-{{$march.Name}}"> <div class="accordion" id="accordion-{{$march.Name}}">
{{range $repo := $march.Repos}} {{range $repo := $march.Repos}}
<div class="accordion-item"> <div class="accordion-item">
<h2 <h2 class="accordion-header" id="heading-{{$march.Name}}-{{$repo.Name}}">
class="accordion-header" <button aria-controls="collapse-{{$march.Name}}-{{$repo.Name}}" aria-expanded="false"
id="heading-{{$march.Name}}-{{$repo.Name}}" class="accordion-button"
> data-bs-target="#collapse-{{$march.Name}}-{{$repo.Name}}"
<button data-bs-toggle="collapse"
aria-controls="collapse-{{$march.Name}}-{{$repo.Name}}" type="button">{{$repo.Name}}-{{$march.Name}}
aria-expanded="false" </button>
class="accordion-button" </h2>
data-bs-target="#collapse-{{$march.Name}}-{{$repo.Name}}" <div aria-labelledby="heading-{{$march.Name}}-{{$repo.Name}}" class="accordion-collapse collapse show"
data-bs-toggle="collapse" data-bs-parent="#accordion-{{$march.Name}}" id="collapse-{{$march.Name}}-{{$repo.Name}}">
type="button" <div class="accordion-body overflow-auto">
> <table class="table table-sorted">
{{$repo.Name}}-{{$march.Name}} <thead>
</button> <tr>
</h2> <th scope="col">Pkgbase</th>
<div <th scope="col">Status</th>
aria-labelledby="heading-{{$march.Name}}-{{$repo.Name}}" <th scope="col">Reason</th>
class="accordion-collapse collapse show" <th scope="col">SVN2GIT Version</th>
data-bs-parent="#accordion-{{$march.Name}}" <th scope="col">{{$repo.Name}}-{{$march.Name}} Version</th>
id="collapse-{{$march.Name}}-{{$repo.Name}}" <th scope="col">Info</th>
> </tr>
<div class="accordion-body overflow-auto"> </thead>
<table class="table" id="table-sorted-{{$march.Name}}"> <tbody>
<thead> {{range $pkg := $repo.Packages}}
<tr> <tr class="{{$pkg.Class}}" id="{{$repo.Name}}-{{$march.Name}}-{{$pkg.Pkgbase}}">
<th scope="col">Pkgbase</th> <td>{{$pkg.Pkgbase}}</td>
<th scope="col">Status</th> <td>{{$pkg.Status}}</td>
<th scope="col">Reason</th> <td>{{$pkg.Skip}}</td>
<th scope="col">SVN2GIT Version</th> <td>{{$pkg.Svn2GitVersion}}</td>
<th scope="col">{{$repo.Name}}-{{$march.Name}} Version</th> <td>{{$pkg.Version}}</td>
<th scope="col">Info</th> <td class="text-center">
</tr> {{with $pkg.Log}}<a href="{{.}}"
</thead> ><i class="bi bi-file-text-fill"></i></a
<tbody> >{{end}}
{{range $pkg := $repo.Packages}} <a data-bs-html="true" data-bs-placement="bottom" data-bs-toggle="tooltip"
<tr href="#{{$repo.Name}}-{{$march.Name}}-{{$pkg.Pkgbase}}"
class="{{$pkg.Class}}" title="{{if $pkg.BuildDate}}Build Date: {{$pkg.BuildDate}}&#10;{{end}}{{if $pkg.BuildDuration}}Build Duration: {{$pkg.BuildDuration}}&#10;{{end}}Check date: {{$pkg.Checked}}">
id="{{$repo.Name}}-{{$march.Name}}-{{$pkg.Pkgbase}}" <i class="bi bi-info-circle-fill"></i></a>
> </td>
<td>{{$pkg.Pkgbase}}</td> </tr>
<td>{{$pkg.Status}}</td> {{end}}
<td>{{$pkg.Skip}}</td> </tbody>
<td>{{$pkg.Svn2GitVersion}}</td> </table>
<td>{{$pkg.Version}}</td> </div>
<td class="text-center">
{{with $pkg.Log}}<a href="{{.}}"
><i class="bi bi-file-text-fill"></i></a
>{{end}}
<a
data-bs-html="true"
data-bs-placement="bottom"
data-bs-toggle="tooltip"
href="#{{$repo.Name}}-{{$march.Name}}-{{$pkg.Pkgbase}}"
title="{{if $pkg.BuildDate}}Build Date: {{$pkg.BuildDate}}&#10;{{end}}{{if $pkg.BuildDuration}}Build Duration: {{$pkg.BuildDuration}}&#10;{{end}}Check date: {{$pkg.Checked}}"
>
<i class="bi bi-info-circle-fill"></i
></a>
</td>
</tr>
{{end}}
</tbody>
</table>
</div> </div>
</div>
</div> </div>
{{end}} {{end}}
</div>
{{end}}
</div> </div>
{{end}}
</div>
<footer <footer class="text-center text-lg-start bg-dark text-muted mt-3 fixed-bottom">
class="text-center text-lg-start bg-dark text-muted mt-3 fixed-bottom" <div class="text-center p-4" style="background-color: rgba(0, 0, 0, 0.05)">
>
<div
class="text-center p-4"
style="background-color: rgba(0, 0, 0, 0.05)"
>
Generated: {{.Generated}} Generated: {{.Generated}}
</div> </div>
</footer> </footer>
<script <script crossorigin="anonymous" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj"
crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js"></script>
integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" <script>
src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js" function searchFilter() {
></script> let input, filter, table, tr, td, i, txtValue;
<script>
function searchFilter() {
var input, filter, table, tr, td, i, txtValue
input = document.getElementById('table-sort-input') input = document.getElementById('table-sort-input')
filter = input.value.toUpperCase() filter = input.value.toUpperCase()
tables = document.getElementsByClassName('table-sorted') const tables = document.getElementsByClassName('table-sorted');
for (j = 0; j < tables.length; j++) { for (let j = 0; j < tables.length; j++) {
tr = tables[j].getElementsByTagName('tr') tr = tables[j].getElementsByTagName('tr')
console.log(j) for (i = 0; i < tr.length; i++) {
for (i = 0; i < tr.length; i++) { td = tr[i].getElementsByTagName('td')[0]
td = tr[i].getElementsByTagName('td')[0] if (td) {
if (td) { txtValue = td.textContent || td.innerText
txtValue = td.textContent || td.innerText if (txtValue.toUpperCase().indexOf(filter) > -1) {
if (txtValue.toUpperCase().indexOf(filter) > -1) { tr[i].style.display = ''
tr[i].style.display = '' } else {
} else { tr[i].style.display = 'none'
tr[i].style.display = 'none' }
} }
} }
}
} }
} }
</script> </script>
</body> </body>
</html> </html>