mirror of https://github.com/lidarr/Lidarr
Fixed: Only show install/cannot install on the latest version
This commit is contained in:
parent
86aba08289
commit
877a851fe9
|
@ -22,17 +22,19 @@ namespace NzbDrone.Api.Update
|
||||||
.OrderByDescending(u => u.Version)
|
.OrderByDescending(u => u.Version)
|
||||||
.InjectTo<List<UpdateResource>>();
|
.InjectTo<List<UpdateResource>>();
|
||||||
|
|
||||||
foreach (var updateResource in resources)
|
var first = resources.First();
|
||||||
{
|
first.Latest = true;
|
||||||
if (updateResource.Version > BuildInfo.Version)
|
|
||||||
{
|
|
||||||
updateResource.IsUpgrade = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (updateResource.Version == BuildInfo.Version)
|
if (first.Version > BuildInfo.Version)
|
||||||
{
|
{
|
||||||
updateResource.Installed = true;
|
first.Installable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var installed = resources.SingleOrDefault(r => r.Version == BuildInfo.Version);
|
||||||
|
|
||||||
|
if (installed != null)
|
||||||
|
{
|
||||||
|
installed.Installed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return resources;
|
return resources;
|
||||||
|
|
|
@ -14,8 +14,9 @@ namespace NzbDrone.Api.Update
|
||||||
public DateTime ReleaseDate { get; set; }
|
public DateTime ReleaseDate { get; set; }
|
||||||
public String FileName { get; set; }
|
public String FileName { get; set; }
|
||||||
public String Url { get; set; }
|
public String Url { get; set; }
|
||||||
public Boolean IsUpgrade { get; set; }
|
|
||||||
public Boolean Installed { get; set; }
|
public Boolean Installed { get; set; }
|
||||||
|
public Boolean Installable { get; set; }
|
||||||
|
public Boolean Latest { get; set; }
|
||||||
public UpdateChanges Changes { get; set; }
|
public UpdateChanges Changes { get; set; }
|
||||||
public String Hash { get; set; }
|
public String Hash { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,12 @@
|
||||||
{{#if installed}}
|
{{#if installed}}
|
||||||
<span class="label label-success">Installed</span>
|
<span class="label label-success">Installed</span>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if isUpgrade}}
|
{{#if latest}}
|
||||||
<span class="label label-default install-update x-install-update">Install</span>
|
{{#if installable}}
|
||||||
{{else}}
|
<span class="label label-default install-update x-install-update">Install</span>
|
||||||
<span class="label label-default label-disabled" title="Cannot install an older version">Install</span>
|
{{else}}
|
||||||
|
<span class="label label-default label-disabled" title="Cannot install an older version">Install</span>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in New Issue