diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index d22c4906..ce76fab7 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -3,11 +3,9 @@ name: Web Tests/Analysis on: workflow_dispatch: push: - paths: - - 'python/web/**' - - 'python/common/**' - - '.github/workflows/web.yml' - - 'easyinstall.sh' + branches: + - 'develop' + - 'main' pull_request: paths: - 'python/web/**' @@ -19,9 +17,6 @@ on: - opened - synchronize - reopened - branches: - - 'develop' - - 'main' jobs: backend_checks: diff --git a/python/common/src/piscsi/file_cmds.py b/python/common/src/piscsi/file_cmds.py index 9f696c59..ee8e2b37 100644 --- a/python/common/src/piscsi/file_cmds.py +++ b/python/common/src/piscsi/file_cmds.py @@ -64,7 +64,7 @@ class FileCmds: excluded_dirs = ("Network Trash Folder", "Temporary Items", "TheVolumeSettingsFolder") for root, dirs, _files in walk(directory, topdown=True): # Strip out dirs that begin with . - dirs[:] = [d for d in dirs if not d[0] == "."] + dirs[:] = [d for d in dirs if d[0] != "."] for dir in dirs: if dir not in excluded_dirs: dirpath = path.join(root, dir) @@ -488,12 +488,12 @@ class FileCmds: iso_filename = Path(server_info["image_dir"]) / f"{file_name}.iso" with TemporaryDirectory() as tmp_dir: - req_proc = self.download_to_dir(quote(url, safe=URL_SAFE), tmp_dir, file_name) + tmp_full_path = Path(tmp_dir) / file_name + req_proc = self.download_to_dir(quote(url, safe=URL_SAFE), tmp_full_path) logging.info("Downloaded %s to %s", file_name, tmp_dir) if not req_proc["status"]: return {"status": False, "msg": req_proc["msg"]} - tmp_full_path = Path(tmp_dir) / file_name if is_zipfile(tmp_full_path): if "XtraStuf.mac" in str(ZipFile(str(tmp_full_path)).namelist()): logging.info( @@ -565,9 +565,9 @@ class FileCmds: } # noinspection PyMethodMayBeStatic - def download_to_dir(self, url, save_dir, file_name): + def download_to_dir(self, url, target_path): """ - Takes (str) url, (str) save_dir, (str) file_name + Takes (str) url, (Path) target_path Returns (dict) with (bool) status and (str) msg """ logging.info("Making a request to download %s", url) @@ -580,7 +580,7 @@ class FileCmds: ) as req: req.raise_for_status() try: - with open(f"{save_dir}/{file_name}", "wb") as download: + with open(str(target_path), "wb") as download: for chunk in req.iter_content(chunk_size=8192): download.write(chunk) except FileNotFoundError as error: @@ -593,7 +593,7 @@ class FileCmds: logging.info("Response content-type: %s", req.headers["content-type"]) logging.info("Response status code: %s", req.status_code) - parameters = {"file_name": file_name, "save_dir": save_dir} + parameters = {"target_path": str(target_path)} return { "status": True, "return_code": ReturnCodes.DOWNLOADTODIR_SUCCESS, diff --git a/python/ctrlboard/src/ctrlboard_event_handler/ctrlboard_menu_update_event_handler.py b/python/ctrlboard/src/ctrlboard_event_handler/ctrlboard_menu_update_event_handler.py index 6b48d9f7..768e996f 100644 --- a/python/ctrlboard/src/ctrlboard_event_handler/ctrlboard_menu_update_event_handler.py +++ b/python/ctrlboard/src/ctrlboard_event_handler/ctrlboard_menu_update_event_handler.py @@ -107,8 +107,7 @@ class CtrlBoardMenuUpdateEventHandler(Observer): except AttributeError: log = logging.getLogger(__name__) log.error( - "Handler function [%s] not found or returned an error. Skipping.", - str(handler_function_name), + "Handler function not found or returned an error. Skipping.", ) # noinspection PyUnusedLocal diff --git a/python/ctrlboard/src/ctrlboard_menu_builder.py b/python/ctrlboard/src/ctrlboard_menu_builder.py index cfacbc23..3f322131 100644 --- a/python/ctrlboard/src/ctrlboard_menu_builder.py +++ b/python/ctrlboard/src/ctrlboard_menu_builder.py @@ -8,7 +8,7 @@ from piscsi.piscsi_cmds import PiscsiCmds class CtrlBoardMenuBuilder(MenuBuilder): - """Class fgor building the control board UI specific menus""" + """Class for building the control board UI specific menus""" SCSI_ID_MENU = "scsi_id_menu" ACTION_MENU = "action_menu" @@ -48,7 +48,7 @@ class CtrlBoardMenuBuilder(MenuBuilder): return self.create_device_info_menu(context_object) log = logging.getLogger(__name__) - log.warning("Provided menu name [%s] cannot be built!", name) + log.error("Provided menu name cannot be built!") return self.create_scsi_id_list_menu(context_object) diff --git a/python/web/src/return_code_mapper.py b/python/web/src/return_code_mapper.py index 95025d9b..dd5e43b9 100644 --- a/python/web/src/return_code_mapper.py +++ b/python/web/src/return_code_mapper.py @@ -23,7 +23,7 @@ class ReturnCodeMapper: ReturnCodes.DOWNLOADFILETOISO_SUCCESS: _("Created CD-ROM ISO image with arguments \"%(value)s\""), ReturnCodes.DOWNLOADTODIR_SUCCESS: - _("%(file_name)s downloaded to %(save_dir)s"), + _("Downloaded file to %(target_path)s"), ReturnCodes.WRITEFILE_SUCCESS: _("File created: %(target_path)s"), ReturnCodes.WRITEFILE_COULD_NOT_WRITE: diff --git a/python/web/src/static/themes/classic/style.css b/python/web/src/static/themes/classic/style.css index 3c8b754a..fa9d62e9 100644 --- a/python/web/src/static/themes/classic/style.css +++ b/python/web/src/static/themes/classic/style.css @@ -203,3 +203,7 @@ div.throttle-notice > div a { div.throttle-notice > div a:hover { text-decoration: underline; } + +label.hidden { + display: none; +} diff --git a/python/web/src/static/themes/modern/style.css b/python/web/src/static/themes/modern/style.css index a21a91ed..f91e9752 100644 --- a/python/web/src/static/themes/modern/style.css +++ b/python/web/src/static/themes/modern/style.css @@ -62,6 +62,10 @@ div.notice { color: #fff; } +label.hidden { + display: none; +} + /* ------------------------------------------------------------------------------ Tables diff --git a/python/web/src/templates/base.html b/python/web/src/templates/base.html index 38cbe09b..6d61e93e 100644 --- a/python/web/src/templates/base.html +++ b/python/web/src/templates/base.html @@ -113,46 +113,46 @@