renames ApplicationTree to just Tree

This commit is contained in:
Shannon
2019-01-17 17:33:38 +11:00
parent 1a734141f1
commit 356209e013
10 changed files with 27 additions and 27 deletions

View File

@@ -148,7 +148,7 @@ namespace Umbraco.Web.Editors
var searchableTreeAttribute = searchableTree.Value.SearchableTree.GetType().GetCustomAttribute<SearchableTreeAttribute>(false); var searchableTreeAttribute = searchableTree.Value.SearchableTree.GetType().GetCustomAttribute<SearchableTreeAttribute>(false);
result[ApplicationTree.GetRootNodeDisplayName(tree, Services.TextService)] = new TreeSearchResult result[Tree.GetRootNodeDisplayName(tree, Services.TextService)] = new TreeSearchResult
{ {
Results = searchableTree.Value.SearchableTree.Search(query, 200, 0, out var total), Results = searchableTree.Value.SearchableTree.Search(query, 200, 0, out var total),
TreeAlias = searchableTree.Key, TreeAlias = searchableTree.Key,

View File

@@ -211,7 +211,7 @@ namespace Umbraco.Web.Runtime
{ {
var attribute = treeControllerType.GetCustomAttribute<TreeAttribute>(false); var attribute = treeControllerType.GetCustomAttribute<TreeAttribute>(false);
if (attribute == null) continue; if (attribute == null) continue;
var tree = new ApplicationTree(attribute.SortOrder, attribute.ApplicationAlias, attribute.TreeAlias, attribute.TreeTitle, treeControllerType, attribute.IsSingleNodeTree); var tree = new Tree(attribute.SortOrder, attribute.ApplicationAlias, attribute.TreeAlias, attribute.TreeTitle, treeControllerType, attribute.IsSingleNodeTree);
composition.WithCollectionBuilder<TreeCollectionBuilder>().AddTree(tree); composition.WithCollectionBuilder<TreeCollectionBuilder>().AddTree(tree);
} }
} }

View File

@@ -15,27 +15,27 @@ namespace Umbraco.Web.Services
/// </summary> /// </summary>
/// <param name="treeAlias">The tree alias.</param> /// <param name="treeAlias">The tree alias.</param>
/// <returns>An ApplicationTree instance</returns> /// <returns>An ApplicationTree instance</returns>
ApplicationTree GetByAlias(string treeAlias); Tree GetByAlias(string treeAlias);
/// <summary> /// <summary>
/// Gets all applicationTrees registered in umbraco from the umbracoAppTree table.. /// Gets all applicationTrees registered in umbraco from the umbracoAppTree table..
/// </summary> /// </summary>
/// <returns>Returns a ApplicationTree Array</returns> /// <returns>Returns a ApplicationTree Array</returns>
IEnumerable<ApplicationTree> GetAll(); IEnumerable<Tree> GetAll();
/// <summary> /// <summary>
/// Gets the application tree for the applcation with the specified alias /// Gets the application tree for the applcation with the specified alias
/// </summary> /// </summary>
/// <param name="applicationAlias">The application alias.</param> /// <param name="applicationAlias">The application alias.</param>
/// <returns>Returns a ApplicationTree Array</returns> /// <returns>Returns a ApplicationTree Array</returns>
IEnumerable<ApplicationTree> GetApplicationTrees(string applicationAlias); IEnumerable<Tree> GetApplicationTrees(string applicationAlias);
/// <summary> /// <summary>
/// Gets the grouped application trees for the application with the specified alias /// Gets the grouped application trees for the application with the specified alias
/// </summary> /// </summary>
/// <param name="applicationAlias"></param> /// <param name="applicationAlias"></param>
/// <returns></returns> /// <returns></returns>
IDictionary<string, IEnumerable<ApplicationTree>> GetGroupedApplicationTrees(string applicationAlias); IDictionary<string, IEnumerable<Tree>> GetGroupedApplicationTrees(string applicationAlias);
} }
} }

View File

@@ -18,29 +18,29 @@ namespace Umbraco.Web.Services
} }
/// <inheritdoc /> /// <inheritdoc />
public ApplicationTree GetByAlias(string treeAlias) => _treeCollection.FirstOrDefault(t => t.TreeAlias == treeAlias); public Tree GetByAlias(string treeAlias) => _treeCollection.FirstOrDefault(t => t.TreeAlias == treeAlias);
/// <inheritdoc /> /// <inheritdoc />
public IEnumerable<ApplicationTree> GetAll() => _treeCollection; public IEnumerable<Tree> GetAll() => _treeCollection;
/// <inheritdoc /> /// <inheritdoc />
public IEnumerable<ApplicationTree> GetApplicationTrees(string applicationAlias) public IEnumerable<Tree> GetApplicationTrees(string applicationAlias)
=> GetAll().Where(x => x.ApplicationAlias.InvariantEquals(applicationAlias)).OrderBy(x => x.SortOrder).ToList(); => GetAll().Where(x => x.ApplicationAlias.InvariantEquals(applicationAlias)).OrderBy(x => x.SortOrder).ToList();
public IDictionary<string, IEnumerable<ApplicationTree>> GetGroupedApplicationTrees(string applicationAlias) public IDictionary<string, IEnumerable<Tree>> GetGroupedApplicationTrees(string applicationAlias)
{ {
var result = new Dictionary<string, IEnumerable<ApplicationTree>>(); var result = new Dictionary<string, IEnumerable<Tree>>();
var foundTrees = GetApplicationTrees(applicationAlias).ToList(); var foundTrees = GetApplicationTrees(applicationAlias).ToList();
foreach(var treeGroup in _groupedTrees.Value) foreach(var treeGroup in _groupedTrees.Value)
{ {
List<ApplicationTree> resultGroup = null; List<Tree> resultGroup = null;
foreach(var tree in foundTrees) foreach(var tree in foundTrees)
{ {
foreach(var treeAliasInGroup in treeGroup) foreach(var treeAliasInGroup in treeGroup)
{ {
if (tree.TreeAlias != treeAliasInGroup) continue; if (tree.TreeAlias != treeAliasInGroup) continue;
if (resultGroup == null) resultGroup = new List<ApplicationTree>(); if (resultGroup == null) resultGroup = new List<Tree>();
resultGroup.Add(tree); resultGroup.Add(tree);
} }
} }

View File

@@ -160,7 +160,7 @@ namespace Umbraco.Web.Trees
/// <param name="tree"></param> /// <param name="tree"></param>
/// <param name="queryStrings"></param> /// <param name="queryStrings"></param>
/// <returns></returns> /// <returns></returns>
private async Task<TreeNode> GetRootForMultipleAppTree(ApplicationTree tree, FormDataCollection queryStrings) private async Task<TreeNode> GetRootForMultipleAppTree(Tree tree, FormDataCollection queryStrings)
{ {
if (tree == null) throw new ArgumentNullException(nameof(tree)); if (tree == null) throw new ArgumentNullException(nameof(tree));
try try
@@ -189,7 +189,7 @@ namespace Umbraco.Web.Trees
/// <param name="queryStrings"></param> /// <param name="queryStrings"></param>
/// <param name="application"></param> /// <param name="application"></param>
/// <returns></returns> /// <returns></returns>
private async Task<TreeRootNode> GetRootForSingleAppTree(ApplicationTree tree, string id, FormDataCollection queryStrings, string application) private async Task<TreeRootNode> GetRootForSingleAppTree(Tree tree, string id, FormDataCollection queryStrings, string application)
{ {
var rootId = Constants.System.Root.ToString(CultureInfo.InvariantCulture); var rootId = Constants.System.Root.ToString(CultureInfo.InvariantCulture);
if (tree == null) throw new ArgumentNullException(nameof(tree)); if (tree == null) throw new ArgumentNullException(nameof(tree));
@@ -234,7 +234,7 @@ namespace Umbraco.Web.Trees
/// <remarks> /// <remarks>
/// This ensures that authorization filters are applied to the sub request /// This ensures that authorization filters are applied to the sub request
/// </remarks> /// </remarks>
private async Task<Attempt<TreeNode>> TryGetRootNodeFromControllerTree(ApplicationTree appTree, FormDataCollection formCollection, HttpControllerContext controllerContext) private async Task<Attempt<TreeNode>> TryGetRootNodeFromControllerTree(Tree appTree, FormDataCollection formCollection, HttpControllerContext controllerContext)
{ {
//instantiate it, since we are proxying, we need to setup the instance with our current context //instantiate it, since we are proxying, we need to setup the instance with our current context
var instance = (TreeController)DependencyResolver.Current.GetService(appTree.TreeControllerType); var instance = (TreeController)DependencyResolver.Current.GetService(appTree.TreeControllerType);
@@ -290,7 +290,7 @@ namespace Umbraco.Web.Trees
/// <param name="formCollection"></param> /// <param name="formCollection"></param>
/// <param name="controllerContext"></param> /// <param name="controllerContext"></param>
/// <returns></returns> /// <returns></returns>
private Attempt<TreeNodeCollection> TryLoadFromControllerTree(ApplicationTree appTree, string id, FormDataCollection formCollection, HttpControllerContext controllerContext) private Attempt<TreeNodeCollection> TryLoadFromControllerTree(Tree appTree, string id, FormDataCollection formCollection, HttpControllerContext controllerContext)
{ {
// instantiate it, since we are proxying, we need to setup the instance with our current context // instantiate it, since we are proxying, we need to setup the instance with our current context
var instance = (TreeController)DependencyResolver.Current.GetService(appTree.TreeControllerType); var instance = (TreeController)DependencyResolver.Current.GetService(appTree.TreeControllerType);

View File

@@ -6,9 +6,9 @@ using Umbraco.Web.Models.Trees;
namespace Umbraco.Web.Trees namespace Umbraco.Web.Trees
{ {
[DebuggerDisplay("Tree - {TreeAlias} ({ApplicationAlias})")] [DebuggerDisplay("Tree - {TreeAlias} ({ApplicationAlias})")]
public class ApplicationTree : ITree public class Tree : ITree
{ {
public ApplicationTree(int sortOrder, string applicationAlias, string alias, string title, Type treeControllerType, bool isSingleNodeTree) public Tree(int sortOrder, string applicationAlias, string alias, string title, Type treeControllerType, bool isSingleNodeTree)
{ {
SortOrder = sortOrder; SortOrder = sortOrder;
ApplicationAlias = applicationAlias; ApplicationAlias = applicationAlias;

View File

@@ -10,9 +10,9 @@ using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.Trees namespace Umbraco.Web.Trees
{ {
public class TreeCollection : BuilderCollectionBase<ApplicationTree> public class TreeCollection : BuilderCollectionBase<Tree>
{ {
public TreeCollection(IEnumerable<ApplicationTree> items) public TreeCollection(IEnumerable<Tree> items)
: base(items) : base(items)
{ } { }
} }

View File

@@ -4,15 +4,15 @@ using Umbraco.Core.Composing;
namespace Umbraco.Web.Trees namespace Umbraco.Web.Trees
{ {
//fixme - how will we allow users to modify these items? they will need to be able to change the ApplicationTree's registered (i.e. sort order, section) //fixme - how will we allow users to modify these items? they will need to be able to change the ApplicationTree's registered (i.e. sort order, section)
public class TreeCollectionBuilder : CollectionBuilderBase<TreeCollectionBuilder, TreeCollection, ApplicationTree> public class TreeCollectionBuilder : CollectionBuilderBase<TreeCollectionBuilder, TreeCollection, Tree>
{ {
private readonly List<ApplicationTree> _instances = new List<ApplicationTree>(); private readonly List<Tree> _instances = new List<Tree>();
public void AddTree(ApplicationTree tree) public void AddTree(Tree tree)
{ {
_instances.Add(tree); _instances.Add(tree);
} }
protected override IEnumerable<ApplicationTree> CreateItems(IFactory factory) => _instances; protected override IEnumerable<Tree> CreateItems(IFactory factory) => _instances;
} }
} }

View File

@@ -28,7 +28,7 @@ namespace Umbraco.Web.Trees
} }
/// <inheritdoc /> /// <inheritdoc />
public override string RootNodeDisplayName => ApplicationTree.GetRootNodeDisplayName(this, Services.TextService); public override string RootNodeDisplayName => Tree.GetRootNodeDisplayName(this, Services.TextService);
/// <inheritdoc /> /// <inheritdoc />
public override string TreeAlias => _attribute.TreeAlias; public override string TreeAlias => _attribute.TreeAlias;

View File

@@ -174,7 +174,7 @@
<Compile Include="Trees\TranslationBackOfficeSection.cs" /> <Compile Include="Trees\TranslationBackOfficeSection.cs" />
<Compile Include="Trees\TreeCollectionBuilder.cs" /> <Compile Include="Trees\TreeCollectionBuilder.cs" />
<Compile Include="Trees\UsersBackOfficeSection.cs" /> <Compile Include="Trees\UsersBackOfficeSection.cs" />
<Compile Include="Trees\ApplicationTree.cs" /> <Compile Include="Trees\Tree.cs" />
<Compile Include="Models\Trees\IBackOfficeSection.cs" /> <Compile Include="Models\Trees\IBackOfficeSection.cs" />
<Compile Include="Trees\ITree.cs" /> <Compile Include="Trees\ITree.cs" />
<Compile Include="Models\ContentEditing\PublicAccess.cs" /> <Compile Include="Models\ContentEditing\PublicAccess.cs" />