UI design system unification — one stylesheet, canonical primitives, nav fix (#284)

* docs(plan): design-system unification plan (post-review revisions)

Plan covers consolidating two CSS files into one, introducing
canonical primitives (.btn family, .search-input, .filter-bar,
.page-header, .data-table, .empty-state, .toast, .stat-card,
.tab-strip), unifying the top-nav Admin trigger with sibling
links, and migrating 41 templates that today carry inline
<style> blocks.

Post-review revisions: nav fix moved to first commit (user
complaint lands first); sticky-header and dark-mode skeleton
tasks dropped (defer to follow-up PRs); contract test class
detection tokenizes class="..." attributes properly; baseline
screenshot loop added to Task 0; vendor-token grep widened.

* fix(nav): unify Admin trigger with sibling nav links

The top-nav Admin entry is a <button class="app-nav-link
app-nav-menu-trigger">, siblings are <a class="app-nav-link">.
.app-nav-menu-trigger used to override .app-nav-link with
"color: inherit; font: inherit", resetting font-size from 13px
back to body default and color from --text-secondary to body
color. Active state diverged too: .is-active on links used
--primary blue, [aria-expanded=true] on the button used
--border-light grey.

Fix: expand .app-nav-link so it covers <button>-element resets
(font-family: inherit, border: 0, background: transparent,
cursor: pointer, display: inline-flex for chevron alignment).
Add [aria-expanded="true"] as another active-state selector
so the dropdown's open state highlights identically to .is-active
on links. Delete the now-redundant .app-nav-menu-trigger rules
that stripped button chrome.

Extract the inline <script> from _app_header.html into a new
app/web/static/app.js (loaded by base.html only — base_login.html
has no nav). Sets up window.appUI.wireDropdown for both the user
menu and the Admin dropdown via DOMContentLoaded.

* style(css): consolidate style.css into style-custom.css + add cache-bust

One stylesheet for the whole web UI:
- style.css (1086 lines, legacy Google-inspired tokens + components)
  absorbed into style-custom.css under a labeled block, placed after
  the modern :root + body so style-custom's component rules continue
  to override the legacy ones (preserves the original cascade order
  that came from loading style.css first).
- style.css deleted; <link> dropped from base.html + base_login.html.
- static_url() now appends ?v=<mtime> to /static/<path>. Cheap
  per-request os.stat — auto-invalidates browser + proxy caches on
  redeploy without operator intervention. Mtime survives across
  uvicorn restarts as long as the file content is unchanged.

Legacy classes (.btn, .card, .login-*, .badge, .code-block, .flash,
.form-group, .username-box, .btn-copy, .auth-tabs, .divider, etc.)
still render — they live in style-custom.css now. Login pages,
error page, password setup, and the dashboard's Claude Code Setup
card all kept working in browser smoke.

* test(design): contract test for design-system invariants

7 structural invariants enforced from this commit onwards:
- style.css must stay deleted
- no template links style.css via static_url
- exactly one bare :root block in style-custom.css
- canonical primitives declared (.btn, .btn-primary, .search-input,
  .filter-bar, .page-header, .data-table, .empty-state, .toast, …)
- no deprecated class names in templates (.users-table, .gp-table,
  .marketplaces-table, .audit-table, .users-search, .marketplaces-search,
  .modal-btn, .btn-primary-v2, …)
- app.js loaded by base.html, NOT by base_login.html
- 3 helper-level unit tests for the class-attribute tokenizer
  (multi-line attrs, Jinja-conditional fragments, false-positive prose)

Two of the assertions intentionally start FAILING after this commit
(missing primitives + legacy class refs in 7 admin templates) and
will turn green as Tasks 4–7 add primitives and Tasks 8–15 migrate
the templates.

* feat(css): canonical button family + legacy token aliases

Adds at top of :root: legacy token aliases (--bg, --card-bg, --text,
--text-light, --secondary, --radius) pointing at modern equivalents.
Absorbed style.css rules referenced these names; without aliases
they fell back to 'unset'. Aliases live until Task 16 alongside
their absorbed rules.

Appends canonical .btn variants at end of file (last cascade):
  .btn-primary + .btn-primary-v2 + .modal-btn.primary (alias group)
  .btn-secondary + .btn-secondary-v2 + .modal-btn:not(.primary):not(.danger)
  .btn-ghost + .btn-ghost-v2
  .btn-danger + .modal-btn.danger
  .btn-lg
  .btn:disabled + .btn:focus-visible (focus ring via --focus-ring)

Existing absorbed .btn, .btn-primary, .btn-secondary, .btn-sm rules
remain — the canonical block adds the missing variants + selector-list
aliases so .modal-btn and v2 markup keep rendering until migration
tasks swap them out.

Contract test: .btn-danger now declared (one less missing primitive).
Browser smoke: /admin/tokens hero + filter pills + empty state render
correctly with the absorbed style.css rules now backed by real tokens.

* feat(css): form-control primitives — .search-input + .filter-bar + .filter-pill + .form-input

Canonical filter bar shape: 36px-height inputs (matches button height
for vertical rhythm), 28px pills with .is-active state, consistent
focus ring via --focus-ring token.

Selector-list aliases for legacy per-page classes:
- .users-search / .marketplaces-search / .kb-search → .search-input
- .filters-card → .filter-bar
- .pill[aria-pressed="true"] also matches the .filter-pill active state

.form-input added as a sibling of .search-input for forms — same
baseline height + radius + focus treatment, with textarea.form-input
auto-sizing to min 96px and using the mono font (matches CSV/SQL
pasted-snippet patterns on /admin/agent-prompt + /admin/workspace-prompt).

Contract test: .search-input + .filter-bar + .filter-pill now declared.

* feat(css): .page-header primitive + variants + .tab-strip

Canonical page-header pattern with title (22px) + optional subtitle +
optional eyebrow + right-aligned actions slot. Two modifiers:
- .page-header--hero: gradient background (primary→primary-dark),
  28px white title, semi-transparent subtitle/eyebrow. For
  /marketplace, /store, /profile-style pages that already use this
  layout via per-page inline <style>. Migration tasks delete the
  duplicated rules.
- .page-header--compact: 18px title for dense admin index pages.

.tab-strip + .tab-strip__item — the secondary tab row pattern used by
/marketplace?tab=flea and similar. .is-active / [aria-selected=true]
both flip the active treatment (primary color + bottom border).

Contract test: .page-header / __title / __subtitle / __actions all
now declared (4 fewer missing primitives).

* feat(css+js): .data-table + .empty-state + .toast + .stat-card primitives

Last primitive batch. All 8 canonical-primitives invariants in
test_design_system_contract.py now green; only the template-migration
test fails (expected — Tasks 8–15).

.data-table (+ --compact modifier): selector-list aliases for legacy
per-page table classes (.users-table, .gp-table, .marketplaces-table,
.audit-table) so existing markup keeps rendering until migration.
Compact modifier shrinks padding + font for dense lists (audit log).

.empty-state with __icon / __title / __description / __actions —
replaces the ad-hoc 'no results' rendering scattered across pages
(corporate_memory, admin_users, admin_marketplaces, etc.).

.toast / .toast-container — paired with window.appToast({kind, msg,
timeout}) appended to app.js. Bottom-right stacked, click-to-dismiss,
auto-dismiss after 4s by default. Kind 'success' / 'warning' / 'error'
/ 'info' shows a 3px colored left border.

.stat-card (+ --accent variant) + .stat-row grid — for the dashboard
metric tile row.

* style(templates): migrate 8 templates off deprecated class names

Mechanical class-attribute rewrite via tokenizer (preserves Jinja
conditionals + multi-line attrs):

  modal-btn primary    -> btn btn-primary
  modal-btn danger     -> btn btn-danger
  modal-btn            -> btn btn-secondary
  users-table          -> data-table
  gp-table             -> data-table
  marketplaces-table   -> data-table
  audit-table          -> data-table
  users-search         -> search-input
  marketplaces-search  -> search-input

8 templates touched: admin_groups, admin_marketplaces, admin_tokens,
admin_users, admin_welcome, admin_workspace_prompt, my_tokens,
corporate_memory_admin. 43 lines updated total.

Inline <style> blocks in these templates still define rules for the
old class names — those rules no longer match anything and become
dead code, removed in Task 16's alias cleanup along with the
selector-list aliases in style-custom.css.

Contract test (tests/test_design_system_contract.py) now fully green:
9/9 invariants enforced from this commit onward.

* feat(css): extend .data-table selector list to 13 more bespoke -table classes

Visual unification of remaining tables across the codebase without
per-template edits. The .data-table baseline rules (uppercase header
tracking, 12px padding, hover state, border-radius) now apply to:

  .ad-table / .ea-table / .md-table / .members-table /
  .obs-table / .overview-stats-table / .registry-table /
  .sample-table / .sched-table / .sess-table / .sub-table /
  .subs-table / .ud-table

These class names live in 12 templates (activity_center, admin_access,
admin_group_detail, admin_scheduler_runs, admin_sessions,
admin_store_submissions, admin_tables, admin_usage, admin_user_detail,
catalog, me_debug, profile_sessions) that have their own per-page
<style> blocks. Per-page rules with higher specificity still win for
their custom needs (column widths, etc.) — this commit only sets a
shared baseline so every table renders with the same chrome.

Contract test stays green: 9/9 invariants enforced.

* style(css): remove now-unused legacy class aliases

Phase A renamed 8 templates off these names; no markup references
them any more, so the selector-list memberships are dead weight.
Removed from style-custom.css:

  .btn-primary-v2 / .btn-secondary-v2 / .btn-ghost-v2
  .modal-btn / .modal-btn.primary / .modal-btn.danger /
  .modal-btn:not(.primary):not(.danger)
  .users-search / .marketplaces-search / .kb-search
  .users-table / .gp-table / .marketplaces-table / .audit-table
  .filters-card

37 lines smaller. Contract test catches any reintroduction.

KEPT aliases (still in untouched template markup):
- .pill (marketplace_plugin_detail.html, marketplace.html — these
  pages weren't part of Phase A's deprecated-class sweep; their
  own .pill CSS rules still apply)
- All .data-table family extensions (.ad-table, .ea-table, .md-table,
  .members-table, .obs-table, .overview-stats-table, .registry-table,
  .sample-table, .sched-table, .sess-table, .sub-table, .subs-table,
  .ud-table) — these still render data tables in 12 templates;
  selector-list aliasing keeps them visually unified with .data-table
  baseline.
- Legacy token aliases (--bg / --text / --text-light / --secondary /
  --card-bg / --radius) — still resolve absorbed style.css rules.

Templates' inline <style> blocks still contain dead rules for the
renamed classes (.users-search, .modal-btn, etc.); harmless but
bloat. Optional follow-up: a separate sweep can drop those.

* docs(changelog): design-system unification under [Unreleased]

* feat(css): unify page-shell width — .container baseline 1280px + modifiers

Inventory found 30+ unique max-width values across templates (280px
login → 1600px admin/tables). The legacy .container default was 800px,
which made every admin page set its own wider inline override —
30+ ad-hoc widths drifted as a result.

Canonical: .container max-width = var(--width-app) (1280px). Pages
that need a different shape opt in via modifiers:

  .container--narrow → var(--width-narrow)  (800px) — long-form text,
                                                     setup wizards
  .container--wide   → var(--width-wide)    (1400px) — admin lists,
                                                     marketplace grids
  .container--full   → max-width: none — hero / landing

Pages that already set a NARROWER inline max-width (setup, login flows
inside .login-card, etc.) still render at their narrower size — the
inline override beats the new canonical 1280px. The visible change
hits the ~20 admin pages currently rendering at 800px via the legacy
default, which jump to 1280px and pick up consistent breathing room.

Spacing also normalized: padding 24px 20px → var(--space-6) var(--space-5).

* fix(home+catalog): gut dashboard sections + remove confusing toggle + fix table count

Dashboard /home cleanup:
- Remove 'Your Data' card — Data Packages is already a top-nav entry,
  so duplicating data sources on the landing page just adds noise.
- Remove 'Account' card — group memberships + scripts + last sync
  belong on /profile, not on the welcome screen.
- Remove entire right-column (Corporate Memory + Activity Center
  widgets) — both surfaces have dedicated admin pages reachable from
  the Admin dropdown.
- Keep stats row (Tables/Columns/Rows/Data Size/Unstructured),
  env-setup-CTA, and Notifications card.

/catalog cleanup:
- Strip the 'Always included' badge + the locked toggle-switch from
  Core Business Data and Business Metrics cards. The toggle was
  always 'checked disabled' — it visually looked like a switch but
  could not be toggled, which was confusing. The 'Always included'
  copy itself was redundant once the toggle was gone. Agnes Internal
  already rendered without these, so the three cards are now visually
  consistent.

Catalog data_stats fix:
- 'total_tables' was len(sync_state) — counted only tables that had
  ever synced, so a 30-row table_registry with 0 ever synced rendered
  as '0 tables'. Switched to len(tables) — the registered
  business-data table list — so the count reflects what's actually
  available, not what's been touched.

* fix(home): real stat numbers + drop unstructured tile + cleanup dead CSS

Dashboard stats were hardcoded zeros (columns: 0, size_display:
'0 MB', unstructured_display: '0 MB') and the table counter pulled
from sync_state (synced) instead of table_registry (registered).
On a fresh deployment with 30 registered tables and 0 ever synced,
the page rendered '0 / 0 / 0 / 0 MB / 0 MB' — useless.

Now:
- Tables: COUNT(*) FROM table_registry WHERE source_type != 'internal'.
  Matches the /catalog Core Business Data counter.
- Columns: SUM(sync_state.columns). Zero only when nothing's synced yet.
- Rows: unchanged (SUM(sync_state.rows), already correct).
- Data Size: SUM(sync_state.file_size_bytes), human-formatted via
  inline _fmt_bytes helper (KB/MB/GB).
- Unstructured: tile dropped — was always '0 MB' and had no source.
- last_updated: now derived from sync_state max(last_sync), wasn't set
  before so the 'Synced …' tag never rendered.

Dashboard.html cleanup: ~725 lines of orphan inline <style> removed —
.section-title, .data-source*, .toggle-switch*, .catalog-cta*,
.memory-card / .memory-stat / .memory-description / .memory-footer
/ .btn-memory, .activity-card / .activity-stat / .activity-text
/ .btn-activity, .account-grid / .account-row / .account-scripts
/ .badge-role / .badge-group / .cron-line, .badge-included /
.badge-beta / .badge-demo. All matched markup deleted in the
previous commit; the CSS was dead code until now.

* ui(catalog): rename page heading 'Data Catalog' → 'Data Packages'

The top-nav entry says 'Data Packages' but the page itself said
'Data Catalog' — confusing two-name product. Aligns the heading and
<title> with the nav label. Subtitle trimmed too: 'manage your
subscriptions' was a vestige of the toggle UI that just got removed,
replaced with a one-liner describing what the page is for.

Two other 'Data Catalog' strings stay: they live inside the table-
profiler overlay JS and refer to an EXTERNAL catalog system (e.g.
OpenMetadata / Atlan) that an operator may link to per table — that
is a generic term for any external data-catalog product, not our
page name.

* fix(nav): dropdown clicks always work + mutual-exclusion close

Two bugs in the wireDropdown helper:

1. Clicking trigger B while trigger A's menu was open left both open.
   e.stopPropagation() in trigger.click prevented the document-click
   handler from firing, so trigger A's open menu had no way to learn
   that something else was clicked. Net effect: state diverged across
   the two dropdowns the more you clicked.

2. The target-vs-trigger equality check (e.target !== trigger) was
   strict. Clicking the chevron <svg> inside the button reports the
   svg or its <path> child as e.target — not the button — so removing
   stopPropagation alone would trip the close branch in the same
   click that just opened the panel.

Fix both at once: drop e.stopPropagation() AND switch the doc-handler
guard to trigger.contains(e.target). Now any click outside both the
trigger subtree and the panel subtree closes; any click on another
trigger closes via the OTHER dropdown's doc handler; clicks inside
the trigger (button OR svg child) are fully ignored by the doc
handler and only the trigger's own toggle handler fires.

* feat(ui): canonical blue-gradient hero on every admin page

The UI had a per-page hero pattern on ~10 onboarding/marketing pages
(admin_tokens / profile / install / setup_advanced / marketplace /
my_tokens / store_upload / home_*), each with its own ad-hoc CSS
(.tokens-hero, .profile-hero, .install-hero, .upload-hero, …). The
admin section's index + detail pages had plain H1/H2 with their own
.users-title / .gp-title / .obs-title / .cfg-title / … inline styling.
Net effect: half the app felt like a product, half felt like a
spreadsheet.

Now:
- .page-header--hero CSS upgraded to match the look analysts already
  liked from admin_tokens: 28px/32px/24px padding, 14px radius, soft
  primary-tinted box-shadow (0 4px 16px rgba(0,115,209,0.2)), 28px
  semibold title, optional uppercase eyebrow + 13.5px subtitle.
  Narrow-viewport breakpoint included.
- New _page_hero.html partial wraps the boilerplate. Usage:
    {% set page_hero_eyebrow  = "Users & Access" %}
    {% set page_hero_title    = "Users" %}
    {% set page_hero_subtitle = "…" %}
    {% include "_page_hero.html" %}
- 15 admin templates migrated to it: admin_users / admin_groups /
  admin_marketplaces / admin_access / admin_sessions /
  admin_session_detail / admin_store_submissions /
  admin_scheduler_runs / admin_usage / admin_user_detail /
  admin_welcome / admin_workspace_prompt / admin_server_config /
  activity_center / admin/news_editor. Each gets a grouped eyebrow
  (Users & Access / Data / Agent Experience / Activity Center /
  Server) matching the Admin dropdown sections so the page identity
  is unambiguous at a glance.

Legacy *-title H2/H1 + adjacent subtitle paragraphs deleted; their
per-page CSS rules are dead now (harmless, retire in a follow-up
sweep alongside other inline-style cleanup the reviewers flagged).

admin_tables.html intentionally NOT migrated — it's a standalone
HTML page that doesn't extend base.html; a separate refactor.

Test: test_admin_users_page_renders_for_admin assertion updated
from .users-title to .page-header__title + .page-header--hero (the
canonical pair). All other web/template tests stay green.

* refactor(ui): dedup _humanbytes, drop 267 lines of dead inline CSS

(1) _humanbytes consolidation:
- Add TB branch + optional precision param (default 2 preserves existing
  Store detail callers; dashboard uses precision=1 for headline tiles).
- Delete inline _fmt_bytes from dashboard handler — was a copy of
  _humanbytes with different rounding. One canonical helper now.

(2) Dead inline-CSS sweep across 17 migrated templates:
- Conservative regex: a CSS rule is deleted only when its primary class
  matches one of the known-dead names AND that name is NOT referenced
  from any class= attribute in the same file's markup.
- Per-file 'in-use' guard saved several false positives that the deny
  list would have nuked (e.g. .users-toolbar, .gp-search, .obs-subtitle,
  .marketplaces-toolbar are still in use; only .users-table, .users-search,
  .users-title, .modal-btn, etc. that have NO markup left went away).
- Removed: -267 lines across admin_users (-42), admin_marketplaces (-45),
  admin_groups (-31), my_tokens (-38), admin_tokens (-29), admin_access
  (-9), admin_user_detail (-6), admin_welcome (-8), admin_workspace_prompt
  (-8), admin_server_config (-2), admin_sessions (-1), admin_session_detail
  (-1), admin_usage (-1), admin_store_submissions (-3), admin_scheduler_runs
  (-3), activity_center (-4), corporate_memory_admin (-36).

Contract test stays green (9/9); all web/template/render/user_management
tests pass.

* feat(ui): canonical hero on /catalog (Data Packages)

Same .page-header--hero treatment as the admin pages — Data eyebrow,
Data Packages title, Browse-the-data-sources subtitle. Removes the
ad-hoc .page-title block (h1 / p / wrapper-div) and its CSS rules
(now dead, 3 rule blocks deleted).

* fix(nav): load app.js from _app_header.html — works on standalone pages

The previous nav-fix commit moved the inline dropdown script from
_app_header.html into app/web/static/app.js + added <script src=…>
to base.html. That broke EVERY page that includes _app_header.html
WITHOUT extending base.html (catalog, corporate_memory*,
admin_tables, install). They got the nav markup but no JS → both
Admin and AD dropdowns dead on those pages.

Fix: emit the <script src=app.js defer> directly inside the
_app_header.html partial. Any page that includes the header now
gets the script automatically — base.html-extenders AND standalone
HTML pages alike. base.html's duplicate <script> line removed.

Also fixes the wide-hero on /catalog: .page-header--hero now sets
its own max-width: var(--width-app) (1280px) so standalone pages
without a .container parent don't render the gradient edge-to-edge.
catalog's .source-cards bumped from 900px → 1280px to match the
hero, otherwise the page reads two-tier (wide blue band, narrow
content) which the user flagged.

Verified locally via agent-browser: Admin + AD dropdowns now click
through on /catalog, /admin/tables, /corporate-memory.

* docs(plan): standalone pages → base.html framework migration plan

Plan + Plan-agent review (8 must-fix items applied) for converting
the 5 templates that ship their own <html><head><body> scaffold
(catalog, install, corporate_memory, corporate_memory_admin,
admin_tables) to extend base.html. Root cause of yesterday's
'dropdown dead on /catalog' regression: shared infrastructure in
base.html doesn't propagate to standalones.

* feat(base): body_attrs block + migrate install.html to extend base

base.html: new {% block body_attrs %}{% endblock %} slot so pages
that need <body> attributes (admin_tables has data-source-type)
can carry them through extends.

install.html: convert from standalone <html><head><body> scaffold
to {% extends "base.html" %} with title / body_attrs / head_extra
/ layout / scripts blocks. Drops:
- <!DOCTYPE>, <html>, </html>, <head>, </head>
- <meta charset>, <meta viewport>
- Duplicate <link rel="stylesheet" href="...style-custom.css">
  (base.html already provides one)
- <body> opening + closing tags
- Leading _app_header.html include + _version_badge.html include
  (base.html handles both)

Preserves per-page CSS (in head_extra), per-page JS (in scripts),
the Inter font preconnect (kept inline; not hoisted to base in
this PR — separate decision).

Pilots the migration recipe before the 4 larger pages.

* refactor(memory): extend base.html

Same recipe as install.html. corporate_memory.html now inherits
<html>/<head>/<body> + nav + app.js script tag from base.html.
Page-specific CSS and JS preserved in head_extra + scripts blocks.

* refactor(memory-admin): extend base.html

Same recipe as install/corporate_memory. Curation page now in the
shared rendering pipeline.

* refactor(catalog): extend base.html

catalog.html had the most complexity: 7 head-level assets (chart.js,
Prism, prism-sql, metric_modal.css link + 2 preconnects + Inter
stylesheet), 5 body-level <script> blocks including a <script type=
"module"> for the metric modal, 2 duplicate style-custom.css links
in <head>. The migration script preserved all of them — head-level
externals hoisted to {% block head_extra %} in source order, body
scripts relocated to {% block scripts %} in source order (so chart.js
loads before the IIFE that builds Chart instances), duplicate
style-custom.css links dropped (base.html provides one).

* refactor(admin-tables): extend base.html + carry data-source-type

The biggest of the 5 standalones at 3563 lines. <body data-source-
type="{{ data_source_type }}"> attribute carried through via the
new {% block body_attrs %} slot (admin_tables JS reads
document.body.dataset.sourceType to switch between keboola and
bigquery rendering paths).

* release: 0.54.10 — UI design system unification + homepage status frame + initial workspace override + store guardrails

Co-Authored-By: zdenek.srotyr <zdenek.srotyr@keboola.com>

* refactor(web): migrate remaining templates to canonical design primitives

- admin_group_detail: .data-table, .btn family, appToast(), remove duplicate table/button/toast CSS
- admin_store_submission_detail: .data-table, .btn family, appToast(), remove duplicate btn/toast CSS
- profile_sessions: .data-table, _page_hero.html, remove duplicate table/title CSS
- me_debug: .data-table, .btn family, remove duplicate table/button CSS
- marketplace: .btn-primary/.btn-secondary, remove duplicate button CSS
- store_edit: remove duplicate .btn-primary/.btn-link CSS, canonical button classes
- store_upload: remove duplicate .btn-primary/.btn-secondary/.btn-link CSS

Co-Authored-By: zdenek.srotyr <zdenek.srotyr@keboola.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
ZdenekSrotyr 2026-05-14 13:28:03 +02:00 committed by GitHub
parent aa6a6700f4
commit 1b0329e8c5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
44 changed files with 4461 additions and 2915 deletions

View file

@ -10,6 +10,47 @@ CalVer image tags (`stable-YYYY.MM.N`, `dev-YYYY.MM.N`) are produced for every C
## [Unreleased]
## [0.54.10] — 2026-05-14
### Changed
- Web UI design system unified: single stylesheet (`style-custom.css`),
canonical primitives for buttons, form controls, page headers, tables,
empty states, toasts, and stat cards. Top-nav Admin entry now shares
styling 1:1 with sibling links (font, color, padding, hover, active
state) — previously a `<button class="app-nav-menu-trigger">` reset
inherited font + color away from the sibling `<a class="app-nav-link">`
rules. Inline dropdown JS extracted from `_app_header.html` into
`app/web/static/app.js` (also hosts `window.appToast({kind, msg, timeout})`
for the new toast primitive).
- `static_url()` template helper now appends `?v=<file_mtime>` to
`/static/<path>` so CSS/JS edits auto-invalidate browser + proxy caches
on redeploy without operator intervention.
### Removed
- `app/web/static/style.css` — content folded into `style-custom.css` so
the web UI ships from a single stylesheet. Legacy classes
(`.btn-primary-v2`, `.btn-secondary-v2`, `.btn-ghost-v2`, `.modal-btn`,
`.users-table`, `.gp-table`, `.marketplaces-table`, `.audit-table`,
`.users-search`, `.marketplaces-search`, `.kb-search`, `.filters-card`)
removed from templates and CSS; 8 admin templates migrated to canonical
primitives. Operators on older builds who served the file directly will
hit a 404 — re-run the deploy so the index renders against
`style-custom.css` only.
### Internal
- New `tests/test_design_system_contract.py` (9 invariants): single
`:root` block, no template references the deleted `style.css`,
canonical primitives declared, no deprecated class names in templates,
`app.js` loaded by `base.html` only. Plus 3 helper-level unit tests for
the class-attribute tokenizer (multi-line attrs, Jinja-conditional
fragments, false-positive prose).
- `.data-table` selector list extended to cover 13 bespoke `-table`
classes (`.ad-table`, `.ea-table`, `.md-table`, `.members-table`,
`.obs-table`, `.overview-stats-table`, `.registry-table`,
`.sample-table`, `.sched-table`, `.sess-table`, `.sub-table`,
`.subs-table`, `.ud-table`) so tables in 12 untouched templates render
with the same baseline chrome.
### Added
- **Per-analyst Stats dashboard at `/me/stats`.** Four-tab page showing

View file

@ -40,6 +40,25 @@ def _resolved_home_route() -> str:
return get_home_route()
_STATIC_DIR = Path(__file__).resolve().parent / "static"
def _static_url(path: str) -> str:
"""Build /static/<path> with a cache-buster query string.
Appends ``?v=<file_mtime_int>`` so a redeploy that changes a CSS/JS file
invalidates browser + proxy caches without operator intervention.
Missing files return the bare URL FastAPI's StaticFiles will surface
the 404 normally. Cheap (one ``os.stat`` per template variable use).
"""
full = _STATIC_DIR / path
try:
v = int(full.stat().st_mtime)
return f"/static/{path}?v={v}"
except OSError:
return f"/static/{path}"
logger = logging.getLogger(__name__)
router = APIRouter(tags=["web"])
@ -73,13 +92,15 @@ class _SafeEncoder(_json.JSONEncoder):
templates.env.policies["json.dumps_function"] = lambda obj, **kw: _json.dumps(obj, cls=_SafeEncoder, **kw)
def _humanbytes(value) -> str:
def _humanbytes(value, precision: int = 2) -> str:
"""Render a byte count as the largest binary-prefixed unit it fits in.
Below 1 KiB integer bytes; otherwise two decimal places of KB / MB / GB
(binary, 1024-based). Used by the Store detail template; intentionally
permissive about input type so missing / undefined values render as
``0 B`` rather than crashing the page.
Below 1 KiB integer bytes; otherwise ``precision`` decimal places of
KB / MB / GB / TB (binary, 1024-based). Used by the Store detail
template (default 2-decimal precision for fine-grained file sizes) and
by the /dashboard stat tiles (1-decimal precision for headline numbers).
Intentionally permissive about input type so missing / undefined values
render as ``0 B`` rather than crashing the page.
"""
try:
n = int(value or 0)
@ -89,12 +110,15 @@ def _humanbytes(value) -> str:
return f"{n} B"
kb = n / 1024
if kb < 1024:
return f"{kb:.2f} KB"
return f"{kb:.{precision}f} KB"
mb = kb / 1024
if mb < 1024:
return f"{mb:.2f} MB"
return f"{mb:.{precision}f} MB"
gb = mb / 1024
return f"{gb:.2f} GB"
if gb < 1024:
return f"{gb:.{precision}f} GB"
tb = gb / 1024
return f"{tb:.{precision}f} TB"
templates.env.filters["humanbytes"] = _humanbytes
@ -435,7 +459,7 @@ def _build_context(
"config": ConfigProxy,
"user": _flex(user) if user else _FlexDict(),
"now": datetime.now,
"static_url": lambda path: f"/static/{path}",
"static_url": _static_url,
# Flask compatibility shims for templates
"get_flashed_messages": lambda **kwargs: [],
"url_for": lambda endpoint, **kw: _url_for_shim(endpoint, **kw),
@ -614,9 +638,18 @@ async def dashboard(
enabled_datasets = settings_repo.get_enabled_datasets(user["id"])
datasets = get_datasets()
# Stats
total_tables = len(all_states)
# Stats. `total_tables` counts REGISTERED business tables, not synced
# ones (a registry of 30 with 0 ever synced would otherwise render as
# "0"). Internal source_type tables (agnes_*) live in their own card on
# /catalog and are excluded from the headline counter. Columns + size
# come from sync_state, which is the canonical source for "what's
# actually on disk locally".
total_tables = conn.execute(
"SELECT COUNT(*) FROM table_registry WHERE COALESCE(source_type, '') != 'internal'"
).fetchone()[0]
total_rows = sum(s.get("rows", 0) or 0 for s in all_states)
total_columns = sum(s.get("columns", 0) or 0 for s in all_states)
total_size_bytes = sum(s.get("file_size_bytes", 0) or 0 for s in all_states)
# Build user_info object expected by dashboard template
is_admin = is_user_admin(user["id"], conn)
@ -649,12 +682,14 @@ async def dashboard(
data_stats={
"tables": total_tables,
"total_tables": total_tables,
"columns": 0,
"columns": total_columns,
"rows_display": f"{total_rows:,}" if total_rows else "0",
"size_display": "0 MB",
"unstructured_display": "0 MB",
"size_display": _humanbytes(total_size_bytes, precision=1) if total_size_bytes else "0 MB",
"total_rows": total_rows,
"last_updated": None,
"last_updated": max(
(s.get("last_sync") for s in all_states if s.get("last_sync")),
default=None,
),
"remote_tables": 0,
"local_tables": total_tables,
},
@ -877,10 +912,15 @@ async def catalog(
internal_tables = []
logger.warning(f"Could not load catalog: {e}")
# Build data_stats for catalog template (business-data card header)
# Build data_stats for catalog template (business-data card header).
# `total_tables` must count REGISTERED business tables, not just
# synced ones — a registry of 30 tables with 0 ever synced would
# otherwise render as "0 tables" on the Core Business Data card.
# `internal` source_type tables render in their own card; exclude
# them here so the Core counter doesn't double-count system tables.
total_rows = sum(s.get("rows", 0) or 0 for s in all_states)
data_stats = {
"total_tables": len(all_states),
"total_tables": len(tables),
"total_rows": total_rows,
"total_columns": 0,
"total_size": sum(s.get("file_size_bytes", 0) or 0 for s in all_states),

84
app/web/static/app.js Normal file
View file

@ -0,0 +1,84 @@
/* Global UI helpers loaded by base.html (not by base_login.html login pages
have no nav and no toasts, so the helpers aren't reachable there).
Two responsibilities for now:
- wireDropdown: open/close + click-outside + Escape for the user menu and
the Admin nav dropdown. Used by _app_header.html.
- More helpers (window.appToast, etc.) added later as the design system
primitives need JS sidecars. */
(function () {
"use strict";
function wireDropdown(triggerId, panelId) {
var trigger = document.getElementById(triggerId);
var panel = document.getElementById(panelId);
if (!trigger || !panel) return;
function setOpen(open) {
trigger.setAttribute("aria-expanded", open ? "true" : "false");
if (open) {
panel.removeAttribute("hidden");
} else {
panel.setAttribute("hidden", "");
}
}
trigger.addEventListener("click", function () {
// No stopPropagation — let the click bubble to the document
// handler so any OTHER open dropdown's handler can close
// itself ("only one menu open at a time" behaviour).
setOpen(trigger.getAttribute("aria-expanded") !== "true");
});
document.addEventListener("click", function (e) {
// Use trigger.contains(target) instead of strict equality —
// clicking the chevron <svg> inside the button reports the
// svg / path as e.target, which would otherwise trip the
// close branch immediately after opening.
if (!panel.contains(e.target) && !trigger.contains(e.target)) {
setOpen(false);
}
});
document.addEventListener("keydown", function (e) {
if (e.key === "Escape") {
setOpen(false);
trigger.focus();
}
});
}
// Toast helper — paired with .toast / .toast-container CSS in style-custom.css.
// Usage: window.appToast({kind: "success", msg: "Saved", timeout: 4000})
function ensureToastContainer() {
var c = document.getElementById("appToastContainer");
if (c) return c;
c = document.createElement("div");
c.id = "appToastContainer";
c.className = "toast-container";
document.body.appendChild(c);
return c;
}
function appToast(opts) {
opts = opts || {};
var kind = opts.kind || "info";
var msg = String(opts.msg || "");
var timeout = opts.timeout == null ? 4000 : opts.timeout;
var el = document.createElement("div");
el.className = "toast is-" + kind;
el.textContent = msg;
el.addEventListener("click", function () { el.remove(); });
ensureToastContainer().appendChild(el);
if (timeout > 0) setTimeout(function () { el.remove(); }, timeout);
return el;
}
window.appUI = { wireDropdown: wireDropdown };
window.appToast = appToast;
// Auto-wire the two dropdowns shipped from _app_header.html.
function init() {
wireDropdown("userMenuTrigger", "userMenuPanel");
wireDropdown("adminNavTrigger", "adminNavPanel");
}
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", init);
} else {
init();
}
})();

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -120,29 +120,12 @@
</div>
</div>
</header>
<script>
// Generic toggle pattern — used by both the user menu and the Admin nav dropdown.
function _wireDropdown(triggerId, panelId) {
var trigger = document.getElementById(triggerId);
var panel = document.getElementById(panelId);
if (!trigger || !panel) return;
function setOpen(open) {
trigger.setAttribute('aria-expanded', open ? 'true' : 'false');
if (open) { panel.removeAttribute('hidden'); }
else { panel.setAttribute('hidden', ''); }
}
trigger.addEventListener('click', function(e) {
e.stopPropagation();
setOpen(trigger.getAttribute('aria-expanded') !== 'true');
});
document.addEventListener('click', function(e) {
if (!panel.contains(e.target) && e.target !== trigger) setOpen(false);
});
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') { setOpen(false); trigger.focus(); }
});
}
_wireDropdown('userMenuTrigger', 'userMenuPanel');
_wireDropdown('adminNavTrigger', 'adminNavPanel');
</script>
{# Dropdown wiring lives in app/web/static/app.js. The script tag sits
here (in the shared header partial) instead of base.html so EVERY
page that includes _app_header.html — including standalone pages
like catalog.html / corporate_memory*.html / install.html /
admin_tables.html that don't extend base.html — gets the JS loaded
automatically. Defer keeps it non-blocking; placed after the header
markup so DOM is ready by the time the IIFE runs init(). #}
<script src="{{ static_url('app.js') }}" defer></script>
{% endif %}

View file

@ -0,0 +1,19 @@
{# Canonical hero header for content pages. Usage:
{% set page_hero_eyebrow = "Users & Access" %}
{% set page_hero_title = "Users" %}
{% set page_hero_subtitle = "Manage analyst accounts and group membership." %}
{% include "_page_hero.html" %}
`eyebrow` + `subtitle` are optional; `title` is required (the block is
a no-op without one). CSS lives at `.page-header--hero` in
style-custom.css. #}
{% if page_hero_title %}
<section class="page-header page-header--hero">
<div class="page-header__main">
{% if page_hero_eyebrow %}<div class="page-header__eyebrow">{{ page_hero_eyebrow }}</div>{% endif %}
<h1 class="page-header__title">{{ page_hero_title }}</h1>
{% if page_hero_subtitle %}<p class="page-header__subtitle">{{ page_hero_subtitle | safe }}</p>{% endif %}
</div>
</section>
{% endif %}

View file

@ -7,8 +7,10 @@
<!-- TOP BAR --------------------------------------------------------- -->
<header class="obs-topbar">
<div class="obs-topbar-left">
<h1 class="obs-title">Audit log</h1>
<p class="obs-subtitle">Server-side actions performed against Agnes. Also available locally for analysis. For Claude Code tool / skill telemetry, see <a href="/admin/telemetry">Telemetry</a>.</p>
{% set page_hero_eyebrow = "Activity Center" %}
{% set page_hero_title = "Audit log" %}
{% set page_hero_subtitle = "Every admin and user-mutating action — RBAC writes, sync triggers, marketplace edits, …" %}
{% include "_page_hero.html" %}
<div class="obs-narrative" id="obs-narrative">Loading…</div>
</div>
<div class="obs-topbar-right">
@ -156,10 +158,6 @@
margin-bottom: 16px;
}
.obs-topbar-left { flex: 1; min-width: 0; }
.obs-title { margin: 0 0 4px 0; font-size: 22px; font-weight: 600; color: var(--obs-fg); }
.obs-subtitle { margin: 0 0 10px; color: var(--obs-muted); font-size: 13px; max-width: 720px; }
.obs-subtitle a { color: var(--obs-link); text-decoration: none; border-bottom: 1px dashed currentColor; }
.obs-subtitle a:hover { border-bottom-style: solid; }
.obs-narrative { font-size: 16px; color: var(--obs-fg); line-height: 1.45; }
.obs-narrative b { font-weight: 600; }
.obs-narrative a { color: var(--obs-link); text-decoration: none; border-bottom: 1px dashed transparent; cursor: pointer; }

View file

@ -220,8 +220,10 @@ document.addEventListener('DOMContentLoaded', function () {
{% endblock %}
{% block content %}
<h1>News editor</h1>
{% set page_hero_eyebrow = "Server" %}
{% set page_hero_title = "News editor" %}
{% set page_hero_subtitle = "Compose the news intro shown at the bottom of /home." %}
{% include "_page_hero.html" %}
<div class="panel">
<h2>Currently published</h2>
{% if news_current %}

View file

@ -9,8 +9,6 @@
display: flex; justify-content: space-between; align-items: center;
gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.ax-title { margin: 0; font-size: 22px; font-weight: 600; }
.ax-sub { margin: 0; font-size: 13px; color: var(--text-secondary, #6b7280); }
.ax-layout {
display: grid; grid-template-columns: 320px 1fr; gap: 20px;
@ -245,13 +243,6 @@
}
.modal-card textarea { min-height: 60px; resize: vertical; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal-btn {
padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
border: 1px solid var(--border, #e5e7eb); background: var(--surface, #fff);
cursor: pointer;
}
.modal-btn.primary { background: var(--primary, #6366f1); color: #fff; border-color: var(--primary, #6366f1); }
.modal-btn.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.toast-stack {
position: fixed; bottom: 24px; right: 24px; z-index: 2000;
@ -336,9 +327,10 @@
<div class="ax-page">
<div class="ax-toolbar">
<div>
<h2 class="ax-title">Resource access</h2>
<p class="ax-sub">Pick a group on the left, check resources on the right to grant access.
Manage groups and members on <a href="/admin/groups">Groups</a>.</p>
{% set page_hero_eyebrow = "Users & Access" %}
{% set page_hero_title = "Resource access" %}
{% set page_hero_subtitle = "Pick a group on the left, check resources on the right to grant access. Manage groups and members on <a href=&quot;/admin/groups&quot; style=&quot;color:#fff;text-decoration:underline;&quot;>Groups</a>." %}
{% include "_page_hero.html" %}
</div>
</div>

View file

@ -62,20 +62,7 @@
.gd-section-head .sub { font-size: 11px; color: var(--text-secondary, #6b7280); }
/* Members table */
.members-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.members-table thead th {
text-align: left; padding: 10px 18px;
background: var(--border-light, #f9fafb);
border-bottom: 1px solid var(--border, #e5e7eb);
font-weight: 600; color: var(--text-secondary, #6b7280);
font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
}
.members-table tbody td {
padding: 10px 18px;
border-bottom: 1px solid var(--border-light, #f3f4f6);
}
.members-table tbody tr:last-child td { border-bottom: none; }
.members-table tbody tr:hover { background: var(--border-light, #fafafa); }
.source-meta {
font-size: 12px; color: var(--text-secondary, #9ca3af); font-weight: 400;
}
@ -95,22 +82,9 @@
border: 1px solid var(--border, #e5e7eb); border-radius: 6px;
font-size: 13px; background: var(--surface, #fff);
}
.add-row button {
padding: 7px 14px; border-radius: 6px; font-size: 12px; font-weight: 500;
background: var(--primary, #6366f1); color: #fff;
border: 1px solid var(--primary, #6366f1); cursor: pointer;
}
.add-row button:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-btn {
padding: 5px 10px; border-radius: 6px; font-size: 12px;
border: 1px solid var(--border, #e5e7eb); background: var(--surface, #fff);
cursor: pointer; color: var(--text-primary, #111827);
text-decoration: none;
}
.icon-btn:hover { background: var(--border-light, #f9fafb); }
.icon-btn.danger { color: #b91c1c; border-color: #fecaca; }
.icon-btn.danger:hover { background: #fef2f2; }
.gd-loading, .gd-empty {
padding: 24px 18px; text-align: center;
@ -134,19 +108,7 @@
}
.res-link:hover { filter: brightness(1.05); }
.toast-stack {
position: fixed; bottom: 24px; right: 24px; z-index: 2000;
display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
background: #111827; color: #fff; padding: 10px 16px;
border-radius: 8px; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s;
pointer-events: auto; max-width: 380px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #047857; }
.toast.error { background: #b91c1c; }
</style>
<div class="gd-page"
@ -187,8 +149,8 @@
</div>
{% if not target_group.is_system and not target_group.is_google_managed %}
<div style="display:flex; gap:6px;">
<button class="icon-btn" id="edit-group-btn">Edit</button>
<button class="icon-btn danger" id="delete-group-btn">Delete</button>
<button class="btn btn-sm" id="edit-group-btn">Edit</button>
<button class="btn btn-danger btn-sm" id="delete-group-btn">Delete</button>
</div>
{% endif %}
</div>
@ -208,7 +170,7 @@
<span class="sub" id="members-sub">Loading…</span>
</div>
<div id="members-loading" class="gd-loading">Loading members…</div>
<table class="members-table" id="members-table" style="display:none;">
<table class="data-table" id="members-table" style="display:none;">
<thead><tr>
<th>Email</th><th>Name</th><th>Origin</th>
<th style="text-align:right">Actions</th>
@ -219,7 +181,7 @@
{% if not target_group.is_google_managed %}
<div class="add-row">
<input id="add-email" type="email" autocomplete="off" placeholder="Add user by email…">
<button id="add-btn" disabled>Add member</button>
<button class="btn btn-primary btn-sm" id="add-btn" disabled>Add member</button>
</div>
{% endif %}
</section>
@ -250,13 +212,13 @@
<label style="display:block; font-size:12px; color:#6b7280; margin: 12px 0 6px;">Description</label>
<textarea id="edit-desc" style="width:100%; padding:9px 12px; border:1px solid #e5e7eb; border-radius:8px; font-size:13px; box-sizing:border-box; min-height:60px;"></textarea>
<div style="display:flex; gap:8px; justify-content:flex-end; margin-top:18px;">
<button class="icon-btn" id="edit-cancel-btn">Cancel</button>
<button class="icon-btn" style="background:#6366f1;color:#fff;border-color:#6366f1;" id="edit-save-btn">Save</button>
<button class="btn btn-secondary" id="edit-cancel-btn">Cancel</button>
<button class="btn btn-primary" id="edit-save-btn">Save</button>
</div>
</div>
</div>
<div class="toast-stack" id="toast-stack" aria-live="polite"></div>
<script>
const root = document.querySelector(".gd-page");
@ -290,14 +252,7 @@ if (IS_GOOGLE_MANAGED && !MAPPED_EMAIL) {
function esc(s) { const d = document.createElement("div"); d.textContent = s == null ? "" : String(s); return d.innerHTML; }
function fmtDate(s) { return s ? String(s).slice(0, 16).replace("T", " ") : "-"; }
function toast(msg, kind = "") {
const el = document.createElement("div");
el.className = "toast " + kind;
el.textContent = msg;
document.getElementById("toast-stack").appendChild(el);
requestAnimationFrame(() => el.classList.add("show"));
setTimeout(() => { el.classList.remove("show"); setTimeout(() => el.remove(), 250); }, 3500);
}
function toast(msg, kind = "") { window.appToast({ kind: kind || "info", msg }); }
let groupState = null;
let members = [];

View file

@ -10,8 +10,6 @@
display: flex; justify-content: space-between; align-items: center;
gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.gp-title { margin: 0; font-size: 22px; font-weight: 600; }
.gp-sub { margin: 0; font-size: 13px; color: var(--text-secondary, #6b7280); }
.gp-search {
padding: 8px 12px 8px 32px; min-width: 280px;
border: 1px solid var(--border, #e5e7eb); border-radius: 8px;
@ -19,28 +17,6 @@
background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.35-4.35'/></svg>") no-repeat 10px center;
}
.gp-table-wrap {
background: var(--surface, #fff);
border: 1px solid var(--border, #e5e7eb);
border-radius: 12px;
overflow: hidden;
}
.gp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.gp-table thead th {
text-align: left; padding: 12px 16px;
background: var(--border-light, #f9fafb);
border-bottom: 1px solid var(--border, #e5e7eb);
font-weight: 600; color: var(--text-secondary, #6b7280);
font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
}
.gp-table tbody td {
padding: 12px 16px;
border-bottom: 1px solid var(--border-light, #f3f4f6);
vertical-align: middle;
}
.gp-table tbody tr:last-child td { border-bottom: none; }
.gp-table tbody tr { cursor: pointer; }
.gp-table tbody tr:hover { background: var(--border-light, #fafafa); }
.gp-name {
font-weight: 500; color: var(--text-primary, #111827);
@ -127,13 +103,6 @@
.modal-card textarea { min-height: 60px; resize: vertical; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal-btn {
padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
border: 1px solid var(--border, #e5e7eb); background: var(--surface, #fff);
cursor: pointer;
}
.modal-btn.primary { background: var(--primary, #6366f1); color: #fff; border-color: var(--primary, #6366f1); }
.modal-btn.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.toast-stack {
position: fixed; bottom: 24px; right: 24px; z-index: 2000;
@ -153,9 +122,10 @@
<div class="gp-page">
<div class="gp-toolbar">
<div>
<h2 class="gp-title">Groups</h2>
<p class="gp-sub">Named buckets that hold members and resource grants.
Manage who has access to what on <a href="/admin/access">Resource access</a>.</p>
{% set page_hero_eyebrow = "Users & Access" %}
{% set page_hero_title = "Groups" %}
{% set page_hero_subtitle = "Named groups + members. Resource access lives on the Resource access page." %}
{% include "_page_hero.html" %}
</div>
<div style="display:flex; gap:10px; align-items:center;">
<input id="search" type="search" class="gp-search" placeholder="Filter by name or description…" autocomplete="off">
@ -163,8 +133,8 @@
</div>
</div>
<div class="gp-table-wrap">
<table class="gp-table" id="groups-table">
<div class="data-table-wrap">
<table class="data-table" id="groups-table">
<thead>
<tr>
<th>Name</th>
@ -197,8 +167,8 @@
<label for="group-desc">Description (optional)</label>
<textarea id="group-desc" autocomplete="off"></textarea>
<div class="modal-actions">
<button class="modal-btn" data-close-modal="group-modal">Cancel</button>
<button class="modal-btn primary" id="group-save-btn">Save</button>
<button class="btn btn-secondary" data-close-modal="group-modal">Cancel</button>
<button class="btn btn-primary" id="group-save-btn">Save</button>
</div>
</div>
</div>
@ -209,8 +179,8 @@
<h3 id="confirm-title">Delete group?</h3>
<p class="sub" id="confirm-text"></p>
<div class="modal-actions">
<button class="modal-btn" data-close-modal="confirm-modal">Cancel</button>
<button class="modal-btn danger" id="confirm-ok-btn">Delete</button>
<button class="btn btn-secondary" data-close-modal="confirm-modal">Cancel</button>
<button class="btn btn-danger" id="confirm-ok-btn">Delete</button>
</div>
</div>
</div>

View file

@ -10,38 +10,7 @@
display: flex; justify-content: space-between; align-items: center;
gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.marketplaces-title { margin: 0; font-size: 22px; font-weight: 600; }
.marketplaces-search {
flex: 1; max-width: 360px;
padding: 8px 12px 8px 36px;
border: 1px solid var(--border, #e5e7eb);
border-radius: 8px;
font-size: 13px;
background: var(--surface, #fff) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.35-4.35'/></svg>") no-repeat 12px center;
}
.marketplaces-search:focus { outline: 2px solid var(--primary, #6366f1); outline-offset: -1px; }
.marketplaces-table-wrap {
background: var(--surface, #fff);
border: 1px solid var(--border, #e5e7eb);
border-radius: 12px;
overflow-x: auto;
}
.marketplaces-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.marketplaces-table thead th {
text-align: left; padding: 12px 16px;
background: var(--border-light, #f9fafb);
border-bottom: 1px solid var(--border, #e5e7eb);
font-weight: 600; color: var(--text-secondary, #6b7280);
font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
}
.marketplaces-table tbody td {
padding: 12px 16px;
border-bottom: 1px solid var(--border-light, #f3f4f6);
vertical-align: middle;
}
.marketplaces-table tbody tr:last-child td { border-bottom: none; }
.marketplaces-table tbody tr:hover { background: var(--border-light, #fafafa); }
.mp-cell { display: flex; align-items: center; gap: 10px; }
.mp-avatar {
@ -135,16 +104,6 @@
.modal-card textarea { min-height: 60px; resize: vertical; }
.modal-card input:focus, .modal-card textarea:focus { outline: 2px solid var(--primary, #6366f1); outline-offset: -1px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal-btn {
padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
border: 1px solid var(--border, #e5e7eb); background: var(--surface, #fff);
cursor: pointer; transition: all 0.15s;
}
.modal-btn:hover { background: var(--border-light, #f9fafb); }
.modal-btn.primary { background: var(--primary, #6366f1); color: #fff; border-color: var(--primary, #6366f1); }
.modal-btn.primary:hover { filter: brightness(1.05); }
.modal-btn.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.modal-btn.danger:hover { filter: brightness(1.05); }
.sync-result {
margin: 12px 0;
@ -235,10 +194,6 @@
/* Amber primary modal action — pairs with the system-confirm modal so
the OK button matches the trigger button's visual weight. */
.modal-btn.warning {
background: #f59e0b; color: #fff; border-color: #d97706;
}
.modal-btn.warning:hover { filter: brightness(1.06); }
/* Toast */
.toast-stack {
@ -260,17 +215,20 @@
<div class="marketplaces-page">
<div class="marketplaces-toolbar">
<h2 class="marketplaces-title">Curated Marketplaces</h2>
<input id="mp-search" type="search" class="marketplaces-search" placeholder="Filter by slug, name, or URL…" autocomplete="off">
{% set page_hero_eyebrow = "Agent Experience" %}
{% set page_hero_title = "Curated Marketplaces" %}
{% set page_hero_subtitle = "Admin-managed git repos cloned nightly. Synced plugins surface in the Claude Code marketplace feed." %}
{% include "_page_hero.html" %}
<input id="mp-search" type="search" class="search-input" placeholder="Filter by slug, name, or URL…" autocomplete="off">
<a class="icon-btn" href="/marketplace/format-guide" target="_blank" rel="noopener"
title="Open the marketplace-metadata.json format guide in a new tab">
Format guide →
</a>
<button class="modal-btn primary" id="open-create-btn">+ Add marketplace</button>
<button class="btn btn-primary" id="open-create-btn">+ Add marketplace</button>
</div>
<div class="marketplaces-table-wrap">
<table class="marketplaces-table" id="marketplaces-table">
<div class="data-table-wrap">
<table class="data-table" id="marketplaces-table">
<thead>
<tr>
<th>Marketplace</th>
@ -328,8 +286,8 @@
<div class="help">Stored in <code>$DATA_DIR/state/.env_overlay</code> (chmod 600) on the data volume. Never written to the database or committed to git.</div>
<div class="modal-actions">
<button class="modal-btn" data-close-modal="create-modal">Cancel</button>
<button class="modal-btn primary" id="confirm-create-btn">Register</button>
<button class="btn btn-secondary" data-close-modal="create-modal">Cancel</button>
<button class="btn btn-primary" id="confirm-create-btn">Register</button>
</div>
</div>
</div>
@ -368,8 +326,8 @@
</div>
<div class="modal-actions">
<button class="modal-btn" data-close-modal="edit-modal">Cancel</button>
<button class="modal-btn primary" id="confirm-edit-btn">Save</button>
<button class="btn btn-secondary" data-close-modal="edit-modal">Cancel</button>
<button class="btn btn-primary" id="confirm-edit-btn">Save</button>
</div>
</div>
</div>
@ -381,7 +339,7 @@
<p class="sub" id="sync-target"></p>
<div id="sync-result-body" class="sync-result"></div>
<div class="modal-actions">
<button class="modal-btn primary" data-close-modal="sync-modal">Close</button>
<button class="btn btn-primary" data-close-modal="sync-modal">Close</button>
</div>
</div>
</div>
@ -393,7 +351,7 @@
<p class="sub" id="details-sub"></p>
<div id="details-body" class="plugin-list"></div>
<div class="modal-actions">
<button class="modal-btn primary" data-close-modal="details-modal">Close</button>
<button class="btn btn-primary" data-close-modal="details-modal">Close</button>
</div>
</div>
</div>
@ -407,8 +365,8 @@
<input id="confirm-purge" type="checkbox" checked> Also delete the working copy from disk
</label>
<div class="modal-actions">
<button class="modal-btn" data-close-modal="confirm-modal">Cancel</button>
<button class="modal-btn danger" id="confirm-ok-btn">Delete</button>
<button class="btn btn-secondary" data-close-modal="confirm-modal">Cancel</button>
<button class="btn btn-danger" id="confirm-ok-btn">Delete</button>
</div>
</div>
</div>
@ -424,8 +382,8 @@
<p class="sub" id="system-confirm-plugin" style="margin: 0 0 14px; font-size: 13px; color: var(--text-primary, #111827); font-weight: 500;"></p>
<div id="system-confirm-body" style="font-size: 13px; line-height: 1.55; color: var(--text-secondary, #374151);"></div>
<div class="modal-actions">
<button class="modal-btn" data-close-modal="system-confirm-modal">Cancel</button>
<button class="modal-btn warning" id="system-confirm-ok-btn">Confirm</button>
<button class="btn btn-secondary" data-close-modal="system-confirm-modal">Cancel</button>
<button class="btn btn-warning" id="system-confirm-ok-btn">Confirm</button>
</div>
</div>
</div>
@ -683,8 +641,8 @@ function toggleSystem(btn, marketplaceId, marketplaceName) {
<li>Operators can revoke either via <a href="/admin/access" style="color: var(--primary, #6366f1);">/admin/access</a> or by uninstalling on each user's stack.</li>
</ul>`;
okBtn.textContent = "Unmark system";
okBtn.classList.remove("warning");
okBtn.classList.add("primary");
okBtn.classList.remove("btn-warning");
okBtn.classList.add("btn-primary");
} else {
titleEl.textContent = "Mark as system plugin?";
pluginEl.textContent = pluginName;
@ -702,8 +660,8 @@ function toggleSystem(btn, marketplaceId, marketplaceName) {
Unmarking later does not auto-clean the materialized grants — they stay until manually removed.
</p>`;
okBtn.textContent = "Mark as system";
okBtn.classList.remove("primary");
okBtn.classList.add("warning");
okBtn.classList.remove("btn-primary");
okBtn.classList.add("btn-warning");
}
// Single-shot handler — re-bind on every open so we don't leak across

View file

@ -5,9 +5,6 @@
<style>
/* Width + padding come from .page-shell (style-custom.css) — same
1280px container as /dashboard, /marketplace, /admin/* peers. */
.sched-title { margin: 0 0 8px 0; font-size: 22px; font-weight: 600; }
.sched-help { color: var(--text-secondary, #6b7280); font-size: 13px; margin-bottom: 20px; }
.sched-help code { background: var(--border-light, #f3f4f6); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.sched-table-wrap {
background: var(--surface, #fff);
border: 1px solid var(--border, #e5e7eb);
@ -45,15 +42,10 @@
</style>
<div class="sched-page page-shell">
<h1 class="sched-title">Scheduler runs</h1>
<p class="sched-help">
Last 200 audited scheduler-driven admin actions, newest first.
Tracked actions: {% for a in actions %}<code>{{ a }}</code>{% if not loop.last %} {% endif %}{% endfor %}.
Failed ticks (HTTP 401, network errors) live only in the scheduler container's
stdout — <code>docker logs agnes-scheduler-1</code>. Set <code>SCHEDULER_API_TOKEN</code>
in <code>.env</code> if you see no rows here.
</p>
{% set page_hero_eyebrow = "Server" %}
{% set page_hero_title = "Scheduler runs" %}
{% set page_hero_subtitle = "Recent extractor + materialized + cache-warmup runs from the scheduler." %}
{% include "_page_hero.html" %}
<div class="sched-table-wrap">
{% if rows %}
<table class="sched-table">

View file

@ -16,8 +16,6 @@
display: flex; justify-content: space-between; align-items: center;
gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.cfg-title { margin: 0; font-size: 22px; font-weight: 600; }
.cfg-subtitle { color: var(--text-secondary, #6b7280); font-size: 13px; margin-top: 4px; }
.cfg-banner {
padding: 12px 16px; border-radius: 8px;
@ -163,8 +161,10 @@
<div class="cfg-page" data-page="server-config">
<div class="cfg-toolbar">
<div>
<h2 class="cfg-title">Server configuration</h2>
<div class="cfg-subtitle">Edits land in <code>instance.yaml</code>. Save triggers an app restart (~10s downtime). Secret values are masked here — re-enter them to change.</div>
{% set page_hero_eyebrow = "Server" %}
{% set page_hero_title = "Server configuration" %}
{% set page_hero_subtitle = "Edits land in <code style=&quot;color:#fff;background:rgba(255,255,255,0.15);padding:1px 6px;border-radius:4px&quot;>instance.yaml</code>. Save triggers an app restart (~10s downtime). Secret values are masked here — re-enter them to change." %}
{% include "_page_hero.html" %}
</div>
</div>

View file

@ -6,7 +6,10 @@
<header class="obs-topbar">
<div class="obs-topbar-left">
<h1 class="obs-title">Session transcript</h1>
{% set page_hero_eyebrow = "Activity Center" %}
{% set page_hero_title = "Session transcript" %}
{% set page_hero_subtitle = "Per-session JSONL viewer." %}
{% include "_page_hero.html" %}
<p class="obs-subtitle">
<a href="/admin/sessions">← All sessions</a>
&nbsp;·&nbsp; <code>{{ username }}/{{ session_file }}</code>
@ -31,7 +34,6 @@
.obs-page { font: 14px/1.5 var(--font-sans, system-ui); color: var(--text-primary, #111827); }
.obs-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
padding: 12px 0 20px; border-bottom: 1px solid var(--border, #e5e7eb); margin-bottom: 16px; }
.obs-title { margin: 0 0 4px 0; font-size: 22px; font-weight: 600; }
.obs-subtitle { margin: 0 0 10px; color: var(--text-secondary, #6b7280); font-size: 13px; }
.obs-subtitle a { color: #2563eb; text-decoration: none; }
.obs-subtitle a:hover { text-decoration: underline; }

View file

@ -6,7 +6,10 @@
<header class="obs-topbar">
<div class="obs-topbar-left">
<h1 class="obs-title">Sessions</h1>
{% set page_hero_eyebrow = "Activity Center" %}
{% set page_hero_title = "Sessions" %}
{% set page_hero_subtitle = "Every collected JSONL across users plus a transcript viewer with next-error navigation." %}
{% include "_page_hero.html" %}
<p class="obs-subtitle">All Claude Code sessions across every user. Also available locally for analysis. Click any row to read the full transcript; tick <b>Errors only</b> to surface sessions where tools failed.</p>
<div class="obs-narrative" id="sx-narrative">Loading…</div>
</div>
@ -91,7 +94,6 @@
.obs-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
padding: 12px 0 20px; border-bottom: 1px solid var(--border, #e5e7eb); margin-bottom: 16px; }
.obs-topbar-left { flex: 1; min-width: 0; }
.obs-title { margin: 0 0 4px 0; font-size: 22px; font-weight: 600; }
.obs-subtitle { margin: 0 0 10px; color: var(--text-secondary, #6b7280); font-size: 13px; max-width: 720px; }
.obs-subtitle b { color: var(--text-primary, #111827); }
.obs-narrative { font-size: 16px; line-height: 1.45; }

View file

@ -46,14 +46,7 @@
.badge.archived { background: #e5e7eb; color: #374151; }
.badge.deleted { background: #4b5563; color: #f3f4f6; }
table.sub-table { width: 100%; border-collapse: collapse; font-size: 12px; }
table.sub-table th, table.sub-table td {
text-align: left; padding: 6px 10px;
border-bottom: 1px solid var(--border-light, #f3f4f6);
vertical-align: top;
}
table.sub-table th { color: var(--text-secondary, #6b7280); text-transform: uppercase; letter-spacing: 0.4px; font-size: 10px; }
table.sub-table code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
table.data-table code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
ul.issues { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-secondary, #6b7280); }
.det-summary { font-size: 14px; line-height: 1.5; margin: 8px 0 12px 0; }
@ -76,14 +69,6 @@
}
.det-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.btn {
padding: 6px 14px; border-radius: 6px; border: 1px solid var(--border, #e5e7eb);
background: var(--surface, #fff); cursor: pointer;
font-size: 13px; font-weight: 500; color: var(--text, #111827);
}
.btn.primary { background: var(--text, #111827); color: var(--surface, #fff); border-color: var(--text, #111827); }
.btn.danger { color: #b91c1c; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.empty-msg { font-size: 13px; color: var(--text-secondary, #6b7280); font-style: italic; }
@ -122,18 +107,7 @@
@keyframes spin { to { transform: rotate(360deg); } }
.pending-banner .elapsed { color: #92400e; opacity: 0.7; font-variant-numeric: tabular-nums; margin-left: auto; }
/* Toast — short-lived "action queued" message after rescan/retry.
Fades out so admins know the request was accepted before the page
reloads on completion. */
.toast {
position: fixed; bottom: 24px; right: 24px;
background: var(--text, #111827); color: var(--surface, #fff);
padding: 10px 16px; border-radius: 8px;
font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,0.18);
opacity: 0; transition: opacity .25s ease;
z-index: 9999;
}
.toast.show { opacity: 1; }
</style>
<div class="det-page page-shell">
@ -254,19 +228,19 @@
{# Action buttons — same JSON endpoints as the list page. #}
<div class="det-actions">
{% if sub.status in ['blocked_inline','blocked_llm','review_error'] and sub.entity_id %}
<button class="btn primary" data-action="override" title="Force-publish this entity. Requires reason; recorded in audit_log.">Override + publish</button>
<button class="btn btn-primary" data-action="override" title="Force-publish this entity. Requires reason; recorded in audit_log.">Override + publish</button>
{% endif %}
{% if sub.entity_id %}
<button class="btn" data-action="rescan" title="Re-run all checks (inline + LLM) against the current bundle. Use after check rules change.">Rescan</button>
<button class="btn btn-secondary" data-action="rescan" title="Re-run all checks (inline + LLM) against the current bundle. Use after check rules change.">Rescan</button>
{% endif %}
{% if sub.entity_id and not sub.bundle_purged_at %}
<a class="btn" href="/api/admin/store/submissions/{{ sub.id }}/bundle.zip"
<a class="btn btn-secondary" href="/api/admin/store/submissions/{{ sub.id }}/bundle.zip"
title="Download the on-disk bundle as a ZIP for forensic inspection. Audit-logged.">Download bundle</a>
{% endif %}
{% if sub.status in ['review_error','blocked_llm'] and sub.entity_id %}
<button class="btn" data-action="retry" title="Re-queue LLM review only (skips inline checks).">Retry LLM</button>
<button class="btn btn-secondary" data-action="retry" title="Re-queue LLM review only (skips inline checks).">Retry LLM</button>
{% endif %}
<button class="btn danger" data-action="delete">Delete</button>
<button class="btn btn-danger" data-action="delete">Delete</button>
</div>
{# Help text: explain why override isn't shown on this row, when applicable. #}
{% if sub.status == 'approved' %}
@ -375,7 +349,7 @@
<div class="det-card">
<h2>Static security scan{{ _vchip() }} {% if ic.static_security %}<span class="badge {{ ic.static_security.status or 'pass' }}">{{ ic.static_security.status or 'pass' }}</span>{% endif %}</h2>
{% if ic.static_security and ic.static_security.findings %}
<table class="sub-table">
<table class="data-table">
<thead>
<tr><th>Severity</th><th>Category</th><th>File:line</th><th>Reason</th><th>Snippet</th></tr>
</thead>
@ -430,7 +404,7 @@
<p class="det-summary">{{ sub.llm_findings.summary }}</p>
{% endif %}
{% if sub.llm_findings.findings %}
<table class="sub-table">
<table class="data-table">
<thead>
<tr><th>Severity</th><th>Category</th><th>File</th><th>Explanation</th><th>Fix hint</th></tr>
</thead>
@ -473,18 +447,7 @@
const subId = {{ sub.id|tojson }};
const currentStatus = {{ sub.status|tojson }};
// Fire-and-forget toast in the bottom-right.
function toast(msg, ms) {
const el = document.createElement('div');
el.className = 'toast';
el.textContent = msg;
document.body.appendChild(el);
requestAnimationFrame(() => el.classList.add('show'));
setTimeout(() => {
el.classList.remove('show');
setTimeout(() => el.remove(), 300);
}, ms || 3500);
}
function toast(msg) { window.appToast({ kind: 'info', msg }); }
// Tick the "Xs / Xm Ys" elapsed counter on the pending banner.
function startElapsedTicker() {

View file

@ -5,9 +5,6 @@
<style>
/* Width + padding come from .page-shell (style-custom.css) — same
1280px container as /dashboard, /marketplace, /admin/* peers. */
.subs-title { margin: 0 0 8px 0; font-size: 22px; font-weight: 600; }
.subs-help { color: var(--text-secondary, #6b7280); font-size: 13px; margin-bottom: 20px; }
.subs-help code { background: var(--border-light, #f3f4f6); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.subs-form {
display: grid;
@ -166,17 +163,10 @@
{%- endmacro %}
<div class="subs-page page-shell">
<h1 class="subs-title">Store submissions</h1>
<p class="subs-help">
Every upload to <code>/api/store/entities</code> writes one row here. Inline
checks (manifest, static security, quality+templating) run synchronously;
the LLM security review runs in the background and flips
<code>pending_llm → approved</code> or <code>blocked_llm</code>. Click a
row to see the full check breakdown. Override a blocked submission to
force-publish (audit trail captured), retry a <code>review_error</code>,
or delete spam outright. See <code>docs/STORE_GUARDRAILS.md</code>.
</p>
{% set page_hero_eyebrow = "Agent Experience" %}
{% set page_hero_title = "Flea Submissions" %}
{% set page_hero_subtitle = "Plugin / skill / agent submissions awaiting review." %}
{% include "_page_hero.html" %}
<form class="subs-form" method="get" action="/admin/store/submissions">
{# Preserve status filter when submitting other filters. #}
{% if status_filter %}<input type="hidden" name="status" value="{{ status_filter }}">{% endif %}

View file

@ -1,16 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Table Management - {{ config.INSTANCE_NAME }}</title>
{% if not config.THEME_FONT_URL %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
{% endif %}
<link rel="stylesheet" href="{{ url_for('static', filename='style-custom.css') }}">
<style>
{% extends "base.html" %}
{% block title %}Table Management - {{ config.INSTANCE_NAME }}{% endblock %}
{% block body_attrs %}data-source-type="{{ data_source_type }}"{% endblock %}
{% block head_extra %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
/* Colors - Design System */
--primary: #0073D1;
@ -860,14 +858,10 @@
margin-bottom: 16px;
}
</style>
{% include '_theme.html' %}
</head>
<body data-source-type="{{ data_source_type }}">
{% endblock %}
<!-- ═══════════════ HEADER ═══════════════ -->
{% include '_app_header.html' %}
<!-- ═══════════════ PAGE TITLE ═══════════════ -->
{% block layout %}
<!-- ═══════════════ PAGE TITLE ═══════════════ -->
<div class="page-title">
<h1>Table Management</h1>
<p>Discover, register, and manage data tables from your source</p>
@ -1763,7 +1757,10 @@
<footer class="footer">
<a href="{{ url_for('dashboard') }}">Back to Dashboard</a>
</footer>
<script>
{% endblock %}
{% block scripts %}
<script>
/* ═══════════════════════════════════════════════════════════════
Admin Tables - JavaScript
═══════════════════════════════════════════════════════════════ */
@ -3558,6 +3555,4 @@
document.addEventListener('DOMContentLoaded', cacheWarmupInit);
</script>
{% include "_version_badge.html" %}
</body>
</html>
{% endblock %}

View file

@ -554,35 +554,6 @@
justify-content: flex-end;
margin-top: 24px;
}
.modal-btn {
padding: 10px 18px;
border-radius: 8px;
font-size: 13.5px;
font-weight: 500;
font-family: var(--font-primary, inherit);
cursor: pointer;
transition: all 0.15s ease;
border: 1px solid var(--border, #e5e7eb);
background: var(--surface, #fff);
color: var(--text-primary, #1A253C);
}
.modal-btn:hover {
border-color: #cbd5e1;
background: var(--background, #F5F7FA);
}
.modal-btn.danger {
background: #dc2626;
color: #fff;
border-color: #dc2626;
}
.modal-btn.danger:hover {
background: #b91c1c;
border-color: #b91c1c;
}
.modal-btn:focus-visible {
outline: 2px solid #0073D1;
outline-offset: 2px;
}
/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast-stack {
@ -768,8 +739,8 @@
</p>
<div class="modal-meta" id="confirm-meta" aria-hidden="true"></div>
<div class="modal-actions">
<button class="modal-btn" id="confirm-cancel-btn" data-close-modal="confirm-modal">Cancel</button>
<button class="modal-btn danger" id="confirm-ok-btn">Revoke token</button>
<button class="btn btn-secondary" id="confirm-cancel-btn" data-close-modal="confirm-modal">Cancel</button>
<button class="btn btn-danger" id="confirm-ok-btn">Revoke token</button>
</div>
</div>
</div>

View file

@ -6,7 +6,10 @@
<header class="obs-topbar">
<div class="obs-topbar-left">
<h1 class="obs-title">Telemetry</h1>
{% set page_hero_eyebrow = "Activity Center" %}
{% set page_hero_title = "Telemetry" %}
{% set page_hero_subtitle = "Claude Code tool / skill / agent / slash-command invocations across users." %}
{% include "_page_hero.html" %}
<p class="obs-subtitle">Tool and skill invocations from Claude Code. Also available locally for analysis. For server-side admin / API audit events, see <a href="/admin/activity">Audit log</a>.</p>
<div class="obs-narrative" id="usage-narrative">Loading…</div>
</div>
@ -109,7 +112,6 @@
.obs-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
padding: 12px 0 20px; border-bottom: 1px solid var(--border, #e5e7eb); margin-bottom: 16px; }
.obs-topbar-left { flex: 1; min-width: 0; }
.obs-title { margin: 0 0 4px 0; font-size: 22px; font-weight: 600; color: var(--text-primary, #111827); }
.obs-subtitle { margin: 0 0 10px; color: var(--text-secondary, #6b7280); font-size: 13px; max-width: 720px; }
.obs-subtitle a { color: #2563eb; text-decoration: none; border-bottom: 1px dashed currentColor; }
.obs-subtitle a:hover { border-bottom-style: solid; }

View file

@ -17,12 +17,6 @@
}
.ud-back:hover { color: var(--text-primary, #111827); }
.ud-title-block { flex: 1; }
.ud-title { font-size: 22px; font-weight: 600; margin: 0; }
.ud-subtitle {
font-size: 13px; color: var(--text-secondary, #6b7280);
font-family: var(--font-mono, ui-monospace, monospace);
margin-top: 2px;
}
.ud-status-pill {
display: inline-block; padding: 3px 10px; border-radius: 999px;
font-size: 11px; font-weight: 600;
@ -218,12 +212,10 @@
<div class="ud-header">
<a href="/admin/users" class="ud-back">← Back to users</a>
<div class="ud-title-block">
<h1 class="ud-title">
{{ target_user.name or target_user.email }}
<span id="status-pill" class="ud-status-pill"
style="display:none; vertical-align: middle; margin-left: 8px;"></span>
</h1>
<div class="ud-subtitle">{{ target_user.email }} · id {{ target_user.id[:8] }}…</div>
{% set page_hero_eyebrow = "Users & Access" %}
{% set page_hero_title = "User detail" %}
{% set page_hero_subtitle = "Account, group memberships, sessions, and activity for one user." %}
{% include "_page_hero.html" %}
</div>
</div>

View file

@ -10,39 +10,7 @@
display: flex; justify-content: space-between; align-items: center;
gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.users-title { margin: 0; font-size: 22px; font-weight: 600; }
.users-search {
flex: 1; max-width: 360px;
padding: 8px 12px 8px 36px;
border: 1px solid var(--border, #e5e7eb);
border-radius: 8px;
font-size: 13px;
background: var(--surface, #fff) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.35-4.35'/></svg>") no-repeat 12px center;
}
.users-search:focus { outline: 2px solid var(--primary, #6366f1); outline-offset: -1px; }
.users-table-wrap {
background: var(--surface, #fff);
border: 1px solid var(--border, #e5e7eb);
border-radius: 12px;
overflow-x: auto;
}
.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table thead th {
text-align: left; padding: 12px 16px;
background: var(--border-light, #f9fafb);
border-bottom: 1px solid var(--border, #e5e7eb);
font-weight: 600; color: var(--text-secondary, #6b7280);
font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
}
.users-table tbody td {
padding: 12px 16px;
border-bottom: 1px solid var(--border-light, #f3f4f6);
vertical-align: middle;
}
.users-table tbody tr:last-child td { border-bottom: none; }
.users-table tbody tr.is-deactivated { opacity: 0.55; }
.users-table tbody tr:hover { background: var(--border-light, #fafafa); }
/* Whole user-info cell is the click target for the detail page —
anchor wraps avatar + name + email so the entire block lights up
@ -161,16 +129,6 @@
}
.modal-card input:focus, .modal-card select:focus { outline: 2px solid var(--primary, #6366f1); outline-offset: -1px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal-btn {
padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
border: 1px solid var(--border, #e5e7eb); background: var(--surface, #fff);
cursor: pointer; transition: all 0.15s;
}
.modal-btn:hover { background: var(--border-light, #f9fafb); }
.modal-btn.primary { background: var(--primary, #6366f1); color: #fff; border-color: var(--primary, #6366f1); }
.modal-btn.primary:hover { filter: brightness(1.05); }
.modal-btn.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.modal-btn.danger:hover { filter: brightness(1.05); }
.token-reveal {
margin: 12px 0;
@ -208,13 +166,16 @@
<div class="users-page">
<div class="users-toolbar">
<h2 class="users-title">Users</h2>
<input id="user-search" type="search" class="users-search" placeholder="Filter by email or name…" autocomplete="off">
<button class="modal-btn primary" id="open-create-btn">+ Add user</button>
{% set page_hero_eyebrow = "Users & Access" %}
{% set page_hero_title = "Users" %}
{% set page_hero_subtitle = "Manage analyst accounts and group membership." %}
{% include "_page_hero.html" %}
<input id="user-search" type="search" class="search-input" placeholder="Filter by email or name…" autocomplete="off">
<button class="btn btn-primary" id="open-create-btn">+ Add user</button>
</div>
<div class="users-table-wrap">
<table class="users-table" id="users-table">
<div class="data-table-wrap">
<table class="data-table" id="users-table">
<thead>
<tr>
<th>User</th>
@ -254,8 +215,8 @@
Send invitation link (generates setup token, emails it if transport is configured)
</label>
<div class="modal-actions">
<button class="modal-btn" data-close-modal="create-modal">Cancel</button>
<button class="modal-btn primary" id="confirm-create-btn">Create</button>
<button class="btn btn-secondary" data-close-modal="create-modal">Cancel</button>
<button class="btn btn-primary" id="confirm-create-btn">Create</button>
</div>
</div>
</div>
@ -268,8 +229,8 @@
<label for="setpwd-input">New password (min 8 chars)</label>
<input id="setpwd-input" type="password" autocomplete="new-password">
<div class="modal-actions">
<button class="modal-btn" data-close-modal="setpwd-modal">Cancel</button>
<button class="modal-btn primary" id="confirm-setpwd-btn">Set password</button>
<button class="btn btn-secondary" data-close-modal="setpwd-modal">Cancel</button>
<button class="btn btn-primary" id="confirm-setpwd-btn">Set password</button>
</div>
</div>
</div>
@ -285,7 +246,7 @@
<button class="copy-btn" id="reset-copy-btn">Copy</button>
</div>
<div class="modal-actions">
<button class="modal-btn primary" data-close-modal="reset-modal">Done</button>
<button class="btn btn-primary" data-close-modal="reset-modal">Done</button>
</div>
</div>
</div>
@ -301,7 +262,7 @@
<button class="copy-btn" id="invite-copy-btn">Copy</button>
</div>
<div class="modal-actions">
<button class="modal-btn primary" data-close-modal="invite-modal">Done</button>
<button class="btn btn-primary" data-close-modal="invite-modal">Done</button>
</div>
</div>
</div>
@ -312,8 +273,8 @@
<h3 id="confirm-title">Are you sure?</h3>
<p class="sub" id="confirm-text"></p>
<div class="modal-actions">
<button class="modal-btn" data-close-modal="confirm-modal">Cancel</button>
<button class="modal-btn danger" id="confirm-ok-btn">Confirm</button>
<button class="btn btn-secondary" data-close-modal="confirm-modal">Cancel</button>
<button class="btn btn-danger" id="confirm-ok-btn">Confirm</button>
</div>
</div>
</div>

View file

@ -27,8 +27,6 @@
display: flex; justify-content: space-between; align-items: center;
gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.welcome-title { margin: 0; font-size: 22px; font-weight: 600; }
.welcome-sub { color: var(--text-secondary, #6b7280); font-size: 13px; margin-top: 4px; margin-bottom: 0; }
.origin-chip {
display: inline-block;
@ -188,12 +186,6 @@
.modal-card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.modal-card p.sub { margin: 0 0 18px; font-size: 13px; color: var(--text-secondary, #6b7280); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal-btn {
padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
border: 1px solid var(--border, #e5e7eb); background: var(--surface, #fff);
cursor: pointer;
}
.modal-btn.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
/* Toast stack */
.toast-stack {
@ -214,8 +206,10 @@
<div class="welcome-page">
<div class="welcome-toolbar">
<div>
<h2 class="welcome-title">Init Prompt</h2>
<p class="welcome-sub">The bash setup script shown on <code>/setup</code> and copied by the dashboard CTA.</p>
{% set page_hero_eyebrow = "Agent Experience" %}
{% set page_hero_title = "Init Prompt" %}
{% set page_hero_subtitle = "Welcome shown to analysts at <code style=&quot;color:#fff;background:rgba(255,255,255,0.15);padding:1px 6px;border-radius:4px&quot;>agnes init</code>. Overrides the OSS default." %}
{% include "_page_hero.html" %}
</div>
<div id="status-chip">
{% if is_override %}
@ -290,8 +284,8 @@
<h3 id="reset-modal-title">Reset to default?</h3>
<p class="sub">Your override will be permanently removed. The auto-generated bash bootstrap script will be shown on <code>/setup</code> instead. This cannot be undone.</p>
<div class="modal-actions">
<button class="modal-btn" data-close-modal="reset-modal">Cancel</button>
<button class="modal-btn danger" id="reset-confirm-btn">Reset</button>
<button class="btn btn-secondary" data-close-modal="reset-modal">Cancel</button>
<button class="btn btn-danger" id="reset-confirm-btn">Reset</button>
</div>
</div>
</div>

View file

@ -27,8 +27,6 @@
display: flex; justify-content: space-between; align-items: center;
gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.welcome-title { margin: 0; font-size: 22px; font-weight: 600; }
.welcome-sub { color: var(--text-secondary, #6b7280); font-size: 13px; margin-top: 4px; margin-bottom: 0; }
.origin-chip {
display: inline-block;
@ -188,12 +186,6 @@
.modal-card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.modal-card p.sub { margin: 0 0 18px; font-size: 13px; color: var(--text-secondary, #6b7280); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.modal-btn {
padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500;
border: 1px solid var(--border, #e5e7eb); background: var(--surface, #fff);
cursor: pointer;
}
.modal-btn.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
/* Toast stack */
.toast-stack {
@ -214,8 +206,10 @@
<div class="welcome-page">
<div class="welcome-toolbar">
<div>
<h2 class="welcome-title">Workspace Prompt</h2>
<p class="welcome-sub">Customize the <code>CLAUDE.md</code> Claude Code reads when it opens the analyst workspace.</p>
{% set page_hero_eyebrow = "Agent Experience" %}
{% set page_hero_title = "Workspace Prompt" %}
{% set page_hero_subtitle = "CLAUDE.md template injected into each analyst workspace. Overrides the OSS default." %}
{% include "_page_hero.html" %}
</div>
<div id="status-chip">
{% if is_override %}
@ -314,8 +308,8 @@
<h3 id="reset-modal-title">Reset to default?</h3>
<p class="sub">Your override will be permanently removed. The rich default CLAUDE.md briefing will be written to analyst workspaces instead. This cannot be undone.</p>
<div class="modal-actions">
<button class="modal-btn" data-close-modal="reset-modal">Cancel</button>
<button class="modal-btn danger" id="reset-confirm-btn">Reset</button>
<button class="btn btn-secondary" data-close-modal="reset-modal">Cancel</button>
<button class="btn btn-danger" id="reset-confirm-btn">Reset</button>
</div>
</div>
</div>

View file

@ -4,12 +4,14 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Data Analyst Portal{% endblock %}</title>
<link rel="stylesheet" href="{{ static_url('style.css') }}">
<link rel="stylesheet" href="{{ static_url('style-custom.css') }}">
{# app.js loaded by _app_header.html itself so standalone pages
(catalog, corporate-memory, install, admin_tables) that don't
extend base.html also get the nav-dropdown wiring. #}
{% block head_extra %}{% endblock %}
{% include '_theme.html' %}
</head>
<body>
<body {% block body_attrs %}{% endblock %}>
{% include '_app_header.html' %}
{# `layout` block: pages opt out of the narrow .container wrap by overriding

View file

@ -4,7 +4,6 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Data Analyst Portal{% endblock %}</title>
<link rel="stylesheet" href="{{ static_url('style.css') }}">
<link rel="stylesheet" href="{{ static_url('style-custom.css') }}">
{% include '_theme.html' %}
</head>

View file

@ -1,16 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Data Catalog - Data Analyst Portal</title>
{% if not config.THEME_FONT_URL %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
{% endif %}
<link rel="stylesheet" href="{{ url_for('static', filename='style-custom.css') }}">
<style>
{% extends "base.html" %}
{% block title %}Data Packages - Data Analyst Portal{% endblock %}
{% block head_extra %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
/* Colors - Design System */
--primary: #0073D1;
@ -111,27 +107,12 @@
}
/* ── Page Title ── */
.page-title {
max-width: 900px;
margin: 0 auto;
padding: 32px 24px 24px;
}
.page-title h1 {
font-size: 24px;
font-weight: 800;
color: var(--text-primary);
margin-bottom: 4px;
}
.page-title p {
font-size: 14px;
color: var(--text-secondary);
}
/* ── Source Cards ── */
.source-cards {
max-width: 900px;
max-width: var(--width-app);
margin: 0 auto;
padding: 0 24px 32px;
display: flex;
@ -1336,23 +1317,17 @@
font-size: 13px;
}
</style>
<link rel="stylesheet" href="{{ url_for('static', filename='style-custom.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/metric_modal.css', v=git_version) }}">
<!-- Prism.js for SQL syntax highlighting -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism.min.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.7/dist/chart.umd.min.js"></script>
{% include '_theme.html' %}
</head>
<body>
<link rel="stylesheet" href="{{ url_for('static', filename='css/metric_modal.css', v=git_version) }}">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism.min.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.7/dist/chart.umd.min.js"></script>
{% endblock %}
<!-- ═══════════════ HEADER ═══════════════ -->
{% include '_app_header.html' %}
<!-- ═══════════════ PAGE TITLE ═══════════════ -->
<div class="page-title">
<h1>Data Catalog</h1>
<p>Browse available data sources and manage your subscriptions</p>
</div>
{% block layout %}
<!-- ═══════════════ PAGE TITLE ═══════════════ -->
{% set page_hero_eyebrow = "Data" %}
{% set page_hero_title = "Data Packages" %}
{% set page_hero_subtitle = "Browse the data sources available to your AI agents." %}
{% include "_page_hero.html" %}
<!-- ═══════════════ SOURCE CARDS ═══════════════ -->
<div class="source-cards">
@ -1381,13 +1356,6 @@
</div>
</div>
</div>
<div class="source-card-right">
<span class="badge-included">Always included</span>
<label class="toggle-switch locked">
<input type="checkbox" checked disabled>
<span class="toggle-slider"></span>
</label>
</div>
</div>
{% for category in catalog_data %}
@ -1496,13 +1464,6 @@
<div class="source-card-meta">{{ metrics_total.n }} metrics &middot; {{ metrics_data|length }} categories</div>
</div>
</div>
<div class="source-card-right">
<span class="badge-included">Always included</span>
<label class="toggle-switch locked">
<input type="checkbox" checked disabled>
<span class="toggle-slider"></span>
</label>
</div>
</div>
{% if data_stats and data_stats.last_updated %}
@ -1608,6 +1569,56 @@
<footer class="footer">
<p>&copy; {{ config.INSTANCE_COPYRIGHT or 'AI Data Analyst' }} &middot; Updated daily</p>
</footer>
<!-- ═══════════════ METRIC MODAL ═══════════════ -->
<div id="metricModalOverlay" class="metric-modal-overlay">
<div id="metricModal" class="metric-modal" onclick="event.stopPropagation()">
<!-- Header -->
<div class="metric-modal-header">
<div class="metric-modal-title-section">
<h2 id="metricModalTitle" class="metric-modal-title"></h2>
<div id="metricModalMetadata" class="metric-metadata-chips"></div>
</div>
<button class="metric-modal-close" onclick="closeMetricModal()" aria-label="Close modal">
<svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
</div>
<!-- Tabs -->
<nav class="metric-tabs">
<button class="metric-tab active" data-tab="tabOverview" onclick="switchMetricTab('tabOverview')">
Overview
</button>
<button class="metric-tab" data-tab="tabHowToUse" onclick="switchMetricTab('tabHowToUse')">
How to Use
</button>
<button class="metric-tab" data-tab="tabSQLExamples" onclick="switchMetricTab('tabSQLExamples')">
SQL Examples
</button>
<button class="metric-tab" data-tab="tabTechnical" onclick="switchMetricTab('tabTechnical')">
Metric Details
</button>
</nav>
<!-- Body -->
<div id="metricModalBody" class="metric-modal-body">
<!-- Content loaded dynamically -->
</div>
</div>
</div>
<!-- Prism.js for SQL syntax highlighting -->
<!-- Mermaid.js for relationship diagrams -->
{% endblock %}
{% block scripts %}
<script>
/* ═══════════════ ACCORDION ═══════════════ */
function toggleAccordion(trigger) {
@ -2476,52 +2487,9 @@ document.addEventListener('keydown', e => {
});
})();
</script>
<!-- ═══════════════ METRIC MODAL ═══════════════ -->
<div id="metricModalOverlay" class="metric-modal-overlay">
<div id="metricModal" class="metric-modal" onclick="event.stopPropagation()">
<!-- Header -->
<div class="metric-modal-header">
<div class="metric-modal-title-section">
<h2 id="metricModalTitle" class="metric-modal-title"></h2>
<div id="metricModalMetadata" class="metric-metadata-chips"></div>
</div>
<button class="metric-modal-close" onclick="closeMetricModal()" aria-label="Close modal">
<svg fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
</div>
<!-- Tabs -->
<nav class="metric-tabs">
<button class="metric-tab active" data-tab="tabOverview" onclick="switchMetricTab('tabOverview')">
Overview
</button>
<button class="metric-tab" data-tab="tabHowToUse" onclick="switchMetricTab('tabHowToUse')">
How to Use
</button>
<button class="metric-tab" data-tab="tabSQLExamples" onclick="switchMetricTab('tabSQLExamples')">
SQL Examples
</button>
<button class="metric-tab" data-tab="tabTechnical" onclick="switchMetricTab('tabTechnical')">
Metric Details
</button>
</nav>
<!-- Body -->
<div id="metricModalBody" class="metric-modal-body">
<!-- Content loaded dynamically -->
</div>
</div>
</div>
<!-- Prism.js for SQL syntax highlighting -->
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-sql.min.js"></script>
<script src="{{ url_for('static', filename='js/metric_modal.js', v=git_version) }}"></script>
<!-- Mermaid.js for relationship diagrams -->
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
mermaid.initialize({
@ -2548,6 +2516,4 @@ document.addEventListener('keydown', e => {
// Expose mermaid globally for lazy rendering
window.mermaid = mermaid;
</script>
{% include "_version_badge.html" %}
</body>
</html>
{% endblock %}

View file

@ -1,16 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Curated Memory — Admin</title>
{% if not config.THEME_FONT_URL %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
{% endif %}
<link rel="stylesheet" href="{{ url_for('static', filename='style-custom.css') }}">
<style>
{% extends "base.html" %}
{% block title %}Curated Memory — Admin{% endblock %}
{% block head_extra %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
/* Corporate Memory Page - Design System Styles */
.container-memory {
max-width: 1000px;
@ -593,13 +589,10 @@
}
}
</style>
{% include '_theme.html' %}
</head>
<body>
<!-- Header (outside container so it spans full viewport, matching dashboard) -->
{% include '_app_header.html' %}
{% endblock %}
<div class="container-memory">
{% block layout %}
<div class="container-memory">
{# Match the obs-page header pattern used by /admin/activity,
/admin/telemetry and /admin/sessions so admins see one
consistent visual chrome across the Activity Center + Agent
@ -826,8 +819,10 @@
</div>
{% endif %}
</div>
{% endblock %}
<script>
{% block scripts %}
<script>
// Store user votes locally for UI updates
let userVotes = {{ user_votes | tojson }};
let currentPage = {{ knowledge.page }};
@ -1108,6 +1103,4 @@
}
}
</script>
{% include "_version_badge.html" %}
</body>
</html>
{% endblock %}

View file

@ -1,16 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Corporate Memory Admin - Data Analyst Portal</title>
{% if not config.THEME_FONT_URL %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
{% endif %}
<link rel="stylesheet" href="{{ url_for('static', filename='style-custom.css') }}">
<style>
{% extends "base.html" %}
{% block title %}Corporate Memory Admin - Data Analyst Portal{% endblock %}
{% block head_extra %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
/* Corporate Memory Admin - Design System Styles */
.container-memory {
max-width: 1000px;
@ -563,42 +559,10 @@
}
/* Audit Log Table */
.audit-table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-xl);
overflow: hidden;
box-shadow: var(--shadow-sm);
}
.audit-table th {
padding: var(--space-3) var(--space-4);
text-align: left;
font-size: var(--text-xs);
font-weight: var(--font-semibold);
color: var(--text-secondary);
text-transform: uppercase;
background: var(--background);
border-bottom: 1px solid var(--border);
}
.audit-table td {
padding: var(--space-3) var(--space-4);
font-size: var(--text-sm);
color: var(--text-primary);
border-bottom: 1px solid var(--border-light);
}
.audit-table tr:last-child td {
border-bottom: none;
}
.audit-table tr:hover td {
background: var(--border-light);
}
.action-badge {
display: inline-flex;
@ -827,23 +791,16 @@
flex-wrap: wrap;
}
.audit-table {
display: block;
overflow-x: auto;
}
.shortcut-hint {
display: none !important;
}
}
</style>
{% include '_theme.html' %}
</head>
<body>
<!-- Header (outside container so it spans full viewport, matching dashboard) -->
{% include '_app_header.html' %}
{% endblock %}
<div class="container-memory">
{% block layout %}
<div class="container-memory">
<!-- Stats Bar -->
<div class="stats-bar">
<div class="stat-item highlight">
@ -1145,8 +1102,10 @@
<!-- Toast notification -->
<div id="toast" class="toast"></div>
{% endblock %}
<script>
{% block scripts %}
<script>
// Configuration passed from server
const GROUPS = {{ groups | tojson }};
const GOVERNANCE_MODE = {{ governance_mode | tojson }};
@ -1896,7 +1855,7 @@
}).join('');
content.innerHTML = `
<table class="audit-table">
<table class="data-table">
<thead>
<tr>
<th>Timestamp</th>
@ -2220,6 +2179,4 @@
loadReviewQueue(1);
</script>
{% include "_version_badge.html" %}
</body>
</html>
{% endblock %}

File diff suppressed because it is too large Load diff

View file

@ -1,16 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Setup local agent — {{ config.INSTANCE_NAME }}</title>
{% if not config.THEME_FONT_URL %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
{% endif %}
<link rel="stylesheet" href="{{ url_for('static', filename='style-custom.css') }}">
<style>
{% extends "base.html" %}
{% block title %}Setup local agent — {{ config.INSTANCE_NAME }}{% endblock %}
{% block head_extra %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
/* ── Header (shared visual style with dashboard.html) ── */
.header {
background: var(--surface);
@ -644,14 +640,10 @@
.setup-banner > *:first-child { margin-top: 0; }
.setup-banner > *:last-child { margin-bottom: 0; }
</style>
{% include '_theme.html' %}
</head>
<body>
{% endblock %}
<!-- ═══════════════ HEADER ═══════════════ -->
{% include '_app_header.html' %}
{% with messages = get_flashed_messages(with_categories=true) %}
{% block layout %}
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="flash-messages">
{% for category, message in messages %}
@ -934,8 +926,10 @@
<footer class="footer">
<p>&copy; {{ now().year if now is defined else 2024 }} {{ config.INSTANCE_COPYRIGHT or 'AI Data Analyst' }}</p>
</footer>
{% endblock %}
<script>
{% block scripts %}
<script>
(function() {
function copyToClipboard(text) {
if (navigator.clipboard && window.isSecureContext) {
@ -1092,6 +1086,4 @@
};
})();
</script>
{% include "_version_badge.html" %}
</body>
</html>
{% endblock %}

View file

@ -145,22 +145,11 @@
.mp-actions { display: flex; gap: 8px; align-items: center; }
.mp-actions .btn {
appearance: none;
display: inline-flex; align-items: center; gap: 6px;
padding: 8px 14px;
border: 1px solid var(--border); background: var(--surface);
color: var(--text-primary); border-radius: 8px;
font-size: 13px; font-weight: 500; cursor: pointer;
font-family: var(--font-primary); text-decoration: none;
transition: all 0.15s ease;
}
.mp-actions .btn:hover { border-color: var(--primary); color: var(--primary); }
.mp-actions .btn.primary {
background: var(--primary); color: #fff; border-color: var(--primary);
}
.mp-actions .btn.primary:hover {
background: var(--primary-dark); border-color: var(--primary-dark); color: #fff;
}
/* ── Info block (curated trust badge + flea open-shelf signal) ───── */
.mp-curator-block {
@ -451,10 +440,10 @@
</button>
</div>
<div class="mp-actions">
<a class="btn" data-actions-for="curated" href="/marketplace/guide/curated">Submit a plugin</a>
<a class="btn btn-secondary" data-actions-for="curated" href="/marketplace/guide/curated">Submit a plugin</a>
<!-- Flea has a self-service +Upload button below — no second
"how to" CTA needed. Anyone uploads via the form directly. -->
<a class="btn primary" data-actions-for="flea" href="/store/new" hidden>+ Upload</a>
<a class="btn btn-primary" data-actions-for="flea" href="/store/new" hidden>+ Upload</a>
</div>
</div>

View file

@ -48,17 +48,7 @@
}
.kv .v.muted { color: #9ca3af; font-style: italic; }
.md-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.md-table th, .md-table td {
padding: 8px 14px; text-align: left;
border-bottom: 1px solid var(--border-light, #f3f4f6);
}
.md-table thead th {
background: var(--border-light, #f9fafb);
font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
color: var(--text-secondary, #6b7280); font-weight: 600;
}
.md-table tbody tr:last-child td { border-bottom: none; }
.src-chip {
display: inline-block; padding: 2px 8px; border-radius: 999px;
@ -79,12 +69,7 @@
.md-empty { color: #9ca3af; font-style: italic; font-size: 12px; }
.refetch-btn {
padding: 7px 12px; border-radius: 6px; font-size: 12px; font-weight: 500;
background: var(--primary, #6366f1); color: #fff;
border: 1px solid var(--primary, #6366f1); cursor: pointer;
}
.refetch-btn:disabled { opacity: 0.6; cursor: progress; }
.refetch-result { margin-top: 14px; }
.diff-add { color: #166534; }
@ -168,7 +153,7 @@
<span class="sub">{{ memberships|length }} row(s)</span>
</div>
{% if memberships %}
<table class="md-table">
<table class="data-table">
<thead><tr>
<th>Group</th><th>Linked to</th><th>Source</th><th>Added</th><th>Added by</th>
</tr></thead>
@ -202,7 +187,7 @@
<span class="sub">Distinct {{ grants|length }} grant(s) reachable via your groups.</span>
</div>
{% if grants %}
<table class="md-table">
<table class="data-table">
<thead><tr>
<th>Resource type</th><th>Resource id</th><th>Via group</th>
</tr></thead>
@ -238,7 +223,7 @@
</div>
<div style="margin-top:14px;">
<button id="refetch-btn" class="refetch-btn" type="button">
<button id="refetch-btn" class="btn btn-primary btn-sm" type="button">
Refetch from Google (dry-run)
</button>
<span id="refetch-status" style="margin-left:10px; font-size:12px; color:#6b7280;"></span>

View file

@ -504,35 +504,6 @@
justify-content: flex-end;
margin-top: 24px;
}
.modal-btn {
padding: 10px 18px;
border-radius: 8px;
font-size: 13.5px;
font-weight: 500;
font-family: var(--font-primary, inherit);
cursor: pointer;
transition: all 0.15s ease;
border: 1px solid var(--border, #e5e7eb);
background: var(--surface, #fff);
color: var(--text-primary, #1A253C);
}
.modal-btn:hover {
border-color: #cbd5e1;
background: var(--background, #F5F7FA);
}
.modal-btn.danger {
background: #dc2626;
color: #fff;
border-color: #dc2626;
}
.modal-btn.danger:hover {
background: #b91c1c;
border-color: #b91c1c;
}
.modal-btn:focus-visible {
outline: 2px solid #0073D1;
outline-offset: 2px;
}
/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast-stack {
@ -660,15 +631,6 @@
border-color: #0073D1;
box-shadow: 0 0 0 3px rgba(0, 115, 209, 0.15);
}
.modal-btn.primary {
background: #0073D1;
color: #fff;
border-color: #0073D1;
}
.modal-btn.primary:hover {
background: #0056A3;
border-color: #0056A3;
}
/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
@ -817,8 +779,8 @@
</p>
<div class="modal-meta" id="confirm-meta" aria-hidden="true"></div>
<div class="modal-actions">
<button class="modal-btn" id="confirm-cancel-btn" data-close-modal="confirm-modal">Cancel</button>
<button class="modal-btn danger" id="confirm-ok-btn">Revoke token</button>
<button class="btn btn-secondary" id="confirm-cancel-btn" data-close-modal="confirm-modal">Cancel</button>
<button class="btn btn-danger" id="confirm-ok-btn">Revoke token</button>
</div>
</div>
</div>
@ -846,8 +808,8 @@
</select>
</div>
<div class="modal-actions">
<button type="button" class="modal-btn" data-close-modal="create-modal">Cancel</button>
<button type="submit" class="modal-btn primary" id="create-submit-btn">Create token</button>
<button type="button" class="btn btn-secondary" data-close-modal="create-modal">Cancel</button>
<button type="submit" class="btn btn-primary" id="create-submit-btn">Create token</button>
</div>
</form>
</div>

View file

@ -5,7 +5,7 @@
<style>
.container:has(.sess-page) { max-width: none; padding: 24px 16px; }
.sess-page { max-width: 1200px; margin: 0 auto; padding: 0; }
.sess-title { margin: 0 0 8px 0; font-size: 22px; font-weight: 600; }
.sess-help { color: var(--text-secondary, #6b7280); font-size: 13px; margin-bottom: 20px; line-height: 1.55; }
.sess-help code { background: var(--border-light, #f3f4f6); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.sess-table-wrap {
@ -14,22 +14,7 @@
border-radius: 12px;
overflow-x: auto;
}
.sess-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sess-table thead th {
text-align: left; padding: 12px 16px;
background: var(--border-light, #f9fafb);
border-bottom: 1px solid var(--border, #e5e7eb);
font-weight: 600; color: var(--text-secondary, #6b7280);
font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
white-space: nowrap;
}
.sess-table tbody td {
padding: 10px 16px;
border-bottom: 1px solid var(--border-light, #f3f4f6);
vertical-align: middle;
}
.sess-table tbody tr:last-child td { border-bottom: none; }
.sess-table tbody tr:hover { background: var(--border-light, #fafafa); }
.sess-table .name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.sess-table .ts { white-space: nowrap; color: var(--text-secondary, #6b7280); font-variant-numeric: tabular-nums; }
.sess-table .num { text-align: right; font-variant-numeric: tabular-nums; }
@ -62,7 +47,10 @@
</style>
<div class="sess-page">
<h1 class="sess-title">My sessions</h1>
{% set page_hero_eyebrow = "Profile" %}
{% set page_hero_title = "My sessions" %}
{% set page_hero_subtitle = "Sessions uploaded via <code>agnes push</code> from Claude Code." %}
{% include "_page_hero.html" %}
<p class="sess-help">
Sessions you uploaded via <code>agnes push</code> from your Claude Code workspace, with
extraction status from the verification processor's rows in <code>session_processor_state</code>.
@ -77,7 +65,7 @@
<div class="sess-table-wrap">
{% if sessions %}
<table class="sess-table">
<table class="data-table">
<thead>
<tr>
<th>Session file</th>

View file

@ -44,16 +44,6 @@
}
.actions { display: flex; gap: 8px; margin-top: 20px; align-items: center; }
.btn-primary {
padding: 8px 18px; border-radius: 6px; border: none;
background: var(--primary, #0073D1); color: white;
font-size: 14px; font-weight: 500; cursor: pointer;
}
.btn-primary:disabled { background: var(--border, #d1d5db); cursor: not-allowed; }
.btn-link {
padding: 8px 12px; color: var(--text-secondary, #6b7280); text-decoration: none;
font-size: 14px;
}
.pending-banner {
margin: 12px 0 16px 0; padding: 14px 18px; border-radius: 10px;
@ -175,7 +165,7 @@
<div class="actions">
<button type="submit" class="btn-primary" id="save-btn"
{% if pending_sub %}disabled{% endif %}>Save</button>
<a href="/marketplace/flea/{{ entity.id }}" class="btn-link">Cancel</a>
<a href="/marketplace/flea/{{ entity.id }}" class="btn btn-secondary">Cancel</a>
</div>
</form>
</div>

View file

@ -178,36 +178,8 @@
}
.doc-add:hover { border-color: var(--primary, #0073D1); color: var(--primary, #0073D1); }
/* ── Buttons (mirror /setup primary CTA) ───────────────────────── */
/* ── Buttons ───────────────────────────────────────────────────── */
.actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.btn-primary {
display: inline-flex; align-items: center; gap: 8px;
font-family: var(--font-primary, inherit);
font-size: 14px; font-weight: 600; color: #fff;
background: var(--primary, #0073D1); border: none;
border-radius: 8px; padding: 11px 22px; cursor: pointer;
transition: all 0.15s ease;
}
.btn-primary:hover {
background: var(--primary-dark, #0056A3);
transform: translateY(-1px);
box-shadow: 0 4px 14px rgba(0, 115, 209, 0.25);
}
.btn-primary:disabled { opacity: 0.7; cursor: wait; transform: none; box-shadow: none; }
.btn-secondary {
appearance: none; padding: 10px 18px;
border: 1px solid var(--border, #d1d5db); background: #fff;
color: var(--text-secondary, #6b7280); border-radius: 8px;
font-size: 14px; font-weight: 500; cursor: pointer;
font-family: var(--font-primary, inherit);
transition: all 0.15s ease;
}
.btn-secondary:hover { border-color: var(--primary, #0073D1); color: var(--primary, #0073D1); }
.btn-link {
color: var(--text-secondary, #6b7280); text-decoration: none;
font-size: 13px; padding: 10px 8px;
}
.btn-link:hover { color: var(--text-primary, #111827); }
/* ── Status banner ─────────────────────────────────────────────── */
/* `display: flex` on .banner overrides the user-agent default for the
@ -447,7 +419,7 @@
<div class="actions">
<button type="button" class="btn-primary" id="next-btn">Next →</button>
<a href="/marketplace?tab=flea" class="btn-link">Cancel</a>
<a href="/marketplace?tab=flea" class="btn btn-secondary">Cancel</a>
</div>
</div>
</div>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,549 @@
# Standalone Pages → base.html Framework Migration Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. One PR continuation (`zs/design-pass`).
**Goal:** Migrate the 5 templates that currently ship their own `<html>`, `<head>`, `<body>` scaffold to extend `base.html`. After this lands, every page that includes `_app_header.html` shares ONE rendering pipeline — same font load, same theme include, same script load, same nav. The class of bug that surfaced today (dropdown JS dead on `/catalog`, `/admin/tables`, `/corporate-memory` because `<script src="app.js">` lived only in `base.html`) goes away permanently.
**Architecture:**
- Five pages have private `<head>` + `<body>` scaffolding (10 486 lines combined, of which ~4 169 are inline `<style>` blocks and ~4 201 are inline `<script>` blocks).
- `base.html` already exposes the right block surface: `title`, `head_extra`, `layout`, `content`, `scripts`.
- Migration is mechanical per page: convert `<html>...</html>``{% extends "base.html" %}{% block X %}...{% endblock %}`. No behavior change; same per-page CSS/JS, just hoisted into the right block.
- One small `base.html` change: add `{% block body_attrs %}{% endblock %}` so `admin_tables.html` can keep its `data-source-type` attr on `<body>`.
**Tech Stack:** FastAPI + Jinja2 templates, vanilla CSS, vanilla JS. Tests via pytest + agent-browser for visual smoke.
**Why now / why one PR:** The current `zs/design-pass` PR already touched all the affected pages (hero migration, dead-CSS sweep). Continuing the migration in the same PR keeps related changes together. Each per-page migration ships as its own commit so individual reverts stay surgical.
## Post-review revisions
External Plan-agent review flagged 8 must-fix items before execution. Applied:
1. **Script-extraction bug fixed**: original recipe used `script_m[-1]` which would pick the LAST inline `<script>` and drop earlier ones. Catalog has TWO (868-line IIFE + 26-line module). Revised script collects **all** inline `<script>` blocks in order, preserving each block's tag attributes (so `type="module"` survives).
2. **External assets hoist**: per-page `<link rel="stylesheet">` and `<script src>` inside `<head>` (e.g. catalog's chart.js, Prism, metric_modal.css) must land at the TOP of `{% block head_extra %}` — the original recipe captured only inline `<style>` and silently dropped externals.
3. **Duplicate stylesheet detection**: catalog.html ships a second `<link rel="stylesheet" href="style-custom.css">` after its `<style>` block. base.html already loads it once. The migration drops duplicates.
4. **Layout block default**: changed from `{% block content %}` to `{% block layout %}`. Each standalone has its own top-level wrapper (`<main class="main">`, `<div class="container-memory">`, etc.) — putting that inside base.html's `.container` would double-wrap. Layout block opts out of the `.container` wrap entirely; we must re-include `_app_header.html` (and `_version_badge.html` if base.html includes one) inside the override.
5. **Font preconnect hoist DEFERRED**: Task 0 Step 3 (move Inter preconnect into base.html) is dropped from this PR. The 4 pages that need it keep their inline preconnect inside `head_extra`. Hoisting affects ALL base.html pages (admin section currently lives on system Inter fallback) — separate decision worth its own measurement.
6. **Contract test added**: Task 7 now adds an assertion to `tests/test_design_system_contract.py` that each migrated page extends `base.html` and the rendered HTML has exactly one `<html>` / `<head>` / `<body>`. Prevents future regression back to standalones.
7. **Chart.js smoke verification**: Task 4 (catalog) now requires an explicit "chart rendered" browser screenshot, not just "page loads".
8. **Reviewer-fatigue caveat acknowledged**: user explicitly chose "all in one PR". Per-page commits land in `zs/design-pass` for surgical revert. Reviewer can bisect per commit.
---
**Out of scope** (defer to follow-up PRs):
- `dashboard.html` — already extends `base.html` per `grep -l "extends.*base"`; no migration needed. (Verify Step 0).
- `home_onboarded.html` / `home_not_onboarded.html` — already extend `base.html`; no migration needed.
- `marketplace.html`, `marketplace_*_detail.html` — not part of today's bug surface; can adopt the framework later.
---
## File structure (touch list)
**Modified:**
- `app/web/templates/base.html` — add `{% block body_attrs %}{% endblock %}` after `<body`.
- `app/web/templates/install.html` — convert to extends.
- `app/web/templates/corporate_memory.html` — convert to extends.
- `app/web/templates/corporate_memory_admin.html` — convert to extends.
- `app/web/templates/catalog.html` — convert to extends.
- `app/web/templates/admin_tables.html` — convert to extends; preserve `data-source-type` body attr via the new block.
**Possibly modified (per migration verification):**
- `_app_header.html` — script tag already lives there from the previous fix; no change expected unless we move it back to `<head>` for `defer` performance.
- `base.html` — add `{% block body_attrs %}` (one line).
**Tests:**
- `tests/test_web_ui.py` — likely has assertions on rendered HTML for these routes. Verify, update as needed.
- `tests/test_design_system_contract.py` — should stay green (it doesn't care about page chrome).
**No template deletes.** Every standalone page becomes shorter; CSS/JS volume stays the same per page (just relocates into blocks).
---
## Migration recipe (applied per page)
For every standalone template, the conversion follows a fixed pattern. Carry this recipe forward through Tasks 26.
### Source structure (before)
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Foo - {{ config.INSTANCE_NAME }}</title>
{% if not config.THEME_FONT_URL %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
{% endif %}
<style>
/* … page-specific CSS … */
</style>
{% include '_theme.html' %}
</head>
<body>
{% include '_app_header.html' %}
{# page-specific content … #}
<script>
/* … page-specific JS … */
</script>
</body>
</html>
```
### Target structure (after)
```jinja
{% extends "base.html" %}
{% block title %}Foo - {{ config.INSTANCE_NAME }}{% endblock %}
{% block head_extra %}
<style>
/* … same page-specific CSS, verbatim … */
</style>
{% endblock %}
{% block layout %}
{# Use `layout` (not `content`) when the page renders its OWN top-level
wrapper (e.g. dashboard.html does <main class="main">). Use `content`
when the page is happy inside base.html's <div class="container">. #}
<main class="page-foo">
{# page-specific markup, verbatim (minus the _app_header include —
base.html includes it already). The <body data-x=> attribute, if
any, moves to a {% block body_attrs %}data-x="…"{% endblock %} #}
</main>
{% endblock %}
{% block scripts %}
<script>
/* … same page-specific JS, verbatim … */
</script>
{% endblock %}
```
### Deletions per page
- `<!DOCTYPE html>` + `<html>` + `</html>` (base.html provides)
- `<head>` + `</head>` (base.html provides)
- `<meta charset>`, `<meta name="viewport">` (base.html provides)
- Font preconnect block — `base.html` doesn't ship it today, so this is a small **behavior change**: pages will lose the explicit Inter preconnect. Mitigation: add the preconnect once to base.html's `{% block head_extra %}` parent (or to `base.html` itself above the stylesheet link). See Step 1.
- `<link rel="stylesheet" href="…style-custom.css">` if any (base.html provides)
- `{% include '_theme.html' %}` (base.html provides)
- `<body>` opening tag (base.html provides; attrs go to `{% block body_attrs %}`)
- `{% include '_app_header.html' %}` at start of body (base.html includes it)
- `</body>` + closing tags
### Preserved per page
- `<title>` text → `{% block title %}`
- All inline `<style>` content → `{% block head_extra %}<style>...</style>{% endblock %}`
- All page markup → `{% block content %}` or `{% block layout %}`
- All inline `<script>` content → `{% block scripts %}<script>...</script>{% endblock %}`
- Page-specific JS variable usage (e.g. `data-source-type` on body) → `{% block body_attrs %}`
---
## Task 0: Setup + verify base.html blocks + add body_attrs slot
**Files:**
- Modify: `app/web/templates/base.html`
- [ ] **Step 1: Verify dashboard.html / home_*.html already extend base.html.**
```bash
grep -l "extends.*base\.html" app/web/templates/*.html
```
Expected output includes `dashboard.html`, `home_onboarded.html`, `home_not_onboarded.html`. Confirms our scope is exactly the 5 standalones, not more.
- [ ] **Step 2: Add `{% block body_attrs %}` to base.html.**
The `admin_tables.html` template currently renders `<body data-source-type="{{ data_source_type }}">`; its inline JS reads that attribute. We must preserve the attribute.
Read `base.html`'s `<body>` line, then change it from:
```html
<body>
```
to:
```html
<body {% block body_attrs %}{% endblock %}>
```
The default empty block keeps non-admin_tables pages unchanged.
- [ ] **Step 3: Add Inter font preconnect to base.html.**
Currently `base.html` ships only the stylesheet + `_theme.html` include. The 4 standalone pages that ship their own font preconnect (catalog, corporate_memory*, install) would lose the optimization after migration. Add to `base.html` `<head>` right BEFORE the stylesheet link:
```html
{% if not config.THEME_FONT_URL %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
{% endif %}
```
This change benefits ALL base.html consumers — admin pages currently rely on the system Inter being present. With this addition, base.html-extended pages always have the canonical font loaded.
- [ ] **Step 4: Confirm test pass + render check before any per-page migration.**
```bash
.venv/bin/python -m pytest tests/test_web_ui.py tests/test_web_home_page.py tests/test_design_system_contract.py -q
```
Expected: green. Captures the baseline before migrations begin.
- [ ] **Step 5: Commit.**
```bash
git add app/web/templates/base.html
git commit -m "feat(base): body_attrs block + Inter font preconnect
Adds a body_attrs Jinja block (default empty) so pages that extend
base.html can carry their own <body> attributes — admin_tables.html
needs data-source-type for its JS reading.
Hoists the Inter font preconnect + stylesheet link into base.html's
<head> so every page that extends base gets the same font load. The
5 standalone pages about to be migrated each had this block inline;
centralising it here means future changes (e.g. self-hosting the
font) land in one place."
```
---
## Task 1: Migrate install.html (smallest pilot)
**Why install first**: smallest of the 5 (1097 lines), simplest layout, no admin gating, well-contained. Validates the recipe before tackling the big templates.
**Files:**
- Modify: `app/web/templates/install.html`
- [ ] **Step 1: Read full install.html.**
```bash
wc -l app/web/templates/install.html
sed -n '1,30p' app/web/templates/install.html # head (lines 1-30)
sed -n '640,660p' app/web/templates/install.html # </head> + <body> boundary
sed -n '935,945p' app/web/templates/install.html # <script> start area
tail -5 app/web/templates/install.html
```
Note the exact boundaries. Note any `<body … attribute>` (install.html: none).
- [ ] **Step 2: Convert via Python script (post-review revisions applied).**
```python
import pathlib, re
def migrate(filename: str) -> dict:
"""Convert a standalone Jinja template to extend base.html.
Captures, in order:
- <title>
- Per-page <link> / <script src> / <style> inside <head> head_extra (top)
- Inline <style> blocks (with attributes preserved) head_extra (after links)
- <body> attributes → body_attrs
- Body markup with the leading _app_header.html / _theme.html includes
stripped and all inline scripts pulled out → layout block contents
- All <script> blocks inside body (inline OR src, attributes preserved
verbatim) → scripts block, in order
Drops:
- <!DOCTYPE>, <html>, </html>
- <head>, </head>
- <meta charset>, <meta viewport>
- Duplicate <link rel="stylesheet" href=".../style-custom.css">
(base.html already ships one)
- </body>
"""
path = pathlib.Path(f"app/web/templates/{filename}")
text = path.read_text(encoding="utf-8")
# 1) <title>
title_m = re.search(r"<title>(.*?)</title>", text, re.DOTALL)
title = title_m.group(1).strip() if title_m else filename
# 2) Split <head> from <body>
head_m = re.search(r"<head[^>]*>(.+?)</head>", text, re.DOTALL)
body_m = re.search(r"<body([^>]*)>(.+?)</body>", text, re.DOTALL)
if not head_m or not body_m:
raise RuntimeError(f"missing <head> or <body> in {filename}")
head = head_m.group(1)
body_attrs = body_m.group(1).strip()
body = body_m.group(2)
# 3) Inside <head>: collect head-level <link>, <script src>, <style>.
head_assets = [] # list of (kind, raw_tag) preserving source order
cursor = 0
HEAD_PATTERNS = [
("link", re.compile(r"<link\b[^>]*?>", re.IGNORECASE)),
("script", re.compile(r"<script\b[^>]*?>.*?</script>", re.IGNORECASE | re.DOTALL)),
("style", re.compile(r"<style\b[^>]*?>.*?</style>", re.IGNORECASE | re.DOTALL)),
]
# Concatenate matches found in head, in their original source position.
matches = []
for kind, pat in HEAD_PATTERNS:
for m in pat.finditer(head):
matches.append((m.start(), kind, m.group(0)))
matches.sort()
for _, kind, raw in matches:
# Skip duplicate style-custom.css link (base.html already provides).
if kind == "link" and "style-custom.css" in raw:
continue
# Skip <link rel="preconnect/stylesheet" pointing at font.googleapis>
# we keep the inline preconnect block per page to preserve current
# behaviour; do NOT dedupe against base.html in this pass.
head_assets.append(raw)
head_extra = "\n".join(head_assets)
# 4) Inside <body>: pull out every <script> (inline OR src), in order,
# for relocation to {% block scripts %}. Strip the leading
# _app_header.html include + any leading {% include "_theme.html" %}.
script_blocks = []
SCRIPT_BODY_RE = re.compile(r"<script\b[^>]*?>.*?</script>", re.IGNORECASE | re.DOTALL)
for m in SCRIPT_BODY_RE.finditer(body):
script_blocks.append(m.group(0))
body_no_scripts = SCRIPT_BODY_RE.sub("", body)
# Strip leading _app_header.html include (with optional surrounding
# whitespace and HTML comments).
body_no_header = re.sub(
r"^\s*(?:<!--[^>]*-->\s*)*\{%\s*include\s+['\"]_app_header\.html['\"]\s*%\}\s*",
"", body_no_scripts, count=1
)
# 5) Compose output.
layout_indent = " "
out = ['{% extends "base.html" %}', "", f"{{% block title %}}{title}{{% endblock %}}"]
if body_attrs:
out += ["", f"{{% block body_attrs %}}{body_attrs}{{% endblock %}}"]
if head_extra.strip():
out += ["", "{% block head_extra %}", head_extra, "{% endblock %}"]
out += [
"",
"{% block layout %}",
"{% include '_app_header.html' %}",
body_no_header.rstrip(),
"{% endblock %}",
]
if script_blocks:
out += ["", "{% block scripts %}"]
out += script_blocks
out += ["{% endblock %}"]
out.append("")
new_text = "\n".join(out)
path.write_text(new_text, encoding="utf-8")
return {
"name": filename,
"old_lines": len(text.splitlines()),
"new_lines": len(new_text.splitlines()),
"head_assets": len(head_assets),
"script_blocks": len(script_blocks),
"body_attrs": bool(body_attrs),
}
result = migrate("install.html")
print(result)
```
- [ ] **Step 3: Decide content vs layout block.**
`install.html`'s top-level wrapper after the header — read it. If it's just standard content, `{% block content %}` is right (base.html wraps it in `<div class="container">`). If it has its own `<main>` or full-bleed elements, switch to `{% block layout %}` (which overrides base.html's container entirely) and manually re-add the `_app_header.html` include and `<main>` wrapper. **Default to `content`; switch only if the page looks broken in browser.**
- [ ] **Step 4: Smoke test in dev server.**
```bash
LOCAL_DEV_MODE=1 DATA_DIR=/tmp/agnes-design-pass-data .venv/bin/uvicorn app.main:app --port 8765 > /tmp/uv-install.log 2>&1 &
sleep 4
agent-browser open http://localhost:8765/install --wait-until networkidle
agent-browser screenshot /tmp/install-after.png --full
# Click Admin dropdown
agent-browser snapshot -i | grep -E "Admin|Hide"
# Verify install page's own behavior (whatever it does — copy buttons, accordions, etc.)
pkill -f "uvicorn.*8765"
```
Compare `install-after.png` against the baseline from `/tmp/design-pass-baseline/`.
- [ ] **Step 5: Run tests + commit.**
```bash
.venv/bin/python -m pytest tests/ -k "install or web_ui" -q
git add app/web/templates/install.html
git commit -m "refactor(install): extend base.html instead of standalone
Pilots the 5-page standalone→framework migration. install.html now
inherits <head>, <body>, font preconnect, theme include, app-header,
and the app.js script tag from base.html. Page-specific styles and
scripts kept verbatim inside head_extra + scripts blocks. -1097 line
template becomes ~+200 less (head/body scaffolding deleted)."
```
---
## Task 2: Migrate corporate_memory.html
**Files:** `app/web/templates/corporate_memory.html`
Same recipe as Task 1. Note: page is admin-gated (`{% if session.user %}` checks in markup). The wrapping logic isn't part of the migration — base.html's `_app_header.html` already handles the auth check.
- [ ] **Step 15: Apply Task-1 recipe verbatim.** Commit as `refactor(memory): extend base.html`.
- [ ] **Step 6: Verify memory-page-specific JS** (knowledge filter, voting, sync status) still works on `/corporate-memory`. Browser test: click a knowledge item, click upvote, click filter pill.
---
## Task 3: Migrate corporate_memory_admin.html
**Files:** `app/web/templates/corporate_memory_admin.html`
Same recipe. Admin-only curation page; modals + accordion behavior to verify.
- [ ] Apply recipe + commit `refactor(memory-admin): extend base.html`.
- [ ] Browser test: open a knowledge item modal, edit, save (don't commit DB; just verify modal opens and closes).
---
## Task 4: Migrate catalog.html
**Files:** `app/web/templates/catalog.html`
The biggest of the four "memory + catalog + install" group (2524 lines). Has source-cards, accordion, profiler overlay, two inline `<script>` blocks (868 lines + 26 lines).
- [ ] **Step 1: Concatenate the TWO inline `<script>` blocks** before relocating. Otherwise only the last one would land in `{% block scripts %}` and the smaller post-script would orphan. Either:
- Order them as `script_outer + "\n\n" + script_inner` in the migration script, OR
- Verify both are independent and emit them as two consecutive `<script>` blocks inside `{% block scripts %}`.
- [ ] Apply recipe + commit `refactor(catalog): extend base.html`.
- [ ] Browser test: load `/catalog`, click an accordion to expand, click a table row to open profiler overlay, verify "Live" / "Local" badges render.
---
## Task 5: Migrate admin_tables.html (biggest, highest risk)
**Files:** `app/web/templates/admin_tables.html`
3563 lines. Has the `data-source-type` body attribute (uses `{% block body_attrs %}` from Task 0). 850-line `<style>` block. 1795-line `<script>` block — biggest JS on the site (registry mutations, modal forms, AJAX, table polling).
- [ ] **Step 1: Apply the recipe with body_attrs override.**
Add in the new template:
```jinja
{% block body_attrs %}data-source-type="{{ data_source_type }}"{% endblock %}
```
- [ ] **Step 2: Stress-test the JS.** This page has the most behavior. Manual checks:
- Source-type filter switcher
- "+ Register table" modal opens
- Click into a registered table row → edit modal opens
- Cache warm-up trigger button
- Table search filter
- [ ] Apply recipe + commit `refactor(admin-tables): extend base.html`.
---
## Task 6: Cross-page browser smoke + full pytest
**Files:** none (verification only).
- [ ] **Step 1: Boot dev server + iterate ALL 5 migrated routes via agent-browser.**
```bash
LOCAL_DEV_MODE=1 DATA_DIR=/tmp/agnes-design-pass-data .venv/bin/uvicorn app.main:app --port 8765 > /tmp/uv-smoke.log 2>&1 &
sleep 4
for r in /install /corporate-memory /corporate-memory/admin /catalog /admin/tables; do
safe="${r//\//-}"
agent-browser open "http://localhost:8765${r}" --wait-until networkidle
agent-browser screenshot "/tmp/framework-after${safe}.png" --full
done
# Click Admin dropdown on each — confirm it opens
for r in /install /corporate-memory /catalog /admin/tables; do
agent-browser open "http://localhost:8765${r}"
snap=$(agent-browser snapshot -i)
admin_ref=$(echo "$snap" | grep -oE 'button "Admin"[^@]*@e[0-9]+' | grep -oE 'e[0-9]+' | head -1)
hide_ref=$(echo "$snap" | grep -oE 'link "Hide »"[^@]*@e[0-9]+' | grep -oE 'e[0-9]+' | head -1)
[ -n "$hide_ref" ] && agent-browser click "@$hide_ref"
sleep 1
agent-browser click "@$admin_ref"
sleep 1
echo "$r — Admin: $(agent-browser snapshot -i | grep -c menuitem) menu items"
done
pkill -f "uvicorn.*8765"
```
Expected: each page → 15+ menuitem entries when Admin dropdown opens.
- [ ] **Step 2: Full pytest.**
```bash
.venv/bin/python -m pytest tests/ --tb=line -n auto -q
```
Expected: same baseline pass count (4500+) + 12 pre-existing Keboola/clean-install fails.
- [ ] **Step 3: Visual diff vs baseline.** Open at least one screenshot per migrated page and compare against `/tmp/design-pass-baseline/`. Any unexpected layout shift → flag for fix before commit.
---
## Task 7: CHANGELOG entry + final push
- [ ] **Step 1: Add to CHANGELOG.md `[Unreleased]`.**
Under `### Changed`:
```markdown
- All web templates now extend `base.html`. Previously 5 templates
(`catalog.html`, `corporate_memory.html`, `corporate_memory_admin.html`,
`install.html`, `admin_tables.html`) shipped their own `<html>` /
`<head>` / `<body>` scaffold — a source of drift when shared
infrastructure changed (today's symptom: the nav-dropdown
`app.js` script lived only in `base.html`, so those 5 pages had
dead dropdowns). `base.html` now exposes a `body_attrs` Jinja
block + emits the Inter font preconnect, so all pages share one
rendering pipeline.
```
- [ ] **Step 2: Final pytest + push.**
```bash
.venv/bin/python -m pytest tests/ --tb=line -n auto -q | tail -8
git push origin zs/design-pass
```
PR #284 auto-updates with the new commits.
---
## Risk register
1. **Page-specific JS reads from elements that base.html wraps differently.** Mitigation: keep `{% block content %}` markup byte-identical to the old body content (sans `_app_header.html` include). IDs, classes, data attrs all preserved. JS sees the same DOM.
2. **`<body data-source-type=…>` on admin_tables.html.** Mitigation: `{% block body_attrs %}` slot added to base.html in Task 0.
3. **Per-page CSS specificity collisions with style-custom.css.** Inline `<style>` blocks have always loaded AFTER style-custom.css. After migration, the inline `<style>` is in `{% block head_extra %}` which sits AFTER style-custom.css link in base.html. Order preserved. No specificity flip.
4. **Page-specific font preconnect already loaded twice.** Currently 4 of the 5 pages have the Inter preconnect inline; after migration they inherit it from base.html. Mitigation: Task 0 Step 3 hoists the preconnect to base.html before any per-page migration. After Task 0, the inline ones become duplicates → harmless but should be deleted as part of each per-page conversion (the migration script captures only `<style>` content + script content, so preconnect lines naturally drop).
5. **Login pages (`base_login.html` consumers).** Not in scope. Login pages still use `base_login.html`. The framework migration is for authed-content pages only.
6. **Reviewer fatigue.** ~5000 LOC of diff across 6 commits. Mitigation: per-page commit boundary → reviewer can read one commit, ack, move on.
---
## Self-review
- **Spec coverage**: 5 standalone pages enumerated; all 5 have a task. ✅
- **Block-mapping completeness**: title, head_extra, content/layout, scripts, body_attrs all addressed. ✅
- **No placeholders**: each migration step has concrete shell + Python code. ✅
- **Tests run before each commit**: Task 0 Step 4, Task 1 Step 5, Task 6 Step 2. ✅
- **CHANGELOG entry**: Task 7 Step 1. ✅
- **One-PR continuation**: lands on existing `zs/design-pass`. ✅
- **Rollback granularity**: per-page commits; revert individual migrations cleanly. ✅

View file

@ -1,6 +1,6 @@
[project]
name = "agnes-the-ai-analyst"
version = "0.54.9"
version = "0.54.10"
description = "Agnes — AI Data Analyst platform for AI analytical systems"
requires-python = ">=3.11,<3.14"
license = "MIT"

View file

@ -0,0 +1,186 @@
"""Design-system invariants. Fails if a future PR undoes the design-pass."""
from pathlib import Path
import re
TEMPLATES = Path("app/web/templates")
STATIC = Path("app/web/static")
def _all_html() -> list[Path]:
return sorted(p for p in TEMPLATES.rglob("*.html"))
# Match every class="..." or class='...' attribute, possibly multi-line.
# Jinja templates frequently break class attributes across lines for the
# {% if … %}is-active{% endif %} pattern, so re.DOTALL is required.
_CLASS_ATTR_RE = re.compile(r"""class\s*=\s*(["'])(.*?)\1""", re.DOTALL)
def _classes_in_template(text: str) -> set[str]:
"""Extract every literal class token used in the template. Tokenizes the
class attribute on whitespace so multi-class attrs ("btn btn-primary")
and multi-line attrs split cleanly. Jinja conditionals (tokens that
contain `{{`, `{%`, `}`) are skipped only authors' literal class
names are returned, since constructed names can't be statically
audited without a render."""
tokens: set[str] = set()
for match in _CLASS_ATTR_RE.finditer(text):
attr_value = match.group(2)
for tok in attr_value.split():
if "{" in tok or "}" in tok:
continue
tokens.add(tok)
return tokens
# Single class tokens. Multi-token patterns (like "modal-btn primary") are
# caught by the single-token entry (.modal-btn) — no need to special-case.
DEPRECATED_CLASSES = {
"btn-primary-v2": "btn-primary",
"btn-secondary-v2": "btn-secondary",
"modal-btn": "btn + .btn-primary / .btn-secondary",
"users-table": "data-table",
"gp-table": "data-table",
"marketplaces-table": "data-table",
"audit-table": "data-table",
"users-search": "search-input",
"marketplaces-search": "search-input",
"kb-search": "search-input",
"filters-card": "filter-bar",
}
def test_style_css_deleted() -> None:
"""style.css must stay deleted — all rules live in style-custom.css."""
assert not (STATIC / "style.css").exists(), (
"style.css must stay deleted — all rules live in style-custom.css"
)
def test_no_template_references_style_css() -> None:
"""No template should link the deleted stylesheet."""
offenders: list[str] = []
for path in _all_html():
text = path.read_text(encoding="utf-8")
if "static_url('style.css')" in text or 'static_url("style.css")' in text:
offenders.append(str(path))
assert not offenders, f"templates still link style.css: {offenders}"
def test_style_custom_has_single_root_block() -> None:
"""Exactly one :root { … } block (plus optional :root[data-theme] siblings).
Multiple bare :root blocks signal a merge gone wrong the cascade order
becomes load-bearing for tokens, which we don't want."""
css = (STATIC / "style-custom.css").read_text(encoding="utf-8")
# Match :root { (no attribute selectors after it).
bare_root = re.findall(r"^:root\s*\{", css, flags=re.MULTILINE)
assert len(bare_root) == 1, (
f"expected exactly one bare :root block, found {len(bare_root)}"
)
def test_canonical_primitives_defined() -> None:
"""Every primitive the design-pass migration produces must be declared
in style-custom.css. Tasks 47 introduce them; this test starts failing
after Task 3 lands and goes green when the last primitive lands."""
css = (STATIC / "style-custom.css").read_text(encoding="utf-8")
required = [
# buttons
".btn",
".btn-primary",
".btn-secondary",
".btn-ghost",
".btn-danger",
".btn-warning",
# form controls
".search-input",
".filter-bar",
".filter-pill",
# page header
".page-header",
".page-header__title",
".page-header__subtitle",
".page-header__actions",
# data display
".data-table",
".empty-state",
# global feedback
".toast",
]
missing = [sel for sel in required if sel not in css]
assert not missing, f"missing canonical primitive selectors: {missing}"
def test_no_deprecated_class_in_templates() -> None:
"""Templates must use canonical primitives, not legacy aliases.
Migration tasks (815) drive this to green by sweeping each page; Task
16 removes the supporting CSS aliases. A regression that re-adds one of
these class names fails the build.
"""
offenders: dict[str, list[str]] = {}
for path in _all_html():
text = path.read_text(encoding="utf-8")
used = _classes_in_template(text)
for cls in DEPRECATED_CLASSES:
if cls in used:
offenders.setdefault(cls, []).append(path.name)
assert not offenders, (
"deprecated classes found in templates:\n"
+ "\n".join(
f" .{cls} → use {DEPRECATED_CLASSES[cls]} ({sorted(files)})"
for cls, files in offenders.items()
)
)
def test_app_js_referenced_by_base_only() -> None:
"""app.js carries dropdown wiring scoped to the authed nav. base_login.html
has no nav, so it must NOT load app.js that would let login pages call
window.appUI / window.appToast (defined later), which is not their
contract. The opposite (base.html missing app.js) would break the
Admin dropdown."""
base = (TEMPLATES / "base.html").read_text(encoding="utf-8")
base_login = (TEMPLATES / "base_login.html").read_text(encoding="utf-8")
assert "app.js" in base, "base.html must load app.js"
assert "app.js" not in base_login, "base_login.html must not load app.js"
# Helper-level unit tests for the class-tokenizer itself — keeps the
# audit logic honest as the design-pass evolves.
def test_classes_helper_multiline_attr() -> None:
"""class= attributes split across lines (typical Jinja conditional
pattern) must still tokenize cleanly."""
sample = '''
<a class="app-nav-link
is-active"
href="/">Home</a>
'''
assert _classes_in_template(sample) == {"app-nav-link", "is-active"}
def test_classes_helper_skips_jinja_tokens() -> None:
"""Jinja-constructed class fragments don't get audited (can't be statically
resolved). Verify the {% if %}, {{ }} pieces are filtered out, real
literal tokens around them stay."""
sample = '''<button class="btn {% if active %}is-active{% endif %} btn-primary">Go</button>'''
tokens = _classes_in_template(sample)
assert "btn" in tokens
assert "btn-primary" in tokens
# Jinja control-flow tokens get skipped — they contain `{` or `}`.
for tok in tokens:
assert "{" not in tok and "}" not in tok
def test_classes_helper_compound_match_is_not_false_positive() -> None:
"""Prose containing the word 'pill' or 'btn' in a comment should NOT be
detected as a deprecated class. Only class= attribute values count."""
sample = '''
<!-- this is the filter pill row -->
<p>The button (btn) below opens the menu.</p>
<span class="badge">x</span>
'''
assert _classes_in_template(sample) == {"badge"}

View file

@ -239,7 +239,10 @@ def test_admin_users_page_renders_for_admin(app_client, fresh_db):
cookies={"access_token": token},
)
assert resp.status_code == 200
assert 'class="users-title">Users' in resp.text
# /admin/users uses the canonical .page-header--hero block (Users &
# Access eyebrow + Users title). Legacy .users-title H2 retired.
assert 'class="page-header__title">Users<' in resp.text
assert "page-header--hero" in resp.text
def test_admin_users_page_denies_non_admin(app_client, fresh_db):