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-, one per line) is - ticked. `changed` runs after each change. */ + ticked; a box unticked at load filters from the start. `changed` runs + after each change. */ filters(scope, changed) { const allowed = {}; scope.querySelectorAll('[data-filter-menu]').forEach(menu => { const col = menu.dataset.filterMenu; const boxes = () => [...menu.querySelectorAll('input[data-value]')]; const btn = scope.querySelector(`.filter-btn[data-filter="${col}"]`); - const sync = () => { + const read = () => { const on = boxes().filter(b => b.checked).map(b => b.dataset.value); // All checked means "no filter": keeps the active marker honest. allowed[col] = on.length === boxes().length ? null : new Set(on); btn?.classList.toggle('on', Boolean(allowed[col])); - changed(); }; + const sync = () => { read(); changed(); }; + read(); menu.addEventListener('change', sync); menu.addEventListener('click', e => { if (e.target.closest('[data-all]')) { boxes().forEach(b => b.checked = true); sync(); } @@ -153,19 +155,24 @@ window.NulliusTable = { /* A table's Filter and Sort by menus (the tools macro), under `tools`, in place of header carets. Filter counts the columns it narrows; Sort by sets the sort, and follows a header click. `changed` runs after either. + A toolbar without Filter (the macro given no filters) only sorts. Returns {passes, resort}, as filters and sortable do. */ toolbar(table, tools, changed) { const [fbtn, fmenu, sbtn, smenu] = ['filter', 'sort'].flatMap(k => [tools.querySelector(`[data-tools-btn="${k}"]`), tools.querySelector(`[data-tools="${k}"]`)]); - const count = fbtn.querySelector('.tools-count'); - const narrowed = () => { + const count = fbtn?.querySelector('.tools-count'); + const mark = () => { const n = Object.values(f.allowed).filter(Boolean).length; count.textContent = n || ''; count.hidden = !n; - changed(); }; - const f = this.filters(fmenu, narrowed); - fmenu.querySelector('[data-clear]').addEventListener('click', () => { f.clear(); narrowed(); }); + const narrowed = () => { mark(); changed(); }; + const f = fmenu ? this.filters(fmenu, narrowed) : {allowed: {}, passes: () => true}; + if (fmenu) { + mark(); + fmenu.querySelector('[data-clear]').addEventListener('click', () => { f.clear(); narrowed(); }); + this.menu(fbtn, fmenu); + } const heads = [...table.tHead.rows[0].cells]; const sync = () => { const {col, dir} = resort.state(), on = col === null ? '' : heads[col].dataset.col; @@ -180,7 +187,6 @@ window.NulliusTable = { resort.set(idx, dir); }); sync(); - this.menu(fbtn, fmenu); this.menu(sbtn, smenu); return {passes: f.passes, resort}; }, diff --git a/app/static/workspaces/workspaces.css b/app/static/workspaces/workspaces.css new file mode 100644 index 00000000..cc531457 --- /dev/null +++ b/app/static/workspaces/workspaces.css @@ -0,0 +1,19 @@ +/* The Workspaces page: one row per workspace; its roots in a dialog (the Launches page's, runs/launches.css). */ +.ws-head { justify-content: space-between; align-items: center; } +.ws-current td { background: var(--accent-soft); } +.ws-mark { width: 1.2rem; } +.ws-table th { position: relative; } /* holds a header named for a screen reader only, inside the scrolling box */ +.ws-name { min-width: 12rem; } +.ws-show { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px .4rem; } +.ws-title { overflow-wrap: anywhere; } /* a name wraps, never cut */ +.ws-rename { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; } +.ws-rename input[type=text] { width: min(16rem, 100%); font-size: .9rem; padding: .3rem .5rem; } +.ws-roots-btn { font-variant-numeric: tabular-nums; } +.launch-delete .ws-root-list { list-style: none; padding: 0; margin: 12px 0 0; } +.ws-root-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border-soft); } +.ws-root-list li > .mono { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; } /* a path wraps, never cut */ +.ws-root-acts { position: relative; display: inline-flex; flex: none; gap: 2px; } /* holds a hidden reason */ +.launch-delete p.mono, .launch-delete p .mono { overflow-wrap: anywhere; } +dialog.std-how.launch-delete.wide { width: min(56rem, calc(100vw - 32px)); } /* the roots: room for a path */ +.launch-delete .std-how-head h2 { min-width: 0; overflow-wrap: anywhere; } +.grid.tools.ws-table td { vertical-align: middle; } /* a count beside a button: one line */ diff --git a/app/templates/_tables.html b/app/templates/_tables.html index 9791ac73..fd9e1595 100644 --- a/app/templates/_tables.html +++ b/app/templates/_tables.html @@ -17,9 +17,10 @@ {% endmacro %} {# A table's Filter and Sort by menus, in place of header carets (static/tables.js `toolbar`). `filters`: a list of - (col, label, choices), choices as filter_button's; `sorts`: a list of (col, label), the sortable headers. #} -{% macro tools(filters, sorts) %} - {%- set filters = [] %}{% for col, label in cols if col in choices %}{% set _ = filters.append((col, label, choices[col])) %}{% endfor %} - {{ tools(filters, cols|rejectattr(0, 'in', unsorted)|list) }} + {{ tools(filters, cols|rejectattr(0, 'in', unsorted)|list, only) }}
@@ -86,7 +86,7 @@ {% if not r.why %}{{ delete_ask(L, none, 'launches', icon=true) }} - {%- else %}{{ r.why }}{% endif %} + {%- else %}{{ greyed('Delete launch ' ~ L.title, 'Delete launch', r.why, 'why-' ~ L.key) }}{% endif %} {% endfor %} @@ -102,6 +102,9 @@ let pages = () => {}; const tools = NulliusTable.toolbar(table, document.getElementById('launch-tools'), () => pages()); pages = NulliusTable.pager(table, 'launches.per', tools.passes, document.getElementById('empty-note')); + // ?ws= ticked its workspace alone at load; from here the filter lives in the page, as the others do + const url = new URL(location.href); + if (url.searchParams.has('ws')) { url.searchParams.delete('ws'); history.replaceState(history.state, '', url); } // off until a viewer chooses: the table fits 1280 px without them const colBtn = document.getElementById('col-btn'), colMenu = document.getElementById('col-menu'); NulliusTable.columns(table, null, colMenu, 'launches.cols', ['checks', 'machines', 'size']); diff --git a/app/templates/runs/setup.html b/app/templates/runs/setup.html index a9805815..533a0da9 100644 --- a/app/templates/runs/setup.html +++ b/app/templates/runs/setup.html @@ -5,7 +5,7 @@ {% block body %}
{% if mode == 'add' %} -

Add runs to {{ workspace.label }}

+

Add runs to {{ (target or workspace).label }}

Harbor{% if IMPORTERS %}, {{ IMPORTERS|join(' and ') }}{% endif %} output, recognised by shape.

{% elif mode == 'new' %}

New workspace

@@ -26,6 +26,7 @@

Import runs

message ourselves instead of the browser's native bubble. -->
+ {% if into %}{% endif %} {% if mode != 'add' %} @@ -260,6 +261,7 @@

Import runs

const nameField = document.getElementById('ws-name'); fd.append('name', nameField ? nameField.value.trim() : ''); fd.append('new', document.getElementById('ws-new').value); + fd.append('into', document.getElementById('ws-into')?.value || ''); fd.append('csrf', '{{ csrf_token() }}'); parseBtn.disabled = true; status.textContent = `Uploading ${total} files…`; diff --git a/app/templates/workspaces/_root_ask.html b/app/templates/workspaces/_root_ask.html new file mode 100644 index 00000000..6b6331ce --- /dev/null +++ b/app/templates/workspaces/_root_ask.html @@ -0,0 +1,11 @@ +{#- What Delete asks of a root's folder (`workspace_root_ask`): the folder, what it holds, the other workspaces that lose it. #} +{% set run = gone.runs[0] %}{% set others = run.workspaces|map(attribute='ws')|rejectattr('name', 'eq', ws.name)|map(attribute='label')|list %} +

Delete a root of {{ ws.label }} from disk

+ + +

{{ run.dir }}

+

{{ n_runs }} run{{ '' if n_runs == 1 else 's' }}{% if n_checks %} · {{ n_checks }} check{{ '' if n_checks == 1 else 's' }}{% endif %} · {{ gone.bytes|filesizeformat }}{% if gone.judgements %} · {{ gone.judgements }} judgement{{ '' if gone.judgements == 1 else 's' }}{% endif %}

+ {% if others %}

Also removed from {{ others|join(', ') }}.

{% endif %} + {% for h, c in gone.hosts.items() %}{% endfor %} +
+ diff --git a/app/templates/workspaces/workspaces.html b/app/templates/workspaces/workspaces.html index 91da35af..6a9e7572 100644 --- a/app/templates/workspaces/workspaces.html +++ b/app/templates/workspaces/workspaces.html @@ -1,54 +1,145 @@ +{% from '_tables.html' import tools, pager, greyed %} {% extends "base.html" %} {% block title %}Workspaces — Nullius{% endblock %} {% block crumb %}/ workspaces{% endblock %} +{% block head %} + + +{% endblock %} {% block body %} - - -

Workspaces

-

A named set of run roots and what was read from them. New workspace →

+

Workspaces

+ New workspace
{% if workspaces %} -
+{% set labels = workspaces|map(attribute='label')|list %} +
{{ tools([], [('name', 'Name'), ('roots', 'Roots'), ('runs', 'Runs'), ('checks', 'Checks'), ('launches', 'Launches'), ('opened', 'Last opened')]) }}
+
+
- + {% for ws in workspaces %} - {% set current = workspace and ws.name == workspace.name %} - - - + + - - - - - - + + + {#- the time as digits, UTC as every workspace records it; never opened sorts last, newest first #} + + {% endfor %}
WorkspaceNameRootsCached runsLast opened
OpenNameRootsRunsChecksLaunchesLast openedActions
{% if current %}●{% endif %} - {# every workspace renames from its own row, open or not; its directory follows the name #} -
+ {% set current = workspace and ws.name == workspace.name %}{% set rs = roots[ws.name] %}{% set clash = labels.count(ws.label) > 1 %} +
{% if current %}●{% endif %} + {#- the label; the name on disk too where two labels are alike #} + {{ ws.label }}{% if clash %} {{ ws.name }}{% endif %} + + - - + + {{ ws.name }}{% for r in ws.roots %}{{ r }}{% if not loop.last %}
{% endif %}{% endfor %}
{{ ws.n_cached }}{{ ws.opened[:16]|replace('T', ' ') }} - {% if current %}runs → - {% else %}
{% endif %} +
+ + - {# removes the workspace's cache, imports and export record; the job roots stay where they are #} -
- - -
+
{{ counts[ws.name].runs }}{{ counts[ws.name].checks }}{% set n = n_launches[ws.name] %}{% if n %}{{ n }}{% else %}0{% endif %}{{ ws.opened[:16]|replace('T', ' ') }} + +
+
+{{ pager('ws-table') }} + + {% else %}
No workspace yet.
{% endif %} - - {% endblock %} diff --git a/app/tests/test_judge.py b/app/tests/test_judge.py index 85f34ed5..2c7fdb58 100644 --- a/app/tests/test_judge.py +++ b/app/tests/test_judge.py @@ -206,6 +206,16 @@ def test_save_load_merge_and_survive_a_reparse(self): self.assertEqual(store.load(self.ws.dir, "job-1", "task__abc/def")["answers"]["task_completed"], {"noul": 0.9}) + def test_count_is_one_per_trial_and_lane_every_version_inside(self): + self.assertEqual(store.count(self.ws.dir), 0) + for version in ("judgement.questions.v1", questions.VERSION): + store.save(self.ws.dir, "job-1", "t0", {"questions": version, "answers": {}}) # two versions: one judgement + store.save(self.ws.dir, "job-1", "t1", {"questions": "v", "answers": {}}) + store.save(self.ws.dir, "job-2", "t0", {"questions": "v", "answers": {}}, lane="llm") + (Path(self.ws.jobs_dir)).mkdir(parents=True, exist_ok=True); (Path(self.ws.jobs_dir) / "x.json").write_text("{}") # the cache: not one + self.assertEqual(store.count(self.ws.dir), 3) + + class Versions(unittest.TestCase): """The vocabulary bumped: a v1 record and a v2 record coexist in one file, a read without a version prefers the current one and falls back diff --git a/app/tests/test_run_delete.py b/app/tests/test_run_delete.py index e8423cf7..dda38f8b 100644 --- a/app/tests/test_run_delete.py +++ b/app/tests/test_run_delete.py @@ -98,6 +98,17 @@ def test_only_a_run_folder_in_the_runs_root_is_deleted(self): execution.delete([name], self.home, self.root) self.assertTrue(os.path.isfile(os.path.join(outside, execution.RECORD))) + def test_a_root_is_a_run_s_own_folder_only_inside_the_runs_root(self): + outside = os.path.join(self.tmp, "outside"); _write_json(os.path.join(outside, execution.RECORD), {"plan": {}, "state": "done"}) + os.symlink(outside, os.path.join(self.root, "link")) # a link out of the runs root + os.symlink(self.jobs, os.path.join(self.tmp, "alias")) # a link into it: the run it resolves to + os.makedirs(os.path.join(self.jobs, "job-a", "deeper"), exist_ok=True) + for path, name in ((self.jobs, "r1"), (os.path.dirname(self.jobs), "r1"), (os.path.join(self.tmp, "alias"), "r1"), + (self.root, None), (os.path.join(self.root, "link"), None), (outside, None), + (os.path.join(self.jobs, "job-a"), None), (os.path.join(self.tmp, "elsewhere"), None)): + with self.subTest(path=path): + self.assertEqual(execution.run_of(path, self.root), name) + def test_the_host_copy_goes_when_asked(self): self.run_("far", host="ubuntu@10.0.0.4") calls = [] diff --git a/app/ui_tests/test_cli_agreement_more.py b/app/ui_tests/test_cli_agreement_more.py index f8130f24..17ff3258 100644 --- a/app/ui_tests/test_cli_agreement_more.py +++ b/app/ui_tests/test_cli_agreement_more.py @@ -111,12 +111,11 @@ def test_workspace_list_says_what_the_workspaces_page_renders(self): self.assertEqual(code, 0) rows = json.loads(out) page = self.page("/workspaces") - listed = re.findall(r'([^<]+)', page) - self.assertEqual([r["name"] for r in rows], listed[::2]) # name cells; the opened stamps between + listed = re.findall(r'{row["name"]}', 1)[1].split("", 1)[0] - self.assertIn(f'{row["n_cached"]}', block) + block = page.split(f'data-ws="{row["name"]}"', 1)[1].split("", 1)[0] for root in row["roots"]: self.assertIn(f'{html.escape(root)}', block) self.assertIn(row["opened"][:16].replace("T", " "), block) diff --git a/app/ui_tests/test_empty_workspace.py b/app/ui_tests/test_empty_workspace.py index 413a94d3..d1f961a9 100644 --- a/app/ui_tests/test_empty_workspace.py +++ b/app/ui_tests/test_empty_workspace.py @@ -60,7 +60,7 @@ def test_a_path_still_goes_to_its_roots(self): (job / "config.json").write_text(json.dumps({"agents": [{"name": "fixture"}]})) with patch.object(web.shared, "adopt_roots") as adopt: self.post("/use-path", name="", path=str(self.root / "jobs"), new="1") - adopt.assert_called_once_with([str(self.root / "jobs")], label="", new=True) + adopt.assert_called_once_with([str(self.root / "jobs")], label="", new=True, into="") self.assertFalse(self.home.exists()) def test_a_missing_path_creates_nothing(self): diff --git a/app/ui_tests/test_folder_suggestions.py b/app/ui_tests/test_folder_suggestions.py index d9e2ec4e..7c1c8c93 100644 --- a/app/ui_tests/test_folder_suggestions.py +++ b/app/ui_tests/test_folder_suggestions.py @@ -76,4 +76,4 @@ def test_linked_job_directory_can_be_imported(self): response = self.client.post("/use-path", data={"csrf": "folder-test", "path": str(alias / "jobs"), "new": "1"}) self.addCleanup(response.close) self.assertEqual(response.status_code, 302) - adopt.assert_called_once_with([str(alias / "jobs")], label="", new=True) + adopt.assert_called_once_with([str(alias / "jobs")], label="", new=True, into="") diff --git a/app/ui_tests/test_run_routes.py b/app/ui_tests/test_run_routes.py index 1579943e..f20eab4f 100644 --- a/app/ui_tests/test_run_routes.py +++ b/app/ui_tests/test_run_routes.py @@ -483,7 +483,7 @@ def test_a_run_on_openai_is_given_openais_endpoint(self): class WorkspaceDelete(unittest.TestCase): - """The × on the Workspaces page: the workspace goes, its roots stay, the open one closes; a form token is needed.""" + """Delete on the Workspaces page: the workspace goes, its roots stay, the open one closes; a form token is needed.""" def setUp(self): from nullius import workspace self.stack = ExitStack(); self.addCleanup(self.stack.close) @@ -495,7 +495,7 @@ def setUp(self): self.ws = workspace.create(str(self.tmp / "ws"), [str(root)], label="gone soon") self.client = web.app.test_client() r = self.client.get("/workspaces"); self.addCleanup(r.close) - self.assertIn('class="ws-remove"', r.get_data(as_text=True)) + self.assertIn('aria-label="Delete workspace gone soon" title="Delete workspace"', r.get_data(as_text=True)) with self.client.session_transaction() as s: self.csrf = s["csrf"] @@ -530,7 +530,7 @@ def test_any_workspace_renames_from_its_row_open_or_not(self): other = workspace.create(home, [str(self.tmp / "jobs")], label="sharp lemur") page = self.client.get("/workspaces"); self.addCleanup(page.close) html = page.get_data(as_text=True) - self.assertEqual(html.count('class="ws-rename"'), 2) # a field on every row, none open + self.assertEqual(html.count('class="ws-rename" hidden>'), 2) # a field on every row, none open for ws in (self.ws, other): self.assertIn(f'', html) self.assertEqual(self.client.post("/workspaces/rename", data={"name": other.name, "label": "x"}, headers={"Origin": "http://localhost"}).status_code, 403) # no token @@ -901,7 +901,7 @@ def test_delete_from_the_page_with_no_workspace_open(self): web.shared.close_workspace() row = self.rows()[f"run:{orphan.id}"] self.assertNotIn('