From 6c60dcf5501ed8066f8bd84d1c6566b3b07c2cd8 Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Sat, 23 Oct 2021 23:00:40 -0700 Subject: [PATCH] Display image properties inline in the image list, and remove the previous UI --- src/web/file_cmds.py | 12 +++++----- src/web/static/style.css | 2 +- src/web/templates/index.html | 45 +++++++++++++++++++++--------------- src/web/web.py | 21 ----------------- 4 files changed, 33 insertions(+), 47 deletions(-) diff --git a/src/web/file_cmds.py b/src/web/file_cmds.py index e16eba24..fbf7dbcd 100644 --- a/src/web/file_cmds.py +++ b/src/web/file_cmds.py @@ -67,9 +67,10 @@ def list_images(): files = [] for f in result.image_files_info.image_files: - # Add flag for whether an image file has an associated *.properties file + # Add properties meta data for the image, if applicable if f.name in prop_files: - prop = True + process = read_drive_properties(f"{cfg_dir}/{f.name}.{PROPERTIES_SUFFIX}") + prop = process["conf"] else: prop = False size_mb = "{:,.1f}".format(f.size / 1024 / 1024) @@ -304,10 +305,9 @@ def write_drive_properties(file_name, conf): def read_drive_properties(path_name): """ - Reads drive properties to any dir. - Either ones deployed to the images dir, or the canonical database. - Takes file path and bas (str) as argument - Returns dict with boolean status and str msg + Reads drive properties from json formatted file. + Takes (str) path_name as argument. + Returns dict with boolean status, str msg, dict conf """ from json import load try: diff --git a/src/web/static/style.css b/src/web/static/style.css index 08fdcece..cf7ebf5c 100644 --- a/src/web/static/style.css +++ b/src/web/static/style.css @@ -48,7 +48,7 @@ td.inactive { background-color:tan; } -summary { +summary.heading { color: black; font-size: large; font-weight: bold; diff --git a/src/web/templates/index.html b/src/web/templates/index.html index 5c097d11..ac4d30a3 100644 --- a/src/web/templates/index.html +++ b/src/web/templates/index.html @@ -2,7 +2,7 @@ {% block content %}
- Current RaSCSI Configuration + Current RaSCSI Configuration