/
bucket.html.pasta
149 lines (142 loc) · 7.09 KB
/
bucket.html.pasta
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<i:arg name="bucket"
type="ninja.Bucket"/>
<i:arg name="page"
type="Page"/>
<t:page title="@bucket.getName()">
<i:block name="breadcrumbs">
<li>
<a href="@apply('/ui/%s', bucket.getEncodedName())">@bucket.getName()</a>
</li>
</i:block>
<i:block name="page-header">
<i:invoke template="/templates/header.html.pasta"
title="@bucket.getName()"
subtitle="Private buckets can only be accessed using proper API keys. Public buckets can be accessed by anyone."/>
</i:block>
<div class="row">
<div class="col-md-4">
<div class="card shadow-sm mb-4">
<div class="card-body">
<i:if test="bucket.isPrivate()">
<a class="btn btn-success w-100"
href="/ui/@bucket.getEncodedName()?make-public">
<i class="fa-solid fa-lock-open"></i>
<span class="ps-2">Make public</span>
</a>
<i:else>
<a class="btn btn-danger w-100"
href="/ui/@bucket.getEncodedName()?make-private">
<i class="fa-solid fa-lock"></i>
<span class="ps-2">Make private</span>
</a>
</i:else>
</i:if>
</div>
</div>
<div class="card shadow-sm mb-4">
<div class="card-body">
<t:fileUpload btnClass="btn-secondary w-100"
uploadUrl="@apply('/ui/%s?upload', bucket.getEncodedName())"/>
<div class="text-muted text-small">
Drag files onto the button to upload them.
</div>
</div>
</div>
</div>
<div class="col-md-8">
<t:searchHeader page="@page"
baseUrl="@apply('/ui/%s', bucket.getEncodedName())"></t:searchHeader>
<div class="card shadow-sm mb-4">
<div class="card-body">
<table class="table mb-0">
<thead>
<tr>
<th>Object</th>
<th></th>
</tr>
</thead>
<tbody>
<i:if test="page.getItems().isEmpty()">
<tr>
<td colspan="2"
class="border-0 border-top text-muted">
(No objects in bucket)
</td>
</tr>
</i:if>
<i:for type="ninja.StoredObject"
var="obj"
items="page.getItems()">
<tr>
<td class="border-0 border-top">
<a class="link"
href="/ui/@bucket.getEncodedName()/@obj.getEncodedKey()">@obj.getKey()</a><br/>
<div class="text-muted small">@obj.getSize()</div>
<div class="text-muted small">@obj.getLastModified()</div>
</td>
<td class="border-0 border-top text-end pe-0">
<i:local name="modalId"
value="generateId('object_info_%s')"/>
<i:local name="propertyNames"
value="obj.getPropertyNames()"/>
<i:local name="properties"
value="obj.getProperties()"/>
<t:modal name="@modalId"
title="@obj.getKey()"
cancel="Close"
class="modal-lg modal-dialog-centered">
<div class="text-start"
style="margin-bottom: -1rem;">
<i:if test="properties.isEmpty()">
<p class="text-muted">
(No properties)
</p>
</i:if>
<i:for type="ninja.StoredObject"
var="propertyName"
items="propertyNames">
<i:local name="propertyValue"
value="properties.get(propertyName)"/>
<p>
<span class="text-muted">
@propertyName
</span>
<br/>
<span>
@propertyValue
</span>
</p>
</i:for>
</div>
</t:modal>
<t:additionalActions label="Actions">
<t:dropdownItem url="@apply('javascript:showProperties(\'#%s\')', modalId)"
icon="fa-solid fa-circle-info"
label="Properties"/>
<t:dropdownDeleteItem
url="@apply('/ui/%s/%s?delete', bucket.getEncodedName(), obj.getEncodedKey())"/>
</t:additionalActions>
</td>
</tr>
</i:for>
</tbody>
</table>
</div>
</div>
<t:pagination page="@page"
baseUrl="@apply('/ui/%s', bucket.getEncodedName())"/>
</div>
</div>
<script>
function showProperties(selector) {
const _modalElement = document.querySelector(selector);
if (!_modalElement.modal) {
_modalElement.modal = new bootstrap.Modal(_modalElement);
}
_modalElement.modal.show();
}
</script>
<i:block name="footer">
<i:invoke template="/templates/footer.html.pasta"/>
</i:block>
</t:page>