Mission Planning: Add free map placement to mission library items#2802
Mission Planning: Add free map placement to mission library items#2802ArturoManzoli wants to merge 6 commits into
Conversation
|
/review |
Automated PR Re-review 1 (Claude)No previous review exists — performing a full review of New findings0. SummaryVerdict: MINOR SUGGESTIONS Items worth attention: 6.1, 6.2, 7.1. This PR adds a Mission Library feature to the mission planner: users can save, load, import/export, and delete missions from a local library. It introduces free-placement mode (drag, scale, rotate on the map) when loading a library mission, a new 1. Correctness & Implementation Bugs1.1 ( 1.2 ( 1.3 ( 2. AGENTS.md Adherence — ✅3. Security — ✅4. Performance4.1 ( 5. UI / UX — ✅6. Code Quality & Style6.1 ( 6.2 ( 6.3 ( 7. Commit Hygiene7.1 ( 8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional10.1 ( 10.2 ( Generated by Claude. This is advisory; a human reviewer must still approve. |
|
/review |
Automated PR Re-review 2 (Claude)Comparing Previous findings status
New findings0. SummaryVerdict: MINOR SUGGESTIONS Items worth attention: 1.4, 6.1 (ongoing). The three new commits add a context-menu submenu for the mission library (add from library / save to library), highlight the first and last mission waypoints in orange to signal endpoints, and bias context-menu inserts (waypoint, survey, simple path, library mission) toward the closer mission endpoint — clicks near the start prepend instead of always appending. 1. Correctness & Implementation Bugs1.4 ( openMissionLibrary()
const insertIndex = getContextMenuEndpointSplicePosition()
if (insertIndex === 0) pendingSegmentInsertIndex.value = -1This works because the assignment on the very next line happens synchronously before any watcher fires. However, it relies on 1.5 ( 2. AGENTS.md Adherence — ✅3. Security — ✅4. Performance — ✅5. UI / UX5.1 ( 6. Code Quality & Style6.1 (ongoing, 6.4 ( 7. Commit Hygiene7.2 ( 8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional10.3 ( Generated by Claude. This is advisory; a human reviewer must still approve. |
Skipping this one, since MissionPlanningView.vue at line 2015 already has the "set the sentinel afterwards" comment at the call site, which is exactly the remediation suggested. |
4a0eaa5 to
48c8e4c
Compare
|
/review |
Automated PR Re-review 3 (Claude)Comparing Previous findings status
Discussion since last review
New findings0. SummaryVerdict: MINOR SUGGESTIONS Items worth attention: 5.2 (major), 6.1 (ongoing, major), 1.6. This PR adds free-placement functionality to the mission library: users can drag, scale, and rotate a saved mission on the planning map before committing it. It also adds endpoint highlighting (first/last waypoints in orange), endpoint-biased insertion from the context menu, a "Planning for" vehicle-type selector for offline planning, and context-menu entries for save/load from the mission library. The code is well-structured with domain logic properly extracted into 1. Correctness & Implementation Bugs1.6 ( 1.7 ( 2. AGENTS.md Adherence2.1 ( 3. Security — ✅4. Performance — ✅5. UI / UX5.2 (
6. Code Quality & Style6.1 (ongoing, 6.5 ( 7. Commit Hygiene7.1 (updated, 8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional10.1 (ongoing, 10.4 ( Generated by Claude. This is advisory; a human reviewer must still approve. |
48c8e4c to
0e87529
Compare
|
/review |
Automated PR Re-review 4 (Claude)Comparing Previous findings status
New findings0. SummaryVerdict: MINOR SUGGESTIONS Items worth attention: 6.1 (ongoing, major), 5.2 (partially addressed, major from previous review). The changes since the last review are primarily structural: the large block of mission-merging logic (clone, append, segment-insert, fresh-load routing) has been extracted from 1. Correctness & Implementation Bugs — ✅2. AGENTS.md Adherence2.2 ( 3. Security — ✅4. Performance — ✅5. UI / UX5.3 ( 6. Code Quality & Style6.1 (ongoing, 6.6 ( 7. Commit Hygiene — ✅8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional10.1 (ongoing, Generated by Claude. This is advisory; a human reviewer must still approve. |
|
Review follow-up — round 4 Done src/views/MissionPlanningView.vue (5.2 + 5.3 — missing logUserAction on context-menu wrappers): Won't change (with reasoning) 1.2 — startFreePlacement uses JSON.parse instead of structuredClone: intentionally used 6.1 — MissionPlanningView.vue > 2000 lines: the previous push already extracted two composables ( Note: 2.1 + 2.2 ( |
0e87529 to
572da50
Compare
|
/review |
Automated PR Re-review 6 (Claude)Comparing Previous findings status
Discussion since last review@ArturoManzoli's New findings0. SummaryVerdict: MINOR SUGGESTIONS Items worth attention: 1.8, 6.1 (ongoing). This commit adds endpoint-biased insertion: context-menu actions (add waypoint, simple path, survey, library mission) now detect whether the cursor is closer to the first or last waypoint and prepend/append accordingly. First/last waypoints are highlighted in orange. The 1. Correctness & Implementation Bugs1.8 ( 2. AGENTS.md Adherence — ✅3. Security — ✅4. Performance — ✅5. UI / UX — ✅6. Code Quality & Style6.1 (ongoing, 7. Commit Hygiene — ✅8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional — ✅Generated by Claude. This is advisory; a human reviewer must still approve. |
|
Review follow-up — round 5 Done
|
572da50 to
7dad330
Compare
|
/review |
Automated PR Re-review 7 (Claude)Comparing Previous findings status
Discussion since last review@ArturoManzoli explained that finding 1.8 was reworked: when the right-click lands on or near an existing mission segment, the context-menu item is relabelled "Add element here" and clicking it opens the segment radial menu at the segment midpoint — same UX as the hover "+" icon. Away from segments the item stays "Add waypoint here" with endpoint bias. The incremental diff confirms this new implementation via New findings0. SummaryVerdict: MINOR SUGGESTIONS Items worth attention: 6.1 (ongoing). This commit adds endpoint-biased insertion for context-menu actions and an explicit segment-detection flow that relabels the "Add waypoint here" menu item and routes through the segment radial menu when the cursor is near an existing path segment. First/last waypoints are highlighted orange. The 1. Correctness & Implementation Bugs — ✅2. AGENTS.md Adherence — ✅3. Security — ✅4. Performance — ✅5. UI / UX — ✅6. Code Quality & Style6.1 (ongoing, 7. Commit Hygiene — ✅8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional — ✅Generated by Claude. This is advisory; a human reviewer must still approve. |
Add a "Planning for" selector (Surface Boat, Submarine, UAV, Ground Rover) to the planner sidebar that users can pick while no vehicle is connected, backed by a new `plannedVehicleType` store field (persisted under `cockpit-planned-vehicle-type`) and an `effectiveVehicleType` reader that prefers the connected vehicle's real type and falls back to the planned one. Mission estimates and vehicle-specific UI cues now consume `effectiveVehicleType` so they keep working offline, and the Surface Boat options gear is hidden when no vehicle is online since its tweaks never reach the generic offline estimator anyway.
Replace the toolbar's separate save/load buttons with a single bookshelf entry that opens a new MissionLibraryModal — a grid of preview cards (thumbnail, name, date, vehicle type, stats pills) for the user's saved missions, with save and detail dialogs and an "Open in Google Earth" link. Entries are persisted under `cockpit-mission-library` (BlueOS-synced when available) and captured at save time with a baked SVG thumbnail and a precomputed `MissionEstimatesSnapshot`, so summaries render without recomputing against the currently planned mission. Loads go through a placement-choice dialog where "Keep original location" replays the saved settings via loadDraftMission — the repositioning path arrives in a follow-up PR.
Add the pure math layer that powers the upcoming free-placement workflow: local east/north meters frame projection, scale + rotation transforms, the inverse rotation used during scale-handle drags, the bounding box of a mission's features in that frame, and the shared scale/rotation limits. Keeping the math in the mission library lets the placement composable stay focused on the leaflet state machine without duplicating geometry.
Extend the library load flow with a "Reposition on map" option that
drops the saved mission onto the planning map at 1:1 scale and lets
the user drag, scale (independent X/Y, hold Shift for uniform), and
rotate it via on-map handles plus numeric overlays before committing.
A green check confirms the placement, a red trash cancels, and a
restore button resets scale and rotation to defaults.
The interactive state machine (drag, scale-corner handles, rotation
handle, raf-coalesced preview rebuild, snackbar hint) lives in a
leaflet-aware composable (`useMissionPlacement`) so the host view only
owns mission routing and toolbar positioning. The composable manages
its own preview layers, mouse listeners, and zoom-end rebuild, and
tears everything down on scope dispose to keep the view's onUnmounted
free of placement code.
Also add the segment-insert third option to the radial menu shown when
hovering between two existing waypoints ("Insert mission from library
here") and the routing in finalizeMissionPlacement /
appendMissionToPlanning / insertMissionIntoSegment so loading a library
mission either:
- splices into the requested segment (when the load came from the
radial menu), preserving waypoint ids consistently between the
top-level and survey-internal lists so editing the survey later
doesn't leave an orphan polygon on the map;
- appends to the current planning when the planner already has work
in progress (so a second library load doesn't wipe the first); or
- replays the saved settings when the planner is empty.
buildCurrentMissionSnapshot, currentMissionSnapshot and its
watchDebounced, and currentMissionEstimatesSnapshot are also
colocated next to drawMissionOnTheMap so the placement section can
grow without bundling unrelated function-definition relocations into
the same diff.
Replace the single "Mission library" entry plan with a hover submenu in the map context menu that exposes "Save mission to library" (only enabled when there's something to save) and "Add mission from library". The save entry opens the library modal directly on the save form via a new `openSaveOnMount` prop / `missionLibraryOpenSaveOnMount` flag, while the add entry reuses the existing toolbar entry point. Both segment-insert intent and save-on-mount intent are now cleared on every fresh open of the library so a plain toolbar open never inherits stale flags from a previous interaction.
The "Add waypoint", "Add survey", "Add simple path", and "Add mission from library" actions on the map context menu now check which mission endpoint is closer to the click and prepend instead of append when it lands closer to the start. Segment-proximity insertion still wins when the cursor is on or near an existing segment. addWaypoint takes an optional insertIndex, a small getEndpointInsertIndexForLatLng helper drives the choice, and insertMissionIntoSegment accepts -1 for "insert at the very start" with the exclusive upper bound documented so future callers route append-to-end through appendMissionToPlanning. To make the bias UX-discoverable, the first and last waypoints of the current mission are rendered with a new `.endpoint-marker` style (orange fill via `#ff9800`, scaled up to 1.25x around the center) so it's visually obvious which waypoints are the mission's start and end. The `endpoint-marker` class is added through `createWaypointMarkerHtml`'s new `isEndpoint` flag, computed via the small `isEndpointWaypoint(id)` helper and threaded through every place that builds or refreshes a waypoint icon (updateWaypointMarkers, both marker-creation paths, applySelectedWaypointMarkerVisual, and the click-clear handler) so the highlight stays consistent across selection, drag, zoom, and survey entry/exit re-renders.
7dad330 to
272ffd8
Compare
|
Review follow-up — round 6 Done
Not addressed
|
|
/review |
1 similar comment
|
/review |
Automated PR Re-review 8 (Claude)Comparing Previous findings status
Discussion since last review@ArturoManzoli explained that findings 5.1 (chevron positioning), 6.6 (wrapper removal), and 10.1 (constant duplication) are all addressed in this push. Finding 4.1 ( New findings0. SummaryVerdict: MINOR SUGGESTIONS Items worth attention: 6.1 (ongoing). This push addresses the chevron positioning fix (5.1), removes the one-liner wrapper (6.6), and deduplicates the 1. Correctness & Implementation Bugs — ✅2. AGENTS.md Adherence — ✅3. Security — ✅4. Performance — ✅5. UI / UX — ✅6. Code Quality & Style6.1 (ongoing, 7. Commit Hygiene — ✅8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional — ✅Generated by Claude. This is advisory; a human reviewer must still approve. |
|
@rafaellehmkuhl This one is also ready to review |
Diff excluding the borrowed$\color{green}\pmb{+1{,}517}$ $\color{red}\pmb{-34}$
[drop]commits:Screenshare.-.2026-06-22.1_37_36.PM.mp4
Second and final PR splitting #2654:
To be merged after #2795