mirror of https://github.com/Radarr/Radarr
Updates cleanup
This commit is contained in:
parent
27511769ae
commit
308f76d0fe
|
@ -5,6 +5,7 @@ using Nancy;
|
|||
using Newtonsoft.Json;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using NzbDrone.Api.REST;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.Update;
|
||||
using NzbDrone.Api.Mapping;
|
||||
|
||||
|
@ -30,9 +31,17 @@ namespace NzbDrone.Api.Update
|
|||
.OrderByDescending(u => u.Version)
|
||||
.InjectTo<List<UpdateResource>>();
|
||||
|
||||
if (resources.Any())
|
||||
foreach (var updateResource in resources)
|
||||
{
|
||||
resources.First().Latest = true;
|
||||
if (updateResource.Version > BuildInfo.Version)
|
||||
{
|
||||
updateResource.IsUpgrade = true;
|
||||
}
|
||||
|
||||
else if (updateResource.Version == BuildInfo.Version)
|
||||
{
|
||||
updateResource.Installed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return resources;
|
||||
|
@ -58,7 +67,8 @@ namespace NzbDrone.Api.Update
|
|||
public DateTime ReleaseDate { get; set; }
|
||||
public String FileName { get; set; }
|
||||
public String Url { get; set; }
|
||||
public Boolean Latest { get; set; }
|
||||
public Boolean IsUpgrade { get; set; }
|
||||
public Boolean Installed { get; set; }
|
||||
public UpdateChanges Changes { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'handlebars',
|
||||
'System/StatusModel'
|
||||
], function (Handlebars, StatusModel) {
|
||||
|
||||
Handlebars.registerHelper('if_windows', function(options) {
|
||||
if (StatusModel.get('isWindows'))
|
||||
{
|
||||
return options.fn(this);
|
||||
}
|
||||
|
||||
return options.inverse(this);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('if_linux', function(options) {
|
||||
if (StatusModel.get('isLinux'))
|
||||
{
|
||||
return options.fn(this);
|
||||
}
|
||||
|
||||
return options.inverse(this);
|
||||
});
|
||||
});
|
|
@ -1,22 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'handlebars'
|
||||
], function (Handlebars) {
|
||||
|
||||
Handlebars.registerHelper('currentVersion', function (version, latest) {
|
||||
var currentVersion = window.NzbDrone.ServerStatus.version;
|
||||
|
||||
if (currentVersion === version)
|
||||
{
|
||||
return new Handlebars.SafeString('<i class="icon-ok" title="Installed"></i>');
|
||||
}
|
||||
|
||||
if (latest) {
|
||||
return new Handlebars.SafeString('<span class="label label-inverse install-update x-install-update">Install</span>');
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
});
|
|
@ -9,7 +9,7 @@ define(
|
|||
'Handlebars/Helpers/Episode',
|
||||
'Handlebars/Helpers/Series',
|
||||
'Handlebars/Helpers/Quality',
|
||||
'Handlebars/Helpers/Version',
|
||||
'Handlebars/Helpers/System',
|
||||
'Handlebars/Handlebars.Debug'
|
||||
], function (Templates) {
|
||||
return function () {
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
<div class="update">
|
||||
<fieldset>
|
||||
<legend>{{version}} <span class="date">- {{ShortDate releaseDate}} {{currentVersion version latest}}</span></legend>
|
||||
<legend>{{version}}
|
||||
<span class="date">
|
||||
- {{ShortDate releaseDate}}
|
||||
{{#if installed}}<i class="icon-ok" title="Installed"></i>{{/if}}
|
||||
|
||||
{{#if_windows}}
|
||||
{{#if isUpgrade}}<span class="label label-inverse install-update x-install-update">Install</span>{{/if}}
|
||||
{{/if_windows}}
|
||||
</span>
|
||||
</legend>
|
||||
|
||||
{{#with changes}}
|
||||
{{#each new}}
|
||||
|
|
Loading…
Reference in New Issue