forked from TrueCloudLab/frostfs-http-gw
112 lines
2.7 KiB
Go Template
112 lines
2.7 KiB
Go Template
{{$container := .Container}}
|
|
{{ $prefix := trimPrefix .Prefix }}
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<title>Index of {{.Protocol}}://{{$container}}
|
|
/{{if $prefix}}/{{$prefix}}/{{end}}</title>
|
|
<style>
|
|
.alert {
|
|
width: 80%;
|
|
box-sizing: border-box;
|
|
padding: 20px;
|
|
background-color: #f44336;
|
|
color: white;
|
|
margin-bottom: 15px;
|
|
}
|
|
table {
|
|
width: 80%;
|
|
border-collapse: collapse;
|
|
}
|
|
body {
|
|
background: #f2f2f2;
|
|
}
|
|
table, th, td {
|
|
border: 0 solid transparent;
|
|
}
|
|
th, td {
|
|
padding: 10px;
|
|
text-align: left;
|
|
}
|
|
th {
|
|
background-color: #c3bcbc;
|
|
}
|
|
|
|
h1 {
|
|
font-size: 1.5em;
|
|
}
|
|
tr:nth-child(even) {background-color: #ebe7e7;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Index of {{.Protocol}}://{{$container}}/{{if $prefix}}{{$prefix}}/{{end}}</h1>
|
|
{{ if .HasErrors }}
|
|
<div class="alert">
|
|
Errors occurred while processing the request. Perhaps some objects are missing
|
|
</div>
|
|
{{ end }}
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Filename</th>
|
|
<th>OID</th>
|
|
<th>Size</th>
|
|
<th>Created</th>
|
|
<th>Download</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{ $trimmedPrefix := trimPrefix $prefix }}
|
|
{{if $trimmedPrefix }}
|
|
<tr>
|
|
<td>
|
|
⮐<a href="/get/{{$container}}{{ urlencode $trimmedPrefix }}/">..</a>
|
|
</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
{{else}}
|
|
<tr>
|
|
<td>
|
|
⮐<a href="/get/{{$container}}/">..</a>
|
|
</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
{{end}}
|
|
{{range .Objects}}
|
|
<tr>
|
|
<td>
|
|
{{if .IsDir}}
|
|
🗀
|
|
<a href="{{.GetURL}}/">
|
|
{{.FileName}}/
|
|
</a>
|
|
{{else}}
|
|
🗎
|
|
<a href="{{ .GetURL }}">
|
|
{{.FileName}}
|
|
</a>
|
|
{{end}}
|
|
</td>
|
|
<td>{{.OID}}</td>
|
|
<td>{{if not .IsDir}}{{ formatSize .Size }}{{end}}</td>
|
|
<td>{{ .Created }}</td>
|
|
<td>
|
|
{{ if .OID }}
|
|
<a href="{{ .GetURL }}?download=true">
|
|
Link
|
|
</a>
|
|
{{ end }}
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</body>
|
|
</html>
|