Add Export/Import backup functionality to the admin panel Setup page#715
Add Export/Import backup functionality to the admin panel Setup page#715
Conversation
Co-authored-by: sven-n <5238610+sven-n@users.noreply.github.com> Agent-Logs-Url: https://github.com/MUnique/OpenMU/sessions/fa43bd29-5da9-403d-81e2-28502a6c8273
sven-n
left a comment
There was a problem hiding this comment.
- There are some build errors.
- Can we move/refactor the EfBackupService to the common MUnique.OpenMU.Persistence project, rename to BackupService and use the available repositories? Additionally, you can use the JsonObjectLoader for all types, you just have to pass the commonly used classes into it:
new JsonObjectLoader(new JsonQueryBuilder(), new JsonObjectDeserializer(), new CachingReferenceHandler()).
…jectLoader for all types, fix ambiguous type references Co-authored-by: sven-n <5238610+sven-n@users.noreply.github.com> Agent-Logs-Url: https://github.com/MUnique/OpenMU/sessions/f54d8be1-3e2f-429c-8ae6-779e5215fe8e
Fixed in 145e33c:
|
There was a problem hiding this comment.
Move the backup service to the Persistence project, without dependencies to the entity framework.
It should work for all persistence implementations, which may come up later. Therefore, use the repositories which are available.
There was a problem hiding this comment.
Done in 39ebd06. BackupService is now in src/Persistence/BackupService.cs with no EntityFramework dependencies. It uses IPersistenceContextProvider.CreateNewContext() and IContext.GetAsync<T>() to load objects via the available repositories, making it backend-agnostic. InMemoryBackupService now extends BackupService (inheriting the export path) and only overrides RestoreBackupAsync to throw NotSupportedException.
… IContext.GetAsync Co-authored-by: sven-n <5238610+sven-n@users.noreply.github.com> Agent-Logs-Url: https://github.com/MUnique/OpenMU/sessions/cf6f3fc0-2445-4600-a2e6-11cd40e6cd5d
|
@copilot I get an error when I try to do an export: |
…and JsonObjectDeserializer Co-authored-by: sven-n <5238610+sven-n@users.noreply.github.com> Agent-Logs-Url: https://github.com/MUnique/OpenMU/sessions/96be83dd-97c3-41c5-908e-be6c736acec6
Fixed in 64e7860. |
|
@copilot next issue when clicking the backup button: I think it tries to map some transient properties (marked with |
…s in MapsterConfigurator Co-authored-by: sven-n <5238610+sven-n@users.noreply.github.com> Agent-Logs-Url: https://github.com/MUnique/OpenMU/sessions/f52ad4aa-9751-4aca-8632-70f3363c04c7
... Fixed in cabe60c. Added a global Mapster ignore rule in |
|
@copilot The export works now, now I'm stuck at the import. Additionally, a progress overlay should be shown during the import to the user, because otherwise it's not clear what (or that anything) is happening. |
…ess indicator Co-authored-by: sven-n <5238610+sven-n@users.noreply.github.com> Agent-Logs-Url: https://github.com/MUnique/OpenMU/sessions/458f68ea-7cc1-4925-81a1-e833ed68d2b3
... Fixed in 08bc360:
|
IBackupServiceinterface insrc/Persistence/BackupServiceinsrc/Persistence/— no EF dependencies, usesIPersistenceContextProvider.CreateNewContext()andIContext.GetAsync<T>()via the repository patternInMemoryBackupServiceto extendBackupService(inherits export) and only overrideRestoreBackupAsyncsrc/Persistence/EntityFramework/BackupService.csStartup/Program.csandDapr/Common/Extensions.cs)BackupControllerAPI controller insrc/Web/AdminPanel/API/Setup.razorandSetup.razor.csfor Export/Import UIResources.resxandResources.Designer.csInputFilecomponentIConvertibleTo<BasicModel.ChatServerDefinition>andIConvertibleTo<BasicModel.GameServerDefinition>inExtendedTypes.Custom.csLocalizedStringJsonConvertertoJsonObjectSerializerandJsonObjectDeserializeroptions to fix runtime export errorMapsterConfiguratorto prevent Mapster compile exception during exportNotSupportedException: copyBrowserFileStreamtoMemoryStream(pre-sized withfile.Size) before passing toRestoreBackupAsync, sinceZipArchiveuses synchronous reads internallyOriginal 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.