artifactview/templates/listing.hbs

69 lines
3.1 KiB
Handlebars

{{#> partial/header ~}}
<title>Index: {{artifact_name}}</title>
{{~/partial/header }}
{{> partial/fileIcons }}
<header>
{{> partial/logoLink }}
<h1>{{#each path_components}}<a href="{{this.url}}">{{this.name}}</a><span class="sep">/</span>{{/each}}</h1>
</header>
<main>
<div class="metadata">
<div id="summary">
<span class="meta-item"><b>{{n_dirs}}</b> director{{#if n_dirs != 1}}ies{{else}}y{{/if}}</span>
<span class="meta-item"><b>{{n_files}}</b> file{{#if n_files != 1}}s{{/if}}</span>
<span class="meta-item"><a href="{{run_url}}" target="_blank" rel="noopener noreferrer">CI run</a></span>
<span class="meta-item"><input type="text" placeholder="filter" id="filter" onkeyup="filter()"/></span>
</div>
</div>
<div class="listing">
<table id="list" aria-describedby="summary">
<thead>
<tr>
<th><a href="?C=N&amp;O=A">Name</a>&nbsp;<a
href="?C=N&amp;O=D"
>&nbsp;&darr;&nbsp;</a></th>
<th>CRC32</th>
<th><a href="?C=S&amp;O=A">Size</a>&nbsp;<a
href="?C=S&amp;O=D"
>&nbsp;&darr;&nbsp;</a></th>
</tr>
</thead>
<tbody>
{{#if has_parent}}
<tr>
<td><a href=".."><span class="goup">Parent directory</span></a></td>
<td>&mdash;</td>
<td>&mdash;</td>
</tr>
{{/if}}
{{ let vms = viewer_max_size }}
{{#each entries}}
<tr class="file">
<td>
<a href="{{name}}{{#if !is_dir && size.0 <= vms }}?viewer=1{{/if}}">
<svg width="1.5em" height="1em" version="1.1" viewBox="0 0 317 259"><use xlink:href="{{#if is_dir}}#folder{{else}}#file{{/if}}"></use></svg>
<span class="name">{{name}}</span>
</a>
</td>
<td>{{#if is_dir}}&mdash;{{else}}{{crc32}}{{/if}}</td>
<td>{{#if is_dir}}&mdash;{{else}}{{size}}{{/if}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</main>
{{#> partial/footer ~}}
<script>
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT
var filterEl = document.getElementById("filter");
function initFilter() { if (!filterEl.value) { var filterParam = new URL(window.location.href).searchParams.get("filter"); if (filterParam) { filterEl.value = filterParam } } filter() }
function filter() { var q = filterEl.value.trim().toLowerCase(); var elems = document.querySelectorAll("tr.file"); elems.forEach(function (el) { if (!q) { el.style.display = ""; return } var nameEl = el.querySelector("td"); var nameVal = nameEl.textContent.trim().toLowerCase(); if (nameVal.indexOf(q) !== -1) { el.style.display = "" } else { el.style.display = "none" } }) }
document.addEventListener("DOMContentLoaded", initFilter);
// @license-end
</script>
{{~/partial/footer }}