Browse Source

fix package install button being enabled 24/7

pull/438/head
JT 10 months ago
parent
commit
19938536e4
  1. 1
      CHANGELOG.md
  2. 14
      StabilityMatrix.Avalonia/ViewModels/PackageManager/PackageInstallDetailViewModel.cs
  3. 1
      StabilityMatrix.Avalonia/Views/PackageManager/PackageInstallDetailView.axaml

1
CHANGELOG.md

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
### Fixed
- Fixed Auto-update failing to start new version on Windows and Linux when path contains spaces
- Fixed InvokeAI v3.6.0 `"detail": "Not Found"` error when opening the UI
- Install button will now be properly disabled when the duplicate warning is shown
## v2.8.0-pre.1
### Added

14
StabilityMatrix.Avalonia/ViewModels/PackageManager/PackageInstallDetailViewModel.cs

@ -82,6 +82,9 @@ public partial class PackageInstallDetailViewModel(
[ObservableProperty]
private GitCommit? selectedCommit;
[ObservableProperty]
private bool canInstall;
private PackageVersionOptions? allOptions;
public override async Task OnLoadedAsync()
@ -104,6 +107,8 @@ public partial class PackageInstallDetailViewModel(
UpdateVersions();
await UpdateCommits(SelectedPackage.MainBranch);
}
CanInstall = !ShowDuplicateWarning;
}
[RelayCommand]
@ -214,6 +219,8 @@ public partial class PackageInstallDetailViewModel(
private void UpdateVersions()
{
CanInstall = false;
AvailableVersions =
IsReleaseMode && ShowReleaseMode ? allOptions.AvailableVersions : allOptions.AvailableBranches;
@ -221,16 +228,22 @@ public partial class PackageInstallDetailViewModel(
? AvailableVersions?.FirstOrDefault(x => x.TagName == SelectedPackage.MainBranch)
?? AvailableVersions?.FirstOrDefault()
: AvailableVersions?.FirstOrDefault();
CanInstall = !ShowDuplicateWarning;
}
private async Task UpdateCommits(string branchName)
{
CanInstall = false;
var commits = await SelectedPackage.GetAllCommits(branchName);
if (commits != null)
{
AvailableCommits = new ObservableCollection<GitCommit>(commits);
SelectedCommit = AvailableCommits.FirstOrDefault();
}
CanInstall = !ShowDuplicateWarning;
}
partial void OnInstallNameChanged(string? value)
@ -238,6 +251,7 @@ public partial class PackageInstallDetailViewModel(
ShowDuplicateWarning = settingsManager.Settings.InstalledPackages.Any(
p => p.LibraryPath == $"Packages{Path.DirectorySeparatorChar}{value}"
);
CanInstall = !ShowDuplicateWarning;
}
partial void OnIsReleaseModeChanged(bool value)

1
StabilityMatrix.Avalonia/Views/PackageManager/PackageInstallDetailView.axaml

@ -169,6 +169,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
FontSize="16"
IsEnabled="{Binding CanInstall}"
Command="{Binding InstallCommand}"
Content="{x:Static lang:Resources.Action_Install}" />

Loading…
Cancel
Save