Skip to content

Commit

Permalink
V12/tree nodes (#537)
Browse files Browse the repository at this point in the history
* Add ability to extend child items of the uSync tree node.

* don't append build onto version (we use it to find scripts)

* schema update

* Add Ability to direct menus from the sub items.

* Fix - path seperator not using linux safe '/' value

* fix - for subtrees,return a blank menu, when they don't have a menu.
  • Loading branch information
KevinJump authored Sep 5, 2023
1 parent 643fd8e commit 02721a7
Show file tree
Hide file tree
Showing 22 changed files with 463 additions and 262 deletions.
5 changes: 4 additions & 1 deletion dist/build-package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,7 @@ if ($push) {
Write-Host "uSync Packaged : $fullVersion"

Remove-Item ".\last-build-*"
Out-File -FilePath ".\last-build-$fullVersion.txt" -InputObject $fullVersion
Out-File -FilePath ".\last-build-$fullVersion.txt" -InputObject $fullVersion

## beep means i can look away :)
[console]::beep(1984,500)
38 changes: 19 additions & 19 deletions uSync.AutoTemplates/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"net7.0": {
"Umbraco.Cms.Web.BackOffice": {
"type": "Direct",
"requested": "[12.0.0, )",
"resolved": "12.0.0",
"contentHash": "FRdv36G9fygQfO1mjEpfM4jhIaw9olBF5SPOj5nKmhFkZ0c7eZV+9wJmXNWhbobU5N5jR0vfUl57gXX9sQ1qcg==",
"requested": "[12.0.1, )",
"resolved": "12.0.1",
"contentHash": "+t2sNeHPcDTok3pk+nQqmB22PNBV1uzJkkghgOAZz7uENYMiMG3wGGYz92Yz79z2Un9tXNta5l9B8fv91G5RiA==",
"dependencies": {
"Newtonsoft.Json": "13.0.3",
"Serilog.AspNetCore": "7.0.0",
"Umbraco.Cms.Web.Common": "12.0.0"
"Umbraco.Cms.Web.Common": "12.0.1"
}
},
"Asp.Versioning.Abstractions": {
Expand Down Expand Up @@ -2013,8 +2013,8 @@
},
"Umbraco.Cms.Core": {
"type": "Transitive",
"resolved": "12.0.0",
"contentHash": "pP2cyBiUdqJL/f7ji6nCkr9jEv24I5m7CmmXX8RVNXkFLsZvffJgOAqXh/ozJaLr3a4lUPJeNyeSvaYWXMTpLw==",
"resolved": "12.0.1",
"contentHash": "rJPnp7KBgbDoQusCUG0JPf1+76c2Wc/kNxkECHjXllBi7Ob0KwHgpqGp9KRewSOygSshZXHK2Hp4c3pkK+9Whw==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "7.0.0",
"Microsoft.Extensions.FileProviders.Embedded": "7.0.7",
Expand All @@ -2035,17 +2035,17 @@
},
"Umbraco.Cms.Examine.Lucene": {
"type": "Transitive",
"resolved": "12.0.0",
"contentHash": "M7JvsMjMRR1DhF5YPaeeZfYBex+uiblE1qUymrAklGOrkMZn+W3Kakk27Jc1RTN32wAAGW/wxbixHQM2W0TZeQ==",
"resolved": "12.0.1",
"contentHash": "aY+SAtW6Ukwp9m/GnABBoWPzJm5Rg0Ye04yh5amOcr1D7PunXZtUC4KJySFyAAsKBl8N71oxX8WPr24Xy5M9iA==",
"dependencies": {
"Examine": "3.1.0",
"Umbraco.Cms.Infrastructure": "12.0.0"
"Umbraco.Cms.Infrastructure": "12.0.1"
}
},
"Umbraco.Cms.Infrastructure": {
"type": "Transitive",
"resolved": "12.0.0",
"contentHash": "5krqkb4TJtUCJfu0zM2272F9ucDpdQO6nkEJSstnfjsof6Nf4JtMJogqY/0WFNutHk992+jIDJinIf9ShHzYBw==",
"resolved": "12.0.1",
"contentHash": "nw/h4Q+MCaKTSltTwgXTzH79mpNgwdoV8Wzkb0rO015vZiC2KGxd+XkPgzgMO1Gqb3+8nK20mr1HwYd5QJMLWA==",
"dependencies": {
"Examine.Core": "3.1.0",
"HtmlAgilityPack": "1.11.48",
Expand Down Expand Up @@ -2075,26 +2075,26 @@
"System.IO.FileSystem.AccessControl": "5.0.0",
"System.Security.Cryptography.Pkcs": "7.0.2",
"System.Threading.Tasks.Dataflow": "7.0.0",
"Umbraco.Cms.Core": "12.0.0",
"Umbraco.Cms.Core": "12.0.1",
"ncrontab": "3.3.1"
}
},
"Umbraco.Cms.PublishedCache.NuCache": {
"type": "Transitive",
"resolved": "12.0.0",
"contentHash": "h+Q5sqX+iDN0KlUY24Oi7XMvRAlZw2JzHsrbSQZ3kJlnSKvPB5ohWpG8U5oHlZwsfadaZRkLfYb1slu5c1lUXQ==",
"resolved": "12.0.1",
"contentHash": "DQfX0pzbofyjIRujjEclwYV/C0ojx9gV97rGOe7NtXN5zMHw2usfPSpBCuwtOAgPpGgQBMBZjxmrJLZerbO3tg==",
"dependencies": {
"K4os.Compression.LZ4": "1.3.5",
"MessagePack": "2.5.108",
"Newtonsoft.Json": "13.0.3",
"Umbraco.CSharpTest.Net.Collections": "15.0.0",
"Umbraco.Cms.Infrastructure": "12.0.0"
"Umbraco.Cms.Infrastructure": "12.0.1"
}
},
"Umbraco.Cms.Web.Common": {
"type": "Transitive",
"resolved": "12.0.0",
"contentHash": "LuW9rtGkheo/77T5HdY5VtG9DXXe/Z68crVCiG9BMda6WS/oO6FOoa6ijm07DSe022mS+9j3zaQ4DN7ehiIhdg==",
"resolved": "12.0.1",
"contentHash": "WKV61k0PSDzaxHgPZiHboxx5NBfX/D5/DlapesTFBTrYSvytFO0Cll0fPorEUxO/Z3SdTVeLcXAjxH557Bmi1A==",
"dependencies": {
"Asp.Versioning.Mvc": "7.0.0",
"Asp.Versioning.Mvc.ApiExplorer": "7.0.0",
Expand All @@ -2104,8 +2104,8 @@
"MiniProfiler.AspNetCore.Mvc": "4.3.8",
"Smidge.InMemory": "4.3.0",
"Smidge.Nuglify": "4.3.0",
"Umbraco.Cms.Examine.Lucene": "12.0.0",
"Umbraco.Cms.PublishedCache.NuCache": "12.0.0"
"Umbraco.Cms.Examine.Lucene": "12.0.1",
"Umbraco.Cms.PublishedCache.NuCache": "12.0.1"
}
},
"Umbraco.CSharpTest.Net.Collections": {
Expand Down
2 changes: 1 addition & 1 deletion uSync.AutoTemplates/uSync.AutoTemplates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="12.0.0" />
<PackageReference Include="Umbraco.Cms.Web.BackOffice" Version="12.0.1" />
</ItemGroup>


Expand Down
57 changes: 0 additions & 57 deletions uSync.BackOffice/Controllers/Trees/uSyncTreeController.cs

This file was deleted.

91 changes: 91 additions & 0 deletions uSync.BackOffice/Expansions/ISyncTreeNode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using System.Collections.Generic;

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

using Umbraco.Cms.Core.Trees;

namespace uSync.BackOffice.Expansions
{
/// <summary>
/// add on for uSync that allows you to render a node
/// under the uSync tree.
/// </summary>
public interface ISyncTreeNode
{
/// <summary>
/// position in the tree, (higher is lower down the tree)
/// </summary>
public int Weight { get; }

/// <summary>
/// Id this will be passed to the controller.
/// </summary>
public string Id { get; }

/// <summary>
/// alias for the tree
/// </summary>
public string TreeAlias { get; }

/// <summary>
/// alias for the node item
/// </summary>
public string Alias { get; }

/// <summary>
/// title of the tree item
/// </summary>
public string Title { get; }

/// <summary>
/// icon for the tree item.
/// </summary>
public string Icon { get; }


/// <summary>
/// method to return any additional child nodes under the parent node
/// </summary>
public IEnumerable<uSyncTreeNode> GetChildNodes(string id, FormCollection queryStrings);

/// <summary>
/// to display any context menu.
/// </summary>
/// <param name="id"></param>
/// <param name="queryStrings"></param>
/// <returns></returns>
public ActionResult<MenuItemCollection> GetMenuItems(string id, FormCollection queryStrings);
}

/// <summary>
/// Representation of a single tree node
/// </summary>
public class uSyncTreeNode
{
/// <summary>
/// Id for this tree node
/// </summary>
public string Id { get; set; }

/// <summary>
/// Alias of the tree item
/// </summary>
public string Alias { get; set; }

/// <summary>
/// title (shown to user) for tree item
/// </summary>
public string Title { get; set; }

/// <summary>
/// Icon to display.
/// </summary>
public string Icon { get; set; }

/// <summary>
/// segment path to this item.
/// </summary>
public string Path { get; set; }
}
}
29 changes: 29 additions & 0 deletions uSync.BackOffice/Expansions/SyncTreeNodeCollection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;

using Umbraco.Cms.Core.Composing;

namespace uSync.BackOffice.Expansions;

/// <summary>
/// collection of UI tree nodes, allows us to dynamically extend the uSync tree
/// </summary>
public class SyncTreeNodeCollection
: BuilderCollectionBase<ISyncTreeNode>
{
/// <inheritdoc/>
public SyncTreeNodeCollection(Func<IEnumerable<ISyncTreeNode>> items)
: base(items)
{ }
}

/// <summary>
/// collection builder for UI tree nodes under uSync tree.(subtrees)
/// </summary>
public class SyncTreeNodeCollectionBuilder
: LazyCollectionBuilderBase<SyncTreeNodeCollectionBuilder,
SyncTreeNodeCollection, ISyncTreeNode>
{
/// <inheritdoc/>
protected override SyncTreeNodeCollectionBuilder This => this;
}
Loading

0 comments on commit 02721a7

Please sign in to comment.