2021-01-13 11:02:29 +01:00
|
|
|
using Microsoft.AspNetCore.Authorization;
|
2020-11-19 19:23:41 +11:00
|
|
|
using Microsoft.AspNetCore.Http;
|
2021-01-13 11:02:29 +01:00
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2020-06-09 07:49:26 +02:00
|
|
|
using Umbraco.Core.Services;
|
|
|
|
|
using Umbraco.Web.BackOffice.Filters;
|
|
|
|
|
using Umbraco.Web.Common.Attributes;
|
2020-11-20 12:40:29 +11:00
|
|
|
using Umbraco.Web.Common.Authorization;
|
2018-08-24 10:53:53 +01:00
|
|
|
using Umbraco.Web.Models.Trees;
|
2020-10-26 13:34:08 +01:00
|
|
|
using Umbraco.Web.Trees;
|
2020-06-09 07:49:26 +02:00
|
|
|
using Umbraco.Web.WebApi;
|
2018-08-24 10:53:53 +01:00
|
|
|
using Constants = Umbraco.Core.Constants;
|
|
|
|
|
|
2020-10-26 13:34:08 +01:00
|
|
|
namespace Umbraco.Web.BackOffice.Trees
|
2018-08-24 10:53:53 +01:00
|
|
|
{
|
2020-11-19 19:23:41 +11:00
|
|
|
[Authorize(Policy = AuthorizationPolicies.TreeAccessLogs)]
|
2019-11-05 13:45:42 +01:00
|
|
|
[Tree(Constants.Applications.Settings, Constants.Trees.LogViewer, SortOrder= 9, TreeGroup = Constants.Trees.Groups.Settings)]
|
2020-09-23 08:55:25 +02:00
|
|
|
[PluginController(Constants.Web.Mvc.BackOfficeTreeArea)]
|
2019-01-30 19:52:24 +11:00
|
|
|
[CoreTree]
|
2018-08-30 09:59:53 +01:00
|
|
|
public class LogViewerTreeController : TreeController
|
2018-08-24 10:53:53 +01:00
|
|
|
{
|
2020-06-09 07:49:26 +02:00
|
|
|
public LogViewerTreeController(
|
|
|
|
|
ILocalizedTextService localizedTextService,
|
|
|
|
|
UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection)
|
|
|
|
|
: base(localizedTextService, umbracoApiControllerTypeCollection)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override TreeNodeCollection GetTreeNodes(string id, FormCollection queryStrings)
|
2018-08-24 10:53:53 +01:00
|
|
|
{
|
|
|
|
|
//We don't have any child nodes & only use the root node to load a custom UI
|
|
|
|
|
return new TreeNodeCollection();
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-13 11:02:29 +01:00
|
|
|
protected override ActionResult<MenuItemCollection> GetMenuForNode(string id, FormCollection queryStrings)
|
2018-08-24 10:53:53 +01:00
|
|
|
{
|
|
|
|
|
//We don't have any menu item options (such as create/delete/reload) & only use the root node to load a custom UI
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Helper method to create a root model for a tree
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
2020-06-09 07:49:26 +02:00
|
|
|
protected override TreeNode CreateRootNode(FormCollection queryStrings)
|
2018-08-24 10:53:53 +01:00
|
|
|
{
|
|
|
|
|
var root = base.CreateRootNode(queryStrings);
|
|
|
|
|
|
|
|
|
|
//this will load in a custom UI instead of the dashboard for the root node
|
2019-11-05 13:45:42 +01:00
|
|
|
root.RoutePath = string.Format("{0}/{1}/{2}", Constants.Applications.Settings, Constants.Trees.LogViewer, "overview");
|
2019-01-22 10:05:14 +00:00
|
|
|
root.Icon = "icon-box-alt";
|
2018-08-24 10:53:53 +01:00
|
|
|
root.HasChildren = false;
|
|
|
|
|
root.MenuUrl = null;
|
|
|
|
|
|
|
|
|
|
return root;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|