frostfs-http-gw/templates/index.gotmpl
Nikita Zinkevich 31b838f86a
All checks were successful
/ DCO (pull_request) Successful in 1m23s
/ Vulncheck (pull_request) Successful in 1m48s
/ Builds (pull_request) Successful in 2m3s
/ Lint (pull_request) Successful in 2m45s
/ Tests (pull_request) Successful in 1m39s
[#137] Add index page support
Signed-off-by: Nikita Zinkevich <n.zinkevich@yadro.com>
2024-09-11 16:42:16 +03:00

58 lines
1.5 KiB
Go Template

{{$bucketName := .BucketName}}
{{$prefix := .Prefix }}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Index of {{$bucketName}}/{{$prefix}}</title>
<style>
table {
width: 100%;
border-collapse: collapse;
}
table, th, td {
border: 1px solid black;
}
th, td {
padding: 10px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<h1>Index of {{$bucketName}}/{{$prefix}}</h1>
<table>
<thead>
<tr>
<th>Filename</th>
<th>Size (bytes)</th>
<th>Created</th>
</tr>
</thead>
<tbody>
{{if $prefix}}
<tr>
<td><a href="../">../</a></td>
<td></td>
<td></td>
</tr>
{{end}}
{{range .Objects}}
{{if .FileName}}
<tr>
<td>
<a href="/get/{{ $bucketName }}/{{if $prefix}}{{$prefix}}/{{end}}{{.FileName}}{{if not .Size}}/{{end}}?download=true">
{{.FileName}}{{if not .Size}}/{{end}}
</a>
</td>
<td>{{.Size}}</td>
<td>{{ formatDate .Created }}</td>
</tr>
{{end}}
{{end}}
</tbody>
</table>
</body>
</html>