mirror of
https://github.com/khodges42/nightShift.git
synced 2026-06-14 10:08:37 +00:00
actually show the logo
This commit is contained in:
parent
3ab8567ae9
commit
347ec583e6
|
|
@ -156,7 +156,7 @@ def create_app(project_root: str | Path = ".", artifact_dir: str | Path = ".nigh
|
|||
|
||||
@app.get("/assets/logo.png")
|
||||
def logo():
|
||||
logo_path = root / "docs" / "images" / "logo.png"
|
||||
logo_path = _logo_path(root)
|
||||
if not logo_path.exists():
|
||||
return Response(status=404)
|
||||
response = Response(logo_path.read_bytes(), mimetype="image/png")
|
||||
|
|
@ -182,6 +182,13 @@ def _artifact_paths(run_path: Path) -> list[str]:
|
|||
return sorted(paths, key=lambda item: (priority.get(item, 10), item))
|
||||
|
||||
|
||||
def _logo_path(project_root: Path) -> Path:
|
||||
project_logo = project_root / "docs" / "images" / "logo.png"
|
||||
if project_logo.exists():
|
||||
return project_logo
|
||||
return Path(__file__).resolve().parent.parent / "docs" / "images" / "logo.png"
|
||||
|
||||
|
||||
def _status_from_summary(summary: str) -> str:
|
||||
for line in summary.splitlines():
|
||||
normalized = line.strip().lower()
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import tempfile
|
|||
import unittest
|
||||
|
||||
from nightshift.artifacts import ArtifactStore
|
||||
from nightshift.web import list_runs, read_artifact, render_dashboard
|
||||
from nightshift.web import _logo_path, list_runs, read_artifact, render_dashboard
|
||||
|
||||
|
||||
class WebDashboardTests(unittest.TestCase):
|
||||
|
|
@ -44,6 +44,10 @@ class WebDashboardTests(unittest.TestCase):
|
|||
self.assertIn("line 119", dashboard)
|
||||
self.assertNotIn("line 19\n", dashboard)
|
||||
|
||||
def test_logo_path_falls_back_to_repo_logo(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
self.assertTrue(_logo_path(Path(directory)).exists())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user