Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Commit 0ea5c3d

Browse files
committed
Refine store admin screens
1 parent 9d88e6a commit 0ea5c3d

File tree

8 files changed

+99
-28
lines changed

8 files changed

+99
-28
lines changed

src-admintool/lambda_function.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def self.process(event:,context:)
1515
config = Uc3Ssm::ConfigResolver.new.resolve_file_values(file: config_file, resolve_key: config_block, return_key: config_block)
1616
collHandler = Handler.new(config)
1717
respath = event.fetch("path", "")
18-
return collHandler.redirect("/web#{respath}") if respath =~ %r[^/index.html.*]
18+
return LambdaBase.redirect("/web#{respath}") if respath =~ %r[^/index.html.*]
1919
myparams = collHandler.get_params_from_event(event)
2020
return collHandler.web_assets("/web/favicon.ico", myparams) if respath =~ %r[^/favicon.ico.*]
2121
return collHandler.web_assets(respath, myparams) if collHandler.web_asset?(respath)

src-colladmin/lambda_function.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,34 @@ def self.process(event:,context:)
125125
result = CognitoAction.new(config, path, myparams).get_data
126126
elsif path == "cognito-add-user-to-group"
127127
result = CognitoAction.new(config, path, myparams).get_data
128+
elsif path == "unpause-ingest-for-collection"
129+
result = LambdaBase.jsredirect("https://cdluc3.github.io/mrt-doc/diagrams/store-admin-pause-ing-for-coll")
130+
elsif path == "pause-ingest-for-collection"
131+
result = LambdaBase.jsredirect("https://cdluc3.github.io/mrt-doc/diagrams/store-admin-pause-ing-for-coll")
132+
elsif path == "storage-force-audit-for-object"
133+
result = LambdaBase.jsredirect("https://cdluc3.github.io/mrt-doc/diagrams/store-admin-force-audit")
134+
elsif path == "storage-force-audit-for-collection"
135+
result = LambdaBase.jsredirect("https://cdluc3.github.io/mrt-doc/diagrams/store-admin-force-audit")
136+
elsif path == "storage-force-replic-for-object"
137+
result = LambdaBase.jsredirect("https://cdluc3.github.io/mrt-doc/diagrams/store-admin-force-replic")
138+
elsif path == "storage-force-replic-for-collection"
139+
result = LambdaBase.jsredirect("https://cdluc3.github.io/mrt-doc/diagrams/store-admin-force-replic")
140+
elsif path == "storage-add-node-for-collection"
141+
result = LambdaBase.jsredirect("https://cdluc3.github.io/mrt-doc/diagrams/store-admin-add-node")
142+
elsif path == "storage-del-node-for-collection"
143+
result = LambdaBase.jsredirect("https://cdluc3.github.io/mrt-doc/diagrams/store-admin-del-node")
144+
elsif path == "storage-del-node-for-object"
145+
result = LambdaBase.jsredirect("https://cdluc3.github.io/mrt-doc/diagrams/store-admin-del-node-obj")
146+
elsif path == "storage-change-primary-for-collection"
147+
result = LambdaBase.jsredirect("https://cdluc3.github.io/mrt-doc/diagrams/store-admin-change-primary-node")
148+
elsif path == "storage-reroute-ui-for-collection"
149+
result = LambdaBase.jsredirect("https://cdluc3.github.io/mrt-doc/diagrams/store-admin-reroute-ui")
150+
elsif path == "storage-scan-node"
151+
result = LambdaBase.jsredirect("https://cdluc3.github.io/mrt-doc/diagrams/store-admin-scan-node")
152+
elsif path == "storage-delete-node-key"
153+
result = LambdaBase.jsredirect("https://cdluc3.github.io/mrt-doc/diagrams/store-admin-del-node-keys")
154+
elsif path == "storage-delete-node-obj"
155+
result = LambdaBase.jsredirect("https://cdluc3.github.io/mrt-doc/diagrams/store-admin-del-node-keys")
128156
end
129157

130158
{
@@ -219,6 +247,7 @@ def template_parameters(path, myparams)
219247
elsif path == '/web/storeObjects.html'
220248
objlist = CGI.unescape(myparams.fetch("objlist",""))
221249
mode = myparams.fetch("mode","")
250+
map['OWNERS'] = Owners.new(@config).objs_select
222251
map['OBJLIST'] = objlist
223252
map['ISARK'] = mode == "ark"
224253
map['ISLOC'] = mode == "localid"

src-colladmin/lib/storage_nodes.rb

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def initialize(config, collid, primary_id)
1212
inio.role,
1313
n.number,
1414
n.description,
15+
n.access_mode,
1516
count(*)
1617
from
1718
inv_collections c
@@ -32,12 +33,14 @@ def initialize(config, collid, primary_id)
3233
group by
3334
inio.role,
3435
n.number,
35-
n.description
36+
n.description,
37+
n.access_mode
3638
union
3739
select
3840
'primary' as role,
3941
n.number,
4042
n.description as description,
43+
n.access_mode,
4144
0
4245
from
4346
inv_collections c,
@@ -67,6 +70,7 @@ def initialize(config, collid, primary_id)
6770
'secondary' as role,
6871
n.number,
6972
n.description,
73+
n.access_mode,
7074
0
7175
from
7276
inv_collections c
@@ -103,13 +107,14 @@ def initialize(config, collid, primary_id)
103107
).each_with_index do |r, i|
104108
percent = 100
105109
if i > 0
106-
percent = ((r[3] * 100.0)/@collnodes[0][:count]).to_i if @collnodes[0][:count] > 0
110+
percent = ((r[4] * 100.0)/@collnodes[0][:count]).to_i if @collnodes[0][:count] > 0
107111
end
108112
@collnodes.push({
109113
role: r[0],
110114
number: r[1],
111115
name: r[2],
112-
count: r[3],
116+
access_mode: r[3],
117+
count: r[4],
113118
percent: percent
114119
})
115120
end
@@ -132,7 +137,8 @@ def initialize(config)
132137
when description is null then 'No description'
133138
else description
134139
end as description,
135-
count(*) as pcount
140+
access_mode,
141+
count(inio.inv_object_id) as pcount
136142
from
137143
inv_nodes n
138144
left join inv_nodes_inv_objects inio
@@ -146,7 +152,8 @@ def initialize(config)
146152
).each do |r|
147153
@nodes.push({
148154
number: r[0],
149-
description: "#{r[1]} (#{r[2]})"
155+
description: "#{r[1]} (#{r[3]})",
156+
access_mode: r[2]
150157
})
151158
end
152159
end
@@ -191,14 +198,17 @@ def normalize(s)
191198
def get_sql
192199
%{
193200
select
194-
c.name,
201+
c.name as coll,
202+
own.name as owner,
195203
o.id,
196204
o.ark,
197205
loc.local_id,
198206
o.erc_what,
199207
o.created
200208
from
201209
inv_objects o
210+
inner join inv_owners own
211+
on o.inv_owner_id = own.id
202212
inner join inv_collections_inv_objects icio
203213
on icio.inv_object_id = o.id
204214
inner join inv_collections c
@@ -225,11 +235,12 @@ def search
225235
).each do |r|
226236
objects.push({
227237
coll: r[0],
228-
id: r[1],
229-
ark: r[2],
230-
localid: r[3],
231-
title: r[4],
232-
created: r[5]
238+
owner: r[1],
239+
id: r[2],
240+
ark: r[3],
241+
localid: r[4],
242+
title: r[5],
243+
created: r[6]
233244
})
234245
end
235246
objects
@@ -300,7 +311,8 @@ def initialize(config, ark)
300311
select
301312
inio.role,
302313
n.number,
303-
n.description
314+
n.description,
315+
n.access_mode
304316
from
305317
inv_objects o
306318
inner join inv_nodes_inv_objects inio
@@ -318,7 +330,8 @@ def initialize(config, ark)
318330
@nodes.push({
319331
role: r[0],
320332
number: r[1],
321-
name: r[2]
333+
name: r[2],
334+
access_mode: r[3]
322335
})
323336
end
324337
end

src-colladmin/web/storeCollNodes.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ <h2>Storage Nodes for Collection</h2>
7171
<thead>
7272
<tr>
7373
<th>Role</th>
74-
<th>Number</th>
74+
<th>Node Num</th>
7575
<th>Node Name</th>
76+
<th>Access Mode</th>
7677
<th>Count</th>
7778
<th>% Repl</th>
7879
<th>Actions</th>
@@ -84,6 +85,7 @@ <h2>Storage Nodes for Collection</h2>
8485
<th>{{role}}</th>
8586
<th>{{number}}</th>
8687
<td>{{name}}</td>
88+
<td>{{access_mode}}</td>
8789
<td>{{count}}</td>
8890
<td>{{percent}}</td>
8991
<td>

src-colladmin/web/storeNodes.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ <h1>Manage Storage Nodes</h1>
2020
<thead>
2121
<tr>
2222
<th>Node Number</th>
23-
<th>Node Description</th>
23+
<th>Node Name</th>
24+
<th>Access Mode</th>
2425
<th>Last Scan</th>
2526
<th>% Complete</th>
26-
<th>Num Deletes</th>
27+
<th>Num Untracked</th>
28+
<th>Num to Delete</th>
2729
<th>Actions</th>
2830
</tr>
2931
</thead>
@@ -32,6 +34,8 @@ <h1>Manage Storage Nodes</h1>
3234
<tr>
3335
<th>{{number}}</th>
3436
<td>{{description}}</td>
37+
<td>{{access_mode}}</td>
38+
<td></td>
3539
<td></td>
3640
<td></td>
3741
<td></td>

src-colladmin/web/storeObjectNodes.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ <h1>Manage Object Storage Nodes for {{ARK}}</h1>
2121
<th>Role</th>
2222
<th>Node Num</th>
2323
<th>Node Name</th>
24+
<th>Access Mode</th>
2425
<th>Actions</th>
2526
</tr>
2627
</thead>
@@ -30,6 +31,7 @@ <h1>Manage Object Storage Nodes for {{ARK}}</h1>
3031
<th>{{role}}</th>
3132
<td>{{number}}</td>
3233
<td>{{name}}</td>
34+
<td>{{access_mode}}</td>
3335
<td>
3436
<button title=""
3537
onclick="javascript:document.location='https://cdluc3.github.io/mrt-doc/diagrams/store-admin-del-node-keys'"

src-colladmin/web/storeObjects.html

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,25 @@ <h2>Locate Objects</h2>
2020
<form method="POST">
2121
<div>
2222
<select name="mode">
23-
<option value="ark" selected={{ISARK}}>Search by ark</option>
24-
<option value="localid" selected={{ISLOC}}>Search by localid</option>
25-
<option value="id" selected={{ISID}}>Search by object_id</option>
23+
<option value="ark" {{#ISARK}}selected{{/ISARK}}>Search by ark</option>
24+
<option value="localid" {{#ISLOC}}selected{{/ISLOC}}>Search by localid</option>
25+
<option value="id" {{#ISID}}selected{{/ISID}}>Search by object_id</option>
2626
</select>
2727
</div>
28+
<p class="proval">
29+
<label for="owner">Owner</label>
30+
<select id="owner" name="owner">
31+
<option value="">--ANY Owner--</option>
32+
{{#OWNERS}}
33+
<option value="{{ark}}">{{name}}</option>
34+
{{/OWNERS}}
35+
</select>
36+
</p>
2837
<div>
29-
<label for="object list">Object(s). Place one or more identifiers on each line below.</label>
30-
</div>
31-
<div>
32-
<textarea id="objlist" name="objlist" rows="5" cols="40">{{OBJLIST}}</textarea>
38+
<fieldset>
39+
<legend>Object(s). Place one or more identifiers on each line below.</legend>
40+
<textarea id="objlist" name="objlist" rows="5" cols="40">{{OBJLIST}}</textarea>
41+
</fieldset>
3342
</div>
3443
<div>
3544
<input type="submit" value="Search"/>
@@ -40,9 +49,10 @@ <h2>Objects</h2>
4049
<table class="sortable results">
4150
<thead>
4251
<tr>
52+
<th>Ark</th>
4353
<th>Collection</th>
54+
<th>Owner</th>
4455
<th>Object Id</th>
45-
<th>Ark</th>
4656
<th>Local Id</th>
4757
<th>Title</th>
4858
<th>Created</th>
@@ -52,9 +62,10 @@ <h2>Objects</h2>
5262
<tbody>
5363
{{#OBJS}}
5464
<tr>
55-
<th>{{coll}}</th>
65+
<th>{{ark}}</th>
66+
<td>{{coll}}</td>
67+
<td>{{owner}}</td>
5668
<td>{{id}}</td>
57-
<td>{{ark}}</td>
5869
<td>{{localid}}</td>
5970
<td>{{title}}</td>
6071
<td>{{created}}</td>

src-common/lambda_base.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def web_assets(path, myparams)
144144
}
145145
end
146146

147-
def redirect(path)
147+
def self.redirect(path)
148148
{
149149
statusCode: 303,
150150
headers: {
@@ -154,6 +154,16 @@ def redirect(path)
154154
}
155155
end
156156

157+
def self.jsredirect(path)
158+
{
159+
statusCode: 200,
160+
headers: {
161+
'Content-Type' => 'application/json'
162+
},
163+
body: {location: path}
164+
}
165+
end
166+
157167
def self.error(status, message, return_page = false)
158168
if status != 200 && return_page
159169
{

0 commit comments

Comments
 (0)