diff --git a/uSync.BackOffice/Models/OrderedNodeInfo.cs b/uSync.BackOffice/Models/OrderedNodeInfo.cs index 4da2284f..b4d373c3 100644 --- a/uSync.BackOffice/Models/OrderedNodeInfo.cs +++ b/uSync.BackOffice/Models/OrderedNodeInfo.cs @@ -1,4 +1,5 @@ using System; +using System.Text.Json.Serialization; using System.Xml.Linq; using Umbraco.Extensions; @@ -27,6 +28,7 @@ public OrderedNodeInfo(string filename, XElement node) /// /// set all the values of an ordered node. /// + [JsonConstructor] public OrderedNodeInfo(string filename, XElement node, int level, string path, bool isRoot) : this(filename, node) { @@ -48,7 +50,7 @@ public Guid Key /// /// umbraco alias of the item /// - public string Alias { get; } + public string Alias { get; } /// /// relative path of the item (so same in all 'folders') diff --git a/uSync.Backoffice.Management.Api/Configuration/ConfigSyncApiSwaggerGenOptions.cs b/uSync.Backoffice.Management.Api/Configuration/ConfigSyncApiSwaggerGenOptions.cs index ad8c7874..6de7e956 100644 --- a/uSync.Backoffice.Management.Api/Configuration/ConfigSyncApiSwaggerGenOptions.cs +++ b/uSync.Backoffice.Management.Api/Configuration/ConfigSyncApiSwaggerGenOptions.cs @@ -17,5 +17,6 @@ public void Configure(SwaggerGenOptions options) Version = "Latest", Description = "Api access uSync operations" }); + } } diff --git a/uSync.Backoffice.Management.Client/uSync.Backoffice.Management.Client.csproj b/uSync.Backoffice.Management.Client/uSync.Backoffice.Management.Client.csproj index 7a8e0c58..18d62e74 100644 --- a/uSync.Backoffice.Management.Client/uSync.Backoffice.Management.Client.csproj +++ b/uSync.Backoffice.Management.Client/uSync.Backoffice.Management.Client.csproj @@ -8,4 +8,8 @@ / + + + + diff --git a/uSync.Backoffice.Management.Client/usync-assets/package-lock.json b/uSync.Backoffice.Management.Client/usync-assets/package-lock.json index e69b59ad..d1e10741 100644 --- a/uSync.Backoffice.Management.Client/usync-assets/package-lock.json +++ b/uSync.Backoffice.Management.Client/usync-assets/package-lock.json @@ -1,12 +1,12 @@ { "name": "@jumoo/usync-assets", - "version": "14.0.1-preview001", + "version": "14.1.0-build.20240819.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@jumoo/usync-assets", - "version": "14.0.1-preview001", + "version": "14.1.0-build.20240819.1", "license": "MPL-2.0", "dependencies": { "@microsoft/signalr": "^8.0.0", diff --git a/uSync.Backoffice.Management.Client/usync-assets/package.json b/uSync.Backoffice.Management.Client/usync-assets/package.json index e2e41893..6ca09fd5 100644 --- a/uSync.Backoffice.Management.Client/usync-assets/package.json +++ b/uSync.Backoffice.Management.Client/usync-assets/package.json @@ -2,7 +2,7 @@ "name": "@jumoo/usync-assets", "license": "MPL-2.0", "type": "module", - "version": "14.0.1-preview001", + "version": "14.1.0-build.20240819.1", "main": "./dist/usync.js", "types": "./dist/index.d.ts", "module": "./dist/usync.js", diff --git a/uSync.Backoffice.Management.Client/usync-assets/public/umbraco-package.json b/uSync.Backoffice.Management.Client/usync-assets/public/umbraco-package.json index 90b0a8e0..553e627f 100644 --- a/uSync.Backoffice.Management.Client/usync-assets/public/umbraco-package.json +++ b/uSync.Backoffice.Management.Client/usync-assets/public/umbraco-package.json @@ -2,7 +2,7 @@ "$schema": "../umbraco-package-schema.json", "name": "uSync", "id": "uSync", - "version": "14.0.1-preview001", + "version": "14.1.0-build.20240819.1", "allowTelemetry": true, "extensions": [ { diff --git a/uSync.Core/Sync/ISyncItemManager.cs b/uSync.Core/Sync/ISyncItemManager.cs index 15969208..809b44b3 100644 --- a/uSync.Core/Sync/ISyncItemManager.cs +++ b/uSync.Core/Sync/ISyncItemManager.cs @@ -13,7 +13,7 @@ public interface ISyncItemManager /// Unless the item has some form of shared picker tree with the /// core umbraco UI then answer is likely no (for now) /// - SyncEntityInfo GetSyncInfo(string entityType); + SyncEntityInfo? GetSyncInfo(string entityType); /// /// Which type of tree menu should be used. @@ -52,10 +52,18 @@ public interface ISyncItemManager /// the process should as a bare minimum return the item it is passed, /// when the Include children flag is set - it should also return children. /// - IEnumerable GetItems(SyncItem item); + Task> GetItemsAsync(SyncItem item); /// /// Get the underling Local item for something that was picked from the tree. /// - SyncLocalItem GetEntity(SyncTreeItem treeItem); + Task GetEntityAsync(SyncTreeItem treeItem); + + + /// + /// for a given key find the sync entity. + /// + /// + /// + Task GetSyncEntityAsync(string key); } diff --git a/uSync.Core/Sync/SyncItem.cs b/uSync.Core/Sync/SyncItem.cs index 7db91c0a..4f8bff0b 100644 --- a/uSync.Core/Sync/SyncItem.cs +++ b/uSync.Core/Sync/SyncItem.cs @@ -5,20 +5,37 @@ namespace uSync.Core.Sync; /// -/// An item involved in a sync between servers. SyncItems are the start of any sync process +/// the base for a syncing item. /// -public class SyncItem + +public class SyncEntity { /// /// Name (to display) of the item /// - public string? Name { get; set; } + public required string Name { get; set; } + + /// + /// optional icon to display. + /// + public string? Icon { get; set; } /// /// Umbraco UDI value to identify the item. /// - public Udi? Udi { get; set; } + public required Udi Udi { get; set; } + /// + /// the entity type for the item. + /// + public string EntityType => Udi.EntityType; +} + +/// +/// An item involved in a sync between servers. SyncItems are the start of any sync process +/// +public class SyncItem : SyncEntity +{ /// /// Flags controlling what is to be included when this item is exported /// diff --git a/uSync.Core/Sync/SyncItemManagerBase.cs b/uSync.Core/Sync/SyncItemManagerBase.cs index 0a7f6710..d344f159 100644 --- a/uSync.Core/Sync/SyncItemManagerBase.cs +++ b/uSync.Core/Sync/SyncItemManagerBase.cs @@ -54,7 +54,7 @@ protected string EntityType /// /// /// - protected virtual SyncLocalItem GetRootItem(SyncTreeItem treeItem) + protected virtual SyncLocalItem? GetRootItem(SyncTreeItem treeItem) => new(Constants.System.RootString) { EntityType = EntityType, @@ -62,18 +62,18 @@ protected virtual SyncLocalItem GetRootItem(SyncTreeItem treeItem) Udi = Udi.Create(EntityType) }; - protected abstract IEnumerable GetDescendants(SyncItem item, DependencyFlags flags); + protected abstract Task> GetDescendantsAsync(SyncItem item, DependencyFlags flags); /// /// standard use case, if IncludeChildren flag is set, return this item and all its children. /// if not just return this item. /// - public virtual IEnumerable GetItems(SyncItem item) + public virtual async Task> GetItemsAsync(SyncItem item) { if (item.Flags.HasFlag(DependencyFlags.IncludeChildren)) { var items = new List { item }; - items.AddRange(GetDescendants(item, item.Flags & ~DependencyFlags.IncludeChildren)); + items.AddRange(await GetDescendantsAsync(item, item.Flags & ~DependencyFlags.IncludeChildren)); return items; } else @@ -100,15 +100,16 @@ public virtual IEnumerable GetItems(SyncItem item) /// public abstract class SyncItemManagerIndexBase : SyncItemManagerBase { - protected abstract SyncLocalItem GetLocalEntity(TIndexType id); + protected abstract Task GetLocalEntityAsync(TIndexType id); - public virtual SyncLocalItem? GetEntity(SyncTreeItem treeItem) + /// + public virtual async Task GetEntityAsync(SyncTreeItem treeItem) { if (treeItem.IsRoot()) return GetRootItem(treeItem); var attempt = treeItem.Id.TryConvertTo(); if (attempt.Success && attempt.Result is not null) - return GetLocalEntity(attempt.Result); + return await GetLocalEntityAsync(attempt.Result); return null; }