diff --git a/uSync.BackOffice/BackOfficeConstants.cs b/uSync.BackOffice/BackOfficeConstants.cs index 86798050..31b77575 100644 --- a/uSync.BackOffice/BackOfficeConstants.cs +++ b/uSync.BackOffice/BackOfficeConstants.cs @@ -168,10 +168,10 @@ public static class Groups /// Icons for the well known handler groups. /// public static Dictionary Icons = new Dictionary { - { Settings, "icon-settings-alt color-blue" }, - { Content, "icon-documents color-purple" }, + { Settings, "icon-settings-alt" }, + { Content, "icon-documents" }, { Members, "icon-users" }, - { Users, "icon-users color-green"}, + { Users, "icon-users"}, { Default, "icon-settings" }, { Forms, "icon-umb-contour" }, { Files, "icon-script-alt" } diff --git a/uSync.Backoffice.Management.Api/Services/uSyncManagementService.cs b/uSync.Backoffice.Management.Api/Services/uSyncManagementService.cs index 4ec596bf..366e3812 100644 --- a/uSync.Backoffice.Management.Api/Services/uSyncManagementService.cs +++ b/uSync.Backoffice.Management.Api/Services/uSyncManagementService.cs @@ -2,6 +2,8 @@ using Microsoft.AspNetCore.SignalR; +using Umbraco.Extensions; + using uSync.Backoffice.Management.Api.Extensions; using uSync.Backoffice.Management.Api.Models; using uSync.BackOffice; @@ -23,16 +25,20 @@ internal class uSyncManagementService : ISyncManagementService private readonly IHubContext _hubContext; private readonly uSyncConfigService _configService; + private readonly SyncHandlerFactory _handlerFactory; + public uSyncManagementService( ISyncActionService syncActionService, uSyncConfigService configService, ISyncManagementCache syncManagementCache, - IHubContext hubContext) + IHubContext hubContext, + SyncHandlerFactory handlerFactory) { _syncActionService = syncActionService; _configService = configService; _syncManagementCache = syncManagementCache; _hubContext = hubContext; + _handlerFactory = handlerFactory; } /// @@ -40,6 +46,8 @@ public uSyncManagementService( /// public List GetActions() { + // TODO: Load the actions based on the handlers, and the config, (so they can be turned on and off) + var defaultReport = new SyncActionButton() { Key = HandlerActions.Report.ToString(), @@ -90,31 +98,67 @@ public List GetActions() List defaultButtons = [defaultReport, defaultImport, defaultExport]; List everythingButtons = [defaultReport, defaultImport, everythingExport]; - List actions = [ - new SyncActionGroup - { - GroupName = "Settings", - Icon = "icon-settings-alt", - Key = "settings", - Buttons = defaultButtons - }, - new SyncActionGroup - { - GroupName = "Content", - Icon = "icon-documents", - Key = "content", - Buttons = defaultButtons - }, - new SyncActionGroup - { - GroupName = "Everything", - Icon = "icon-paper-plane-alt", - Key = "all", - Buttons = everythingButtons - } - ]; + List actionGroups = []; + + var options = new SyncHandlerOptions(_configService.Settings.DefaultSet) + { + Group = _configService.Settings.UIEnabledGroups + }; + + var groups = _handlerFactory.GetValidHandlerGroupsAndIcons(options); + + foreach(var group in groups) + { + actionGroups.Add(new SyncActionGroup + { + GroupName = $"{group.Key}", + Icon = group.Value, + Key = group.Key.ToLowerInvariant(), + Buttons = defaultButtons + }); + } + + if (string.IsNullOrWhiteSpace(_configService.Settings.UIEnabledGroups) || + _configService.Settings.UIEnabledGroups.InvariantContains("all")) + { + actionGroups.Add(new SyncActionGroup + { + GroupName = "Everything", + Icon = "icon-paper-plane-alt", + Key = "all", + Buttons = everythingButtons + }); + } - return actions; + return actionGroups; + + + + // List actions = [ + // new SyncActionGroup + // { + // GroupName = "Settings", + // Icon = "icon-settings-alt", + // Key = "settings", + // Buttons = defaultButtons + // }, + // new SyncActionGroup + // { + // GroupName = "Content", + // Icon = "icon-documents", + // Key = "content", + // Buttons = defaultButtons + // }, + // new SyncActionGroup + // { + // GroupName = "Everything", + // Icon = "icon-paper-plane-alt", + // Key = "all", + // Buttons = everythingButtons + // } + //]; + + // return actions; } 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 6a8d77d6..847e9dc1 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.0-rc4.20240528.14", + "version": "14.0.0-rc4.20240528.15", "allowTelemetry": true, "extensions": [ { diff --git a/uSync.Backoffice.Management.Client/usync-assets/src/components/usync-action-box.ts b/uSync.Backoffice.Management.Client/usync-assets/src/components/usync-action-box.ts index 571705c6..39246737 100644 --- a/uSync.Backoffice.Management.Client/usync-assets/src/components/usync-action-box.ts +++ b/uSync.Backoffice.Management.Client/usync-assets/src/components/usync-action-box.ts @@ -60,7 +60,7 @@ export class uSyncActionBox extends LitElement {

${this.group?.groupName}

- +
${dropdownButtons}
@@ -88,7 +88,7 @@ export class uSyncActionBox extends LitElement { margin: 0; } - uui-icon { + umb-icon { margin: var(--uui-size-space-6); font-size: var(--uui-type-h2-size); color: var(--uui-color-text-alt);