Netcore: Migration of Model classes from Umbraco.Infrastructure to Core (#9404)
* Migrating more model, mapping and tree classes * Migrating files from Mapping dir without Newtonsoft dependency * Migrating files from PublishedContent and Editors dirs without Newtonsoft dependency + some more of the same kind * Migrating DataType class without the usage of Newtonsoft.Json and making the corresponding changes to all classes affected * Combining 3 ContentExtensions files into 1 * Refactoring from migrating ContentExtensions * Migrating more classes * Migrating ContentRepositoryExtensions - combining it with existing file in Umbraco.Core * removing Newtonsoft json dependency & migrating file. Adding partial migration of ConfigurationEditor, so PropertyTagsExtensions can be migrated * Migrating ContentTagsExtensions, and refactoring from changes in PropertyTagsExtensions * Changes that should be reverted once ConfigurationEditor class is fully migrated * VS couldn't find Composing, so build was failing. Removing the using solves the problem * Handling a single case for deserializing a subset of an input * Small changes and added tests to JsonNetSerializer Signed-off-by: Bjarke Berg <mail@bergmania.dk> * Migrated ConfigurationEditor Signed-off-by: Bjarke Berg <mail@bergmania.dk> Co-authored-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
committed by
GitHub
parent
d498c1a2cd
commit
dd5f400cf3
@@ -1,27 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
public interface ISearchableTree : IDiscoverable
|
||||
{
|
||||
/// <summary>
|
||||
/// The alias of the tree that the <see cref="ISearchableTree"/> belongs to
|
||||
/// </summary>
|
||||
string TreeAlias { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Searches for results based on the entity type
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <param name="totalFound"></param>
|
||||
/// <param name="searchFrom">
|
||||
/// A starting point for the search, generally a node id, but for members this is a member type alias
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<SearchResultEntity> Search(string query, int pageSize, long pageIndex, out long totalFound, string searchFrom = null);
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
|
||||
namespace Umbraco.Web.Models.Trees
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a model in the tree
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// TreeNode is sealed to prevent developers from adding additional json data to the response
|
||||
/// </remarks>
|
||||
[DataContract(Name = "node", Namespace = "")]
|
||||
public class TreeNode : EntityBasic
|
||||
{
|
||||
/// <summary>
|
||||
/// Internal constructor, to create a tree node use the CreateTreeNode methods of the TreeApiController.
|
||||
/// </summary>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <param name="parentId">The parent id for the current node</param>
|
||||
/// <param name="getChildNodesUrl"></param>
|
||||
/// <param name="menuUrl"></param>
|
||||
public TreeNode(string nodeId, string parentId, string getChildNodesUrl, string menuUrl)
|
||||
{
|
||||
if (nodeId == null) throw new ArgumentNullException(nameof(nodeId));
|
||||
if (string.IsNullOrWhiteSpace(nodeId)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(nodeId));
|
||||
|
||||
Id = nodeId;
|
||||
ParentId = parentId;
|
||||
ChildNodesUrl = getChildNodesUrl;
|
||||
MenuUrl = menuUrl;
|
||||
CssClasses = new List<string>();
|
||||
//default
|
||||
Icon = "icon-folder-close";
|
||||
Path = "-1";
|
||||
}
|
||||
|
||||
[DataMember(Name = "parentId", IsRequired = true)]
|
||||
public new object ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A flag to set whether or not this node has children
|
||||
/// </summary>
|
||||
[DataMember(Name = "hasChildren")]
|
||||
public bool HasChildren { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The tree nodetype which refers to the type of node rendered in the tree
|
||||
/// </summary>
|
||||
[DataMember(Name = "nodeType")]
|
||||
public string NodeType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional: The Route path for the editor for this node
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If this is not set, then the route path will be automatically determined by: {section}/edit/{id}
|
||||
/// </remarks>
|
||||
[DataMember(Name = "routePath")]
|
||||
public string RoutePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The JSON url to load the nodes children
|
||||
/// </summary>
|
||||
[DataMember(Name = "childNodesUrl")]
|
||||
public string ChildNodesUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The JSON url to load the menu from
|
||||
/// </summary>
|
||||
[DataMember(Name = "menuUrl")]
|
||||
public string MenuUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the icon represents a CSS class instead of a file path
|
||||
/// </summary>
|
||||
[DataMember(Name = "iconIsClass")]
|
||||
public bool IconIsClass
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Icon.IsNullOrWhiteSpace())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Icon.StartsWith(".."))
|
||||
return false;
|
||||
|
||||
|
||||
//if it starts with a '.' or doesn't contain a '.' at all then it is a class
|
||||
return Icon.StartsWith(".") || Icon.Contains(".") == false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the icon file path if the icon is not a class, otherwise returns an empty string
|
||||
/// </summary>
|
||||
[DataMember(Name = "iconFilePath")]
|
||||
public string IconFilePath
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO: Is this ever actually used? If not remove, if so, add setter.
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A list of additional/custom css classes to assign to the node
|
||||
/// </summary>
|
||||
[DataMember(Name = "cssClasses")]
|
||||
public IList<string> CssClasses { get; private set; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.Trees
|
||||
{
|
||||
[CollectionDataContract(Name = "nodes", Namespace = "")]
|
||||
public sealed class TreeNodeCollection : List<TreeNode>
|
||||
{
|
||||
public static TreeNodeCollection Empty => new TreeNodeCollection();
|
||||
|
||||
public TreeNodeCollection()
|
||||
{
|
||||
}
|
||||
|
||||
public TreeNodeCollection(IEnumerable<TreeNode> nodes)
|
||||
: base(nodes)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
namespace Umbraco.Web.Models.Trees
|
||||
{
|
||||
public static class TreeNodeExtensions
|
||||
{
|
||||
internal const string LegacyJsCallbackKey = "jsClickCallback";
|
||||
|
||||
/// <summary>
|
||||
/// Legacy tree node's assign a JS method callback for when an item is clicked, this method facilitates that.
|
||||
/// </summary>
|
||||
/// <param name="treeNode"></param>
|
||||
/// <param name="jsCallback"></param>
|
||||
internal static void AssignLegacyJsCallback(this TreeNode treeNode, string jsCallback)
|
||||
{
|
||||
treeNode.AdditionalData[LegacyJsCallbackKey] = jsCallback;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the node style to show that it is a container type
|
||||
/// </summary>
|
||||
/// <param name="treeNode"></param>
|
||||
public static void SetContainerStyle(this TreeNode treeNode)
|
||||
{
|
||||
if (treeNode.CssClasses.Contains("is-container") == false)
|
||||
{
|
||||
treeNode.CssClasses.Add("is-container");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the node style to show that it is currently protected publicly
|
||||
/// </summary>
|
||||
/// <param name="treeNode"></param>
|
||||
public static void SetProtectedStyle(this TreeNode treeNode)
|
||||
{
|
||||
if (treeNode.CssClasses.Contains("protected") == false)
|
||||
{
|
||||
treeNode.CssClasses.Add("protected");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the node style to show that it is currently locked / non-deletable
|
||||
/// </summary>
|
||||
/// <param name="treeNode"></param>
|
||||
public static void SetLockedStyle(this TreeNode treeNode)
|
||||
{
|
||||
if (treeNode.CssClasses.Contains("locked") == false)
|
||||
{
|
||||
treeNode.CssClasses.Add("locked");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the node style to show that it is has unpublished versions (but is currently published)
|
||||
/// </summary>
|
||||
/// <param name="treeNode"></param>
|
||||
public static void SetHasPendingVersionStyle(this TreeNode treeNode)
|
||||
{
|
||||
if (treeNode.CssClasses.Contains("has-unpublished-version") == false)
|
||||
{
|
||||
treeNode.CssClasses.Add("has-unpublished-version");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the node style to show that it is not published
|
||||
/// </summary>
|
||||
/// <param name="treeNode"></param>
|
||||
public static void SetNotPublishedStyle(this TreeNode treeNode)
|
||||
{
|
||||
if (treeNode.CssClasses.Contains("not-published") == false)
|
||||
{
|
||||
treeNode.CssClasses.Add("not-published");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user