Skip to content

Commit

Permalink
Don't show disabled things in the uSync tree.
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJump committed Sep 26, 2023
1 parent 28d8801 commit f7d84f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions uSync.BackOffice/Expansions/ISyncTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ namespace uSync.BackOffice.Expansions
/// </summary>
public interface ISyncTreeNode
{
/// <summary>
/// if the tree node is in-fact enabled.
/// </summary>
public bool Disabled { get; }

/// <summary>
/// position in the tree, (higher is lower down the tree)
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions uSync.BackOffice/Expansions/uSyncTreeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ protected override ActionResult<TreeNodeCollection> GetTreeNodes(string id, [Mod

if (id == Constants.System.RootString)
{
foreach (var node in _treeNodes.OrderBy(x => x.Weight))
foreach (var node in _treeNodes.Where(x => !x.Disabled).OrderBy(x => x.Weight))
{
var treeNode = CreateTreeNode(
node.Id,
id,
queryStrings,
node.Title,
node.Icon,
$"{SectionAlias}/{node.TreeAlias}/{node.Alias}");
$"{SectionAlias}/{node.TreeAlias}/{node.Alias}");

var children = node.GetChildNodes(id, queryStrings);
if (children?.Any() == true)
Expand Down

0 comments on commit f7d84f5

Please sign in to comment.