mirror of
https://github.com/Radarr/Radarr
synced 2024-12-26 17:59:14 +00:00
Fixed: Only show install/cannot install on the latest version
This commit is contained in:
parent
86aba08289
commit
877a851fe9
3 changed files with 20 additions and 15 deletions
|
@ -22,17 +22,19 @@ private List<UpdateResource> GetRecentUpdates()
|
|||
.OrderByDescending(u => u.Version)
|
||||
.InjectTo<List<UpdateResource>>();
|
||||
|
||||
foreach (var updateResource in resources)
|
||||
{
|
||||
if (updateResource.Version > BuildInfo.Version)
|
||||
{
|
||||
updateResource.IsUpgrade = true;
|
||||
}
|
||||
var first = resources.First();
|
||||
first.Latest = true;
|
||||
|
||||
else if (updateResource.Version == BuildInfo.Version)
|
||||
{
|
||||
updateResource.Installed = true;
|
||||
}
|
||||
if (first.Version > BuildInfo.Version)
|
||||
{
|
||||
first.Installable = true;
|
||||
}
|
||||
|
||||
var installed = resources.SingleOrDefault(r => r.Version == BuildInfo.Version);
|
||||
|
||||
if (installed != null)
|
||||
{
|
||||
installed.Installed = true;
|
||||
}
|
||||
|
||||
return resources;
|
||||
|
|
|
@ -14,8 +14,9 @@ public class UpdateResource : RestResource
|
|||
public DateTime ReleaseDate { get; set; }
|
||||
public String FileName { get; set; }
|
||||
public String Url { get; set; }
|
||||
public Boolean IsUpgrade { get; set; }
|
||||
public Boolean Installed { get; set; }
|
||||
public Boolean Installable { get; set; }
|
||||
public Boolean Latest { get; set; }
|
||||
public UpdateChanges Changes { get; set; }
|
||||
public String Hash { get; set; }
|
||||
}
|
||||
|
|
|
@ -8,10 +8,12 @@
|
|||
{{#if installed}}
|
||||
<span class="label label-success">Installed</span>
|
||||
{{else}}
|
||||
{{#if isUpgrade}}
|
||||
<span class="label label-default install-update x-install-update">Install</span>
|
||||
{{else}}
|
||||
<span class="label label-default label-disabled" title="Cannot install an older version">Install</span>
|
||||
{{#if latest}}
|
||||
{{#if installable}}
|
||||
<span class="label label-default install-update x-install-update">Install</span>
|
||||
{{else}}
|
||||
<span class="label label-default label-disabled" title="Cannot install an older version">Install</span>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</span>
|
||||
|
|
Loading…
Reference in a new issue