Commit Graph

19 Commits

Author SHA1 Message Date
aaverbitskiy
a68cac80d1 map: donut clusters, occupancy legend/search/no-coords, styled balloon; header polish
Map (map.ts, styles.css, index.html):
- Cluster icons are now donut charts split green (free) / red (busy) by the
  occupancy of the surfaces they contain, count in the centre. Custom
  clusterIconLayout with a hit-area shape; hover/click preserved.
- gridSize 64 -> 112 so nearby clusters stop overlapping at the overview zoom.
- Live legend: "свободна: X · занята: Y · поверхностей: N", reacts to filters.
- "Без координат" is now a clickable badge opening a compact codes-only panel
  (header "Без координат") so the missing-coordinate surfaces can be fixed.
- Search-to-locate: when a filter narrows to one surface the map flies in and
  opens its balloon.
- Balloon restyled to match the timeline tooltip; muted map tiles (ground-pane
  filter) so the markers stand out.
- Cluster hover tooltip shows the brand for occupied surfaces; legend plate
  raised above the Yandex controls.

Header (index.html, styles.css, main.ts):
- Scale + appearance + checkboxes recomposed into one compact block; shorter
  slider; the "Масштаб" label uses the shared field-label style again.
- "Оформление" is now a round "+" button pinned to the header's bottom-right
  corner with a hover tooltip; opens the same appearance menu.
- Counters relabelled "Поверхности" / "Брони"; the counters plate and the
  view-mode switch now share one borderless grey fill; mode buttons sit on a
  more visible grey frame.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-06 09:39:11 +00:00
aaverbitskiy
557522afcf ui: visual refresh, richer bar tooltip (+manager), header alignment fixes
Frontend (styles.css, index.html, main.ts):
- Design tokens: single accent/border/radius/shadow/spacing system; flat header
  (dropped the boxed groups) with a subtle bottom divider.
- Unified controls: 36px height, consistent focus ring; search field gets a
  magnifier icon; view-mode switch is now a compact vertical segmented control.
- Fixed the dropdown option font: `.field label` styles were leaking into the
  option <label>s (they're inside .field), forcing uppercase + bold; options are
  now normal weight / normal case.
- Header alignment: mode switch fills the row so its bottom lines up with the
  date fields; the counters block is pinned to the same bottom line.
- Dropdown lists no longer show the column-resizer line bleeding through: the
  header now establishes a stacking context (position:relative + z-index) so its
  panels sit above the timeline.
- Dark theme is implemented (tokens + no-flash) but hidden for now (toggle
  display:none, forced light) until it's polished — easy to re-enable.

Timeline tooltip (timeline.ts, types.ts):
- Replaced the plain multi-line text tooltip with a structured card: bold brand
  title + task №, company subtitle, localized dates + duration, status as a
  coloured dot, manager, a distinct collision section, and a "click to open in
  Planfix" hint. Left accent stripe in the bar colour; matches the map tooltip.
- Values are escaped (escapeHtml) before going into innerHTML.

Backend (main.py):
- /api/bookings now returns `manager` (Array(String)), canonicalized to the
  "Фамилия Имя" form (see canon_manager) so the tooltip can show it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-06 04:39:55 +00:00
aaverbitskiy
530bb4754e meta: run the 5 facet queries concurrently via asyncio.gather
/api/meta built the city/brand/dimension/manager/status option lists with five
sequential `await ch_query(...)` calls, so its latency was the sum of five
round-trips to ClickHouse. The queries are independent, and the frontend hits
/api/meta on every filter change, so this was 5x latency for no reason.

Wrap them in asyncio.gather so they fire in parallel; total time is now ~the
slowest single query plus overhead. Output verified identical.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-05 19:30:29 +00:00
aaverbitskiy
1f5b393675 bookings/map: read pf_board and board_info with FINAL to dedup ReplacingMergeTree
Both tables are ReplacingMergeTree; dedup happens only during background part
merges, not at read time. The ongoing etl_rw feed keeps inserting into pf_board,
so right after an insert that updates an existing row there is a short window
(before the forced merge, min_age_to_force_merge_seconds=15) where the same
task_id / board_key exists in two parts. A plain SELECT reads both parts and
returns the row twice.

The /api/boards query already collapses duplicates via argMax + GROUP BY, but
/api/bookings and the two /api/map queries read raw rows, so they could
intermittently double a booking (timeline/balloon) or a surface marker.

Add FINAL to those three reads (pf_board in bookings + map current, board_info
in map surfaces). At 463/515 rows the cost is negligible and it removes the
class of transient duplicates regardless of merge timing. Output verified
unchanged against the single-part baseline.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-05 19:25:40 +00:00
aaverbitskiy
6816ba90f4 managers: normalize name word-order at read time, canonical "Фамилия Имя"
Planfix has emitted manager names in two word orders over time ("Имя Фамилия"
from the 26 Jul 2026 n8n backfill, "Фамилия Имя" from the ongoing etl_rw feed),
so one person appeared as two distinct filter options (e.g. "Александра Столбова"
vs "Столбова Александра"), splitting their tasks across two facet values.

Fix without touching stored data:
- MANAGER_KEY_ARR: SQL expression building a word-order- and case-independent
  key (lowercase, split, arraySort, rejoin) per manager array element.
- MANAGER_COND / MAP_MANAGER_COND now match on that key, so a selected manager
  catches rows stored under either order.
- parse_filters normalizes incoming manager values with the same key (_mkey).
- /api/meta returns canonical "Фамилия Имя" names (CANONICAL_MANAGERS),
  deduplicated; unknown names pass through unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-05 18:50:01 +00:00
aaverbitskiy
c7eae87660 filters: add faceted Status (task_status) filter — meta.statuses, boards/bookings/map filtering (map marker visibility), UI dropdown under Size in filter grid 2026-07-27 19:40:26 +00:00
aaverbitskiy
053bf2587d header: move counters into brand block, compact 4-col filter grid (dates + search on row 2), unify all block backgrounds 2026-07-26 08:52:36 +00:00
aaverbitskiy
d2ad928948 header: responsive layout — fields wrap to next line at min width, all gray blocks may shrink and reflow instead of overlapping 2026-07-26 05:36:35 +00:00
aaverbitskiy
68417bf45e map: Yandex map section (3 modes + resizable split), green/red markers, hover tooltips for markers+clusters; fix map init race; header keeps counters inline (fields shrink first); add Manager (Менеджер) faceted filter 2026-07-26 05:05:04 +00:00
aaverbitskiy
d04e0ae024 db creds: move ClickHouse user/password to gitignored .env via compose env_file; drop hardcoded default from main.py 2026-07-23 05:19:13 +00:00
aaverbitskiy
23f5ce8b1a header layout: checkbox column (3 rows), Оформление under scale slider, counters as inline gray block 2026-07-21 10:24:07 +00:00
aaverbitskiy
66e501ef59 date filters: independent Дата начала (start_date>=) / Дата окончания (end_date<=), header fields under Город/Бренд; qualify pf_board.start_date/end_date to avoid alias shadowing 2026-07-21 10:07:39 +00:00
aaverbitskiy
fe06cdab72 dependent (faceted) filters: city/brand/dimension/search narrow each other 2026-07-21 08:38:53 +00:00
aaverbitskiy
5db77b7a06 brand filter (backend+frontend), compact checkbox grid, two-line counter 2026-07-18 11:15:43 +00:00
aaverbitskiy
b393562c3a frontend UI: header 4 groups, Оформление menu (colors/sizes/fonts), centered bars via inner div, clickable Planfix links 2026-07-17 19:27:22 +00:00
aaverbitskiy
2d66871b62 build: static/{index.html,assets} are generated artifacts (source-only tracking) 2026-07-17 16:22:39 +00:00
aaverbitskiy
6704a50b33 frontend: full modular migration (collisions/dropdown/timeline/styles), staged at /next/, prod unchanged 2026-07-17 16:17:00 +00:00
aaverbitskiy
c6363cd8cf frontend: Vite+TypeScript scaffold (types, api) — not wired to static yet 2026-07-17 15:41:13 +00:00
aaverbitskiy
6c47dada00 Import mapdash (FastAPI + vis-timeline) + docker-compose with static volume 2026-07-17 15:13:27 +00:00