Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 776e8b8

Browse files
committed
Add tooltip for sync submodules
1 parent d107f23 commit 776e8b8

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

src/GitHub.App/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GitHub.App/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,7 @@
285285
<data name="WorkingDirectoryHasUncommittedCHanges" xml:space="preserve">
286286
<value>Cannot checkout as your working directory has uncommitted changes.</value>
287287
</data>
288+
<data name="SyncSubmodules" xml:space="preserve">
289+
<value>Sync {0} submodules</value>
290+
</data>
288291
</root>

src/GitHub.App/ViewModels/GitHubPane/PullRequestDetailViewModel.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,9 @@ public async Task Load(IPullRequestModel pullRequest)
409409
}
410410

411411
var submodulesToSync = await pullRequestsService.CountSubmodulesToSync(LocalRepository);
412+
var syncSubmodulesToolTip = string.Format(Resources.SyncSubmodules, submodulesToSync);
412413

413-
UpdateState = new UpdateCommandState(divergence, pullEnabled, pushEnabled, pullToolTip, pushToolTip, submodulesToSync);
414+
UpdateState = new UpdateCommandState(divergence, pullEnabled, pushEnabled, pullToolTip, pushToolTip, syncSubmodulesToolTip, submodulesToSync);
414415
CheckoutState = null;
415416
}
416417
else
@@ -707,6 +708,7 @@ public UpdateCommandState(
707708
bool pushEnabled,
708709
string pullToolTip,
709710
string pushToolTip,
711+
string syncSubmodulesToolTip,
710712
int submodulesToSync)
711713
{
712714
CommitsAhead = divergence.AheadBy ?? 0;
@@ -715,6 +717,7 @@ public UpdateCommandState(
715717
PullEnabled = pullEnabled;
716718
PullToolTip = pullToolTip;
717719
PushToolTip = pushToolTip;
720+
SyncSubmodulesToolTip = syncSubmodulesToolTip;
718721
SubmodulesToSync = submodulesToSync;
719722
}
720723

@@ -723,9 +726,10 @@ public UpdateCommandState(
723726
public bool UpToDate => CommitsAhead == 0 && CommitsBehind == 0 && !SyncSubmodulesEnabled;
724727
public bool PullEnabled { get; }
725728
public bool PushEnabled { get; }
729+
public bool SyncSubmodulesEnabled => SubmodulesToSync > 0;
726730
public string PullToolTip { get; }
727731
public string PushToolTip { get; }
728-
public bool SyncSubmodulesEnabled => SubmodulesToSync > 0;
732+
public string SyncSubmodulesToolTip { get; }
729733
public int SubmodulesToSync { get; }
730734
}
731735
}

src/GitHub.VisualStudio/Views/GitHubPane/PullRequestDetailView.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@
189189
<ui:GitHubActionLink Content="Sync"
190190
Command="{Binding SyncSubmodules}"
191191
Margin="4 0"
192+
ToolTip="{Binding UpdateState.SyncSubmodulesToolTip}"
192193
Visibility="{Binding UpdateState.SyncSubmodulesEnabled, FallbackValue=Collapsed, Converter={ui:BooleanToVisibilityConverter}}" />
193194
</StackPanel>
194195

0 commit comments

Comments
 (0)