Enable metadata editing and server sync for online objects#226
Enable metadata editing and server sync for online objects#226
Conversation
- Made metadata fields editable in MetadataView.axaml (Description, CreatedDate, ModifiedDate) - Added two-way binding support in LocoObjectMetadataViewModel with ReactiveUI - Implemented server-side UpdateAsync endpoint in ObjectRouteHandler.cs - Added client-side UpdateObjectAsync method in Client.cs and ObjectServiceClient.cs - Integrated metadata upload in ObjectEditorViewModel.Save() for online mode Co-authored-by: LeftofZen <7483209+LeftofZen@users.noreply.github.com>
- Updated ObjectRoutesTest to test the PUT endpoint for metadata updates - Test verifies that Description, CreatedDate, ModifiedDate, and Availability fields can be updated - Test passes successfully Co-authored-by: LeftofZen <7483209+LeftofZen@users.noreply.github.com>
- Eliminated redundant database query in UpdateAsync endpoint - Added null check for CurrentObject.DatInfo before accessing - Improved error logging format - Removed unnecessary Task.Run wrapper Co-authored-by: LeftofZen <7483209+LeftofZen@users.noreply.github.com>
|
@copilot this is a good start but only a few of the metadata properties are exposed in ObjectMetadataViewModel. All of them need to be exposed, editable and saveable to the server |
- Added Availability property to ObjectMetadataViewModel with two-way binding - Added InternalName property (readonly) to ViewModel - Added UploadedDate property to ViewModel - Updated MetadataView.axaml to show all properties with appropriate controls - Changed Availability from readonly TextBox to editable ComboBox - Added InternalName field display - Fixed DataContext binding to use ViewModel properties instead of direct Metadata binding - Updated type references from LocoObjectMetadataViewModel to ObjectMetadataViewModel Co-authored-by: LeftofZen <7483209+LeftofZen@users.noreply.github.com>
All metadata properties from Editable properties (saved to server):
Readonly properties (displayed but not editable):
Collection properties (displayed in separate tabs):
All editable properties are uploaded to the server when saving in online mode. Fixed in commit ae4edac. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
- Changed UploadedDate to direct property binding (no setter) - Removed backing field for UploadedDate - Changed binding mode to OneWay in MetadataView.axaml Co-authored-by: LeftofZen <7483209+LeftofZen@users.noreply.github.com>
|
@copilot this is great; just a few finishing touches now:
|
1. Made Availability and InternalName readonly (removed editable ComboBox for Availability) 2. Made Licence editable as ComboBox with values from /licences endpoint, includes "None" option 3. Added UI for editing Authors, Tags, and ObjectPacks with add/remove functionality 4. Added ReactiveCommands for add/remove operations 5. Fetch available Authors, Tags, ObjectPacks, and Licences from server 6. Sync collections back to Metadata model when changed Co-authored-by: LeftofZen <7483209+LeftofZen@users.noreply.github.com>
All three finishing touches implemented in commit 22d06e0:
All collections sync changes back to the Metadata model and are uploaded to the server when saving in online mode. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
This PR enables full metadata editing in the ObjectEditor UI and implements server synchronization for online objects. The changes include renaming LocoObjectMetadata to ObjectMetadata, implementing a comprehensive ObjectMetadataViewModel with collection editing capabilities, and adding an API endpoint for metadata updates.
Key Changes
- Introduced a new
ObjectMetadataViewModelthat exposes all editable metadata fields (Description, Licence, CreatedDate, ModifiedDate, Authors, Tags, ObjectPacks) with two-way binding and ReactiveUI change notifications - Implemented server-side
UpdateAsyncPUT endpoint and corresponding client methods to persist metadata changes when in online mode - Renamed
LocoObjectMetadatatoObjectMetadatathroughout the codebase for better naming clarity
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| Gui/Views/MetadataView.axaml | Updated UI to expose all editable metadata fields with two-way bindings and added interactive collection editing (Authors, Tags, ObjectPacks) with ComboBoxes and Add/Remove buttons |
| Gui/ViewModels/ObjectMetadataViewModel.cs | New comprehensive viewmodel that wraps ObjectMetadata, provides ReactiveUI property notifications, manages server data loading, and implements collection editing commands |
| Gui/ViewModels/LocoTypes/ObjectEditorViewModel.cs | Modified Save() to call UploadMetadataAsync() for online objects, which constructs and sends DtoObjectDescriptor to the server |
| Gui/ViewModels/LocoObjectMetadataViewModel.cs | Removed the simple wrapper class (now replaced by ObjectMetadataViewModel) |
| Gui/ViewModels/FolderTreeViewModel.cs | Updated type reference from LocoObjectMetadata to ObjectMetadata |
| Gui/ObjectServiceClient.cs | Added client methods for UpdateObjectAsync, GetLicencesAsync, GetAuthorsAsync, GetTagsAsync, and GetObjectPacksAsync |
| Gui/Models/ObjectEditorModel.cs | Updated type references from LocoObjectMetadata to ObjectMetadata |
| Gui/Models/LocoUIObjectModel.cs | Updated Metadata property type from LocoObjectMetadata to ObjectMetadata |
| Gui/Converters/EnumToMaterialIconConverter.cs | Updated mapping key from LocoObjectMetadata to ObjectMetadata |
| Gui/App.axaml | Updated DataTemplate reference from LocoObjectMetadataViewModel to ObjectMetadataViewModel |
| ObjectService/RouteHandlers/TableHandlers/ObjectRouteHandler.cs | Implemented UpdateAsync endpoint to handle metadata updates and added fully-qualified type name for SourceData.ObjectMetadata |
| Definitions/Web/Client.cs | Added static helper methods for UpdateObjectAsync, GetLicencesAsync, GetAuthorsAsync, GetTagsAsync, and GetObjectPacksAsync |
| Definitions/ObjectModels/ObjectMetadata.cs | Renamed class from LocoObjectMetadata to ObjectMetadata |
| Tests/ObjectServiceIntegrationTests/ObjectRoutesTest.cs | Added PutAsync test for metadata update and improved error message for PutRequestDto |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1. Add logging to LoadServerDataAsync exception handler - users now know why data fails to load 2. Handle fire-and-forget Tasks properly with ContinueWith to observe exceptions 3. Add comprehensive tests for PutAsync covering Licence, Authors, Tags, and ObjectPacks updates 4. Pass logger to ObjectMetadataViewModel for better error visibility All 5 PutAsync tests now pass, validating complete metadata update functionality. Co-authored-by: LeftofZen <7483209+LeftofZen@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Metadata Editing Complete ✅
All metadata fields are now editable in the UI and can be saved to the server when in online mode.
Recent Updates (PR Review Feedback)
Editable Properties (Saved to Server)
Readonly Properties
Server API
UpdateAsyncPUT endpoint inObjectRouteHandlerClient Integration
ObjectEditorViewModel.Save()uploads all editable metadata for online objectsCollection Editing Features
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.