Fix shell details: distro name, storage path only in footer
- OS name comes from /etc/os-release (e.g. 'CachyOS Linux'), mirroring the original app's os_utils; macOS/Windows get proper names too - Status pill shows the name as-is instead of uppercasing it - Removed the watched-folder path next to the logo; it now appears only in the footer strip (spec updated to match)
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
import platform
|
||||||
|
from functools import lru_cache
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache(maxsize=1)
|
||||||
|
def _os_release_values():
|
||||||
|
values = {}
|
||||||
|
try:
|
||||||
|
with open("/etc/os-release", encoding="utf-8") as handle:
|
||||||
|
for line in handle:
|
||||||
|
line = line.strip()
|
||||||
|
if not line or "=" not in line:
|
||||||
|
continue
|
||||||
|
key, value = line.split("=", 1)
|
||||||
|
values[key] = value.strip().strip('"')
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
return values
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache(maxsize=1)
|
||||||
|
def get_os_info():
|
||||||
|
"""OS display name and icon key, mirroring the original app's os_utils."""
|
||||||
|
system = platform.system()
|
||||||
|
release = platform.release()
|
||||||
|
if system == "Linux":
|
||||||
|
name = _os_release_values().get("NAME") or "Linux"
|
||||||
|
return {"name": name, "release": release, "icon": "linux"}
|
||||||
|
if system == "Darwin":
|
||||||
|
return {"name": "macOS", "release": release, "icon": "apple"}
|
||||||
|
if system == "Windows":
|
||||||
|
return {"name": "Windows", "release": release, "icon": "windows"}
|
||||||
|
return {"name": system, "release": release, "icon": "unknown"}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import platform
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@@ -6,13 +5,7 @@ from rest_framework.permissions import AllowAny
|
|||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
|
|
||||||
|
from .system_info import get_os_info
|
||||||
def _os_info():
|
|
||||||
system = platform.system()
|
|
||||||
icon = {"Linux": "linux", "Darwin": "apple", "Windows": "windows"}.get(
|
|
||||||
system, "unknown"
|
|
||||||
)
|
|
||||||
return {"name": system, "release": platform.release(), "icon": icon}
|
|
||||||
|
|
||||||
|
|
||||||
def _worker_counts():
|
def _worker_counts():
|
||||||
@@ -35,7 +28,7 @@ class StatusView(APIView):
|
|||||||
"env": settings.APP_ENV,
|
"env": settings.APP_ENV,
|
||||||
"git_hash": settings.GIT_COMMIT_HASH,
|
"git_hash": settings.GIT_COMMIT_HASH,
|
||||||
"version": settings.APP_VERSION,
|
"version": settings.APP_VERSION,
|
||||||
"os": _os_info(),
|
"os": get_os_info(),
|
||||||
"watched_folder": settings.WATCHED_FOLDER,
|
"watched_folder": settings.WATCHED_FOLDER,
|
||||||
"e621_time_ms": None, # no e621 calls in the backend yet
|
"e621_time_ms": None, # no e621 calls in the backend yet
|
||||||
"workers": _worker_counts(),
|
"workers": _worker_counts(),
|
||||||
|
|||||||
@@ -77,12 +77,12 @@ All tag chips, counters, and sidebar taxonomy badges strictly adhere to e621's e
|
|||||||
|
|
||||||
### 4.1 Global Frame (Shell)
|
### 4.1 Global Frame (Shell)
|
||||||
- **Top App Bar (`#11111b`, height: 56px):**
|
- **Top App Bar (`#11111b`, height: 56px):**
|
||||||
- Left: Brand mark `J621` badge (`#cba6f7`) followed by the **storage line** — the path of the watched folder that J621 indexes (e.g. `/mnt/media/library`). J621 is folder-based: this is just a path on disk, not a NAS/appliance indicator.
|
- Left: Brand mark `J621` badge (`#cba6f7`) only. The watched folder path lives in the footer status strip, not in the header.
|
||||||
- Center: Nav pills: `Library`, `Online`, `Pools`, `Followed`, `Upload`, `Duplicates`, and `Stats [STAFF]`.
|
- Center: Nav pills: `Library`, `Online`, `Pools`, `Followed`, `Upload`, `Duplicates`, and `Stats [STAFF]`.
|
||||||
- Right: System status pill with real backend values, never hardcoded: environment (`DEV`/`PROD`), git commit hash, the actual host OS, page generation time, and the total e621 API request time for that page load — e.g. `ENV: PROD · a1b2c3d · LINUX · 18ms (e621: 4ms)`. Followed by the user avatar.
|
- Right: System status pill with real backend values, never hardcoded: environment (`DEV`/`PROD`), git commit hash, the actual host OS, page generation time, and the total e621 API request time for that page load — e.g. `ENV: PROD · a1b2c3d · LINUX · 18ms (e621: 4ms)`. Followed by the user avatar.
|
||||||
- **Global Footer Status Strip (`#11111b`, height: 32px):**
|
- **Global Footer Status Strip (`#11111b`, height: 32px):**
|
||||||
- The strip placement is a proposal; its values are real and drawn from the existing stats data.
|
- The strip placement is a proposal; its values are real and drawn from the existing stats data.
|
||||||
- Left: the watched folder path — `📁 Local Storage: /mnt/media/library`.
|
- Left: the watched folder path — `📁 Local Storage: /mnt/media/library`. This is the only place the path appears (J621 is folder-based; it is just a path on disk, not a NAS/appliance indicator).
|
||||||
- Center: `⚡ Active Workers: N running | Queue: M pending` — the count of active optimization/ingest jobs and queued downloads (the original app surfaced this on its stats page; the footer simply keeps it visible).
|
- Center: `⚡ Active Workers: N running | Queue: M pending` — the count of active optimization/ingest jobs and queued downloads (the original app surfaced this on its stats page; the footer simply keeps it visible).
|
||||||
- Right: the running build — `<env> @ <git commit hash>` (e.g. `dev @ 3f35330`), matching the original app.
|
- Right: the running build — `<env> @ <git commit hash>` (e.g. `dev @ 3f35330`), matching the original app.
|
||||||
- **Collapsible Sidebar (Behavior):**
|
- **Collapsible Sidebar (Behavior):**
|
||||||
|
|||||||
@@ -53,15 +53,6 @@ export function AppShell() {
|
|||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
{status ? (
|
|
||||||
<span
|
|
||||||
className="hidden max-w-[240px] truncate font-mono text-[11px] text-ctp-overlay0 md:block"
|
|
||||||
title={status.watched_folder}
|
|
||||||
>
|
|
||||||
{status.watched_folder}
|
|
||||||
</span>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
{showSidebarToggle ? (
|
{showSidebarToggle ? (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export function StatusPill({ status }: { status?: SystemStatus }) {
|
|||||||
<span>{status.git_hash}</span>
|
<span>{status.git_hash}</span>
|
||||||
<span className="text-ctp-surface2">·</span>
|
<span className="text-ctp-surface2">·</span>
|
||||||
<OsIcon className="h-3 w-3" />
|
<OsIcon className="h-3 w-3" />
|
||||||
<span>{status.os.name.toUpperCase()}</span>
|
<span>{status.os.name}</span>
|
||||||
<span className="text-ctp-surface2">·</span>
|
<span className="text-ctp-surface2">·</span>
|
||||||
<span>{formatMs(status.server_time_ms)}</span>
|
<span>{formatMs(status.server_time_ms)}</span>
|
||||||
{status.e621_time_ms !== null ? (
|
{status.e621_time_ms !== null ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user