Free diskspace in UI
New: View Diskspace for root directories visible in UI #ND-98 fixed
This commit is contained in:
parent
2bd866f590
commit
4212da9146
|
@ -139,13 +139,13 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="HelperTests\XElementHelperFixture.cs" />
|
||||
<Compile Include="HelperTests\XElementHelperTests\ConvertToTFixture.cs" />
|
||||
<Compile Include="JobTests\RenameSeasonJobFixture.cs" />
|
||||
<Compile Include="ProviderTests\SearchProviderTests\GetSeriesTitleFixture.cs" />
|
||||
<Compile Include="ProviderTests\TvRageMappingProviderTests\FindMatchingTvRageSeriesFixture.cs" />
|
||||
<Compile Include="ProviderTests\TvRageMappingProviderTests\ProcessResultsFixture.cs" />
|
||||
<Compile Include="ProviderTests\TvRageProviderTests\GetSeriesFixture.cs" />
|
||||
<Compile Include="ProviderTests\TvRageProviderTests\ParseDayOfWeekFixture.cs" />
|
||||
<Compile Include="HelperTests\XElementHelperTests\ConvertToDayOfWeekFixture.cs" />
|
||||
<Compile Include="ProviderTests\TvRageProviderTests\GetUtcOffsetFixture.cs" />
|
||||
<Compile Include="ProviderTests\TvRageProviderTests\SearchSeriesFixture.cs" />
|
||||
<Compile Include="QualityTypesTest.cs" />
|
||||
|
|
|
@ -112,6 +112,12 @@ namespace NzbDrone.Core
|
|||
private const Decimal ONE_GIGABYTE = ONE_MEGABYTE * 1024M;
|
||||
|
||||
public static string ToBestFileSize(this long bytes, int precision = 0)
|
||||
{
|
||||
var ulongBytes = (ulong)bytes;
|
||||
return ulongBytes.ToBestFileSize(precision);
|
||||
}
|
||||
|
||||
public static string ToBestFileSize(this ulong bytes, int precision = 0)
|
||||
{
|
||||
if (bytes == 0)
|
||||
return "0B";
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.IO;
|
|||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
using PetaPoco;
|
||||
|
@ -25,8 +26,6 @@ namespace NzbDrone.Core.Providers
|
|||
_seriesProvider = seriesProvider;
|
||||
}
|
||||
|
||||
#region IRootDirProvider
|
||||
|
||||
public virtual List<RootDir> GetAll()
|
||||
{
|
||||
return _database.Fetch<RootDir>();
|
||||
|
@ -51,7 +50,7 @@ namespace NzbDrone.Core.Providers
|
|||
_database.Delete<RootDir>(rootDirId);
|
||||
}
|
||||
|
||||
public List<String> GetUnmappedFolders(string path)
|
||||
public virtual List<String> GetUnmappedFolders(string path)
|
||||
{
|
||||
Logger.Debug("Generating list of unmapped folders");
|
||||
if (String.IsNullOrEmpty(path))
|
||||
|
@ -77,26 +76,16 @@ namespace NzbDrone.Core.Providers
|
|||
return results;
|
||||
}
|
||||
|
||||
public virtual string GetMostFreeRootDir()
|
||||
public virtual List<RootDir> AllWithFreeSpace()
|
||||
{
|
||||
ulong maxSize = 0;
|
||||
var maxPath = String.Empty;
|
||||
|
||||
var rootDirs = GetAll();
|
||||
|
||||
foreach (var rootDir in rootDirs)
|
||||
{
|
||||
rootDir.FreeSpace = _diskProvider.FreeDiskSpace(new DirectoryInfo(rootDir.Path));
|
||||
if (rootDir.FreeSpace > maxSize)
|
||||
{
|
||||
maxPath = rootDir.Path;
|
||||
maxSize = rootDir.FreeSpace;
|
||||
}
|
||||
}
|
||||
|
||||
return maxPath;
|
||||
return rootDirs;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
#menu
|
||||
{
|
||||
height: 60px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#menu ul
|
||||
|
@ -9,6 +10,7 @@
|
|||
padding: 5px 0px 5px 0px;
|
||||
list-style: none;
|
||||
line-height: normal;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#menu li
|
||||
|
|
|
@ -211,19 +211,6 @@ button span, input[type="button"] span, input[type="submit"] span, input[type="r
|
|||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
/* Local Series Search */
|
||||
#localSeriesLookup
|
||||
{
|
||||
width: 220px;
|
||||
float: right;
|
||||
margin-top: 7px;
|
||||
margin-bottom: 0px;
|
||||
border: 0px;
|
||||
background: rgb(75, 75, 75);
|
||||
color: rgb(169, 169, 169);
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.ui-dialog-buttonset .ui-delete-button
|
||||
{
|
||||
background: url("jQueryUI/images/ui-bg_flat_30_b40404_40x100.png") repeat-x scroll 50% 50% #B40404;
|
||||
|
@ -268,3 +255,48 @@ i[class*="icon-"]:not(.gridAction):hover {
|
|||
background-color: #065EFE;
|
||||
color: #191919;
|
||||
}
|
||||
|
||||
/* Right Menu */
|
||||
#right-menu {
|
||||
float: right;
|
||||
display: inline-block;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
#right-menu ul {
|
||||
list-style: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#right-menu li
|
||||
{
|
||||
display: block;
|
||||
float: left;
|
||||
padding: 0px 0px 10px 15px;
|
||||
}
|
||||
|
||||
#localSeriesLookup
|
||||
{
|
||||
width: 220px;
|
||||
border: 0px;
|
||||
background: rgb(75, 75, 75);
|
||||
color: rgb(169, 169, 169);
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.free-space {
|
||||
display: inline-block;
|
||||
margin-top: 2px;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
background-color: #6e6e6e;
|
||||
color: #d0d0d0;
|
||||
/*color: #FFFFFF;*/
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.free-space span {
|
||||
color: #191919;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
using System.Web.Mvc;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Web.Models;
|
||||
|
||||
namespace NzbDrone.Web.Controllers
|
||||
|
@ -7,10 +8,12 @@ namespace NzbDrone.Web.Controllers
|
|||
public class SharedController : Controller
|
||||
{
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private readonly RootDirProvider _rootDirProvider;
|
||||
|
||||
public SharedController(EnvironmentProvider environmentProvider)
|
||||
public SharedController(EnvironmentProvider environmentProvider, RootDirProvider rootDirProvider)
|
||||
{
|
||||
_environmentProvider = environmentProvider;
|
||||
_rootDirProvider = rootDirProvider;
|
||||
}
|
||||
|
||||
public ActionResult Index()
|
||||
|
@ -24,5 +27,14 @@ namespace NzbDrone.Web.Controllers
|
|||
{
|
||||
return PartialView(new FooterModel { BuildTime = _environmentProvider.BuildDateTime, Version = _environmentProvider.Version });
|
||||
}
|
||||
|
||||
[ChildActionOnly]
|
||||
//[OutputCache(Duration = 600)]
|
||||
public ActionResult FreeSpace()
|
||||
{
|
||||
var rootDirs = _rootDirProvider.AllWithFreeSpace();
|
||||
|
||||
return PartialView(rootDirs);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -418,6 +418,7 @@
|
|||
<Content Include="Views\System\Indexers.cshtml" />
|
||||
<Content Include="Views\System\Config.cshtml" />
|
||||
<Content Include="Views\Settings\_SettingsLayout.cshtml" />
|
||||
<Content Include="Views\Shared\FreeSpace.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
@using NzbDrone.Core
|
||||
@model IEnumerable<NzbDrone.Core.Repository.RootDir>
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
|
||||
@{
|
||||
foreach(var rootDir in Model)
|
||||
{
|
||||
<div class="free-space" title="@rootDir.Path">
|
||||
@rootDir.FreeSpace.ToBestFileSize(1) <span>Free</span>
|
||||
</div>
|
||||
}
|
||||
}
|
|
@ -32,8 +32,14 @@
|
|||
@MvcHtmlString.Create(Html.CurrentControllerLink("Logs", "Index", "Log"))
|
||||
<li id="donate" title="Donate to support the development of NzbDrone"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KRTE52U3XJDSQ" target="_blank">Donate</a></li>
|
||||
</ul>
|
||||
<input id="localSeriesLookup" type="text" />
|
||||
</div>
|
||||
<div id="right-menu">
|
||||
<ul>
|
||||
<li>@{ Html.RenderAction("FreeSpace", "Shared"); }</li>
|
||||
<li><input id="localSeriesLookup" type="text" /></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="logo">
|
||||
<span>@ViewBag.Title</span>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue