fix(ui): disable Merge button after worktree is no longer Active
Add WorktreeStateLabel observable property populated from entity.Worktree?.State.ToString() in both BindAsync and RefreshWorktreeAsync. CanMerge now requires WorktreeStateLabel == "Active" so the button disables after a successful merge with removeWorktree:false. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -58,6 +58,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
|
|||||||
[ObservableProperty] private string? _model;
|
[ObservableProperty] private string? _model;
|
||||||
[ObservableProperty] private string? _worktreePath;
|
[ObservableProperty] private string? _worktreePath;
|
||||||
[ObservableProperty] private string? _worktreeBaseCommit;
|
[ObservableProperty] private string? _worktreeBaseCommit;
|
||||||
|
[ObservableProperty] private string? _worktreeStateLabel;
|
||||||
[ObservableProperty] private string? _branchLine;
|
[ObservableProperty] private string? _branchLine;
|
||||||
[ObservableProperty] private int _turns;
|
[ObservableProperty] private int _turns;
|
||||||
[ObservableProperty] private int _tokens;
|
[ObservableProperty] private int _tokens;
|
||||||
@@ -231,6 +232,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
|
|||||||
Notes = "";
|
Notes = "";
|
||||||
Model = null;
|
Model = null;
|
||||||
WorktreePath = null;
|
WorktreePath = null;
|
||||||
|
WorktreeStateLabel = null;
|
||||||
BranchLine = null;
|
BranchLine = null;
|
||||||
AgentStatusLabel = "Idle";
|
AgentStatusLabel = "Idle";
|
||||||
LatestRunSessionId = null;
|
LatestRunSessionId = null;
|
||||||
@@ -260,6 +262,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
|
|||||||
Notes = entity.Notes ?? "";
|
Notes = entity.Notes ?? "";
|
||||||
Model = entity.Model;
|
Model = entity.Model;
|
||||||
WorktreePath = entity.Worktree?.Path;
|
WorktreePath = entity.Worktree?.Path;
|
||||||
|
WorktreeStateLabel = entity.Worktree?.State.ToString();
|
||||||
BranchLine = entity.Worktree is { } w ? $"{w.BranchName} \u2190 main" : null;
|
BranchLine = entity.Worktree is { } w ? $"{w.BranchName} \u2190 main" : null;
|
||||||
AgentStatusLabel = entity.Status.ToString();
|
AgentStatusLabel = entity.Status.ToString();
|
||||||
|
|
||||||
@@ -292,6 +295,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
|
|||||||
|
|
||||||
WorktreePath = entity.Worktree?.Path;
|
WorktreePath = entity.Worktree?.Path;
|
||||||
WorktreeBaseCommit = entity.Worktree?.BaseCommit;
|
WorktreeBaseCommit = entity.Worktree?.BaseCommit;
|
||||||
|
WorktreeStateLabel = entity.Worktree?.State.ToString();
|
||||||
BranchLine = entity.Worktree is { } w ? $"{w.BranchName} ← main" : null;
|
BranchLine = entity.Worktree is { } w ? $"{w.BranchName} ← main" : null;
|
||||||
AgentStatusLabel = entity.Status.ToString();
|
AgentStatusLabel = entity.Status.ToString();
|
||||||
if (Task is { } row && entity.Worktree?.DiffStat is { } stat)
|
if (Task is { } row && entity.Worktree?.DiffStat is { } stat)
|
||||||
@@ -343,6 +347,11 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
|
|||||||
ApproveMergeCommand.NotifyCanExecuteChanged();
|
ApproveMergeCommand.NotifyCanExecuteChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
partial void OnWorktreeStateLabelChanged(string? value)
|
||||||
|
{
|
||||||
|
ApproveMergeCommand.NotifyCanExecuteChanged();
|
||||||
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private async System.Threading.Tasks.Task SendPromptAsync()
|
private async System.Threading.Tasks.Task SendPromptAsync()
|
||||||
{
|
{
|
||||||
@@ -398,7 +407,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
private bool CanMerge() =>
|
private bool CanMerge() =>
|
||||||
Task != null && _worker.IsConnected && WorktreePath != null;
|
Task != null && _worker.IsConnected && WorktreePath != null && WorktreeStateLabel == "Active";
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private async System.Threading.Tasks.Task StopAsync()
|
private async System.Threading.Tasks.Task StopAsync()
|
||||||
|
|||||||
Reference in New Issue
Block a user