[#151] index page: Add browse via native protocol
All checks were successful
/ DCO (pull_request) Successful in 1m42s
/ Vulncheck (pull_request) Successful in 1m43s
/ Builds (pull_request) Successful in 1m35s
/ Lint (pull_request) Successful in 2m11s
/ Tests (pull_request) Successful in 1m35s
/ Builds (push) Successful in 1m13s
/ Vulncheck (push) Successful in 1m47s
/ Lint (push) Successful in 2m39s
/ Tests (push) Successful in 1m51s
All checks were successful
/ DCO (pull_request) Successful in 1m42s
/ Vulncheck (pull_request) Successful in 1m43s
/ Builds (pull_request) Successful in 1m35s
/ Lint (pull_request) Successful in 2m11s
/ Tests (pull_request) Successful in 1m35s
/ Builds (push) Successful in 1m13s
/ Vulncheck (push) Successful in 1m47s
/ Lint (push) Successful in 2m39s
/ Tests (push) Successful in 1m51s
Signed-off-by: Nikita Zinkevich <n.zinkevich@yadro.com>
This commit is contained in:
parent
9c0b499ea6
commit
43764772aa
16 changed files with 537 additions and 133 deletions
|
@ -1,11 +1,20 @@
|
|||
{{$bucketName := .BucketName}}
|
||||
{{$container := .Container}}
|
||||
{{ $prefix := trimPrefix .Prefix }}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Index of s3://{{$bucketName}}/{{if $prefix}}/{{$prefix}}/{{end}}</title>
|
||||
<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;
|
||||
|
@ -23,15 +32,25 @@
|
|||
th {
|
||||
background-color: #c3bcbc;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
tr:nth-child(even) {background-color: #ebe7e7;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Index of s3://{{$bucketName}}/{{if $prefix}}{{$prefix}}/{{end}}</h1>
|
||||
<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>
|
||||
|
@ -42,20 +61,22 @@
|
|||
{{if $trimmedPrefix }}
|
||||
<tr>
|
||||
<td>
|
||||
⮐<a href="/get/{{$bucketName}}{{ urlencode $trimmedPrefix "" }}">..</a>
|
||||
⮐<a href="/get/{{$container}}{{ urlencode $trimmedPrefix }}/">..</a>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{else}}
|
||||
<tr>
|
||||
<td>
|
||||
⮐<a href="/get/{{ $bucketName }}/">..</a>
|
||||
⮐<a href="/get/{{$container}}/">..</a>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{range .Objects}}
|
||||
|
@ -63,21 +84,22 @@
|
|||
<td>
|
||||
{{if .IsDir}}
|
||||
🗀
|
||||
<a href="/get/{{ $bucketName }}{{ urlencode $prefix .FileName }}/">
|
||||
<a href="{{.GetURL}}/">
|
||||
{{.FileName}}/
|
||||
</a>
|
||||
{{else}}
|
||||
🗎
|
||||
<a href="/get/{{ $bucketName }}{{ urlencode $prefix .FileName }}">
|
||||
<a href="{{ .GetURL }}">
|
||||
{{.FileName}}
|
||||
</a>
|
||||
{{end}}
|
||||
</td>
|
||||
<td>{{.OID}}</td>
|
||||
<td>{{if not .IsDir}}{{ formatSize .Size }}{{end}}</td>
|
||||
<td>{{if not .IsDir}}{{ formatTimestamp .Created }}{{end}}</td>
|
||||
<td>{{ .Created }}</td>
|
||||
<td>
|
||||
{{ if not .IsDir }}
|
||||
<a href="/get/{{ $bucketName}}{{ urlencode $prefix .FileName }}?download=true">
|
||||
{{ if .OID }}
|
||||
<a href="{{ .GetURL }}?download=true">
|
||||
Link
|
||||
</a>
|
||||
{{ end }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue