aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.WebDashboard
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-09-20 13:22:39 -0400
committerGitHub <noreply@github.com>2017-09-20 13:22:39 -0400
commiteb2a1330045d802bfe0366df7105c220a36f111f (patch)
tree2c1638c424ee9c0837c5de6d6e08a2398da69cdb /MediaBrowser.WebDashboard
parentec426d5c92875639ceac64477ce10fab3e639335 (diff)
parenta015e1208885bc6a8788db683c4fe47e93dc26b7 (diff)
Merge pull request #2897 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.WebDashboard')
-rw-r--r--MediaBrowser.WebDashboard/Api/ConfigurationPageInfo.cs14
-rw-r--r--MediaBrowser.WebDashboard/Api/DashboardService.cs30
2 files changed, 30 insertions, 14 deletions
diff --git a/MediaBrowser.WebDashboard/Api/ConfigurationPageInfo.cs b/MediaBrowser.WebDashboard/Api/ConfigurationPageInfo.cs
index 33289e76c8..b69c14feeb 100644
--- a/MediaBrowser.WebDashboard/Api/ConfigurationPageInfo.cs
+++ b/MediaBrowser.WebDashboard/Api/ConfigurationPageInfo.cs
@@ -11,6 +11,9 @@ namespace MediaBrowser.WebDashboard.Api
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
+ public bool EnableInMainMenu { get; set; }
+
+ public string DisplayName { get; set; }
/// <summary>
/// Gets the type of the configuration page.
@@ -27,15 +30,22 @@ namespace MediaBrowser.WebDashboard.Api
public ConfigurationPageInfo(IPluginConfigurationPage page)
{
Name = page.Name;
+
ConfigurationPageType = page.ConfigurationPageType;
- // Don't use "N" because it needs to match Plugin.Id
- PluginId = page.Plugin.Id.ToString();
+ if (page.Plugin != null)
+ {
+ DisplayName = page.Plugin.Name;
+ // Don't use "N" because it needs to match Plugin.Id
+ PluginId = page.Plugin.Id.ToString();
+ }
}
public ConfigurationPageInfo(IPlugin plugin, PluginPageInfo page)
{
Name = page.Name;
+ EnableInMainMenu = page.EnableInMainMenu;
+ DisplayName = string.IsNullOrWhiteSpace(page.DisplayName) ? plugin.Name : page.DisplayName;
// Don't use "N" because it needs to match Plugin.Id
PluginId = plugin.Id.ToString();
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs
index c6bbca6728..47662b5091 100644
--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs
+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs
@@ -32,6 +32,7 @@ namespace MediaBrowser.WebDashboard.Api
/// </summary>
/// <value>The type of the page.</value>
public ConfigurationPageType? PageType { get; set; }
+ public bool? EnableInMainMenu { get; set; }
}
/// <summary>
@@ -47,13 +48,13 @@ namespace MediaBrowser.WebDashboard.Api
public string Name { get; set; }
}
- [Route("/web/Package", "GET")]
+ [Route("/web/Package", "GET", IsHidden = true)]
public class GetDashboardPackage
{
public string Mode { get; set; }
}
- [Route("/robots.txt", "GET")]
+ [Route("/robots.txt", "GET", IsHidden = true)]
public class GetRobotsTxt
{
}
@@ -61,7 +62,7 @@ namespace MediaBrowser.WebDashboard.Api
/// <summary>
/// Class GetDashboardResource
/// </summary>
- [Route("/web/{ResourceName*}", "GET")]
+ [Route("/web/{ResourceName*}", "GET", IsHidden = true)]
public class GetDashboardResource
{
/// <summary>
@@ -76,7 +77,7 @@ namespace MediaBrowser.WebDashboard.Api
public string V { get; set; }
}
- [Route("/favicon.ico", "GET")]
+ [Route("/favicon.ico", "GET", IsHidden = true)]
public class GetFavIcon
{
}
@@ -221,25 +222,20 @@ namespace MediaBrowser.WebDashboard.Api
/// <returns>System.Object.</returns>
public object Get(GetDashboardConfigurationPages request)
{
- const string unavilableMessage = "The server is still loading. Please try again momentarily.";
+ const string unavailableMessage = "The server is still loading. Please try again momentarily.";
var instance = ServerEntryPoint.Instance;
if (instance == null)
{
- throw new InvalidOperationException(unavilableMessage);
+ throw new InvalidOperationException(unavailableMessage);
}
var pages = instance.PluginConfigurationPages;
if (pages == null)
{
- throw new InvalidOperationException(unavilableMessage);
- }
-
- if (request.PageType.HasValue)
- {
- pages = pages.Where(p => p.ConfigurationPageType == request.PageType.Value).ToList();
+ throw new InvalidOperationException(unavailableMessage);
}
// Don't allow a failing plugin to fail them all
@@ -261,6 +257,16 @@ namespace MediaBrowser.WebDashboard.Api
configPages.AddRange(_appHost.Plugins.SelectMany(GetConfigPages));
+ if (request.PageType.HasValue)
+ {
+ configPages = configPages.Where(p => p.ConfigurationPageType == request.PageType.Value).ToList();
+ }
+
+ if (request.EnableInMainMenu.HasValue)
+ {
+ configPages = configPages.Where(p => p.EnableInMainMenu == request.EnableInMainMenu.Value).ToList();
+ }
+
return _resultFactory.GetOptimizedResult(Request, configPages);
}