feat: PostGIS import UX improvements and tile_source routing refactor#260
Merged
Conversation
928604e to
ed6d5a3
Compare
Phase 1 & 2 of the map editor feature: Backend: - maps table + CRUD API (list/create/get/update/delete) - preview-sources endpoint listing ready data sources - field-values endpoint for classification (distinct values + min/max stats) Frontend: - MapsPanel: map list with create/delete/edit entry - MapEditor: three-panel layout (layers / OL map / symbolization) - ClassificationWizard: single color, unique value, graduated color - ColorRamp: categorical + sequential ramps with interpolation - styleJsonToOl: Mapbox Style JSON -> OL Style conversion with expression support (case/get/==/<=/interpolate/match) - Layer visibility toggle and reordering (up/down) - Auto-fit to data bounds on source add - Debounced auto-save of style JSON - i18n (en/zh) for all map editor UI Homepage tabs: [数据] [资源] [地图]
…dmap Reference QGIS symbology capabilities to prioritize next features: labeling, layer opacity, scale visibility, filter, rule-based renderer, proportional symbols, point clustering, heatmap as high priority.
- Replace overlay button with div to avoid capturing click events - Add stopPropagation on modal-content to prevent event bubbling - Add keyboard handlers for accessibility
Backend: - Add 3 new API endpoints for discovering schemas, tables, and columns - Add data structures for discovery requests/responses Frontend: - Add API functions for schema/table/column discovery - Refactor PostGIS form to use cascade selection: - Test connection → load schemas - Select schema → load tables - Select table → load geometry columns and FID candidates - Add i18n translations for new UI elements
- Fix object field being cleared by race condition in loadPostgisTables: move reset logic to handleSchemaChange (synchronous, before async load) - Remove connectionName field: auto-generate from host:port if not provided - Remove displayName field: backend defaults to table name - Add frontend validation: object must be selected before register
Redesign the PostGIS workflow to separate connection from selection: - New discover-objects API scans all tables with geometry columns - Simplified modal: only connection info (host/port/db/user/pass) - On connect, automatically scan and close modal - Discovered objects appear in data list as collapsible group - Each object shows schema.table, type, geometry info - One-click import button per object (uses first geometry/fid column) - Remove connectionName/displayName/schema/table/column selectors - Remove port spinner buttons
…rlap The PostGIS section was placed as a direct child of panel-body (flex row), causing it to be squeezed between list-area and detail-area. Moved it inside list-area with maxHeight:260px and overflow-y:auto for proper scrolling.
PostGIS code was incorrectly placed inside DetailSidebar component (which has no access to App state). Moved to the correct location: inside list-area, between file list and list-area closing div.
- Backend: discover-objects now returns pkColumns (integer columns with single-column PK/UNIQUE constraint) alongside fidCandidates - Frontend: clicking 'Import' opens inline popover with FID dropdown - PK columns annotated with (PK), others with (no unique constraint) - Geometry column shown as read-only (or dropdown if multiple) - User must confirm before import - Prevents import failures from blindly selecting non-unique FID columns
Tables require single-column PK/UNIQUE for FID (backend enforced). Now the frontend only shows valid FID options: - Tables: only pkColumns (columns with PK/UNIQUE constraint) - Views: all fidCandidates (views skip index check) Tables without any PK/UNIQUE column show 'No valid FID column' and cannot be imported.
- tile_source is now the only routing criterion for all tile endpoints - tile_format is only used for MBTiles content-type, not for routing - MBTiles sets tile_source='mbtiles' on import (was implicit via tile_format) - PostGIS no longer sets tile_format='mvt' (was causing MBTiles routing bug) - PreviewMeta now returns tileSource for frontend to distinguish source types - Frontend Preview.jsx uses tileSource for click behavior (MVT vs DuckDB) - get_tile/get_file_schema/get_feature_properties/get_public_tile all use match tile_source instead of if-else cascade - db.rs defensive migration: existing MBTiles records get tile_source='mbtiles' - PostGIS row count: COUNT(*) for files.size, pg_class.reltuples for discovery - Frontend shows 'N rows' instead of '0 B' for PostGIS sources
…fied_relation_name
…e clamping - handleToggleVisibility: fix inverted logic (was never toggling) - evalExpr: use === and !== instead of == and != for ==/!=/in operators - interpolate: clamp to first stop value when input is below first stop
- db.rs: log warnings on migration failure instead of silently discarding - styleJsonToOl.js: remove dead code colorProp variable - MapEditor.jsx: cleanup saveTimeoutRef on unmount to prevent stale setState
6d31130 to
1fdfd71
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PostGIS connection and import workflow improvements, plus a tile routing architecture refactor.
PostGIS Import Improvements
Tile Source Routing Refactor
Frontend Changes
Test Data
Verification