diff --git a/app/nullius/execution.py b/app/nullius/execution.py index 1236d793..cbbade16 100644 --- a/app/nullius/execution.py +++ b/app/nullius/execution.py @@ -1676,6 +1676,21 @@ def run_folder(name: str, root: Optional[str] = None) -> str: return path +def run_of(path: str, root: Optional[str] = None) -> Optional[str]: + """The name of the run Nullius made whose folder, or its ``jobs`` folder, + *path* is once its links are resolved; None for any other path: the one + folder a workspace root may be deleted as is a run's own, in the runs root.""" + real, runs = os.path.realpath(path), os.path.realpath(root or runs_root()) + name, _, rest = os.path.relpath(real, runs).partition(os.sep) + if name in (os.curdir, os.pardir) or rest not in ("", "jobs"): + return None + try: + run_folder(name, runs) + except ValueError: + return None + return name + + def size_of(path: str) -> int: """The bytes of every file under *path*, links not followed; a file gone since the walk listed it (a run still writing replaces its own) counts 0.""" diff --git a/app/nullius/judge/store.py b/app/nullius/judge/store.py index b484047c..30394c8f 100644 --- a/app/nullius/judge/store.py +++ b/app/nullius/judge/store.py @@ -108,6 +108,12 @@ def job_dirs(ws_dir: str, job_ids) -> list: return [d for lane in ROOTS for j in job_ids if os.path.isdir(d := os.path.join(_root(ws_dir, lane), _SAFE.sub("_", j)))] +def count(ws_dir: str) -> int: + """The stored judgements of a workspace, every lane: one per trial and + lane, its versions inside. What deleting the workspace loses for good.""" + return sum(n.endswith(".json") for lane in ROOTS for _, _, names in os.walk(_root(ws_dir, lane)) for n in names) + + def all_records(ws_dir: str, job_id: Optional[str] = None, lane: str = "system-one"): """Every stored record, every version: yields (job_id, trial_name, version, record). One job's when `job_id` is given.""" diff --git a/app/static/runs/launches.css b/app/static/runs/launches.css index 24c322f9..e6ab049e 100644 --- a/app/static/runs/launches.css +++ b/app/static/runs/launches.css @@ -127,13 +127,10 @@ dialog.std-how.launch-delete { width: min(520px, calc(100vw - 32px)); } .grid.sortable.inventory thead th:not([data-type])::after { content: none; } .inventory td.inv-acts { position: relative; white-space: nowrap; } /* holds its hidden reason, inside the table's scroll */ /* Add, then Delete, side by side on every row */ .inventory .launch-add-btn:focus-visible { color: var(--text); } -.inventory .launch-delete-btn:hover, .inventory .launch-delete-btn:focus-visible { color: var(--bad); } -.inventory .icon-btn[aria-disabled="true"] { opacity: .4; background: none; border-color: transparent; cursor: default; } /* Delete it cannot: the slot kept, greyed, its reason reachable */ /* State and Launch stay put while the table scrolls sideways; State's header is its name for a screen reader only */ .inventory { --inv-state-w: 2.2rem; } .inventory [data-col="state"] { width: var(--inv-state-w); min-width: var(--inv-state-w); padding-left: 0; padding-right: 0; text-align: center; } .inventory [data-col="launch"] { --sticky-left: var(--inv-state-w); } -.inventory .sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; } /* a run's state: its icon, coloured as the Runs page's state dots */ .inventory td[data-col="state"] .ic { vertical-align: middle; } .inventory .st-finished, .inventory .st-running, .inventory .st-preparing { color: var(--resolved); } diff --git a/app/static/style.css b/app/static/style.css index 3ecd015e..0b4d1b6b 100644 --- a/app/static/style.css +++ b/app/static/style.css @@ -1417,13 +1417,13 @@ a.chip { text-decoration: none; } } .rail-toggle:hover, .icon-btn:hover { color: var(--text); background: var(--surface); border-color: var(--border); } .rail-toggle:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: none; } +.icon-btn.danger:not([aria-disabled="true"]):is(:hover, :focus-visible) { color: var(--bad); } /* it deletes */ +.icon-btn[aria-disabled="true"] { opacity: .4; background: none; border-color: transparent; cursor: default; } /* it cannot here: the slot kept, greyed, its reason reachable */ +.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; } /* a name for a screen reader only */ .ic-expand { display: none; } :root[data-rail="collapsed"] .ic-expand { display: block; } :root[data-rail="collapsed"] .ic-collapse { display: none; } -.ws-delete { width: 34px; text-align: right; } -.ws-remove { border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); border-radius: 6px; width: 28px; height: 28px; font-size: 16px; line-height: 1; cursor: pointer; } -.ws-remove:hover { color: var(--bad); border-color: var(--bad); } .ws-switch { position: relative; } .ws-btn { width: 100%; display: flex; align-items: center; gap: .6rem; text-align: left; @@ -1538,12 +1538,6 @@ a.chip { text-decoration: none; } } /* ---- workspaces ---- */ -.ws-current td { background: var(--accent-soft); } -.ws-mark { width: 1.2rem; } -.ws-rename { display: flex; gap: .5rem; align-items: center; } -.ws-rename input[type=text] { width: 16rem; font-size: .9rem; padding: .3rem .5rem; } -.ws-roots { max-width: 40ch; overflow: hidden; text-overflow: ellipsis; } -.ws-roots .mono { font-size: .78rem; } .nav-tree { display: flex; flex-direction: column; } .nav-row { display: flex; align-items: center; gap: 2px; } @@ -1557,7 +1551,6 @@ a.chip { text-decoration: none; } .tree-caret .ic { width: 15px; height: 15px; transition: transform .12s; } .nav-tree.folded .tree-caret .ic { transform: rotate(-90deg); } .tree-kids { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 .2rem .9rem; padding-left: .55rem; border-left: 1px solid var(--border-soft); } -.tree-form { margin: 0; display: flex; } .tree-item { position: relative; display: flex; align-items: center; gap: .5rem; width: 100%; min-height: 30px; padding: 0 .5rem; border-radius: 7px; color: var(--text-dim); font-size: .85rem; text-align: left; white-space: nowrap; @@ -1567,18 +1560,6 @@ a.chip { text-decoration: none; } .tree-item:hover { background: var(--surface); color: var(--text); text-decoration: none; } .tree-item.on { background: var(--accent-soft); color: var(--text); font-weight: 500; } .tree-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: none; } -.tree-item.cur { color: var(--text); font-weight: 500; } -.tree-check { width: 14px; height: 14px; color: var(--ok); flex: none; } -.tree-item.add { color: var(--text-faint); } -.tree-item.add:hover { color: var(--text); } -.tree-runs { display: flex; flex-direction: column; gap: 1px; margin: 0 0 .15rem .5rem; } -.run-item { min-height: 26px; font-size: .78rem; color: var(--text-faint); padding-left: .2rem; } -.run-item .lbl.mono { font-size: .74rem; } -.run-item .tree-guide { flex: none; width: 10px; height: 1px; background: var(--border); margin-right: -.1rem; } -.run-item.on { color: var(--text); } -.run-item.on .tree-guide { background: var(--accent); } -.tree-n { flex: none; font-size: .68rem; color: var(--text-faint); font-variant-numeric: tabular-nums; } -.run-item.faint { cursor: default; font-style: italic; } :root[data-rail="collapsed"] .tree-caret, :root[data-rail="collapsed"] .tree-kids { display: none; } @media (max-width: 900px) { :root[data-rail="collapsed"] .tree-caret, :root[data-rail="collapsed"] .tree-kids { display: flex; } } diff --git a/app/static/tables.js b/app/static/tables.js index baab63f3..0f497379 100644 --- a/app/static/tables.js +++ b/app/static/tables.js @@ -53,20 +53,22 @@ window.NulliusTable = { macro's, each opened by its caret, or the tools macro's. `allowed`: column -> the Set of values ticked, or null when all are. A row passes when, for each column, one of its values (data-f-
| Workspace | Name | Roots | Cached runs | Last opened | |||
|---|---|---|---|---|---|---|---|
| Open | Name | Roots | Runs | Checks | Launches | Last opened | Actions |
| {% if current %}●{% endif %} | -- {# every workspace renames from its own row, open or not; its directory follows the name #} - |