Skip to content

Commit

Permalink
work in progress for idaholab#329, improve extracted_files download page
Browse files Browse the repository at this point in the history
  • Loading branch information
mmguero committed Feb 2, 2024
1 parent 37acad1 commit b1a9aa9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
23 changes: 19 additions & 4 deletions file-monitor/scripts/extracted_files_http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def do_GET(self):
if fileBaseName != '.':
t = tr()
t.add(
td(a('..', href=f'..')),
td(a(i(cls="bi bi-arrow-90deg-up"), href=f'..')),
td("Directory"),
td(''),
)
Expand All @@ -141,7 +141,6 @@ def do_GET(self):

# content rows (files and directories)
for dirpath, dirnames, filenames in os.walk(fullpath):

# list directories first
for dirname in sorted(dirnames, key=natural_sort_key):
try:
Expand Down Expand Up @@ -181,7 +180,8 @@ def do_GET(self):
fileinfo,
href=f'https://www.iana.org/assignments/media-types/{fileinfo}',
),
' ⤤',
" ",
i(cls="bi bi-box-arrow-right"),
)
if args.magic
else td(fileinfo)
Expand Down Expand Up @@ -226,6 +226,22 @@ def do_GET(self):
# our "walk" is not recursive right now, we only need to go one level deep
break

with footer(cls='footer bg-light').add(div(cls='container')).add(div(cls='row')):
with div(cls="col-lg-6 h-100 text-center text-lg-start my-auto"):
p(
"Malcolm © 2024 Battelle Energy Alliance, LLC; developed at INL and released through the cooperation of the Cybersecurity and Infrastructure Security Agency of the U.S. Department of Homeland Security.",
cls="text-muted small mb-4 mb-lg-0",
)

with div(cls="col-lg-6 h-100 text-center text-lg-end my-auto").add(ul(cls="list-inline mb-0")):
li(cls="list-inline-item").add(a(href=f'/readme/')).add(i(cls="bi bi-question-circle fs-3"))
li(cls="list-inline-item").add(
a(href=f'/dashboards/app/dashboards#/view/9ee51f94-3316-4fc5-bd89-93a52af69714')
).add(i(cls="bi bi-bar-chart-line fs-3"))
li(cls="list-inline-item").add(a(href=f'https://github.com/idaholab/Malcolm/')).add(
i(cls="bi-github fs-3")
)

script(type="text/javascript", src=f"{args.assetsDirReplacer}js/bootstrap.bundle.min.js")
script(type="text/javascript", src=f"{args.assetsDirReplacer}js/scripts.js")

Expand Down Expand Up @@ -265,7 +281,6 @@ def do_GET(self):

# handle regular file downloads
if not satisfied:

# if the file doesn't exist as specified but recursive is enabled, go deeper to find the file
if args.recursive and (not os.path.isfile(fullpath)) and (not os.path.islink(fullpath)):
for root, dirs, files in os.walk(os.path.dirname(fullpath)):
Expand Down
2 changes: 2 additions & 0 deletions file-monitor/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ command=/usr/local/bin/extracted_files_http_server.py
--zip %(ENV_EXTRACTED_FILE_HTTP_SERVER_ZIP)s
--recursive %(ENV_EXTRACTED_FILE_HTTP_SERVER_RECURSIVE)s
--directory /zeek/extract_files
--assets-directory "%(ENV_EXTRACTED_FILE_HTTP_SERVER_ASSETS_DIR)s"
--assets-directory-replacer /extracted-files/assets
--malcolm
autostart=%(ENV_EXTRACTED_FILE_HTTP_SERVER_ENABLE)s
autorestart=%(ENV_EXTRACTED_FILE_HTTP_SERVER_ENABLE)s
Expand Down

0 comments on commit b1a9aa9

Please sign in to comment.