Skip to content

feat: disabled 'new sync form' when creating a mutagen sync #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions App/ViewModels/FileSyncListViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ public partial class FileSyncListViewModel : ObservableObject
[NotifyPropertyChangedFor(nameof(ShowSessions))]
public partial string? Error { get; set; } = null;

[ObservableProperty] public partial bool OperationInProgress { get; set; } = false;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(CanOpenLocalPath))]
[NotifyPropertyChangedFor(nameof(NewSessionRemoteHostEnabled))]
[NotifyPropertyChangedFor(nameof(NewSessionRemotePathDialogEnabled))]
public partial bool OperationInProgress { get; set; } = false;

[ObservableProperty] public partial IReadOnlyList<SyncSessionViewModel> Sessions { get; set; } = [];

Expand All @@ -60,6 +64,7 @@ public partial class FileSyncListViewModel : ObservableObject

[ObservableProperty]
[NotifyPropertyChangedFor(nameof(NewSessionCreateEnabled))]
[NotifyPropertyChangedFor(nameof(CanOpenLocalPath))]
public partial bool NewSessionLocalPathDialogOpen { get; set; } = false;

[ObservableProperty]
Expand All @@ -80,10 +85,12 @@ public partial class FileSyncListViewModel : ObservableObject
[NotifyPropertyChangedFor(nameof(NewSessionRemotePathDialogEnabled))]
public partial bool NewSessionRemotePathDialogOpen { get; set; } = false;

public bool NewSessionRemoteHostEnabled => AvailableHosts.Count > 0;
public bool CanOpenLocalPath => !NewSessionLocalPathDialogOpen && !OperationInProgress;

public bool NewSessionRemoteHostEnabled => AvailableHosts.Count > 0 && !OperationInProgress;

public bool NewSessionRemotePathDialogEnabled =>
!string.IsNullOrWhiteSpace(NewSessionRemoteHost) && !NewSessionRemotePathDialogOpen;
!string.IsNullOrWhiteSpace(NewSessionRemoteHost) && !NewSessionRemotePathDialogOpen && !OperationInProgress;

[ObservableProperty] public partial string NewSessionStatus { get; set; } = "";

Expand Down
4 changes: 3 additions & 1 deletion App/Views/Pages/FileSyncListMainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,12 @@
Grid.Column="0"
Margin="0,0,5,0"
VerticalAlignment="Stretch"
IsEnabled="{x:Bind ViewModel.OperationInProgress,Converter={StaticResource InverseBoolConverter}, Mode=OneWay}"
Text="{x:Bind ViewModel.NewSessionLocalPath, Mode=TwoWay}" />

<Button
Grid.Column="1"
IsEnabled="{x:Bind ViewModel.NewSessionLocalPathDialogOpen, Converter={StaticResource InverseBoolConverter}, Mode=OneWay}"
IsEnabled="{x:Bind ViewModel.CanOpenLocalPath, Mode=OneWay}"
Command="{x:Bind ViewModel.OpenLocalPathSelectDialogCommand}"
VerticalAlignment="Stretch">

Expand Down Expand Up @@ -350,6 +351,7 @@
Grid.Column="0"
Margin="0,0,5,0"
VerticalAlignment="Stretch"
IsEnabled="{x:Bind ViewModel.NewSessionRemotePathDialogEnabled, Mode=OneWay}"
Text="{x:Bind ViewModel.NewSessionRemotePath, Mode=TwoWay}" />

<Button
Expand Down
Loading