Merge pull request #6136 from oqtane/revert-5968-dev

Revert "fix #5894 - allow user to select upgrade version"
This commit is contained in:
Shaun Walker
2026-03-26 18:43:08 -07:00
committed by GitHub
2 changed files with 13 additions and 31 deletions

View File

@@ -11,22 +11,11 @@
{ {
<TabStrip> <TabStrip>
<TabPanel Name="Download" ResourceKey="Download"> <TabPanel Name="Download" ResourceKey="Download">
@if (_versions.Count > 0 && _upgradeable) @if (_package != null && _upgradeavailable)
{ {
<div class="container"> <div class="container">
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="version" HelpText="Select the framework upgrade version" ResourceKey="Version">Version: </Label> <Label Class="col-sm-3" HelpText="Specify if you want to backup files during the upgrade process. Disabling this option will reduce the time required for the upgrade." ResourceKey="Backup">Backup Files? </Label>
<div class="col-sm-9">
<select id="backup" class="form-select" @bind="@_version">
@foreach (var version in _versions)
{
<option value="@version">@version</option>
}
</select>
</div>
</div>
<div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="backup" HelpText="Specify if you want to backup files during the upgrade process. Disabling this option will reduce the time required for the upgrade." ResourceKey="Backup">Backup Files? </Label>
<div class="col-sm-9"> <div class="col-sm-9">
<select id="backup" class="form-select" @bind="@_backup"> <select id="backup" class="form-select" @bind="@_backup">
<option value="True">@SharedLocalizer["Yes"]</option> <option value="True">@SharedLocalizer["Yes"]</option>
@@ -38,7 +27,7 @@
<br /> <br />
@if (!_downloaded) @if (!_downloaded)
{ {
<button type="button" class="btn btn-primary" @onclick=@(async () => await Download(Constants.PackageId, _version))>@SharedLocalizer["Download"] @_version</button> <button type="button" class="btn btn-primary" @onclick=@(async () => await Download(Constants.PackageId, @_package.Version))>@SharedLocalizer["Download"] @_package.Version</button>
} }
else else
{ {
@@ -77,9 +66,8 @@
@code { @code {
private bool _initialized = false; private bool _initialized = false;
private bool _downloaded = false; private bool _downloaded = false;
private List<string> _versions = new List<string>(); private Package _package;
private string _version; private bool _upgradeavailable = false;
private bool _upgradeable = false;
private string _backup = "True"; private string _backup = "True";
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host; public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
@@ -96,18 +84,18 @@
{ {
AddModuleMessage(Localizer["Disclaimer.Text"], MessageType.Warning); AddModuleMessage(Localizer["Disclaimer.Text"], MessageType.Warning);
var packages = await PackageService.GetPackagesAsync("framework", "", "", ""); List<Package> packages = await PackageService.GetPackagesAsync("framework", "", "", "");
if (packages != null) if (packages != null)
{ {
_version = packages.First(item => item.PackageId.StartsWith(Constants.PackageId)).Version; _package = packages.Where(item => item.PackageId.StartsWith(Constants.PackageId)).FirstOrDefault();
foreach (var version in Constants.ReleaseVersions.Split(',')) if (_package != null)
{ {
if (Version.Parse(version).CompareTo(Version.Parse(Constants.Version)) > 0) _upgradeavailable = (Version.Parse(_package.Version).CompareTo(Version.Parse(Constants.Version)) > 0);
{ }
_versions.Add(version); else
} {
_package = new Package { Name = Constants.PackageId, Version = Constants.Version };
} }
_upgradeable = (Version.Parse(_version).CompareTo(Version.Parse(Constants.Version)) > 0);
} }
_initialized = true; _initialized = true;
} }

View File

@@ -156,10 +156,4 @@
<data name="Backup.HelpText" xml:space="preserve"> <data name="Backup.HelpText" xml:space="preserve">
<value>Specify if you want to backup files during the upgrade process. Disabling this option will reduce the time required for the upgrade.</value> <value>Specify if you want to backup files during the upgrade process. Disabling this option will reduce the time required for the upgrade.</value>
</data> </data>
<data name="Version.Text" xml:space="preserve">
<value>Version:</value>
</data>
<data name="Version.HelpText" xml:space="preserve">
<value>Select the framework upgrade version</value>
</data>
</root> </root>