Skip to content

Commit 6d298be

Browse files
committed
enhance: only show Initialize as needed option when it is necessary
Signed-off-by: leo <[email protected]>
1 parent b346e2b commit 6d298be

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/ViewModels/UpdateSubmodules.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ public bool UpdateAll
2727
set => SetProperty(ref _updateAll, value);
2828
}
2929

30+
public bool IsEnableInitVisible
31+
{
32+
get;
33+
set;
34+
} = true;
35+
3036
public bool EnableInit
3137
{
3238
get;
@@ -53,12 +59,14 @@ public UpdateSubmodules(Repository repo, Models.Submodule selected)
5359
{
5460
_updateAll = false;
5561
SelectedSubmodule = selected;
62+
IsEnableInitVisible = selected.Status == Models.SubmoduleStatus.NotInited;
5663
EnableInit = selected.Status == Models.SubmoduleStatus.NotInited;
5764
HasPreSelectedSubmodule = true;
5865
}
5966
else if (repo.Submodules.Count > 0)
6067
{
6168
SelectedSubmodule = repo.Submodules[0];
69+
IsEnableInitVisible = true;
6270
HasPreSelectedSubmodule = false;
6371
}
6472
}

src/Views/UpdateSubmodules.axaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<TextBlock FontSize="18"
1212
Classes="bold"
1313
Text="{DynamicResource Text.UpdateSubmodules}"/>
14-
<Grid Margin="0,16,0,0" RowDefinitions="32,Auto,32,32,32" ColumnDefinitions="120,*">
14+
<Grid Margin="0,16,0,0" RowDefinitions="32,Auto,Auto,32,32" ColumnDefinitions="120,*">
1515
<TextBlock Grid.Row="0" Grid.Column="0"
1616
HorizontalAlignment="Right" VerticalAlignment="Center"
1717
Margin="0,0,8,0"
@@ -45,8 +45,10 @@
4545
IsVisible="{Binding !HasPreSelectedSubmodule, Mode=OneWay}"/>
4646

4747
<CheckBox Grid.Row="2" Grid.Column="1"
48+
Height="32"
4849
Content="{DynamicResource Text.UpdateSubmodules.Init}"
4950
IsChecked="{Binding EnableInit, Mode=TwoWay}"
51+
IsVisible="{Binding IsEnableInitVisible, Mode=OneWay}"
5052
ToolTip.Tip="--init"/>
5153

5254
<CheckBox Grid.Row="3" Grid.Column="1"

0 commit comments

Comments
 (0)