s3manager-web/web/template/bucket.html.tmpl

119 lines
4.1 KiB
Cheetah
Raw Normal View History

2016-12-18 22:54:21 +01:00
{{ define "content" }}
2019-08-18 14:26:29 +02:00
<nav>
2017-05-08 23:07:07 +02:00
<div class="nav-wrapper container">
<span href="#" class="brand-logo"><i class="material-icons">folder_open</i>{{ .BucketName }}</span>
{{ if not .Objects }}
2019-08-18 14:26:29 +02:00
<ul class="right">
<li>
<a class="waves-effect waves-light btn" href="#" onclick="deleteBucket({{ .BucketName }})">
Delete <i class="material-icons right">delete</i>
</a>
</li>
</ul>
2017-05-08 23:07:07 +02:00
{{ end }}
</div>
2016-12-21 00:32:40 +01:00
</nav>
2016-12-21 01:45:07 +01:00
<div class="section">
2019-08-18 14:26:29 +02:00
<a href="/buckets" style="padding-left:25px;vertical-align:middle;">
<i class="material-icons" style="vertical-align: middle;">arrow_back</i> Buckets
</a>
2016-12-21 00:32:40 +01:00
2017-05-08 23:07:07 +02:00
{{ if .Objects }}
2019-08-18 14:26:29 +02:00
<table class="striped">
2017-05-08 23:07:07 +02:00
<thead>
<tr>
2019-08-18 14:26:29 +02:00
<th style="width:75px;"></th>
2017-05-08 23:07:07 +02:00
<th>Key</th>
<th>Size</th>
<th>Owner</th>
<th>Last Modified</th>
2019-08-18 14:26:29 +02:00
<th style="min-width:165px;"></th>
2017-05-08 23:07:07 +02:00
</tr>
</thead>
2016-12-21 00:32:40 +01:00
2017-05-08 23:07:07 +02:00
<tbody>
{{ range $index, $object := .Objects }}
<tr>
2019-08-18 14:26:29 +02:00
<td style="padding-left:25px;"><i class="material-icons">{{ $object.Icon }}</i></td>
2018-06-18 20:39:58 +02:00
<td>{{ $object.Info.Key }}</td>
<td>{{ $object.Info.Size }} bytes</td>
<td>{{ $object.Info.Owner }}</td>
<td>{{ $object.Info.LastModified }}</td>
2017-05-08 23:07:07 +02:00
<td>
2019-08-18 14:26:29 +02:00
<button class="dropdown-trigger waves-effect waves-teal btn" data-target="actions-dropdown-{{ $index }}">
2017-05-08 23:07:07 +02:00
Actions <i class="material-icons right">arrow_drop_down</i>
2019-08-18 14:26:29 +02:00
</button>
2017-05-08 23:07:07 +02:00
<!-- Dropdown Structure -->
<ul id="actions-dropdown-{{ $index }}" class="dropdown-content">
<li><a target="_blank" href="/api/buckets/{{ $.BucketName }}/objects/{{ $object.Info.Key }}">Download</a></li>
{{- if $.AllowDelete }}
2018-06-18 20:39:58 +02:00
<li><a href="#" onclick="deleteObject({{ $.BucketName }}, {{ $object.Info.Key }})">Delete</a></li>
{{- end }}
2017-05-08 23:07:07 +02:00
</ul>
</td>
</tr>
{{ end }}
</tbody>
</table>
{{ end }}
2016-12-21 00:32:40 +01:00
2017-05-08 23:07:07 +02:00
{{ if not .Objects }}
2019-08-18 14:26:29 +02:00
<p style="text-align:center;margin-top:2em;color:gray;">No objects in <strong>{{ .BucketName }}</strong> yet</p>
2017-05-08 23:07:07 +02:00
{{ end }}
2016-12-21 00:32:40 +01:00
</div>
<div class="fixed-action-btn">
2019-08-18 14:26:29 +02:00
<button type="button" class="btn-floating btn-large red modal-trigger" data-target="modal-create-object">
2017-05-08 23:07:07 +02:00
<i class="large material-icons">add</i>
2019-08-18 14:26:29 +02:00
</button>
2016-12-21 00:32:40 +01:00
</div>
<div id="modal-create-object" class="modal">
2017-05-08 23:07:07 +02:00
<form action="/api/buckets/{{ .BucketName }}/objects" method="POST" id="create-object-form" enctype="multipart/form-data">
<div class="modal-content">
<h4>Create Object</h4>
<br>
<div class="row">
<div class="col s6">
<div class="file-field input-field">
<div class="btn">
<span>File</span>
<input type="file" name="file">
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text">
</div>
</div>
</div>
2016-12-21 00:32:40 +01:00
</div>
2017-05-08 23:07:07 +02:00
</div>
<div class="modal-footer">
2019-08-18 14:26:29 +02:00
<button type="button" class="modal-close waves-effect waves-green btn-flat">Cancel</button>
<button type="submit" class="modal-close waves-effect waves-green btn">Upload</button>
2017-05-08 23:07:07 +02:00
</div>
</form>
2016-12-21 00:32:40 +01:00
</div>
2016-12-18 22:54:21 +01:00
2016-12-21 00:32:40 +01:00
<script>
2017-05-08 23:07:07 +02:00
function deleteObject(bucketName, objectName) {
2016-12-21 00:32:40 +01:00
$.ajax({
2017-05-08 23:07:07 +02:00
type: 'DELETE',
url: '/api/buckets/' + bucketName + '/objects/' + objectName,
success: function () { location.reload(); }
2016-12-21 00:32:40 +01:00
})
2017-05-08 23:07:07 +02:00
}
function deleteBucket(bucketName) {
2016-12-21 22:29:12 +01:00
$.ajax({
2017-05-08 23:07:07 +02:00
type: 'DELETE',
url: '/api/buckets/' + bucketName,
success: function () { window.location.replace('/buckets'); }
2016-12-21 22:29:12 +01:00
})
2017-05-08 23:07:07 +02:00
}
2016-12-21 00:32:40 +01:00
</script>
2016-12-18 22:54:21 +01:00
{{ end }}