Skip to content

Commit

Permalink
s3 links
Browse files Browse the repository at this point in the history
  • Loading branch information
terrywbrady committed Feb 6, 2024
1 parent d0474f9 commit 99b6aad
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src-admintool/queries/s3_list_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,27 @@ def initialize(query_factory, path, myparams)
super(query_factory, path, myparams)
rptpath = myparams.fetch('rptpath', 'daily-build')
@report = "merritt-reports/#{rptpath}"
end

def run_sql
no_data
end

def get_alternative_queries
res = []
@files = []
resp = @s3_client.list_objects_v2({
bucket: @s3bucket,
prefix: @report
})
# Delete any prior reports
# consistency-reports is intentionally hard coded into the delete
resp.contents.each do |s3obj|
res.push(
{
label: s3obj.key,
url: get_report_url(s3obj.key),
class: 'download'
}
)
link = "#{s3obj.key};#{get_report_url(s3obj.key)}"
@files.push([link, s3obj.last_modified, s3obj.size])
end
end

res
def get_headers
['File', 'Modified', 'Size']
end

def get_types
['link', 'datetime', 'bytes']
end

def run_sql
return_data(@files, get_types, get_headers)
end

end
5 changes: 5 additions & 0 deletions src-common/template/api-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,11 @@ function format(cell, v, type, merritt_path) {
if (arr.length == 3) {
makeLink(cell, arr[2], colladmin_home + "?path=queues&profile="+arr[0]+"&qstatus="+arr[1]);
}
} else if (type == 'link') {
arr = v.split(";");
if (arr.length == 2) {
makeLink(cell, arr[0], arr[1]);
}
} else {
cell.text(v);
}
Expand Down

0 comments on commit 99b6aad

Please sign in to comment.