-
-
Notifications
You must be signed in to change notification settings - Fork 317
Feature: Job/Task Architecture #1119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Did we remove intentionally the Open from ISO-XML and KML options? Not quite sure why the Open Local field is good, maybe n case we don't have AgShare the fact that we need 2 steps to open local fields is a bit excessive but it's a good way to advertise AgShare. Btw It would be great to be able to mass import KML files later (i.e. if we organize them inside Google Earth then we should be able to import all the fields together in a loop. I have made a couple tools for farmers to download files for boundaries.) ISOXML already contains multiple fields / AB lines / etc we should be able to generate all the fields from that Add Task: Task page: Notes: This way in AgShare too we could have a quick and easy overview of what was planted for a given season. (and also the tasks for that plant) Grandpa Option: Just create a New Field with the date + time + profile , and automatically display the A-B line picker (in fact if we have no AB lines we should probably have that menu opened it would save us a few phone calls) This is a much better place to choose a profile. IMHO we should offer the option to pick a profile and create a new from the Machine selection screen. (and if we do this then after that profile is created we should open the settings page with the nozzles so they can easily modify the width) I like that we no longer have the reception bars. |
|
Would this also bring us the possibility to have the coverage displayed from a previous task? (or a task currently managed by another tractor that would appear as a flag moving once a minute or so) |
|
Extra feedback from a hungarian tester: Maybe it could fit under the Work Type Selection where the previous operations could be displayed (if they exists) |
Yes that is the Export Function which is disabled because it isnt implemented yet. |
Running jobs are active.. finished jobs are finished and unable to Unfinish since they are finished. Other then that it can be possible to put it under the current Job as a layer, just for visualization. |
9ec4690 to
7202361
Compare
|
@codex please review again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
526c84b to
ecba922
Compare
|
About the file structure: I wonder if it would be better to make an elevation.txt for each task. They are still only made if the user enable the option in the profile? If you want an elevation profile you most likely want to know from which task it comes from anyway. Not counting be bad pts it could collect from multiple pass with different vehicles. |
why should a elevation file belong to a task? Its field related? |
Yes and no. I think we should log it both places. Do we have a use-case for this? No. Should we upload this to AgShare? I'd say No. (lets keep the storage there minimal) |
Correct, it isn’t connected yet.
correct, it’s a place holder.
I think we need to change the SIM enable to registry instead of settings. |
It's related to the task (It's related to the vehicle used). If you keep it field related It's almost guaranteed to be a mess and unusable after some numbers of tasks: If you eventually need elevation for some function in AOG, I would say take this from the task you select for "visual previous task" layer. |
- Add CJob class with properties for job metadata (id, name, field, profile, work type, timestamps)
- Add JobFiles.cs with Load/Save/List operations for job directories
- Add CreateEmpty methods to ContourFiles and FlagsFiles for job initialization
- Jobs will be stored in Fields/{FieldName}/Jobs/{JobName}/ folders
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
- Add CWorkType class for work type definitions (id, name, icon) - Add WorkTypes static manager with Load/Save/Add/Remove operations - Include default work types (Spraying, Seeding, Tillage, Harvest, Mowing, Fertilizing, Other) - Work types stored in WorkTypes.json in settings directory 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- FormStartWork: Main entry point for job-based workflow with Resume/New/Open/Close buttons - FormJobWizard: 3-step wizard for creating new jobs (Profile -> Field -> WorkType) - FormResumeJob: List of active jobs to resume work sessions All forms follow existing design patterns (borderless, flat buttons, Tahoma font). Forms are created but not yet integrated into main flow - next step will wire them up. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Replace multi-form approach with single form containing switchable panels: - Main menu panel (Resume/New/Open/Close buttons + AgShare) - Wizard Step 1: Profile selection - Wizard Step 2: Field selection - Wizard Step 3: Work type & job name - Resume job list panel Uses ViewMode enum for state management and panel visibility switching. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
All functionality is now consolidated in FormStartWork with embedded panels. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Track the currently active job (work session) within a field. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Add GetJobDir() method to return job directory when currentJob is set - Update FileSaveSections, FileSaveContour, FileSaveFlags, FileSaveRecPath to use job directory - Update FileCreateSections, FileCreateContour, FileCreateFlags, FileCreateRecPath to use job directory - Add FileLoadJobData() method to load job-specific coverage data after setting currentJob When no job is active, operations fall back to field directory for backward compatibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Check if field has legacy coverage data (Sections.txt in field root without Jobs folder). This enables UI to detect and handle migration of legacy fields to job-based system. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Replace FormJob with FormStartWork in the job menu button click handler. FormStartWork handles all job operations internally (new job, resume, open field, etc.) so the complex DialogResult handling is no longer needed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Form is now borderless (FormBorderStyle.None) with colored border - Added draggable header panel for moving the form - Buttons have depth with hover effects and subtle shadows - Modern color scheme with softer backgrounds - Better visual hierarchy with styled section headers - AgShare buttons have accent border styling - Cancel button in red for clear visual distinction 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Add btnCloseJob and btnFinishJob buttons to main view (3x2 grid) - Close Job: saves job and clears currentJob, job stays in active list - Finish Job: marks job as completed, won't appear in resume list - Update button states based on currentJob: - Resume/New Job disabled when job is active - Close/Finish Job enabled only when job is active - Set mf.currentJob when creating or resuming jobs - Skip wizard steps 1-2 when field is already open (direct to step 3) - Fix Resume Job crash: properly close field before opening different one - Improve Resume Job list layout: FieldName prominent on same line as JobName - Remove drag functionality (form is always CenterParent) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Refactors the FormStartWork form to improve the user experience for field and job management. Introduces a dedicated panel for opening fields, allowing users to select from local storage or AgShare cloud. Reorganizes the layout of job-related actions into a separate table for better clarity.
- Coverage only saves when a job is active (not in View-Only mode) - FileSaveSections(), FileSaveContour(), FileSaveRecPath() check currentJob != null - patchSaveList/contourSaveList still cleared to prevent memory buildup - Flags now load from field level (shared across all jobs) - Added debug output for troubleshooting coverage saves - Updated GetJobDir() comments for clarity 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <[email protected]>
Coverage Import (Backward Compatibility): - CheckForExistingCoverage() detects legacy Sections.txt in field root - ShowImportDialog() using FormDialog for user choice - ImportCoverageToJob() copies coverage files to new job directory - DeleteLegacyCoverage() cleans up field-root coverage after choice Job Close/Finish: - Use await instead of fire-and-forget for FileSaveEverythingBeforeClosingField() - Close Job and Finish Job now also close the field via mf.JobClose() - Job metadata saved before clearing currentJob Resume Job: - Properly saves and closes current job before switching - FileLoadJobData() called after setting currentJob UI Improvements: - Added OpenField panel with separate Local Storage and AgShare sections - Fixed field list in wizard step 2 to show all fields correctly 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <[email protected]>
- Replace lblFix with lblJobStatus for job status display in top bar - Add FixQuality icons (0-4, 8) to show GPS fix status on btnGPSData - Add Age display to FormGPSData (between HDOP and Frame) - Remove scrolling text behavior from top bar labels - Load profile when selected in wizard Step 1 - Fix AgShare snapshot creation timing (create on menu click) - Handle invalid AgShare GUID format with user-friendly error
Main panel improvements: - Add tableJobs (3x2): Resume Last Job, Resume Job (List), Finish Job, New Job, Close Job, Export Jobs (placeholder) - Add tableFields (2x2): Open Field, New Field, Close Field - Add lblLastJobInfo below tableJobs showing last job details - Add lblCurrentField below tableFields showing current/last field - Hide Field section when a job is active - Keep form open after Close Job, Finish Job, Close Field actions Job management: - Add JobManager class to handle job lifecycle (create, resume, close, finish) and coverage import/migration - Resume Last Job directly opens the last job - Resume Job (List) always shows the job selection list - Disable Resume/New Job buttons when a job is already open - Disable Close Field when a job is active (must close job first) Wizard improvements: - Add "+ New Field" button in Step 2 between Back and Next - Auto-select last opened field in the field list - Support creating new field + job in a single flow (Step 3) Other changes: - Add FormKeyboard support for text inputs (txtFieldName, txtJobName) - Set FormKeyboard StartPosition to CenterParent - Use BeginInvoke for focus to ensure UI updates before keyboard opens 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Rename all Job-related classes, properties, and UI elements to Task: Classes: - CJob → CTask - JobManager → TaskManager - JobFiles → TaskFiles Properties: - currentJob → currentTask - jobManager → taskManager UI elements: - tableJobs → tableTasks - btnResumeLastJob → btnResumeLastTask - btnResumeJob → btnResumeTask - btnNewJob → btnNewTask - btnCloseJob → btnCloseTask - btnFinishJob → btnFinishTask - btnExportJobs → btnExportTasks - lblLastJobInfo → lblLastTaskInfo - lblJobStatus → lblTaskStatus - txtJobName → txtTaskName - flpJobList → flpTaskList Button text updated to use "Task" instead of "Job" File structure: - Jobs folder → Tasks folder 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add task closing logic to ShowSavingFormAndShutdown() to ensure the current task is properly saved when the application exits. This calls CloseCurrentTask() after field data is saved, which updates task metadata (end time, status) before the app closes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Rename "New Field" button to "Add Field" with sub-panel options: - Create New Field (FormFieldDir) - From ISO-XML (FormFieldIsoXml) - From KML (FormFieldKML) - Replace ListBox with ListView for field selection in wizard Step 2: - Show field name, distance (km/mi), and area (ha/ac) - Bold header row with column labels - Sort by Name, Distance, or Area via Sort button - Distance calculated from current GPS position - Area calculated from boundary using shoelace algorithm - UI improvements: - Fixed column widths (no user resize) - Larger font (20pt) for better readability - Auto-select last opened field
FileSaveEverythingBeforeClosingField() was being called fire-and-forget in three methods, allowing the save to run concurrently with operations that change currentJob/currentFieldDirectory. This could cause coverage data to be saved to the wrong folder or not saved at all. Changed btnOpenFieldLocal_Click, btnAddFieldNew_Click, and DoResumeTask to properly await the save operation before proceeding. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
InitializeTaskFiles now checks if a task directory already exists before creating files. If a task with the same name exists, it throws an InvalidOperationException instead of silently overwriting coverage data. TaskManager catches this exception and shows a user-friendly error message, preventing operators from accidentally erasing existing task data by reusing the same task name (e.g., default name yyyy-MM-dd_Work_Profile on the same day). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Implemented template-based task notes system with WorkType-specific fields:
**New Features:**
- Template-based notes with dynamic fields per WorkType (Spraying, Seeding, Fertilizing, etc.)
- Previous Tasks panel showing last 10 tasks for selected field with notes preview
- Auto-load notes from selected previous task
- Notes displayed in Resume Task List and Last Task info
- Last-used values saved and auto-filled per WorkType
- WorkType selection UI improvement - hide buttons after selection, show selected type with back button
**New Files:**
- WorkTypeTemplate.cs - Template definition classes (WorkTypeTemplate, TemplateField)
- WorkTypeTemplates.cs - Template management with case-insensitive WorkType matching
**Modified Files:**
- CTask.cs - Added Notes and NoteFields properties
- TaskFiles.cs - Added ListAllTasksForField() method
- FormStartWork.cs - Added LoadNotesTemplate(), CreateNoteField(), SaveNotesToTask(), LoadPreviousTasks()
- FormStartWork.Designer.cs - Added panelNotes, flpNoteFields, panelPreviousTasks, lvPreviousTasks UI components
**Technical Details:**
- Dynamic UI generation using FlowLayoutPanel with Panel containers
- ListView with SelectedIndexChanged event for auto-loading notes
- Case-insensitive WorkType matching using ToLowerInvariant()
- Template storage in {fieldsDirectory}/note_templates.json
- Dropdown fields for units (L/ha, kg/ha, etc.)
- Text fields for Product, Rate, Crop, Variety, etc.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
f6538c3 to
f31163b
Compare
Update FormAgShareUploader instantiation to pass required AgShareClient parameter. This aligns with the refactoring where AgShare components were moved to AgOpenGPS.Core/AgShare. **Changes:** - Pass mf.agShareClient to FormAgShareUploader constructor in FormStartWork.cs - Consistent with existing pattern in FormJob.cs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
|
@richardklasens from the ISOBUS/ RATE controller perspective we could easily send the actual flow (seed etc) values and those could be stored alongside the job data. (Which means our isoxml exports will likely need changes too.) The planter monitoring data could also be stored in a map. Is this something we could do in the future? |
Everything is possible yes, but lets finish this addition first. GOt a lot more work to do for AgShare to get rid of your 800+ fields ;-) |
Improves the task creation flow by prompting the user to create a task immediately after creating a new field. This streamlines the workflow and encourages users to define tasks for newly created fields, ensuring that work is properly tracked and managed. Adds work type icons to the task selection screen.


Pull Request: Task Architecture
Summary
This PR introduces a comprehensive Task-based workflow for AgOpenGPS, allowing operators to track work sessions (tasks) within fields. Tasks store coverage data separately, enabling multiple work sessions on the same field without overwriting previous data.
Key features:
Changes by Commit
1.
98a839aa- Add Job data model and file I/O for job-based work sessionsCJobclass with properties for job metadata (id, name, field, profile, work type, timestamps)JobFiles.cswith Load/Save/List operations for job directoriesCreateEmptymethods toContourFilesandFlagsFilesfor job initializationFields/{FieldName}/Jobs/{JobName}/folders2.
8200345b- Add CWorkType for customizable work typesCWorkTypeclass for work type definitions (id, name, icon)WorkTypesstatic manager with Load/Save/Add/Remove operationsWorkTypes.jsonin settings directory3.
c3822ced- Add job management formsFormStartWork: Main entry point with Resume/New/Open/Close buttonsFormJobWizard: 3-step wizard for creating new jobs (Profile → Field → WorkType)FormResumeJob: List of active jobs to resume4.
bb19d3e4- Refactor FormStartWork to all-in-one formViewModeenum for state management and panel visibility5.
82caf59a- Remove obsolete FormJobWizard and FormResumeJob6.
e153a6d9- Add currentJob property to FormGPS7.
caded8ea- Add job-aware file operationsGetJobDir()method to return job directory when currentJob is setFileLoadJobData()to load job-specific coverage data8.
db22ec02- Add HasLegacyCoverageData() for backward compatibility9.
b87835f9- Wire up FormStartWork to btnJobMenu_Click10.
be2c9b57- Restyle FormStartWork: borderless with modern UI11.
cf5eabff- Add Close Job and Finish Job buttons12.
3f32a652- Update FormGPS resources13.
2c6ab8f1- Restructures field and job management UI14.
ac7877ce- Add View-Only mode and job-aware coverage saving15.
62a6cade- Improve job management with coverage importCheckForExistingCoverage()detects legacy coverage in field rootShowImportDialog()for user choice on importImportCoverageToJob()copies coverage to new job directoryDeleteLegacyCoverage()cleans up after import16.
bcf69e4f- Add GPS fix quality icons and improve UI17.
2b997917- Refactor FormStartWork UI and add JobManager classJobManagerclass for job lifecycle management18.
0e7e895d- Rename Job to Task throughout codebaseCJob→CTask,JobManager→TaskManager,JobFiles→TaskFilescurrentJob→currentTask,jobManager→taskManagerJobsfolder →Tasksfolder19.
8400b01a- Close active task during application shutdownShowSavingFormAndShutdown()CloseCurrentTask()after field data is saved20.
72023617- Add Field panel and enhanced field list in FormStartWork21.
c24fcd80- Fix race condition when saving field data before switching tasks/fieldsFileSaveEverythingBeforeClosingField()currentTask/currentFieldDirectorybtnOpenFieldLocal_Click,btnAddFieldNew_Click, andDoResumeTaskto properly await save operationFile Structure
New Classes
CTaskTaskFilesCWorkTypeWorkTypesTaskManagerUI Changes
Test Plan
Task Management
Field Management
Bug Fixes
UI