Skip to content

Commit d0474f9

Browse files
committed
s3 listing
1 parent 5b812cf commit d0474f9

File tree

4 files changed

+54
-1
lines changed

4 files changed

+54
-1
lines changed

src-admintool/config/reports.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ producer_files:
120120
category: files
121121
description: |
122122
Producer Files for a Mnemonic.
123+
s3-list:
124+
link-title: S3 Download Links
125+
breadcrumb: bp_content_projects
126+
class: S3ListQuery
127+
category: files
128+
description: |
129+
Generate S3 Download Links
123130
objects_large:
124131
link-title: Sample Objects Larger than 1GB
125132
breadcrumb: bp_obj
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# frozen_string_literal: true
2+
3+
require 'tempfile'
4+
5+
# Query class - see config/reports.yml for description
6+
class S3ListQuery < AdminQuery
7+
def initialize(query_factory, path, myparams)
8+
super(query_factory, path, myparams)
9+
rptpath = myparams.fetch('rptpath', 'daily-build')
10+
@report = "merritt-reports/#{rptpath}"
11+
end
12+
13+
def run_sql
14+
no_data
15+
end
16+
17+
def get_alternative_queries
18+
res = []
19+
resp = @s3_client.list_objects_v2({
20+
bucket: @s3bucket,
21+
prefix: @report
22+
})
23+
# Delete any prior reports
24+
# consistency-reports is intentionally hard coded into the delete
25+
resp.contents.each do |s3obj|
26+
res.push(
27+
{
28+
label: s3obj.key,
29+
url: get_report_url(s3obj.key),
30+
class: 'download'
31+
}
32+
)
33+
end
34+
35+
res
36+
end
37+
end

src-admintool/web/index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ <h3>Current Jobs</h3>
6666
</ul>
6767

6868
<h3>Collections</h3>
69+
<ul>
6970
<li class="coll"><a href="{{ADMINTOOL_HOME}}?path=list_collections">List Collections</a></li>
70-
71+
</ul>
72+
7173
<h3>Bytes Recently Ingested</h3>
7274
<ul>
7375
<li class="graph"><a href="{{ADMINTOOL_HOME}}?path=ingest_bytes_by_hour">Recent Bytes ingested by hour</a></li>
@@ -77,6 +79,11 @@ <h3>Bytes Recently Ingested</h3>
7779
<li class="graph"><a href="{{ADMINTOOL_HOME}}?path=ingest_bytes_by_year">Bytes ingested by Year</a></li>
7880
</ul>
7981

82+
<h3>Daily Build Output</h3>
83+
<ul>
84+
<li class="graph"><a href="{{ADMINTOOL_HOME}}?path=s3-list&rptpath=daily-build">Daily Build</a></li>
85+
</ul>
86+
8087
<h3>Object Management</h3>
8188
<ul>
8289
<li>

src-common/template/navmenu.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
<a class="graph" href="{{ADMINTOOL_HOME}}?path=ingest_bytes_by_hour">Recent Bytes ingested by hour</a>
2424
<a class="graph" href="{{ADMINTOOL_HOME}}?path=ingest_bytes_by_hour&days=30">Recent Bytes ingested by day - last 30 days</a>
2525
<a class="graph" href="{{ADMINTOOL_HOME}}?path=ingest_bytes_by_week">Recent Bytes ingested by week - last year</a>
26+
<a class="graph" href="{{ADMINTOOL_HOME}}?path=list_collections">List Collections</a>
27+
<a class="graph" href="{{ADMINTOOL_HOME}}?path=s3-list&rptpath=daily-build">Daily Build Output</a>
2628
</div>
2729
</div>
2830
<div class="dropdown">

0 commit comments

Comments
 (0)