Skip to content

Commit 021aab8

Browse files
committed
enhance: add a button to clear all git command logs
Signed-off-by: leo <[email protected]>
1 parent c1e31ac commit 021aab8

File tree

6 files changed

+22
-5
lines changed

6 files changed

+22
-5
lines changed

build/scripts/localization-check.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ async function calculateTranslationRate() {
6262

6363
// Add an empty line before the first x:String
6464
xmlStr = xmlStr.replace(' <x:String', '\n <x:String');
65-
66-
await fs.writeFile(filePath, xmlStr, 'utf8');
65+
await fs.writeFile(filePath, xmlStr + '\n', 'utf8');
6766

6867
if (missingKeys.length > 0) {
6968
const progress = ((enUSKeys.size - missingKeys.length) / enUSKeys.size) * 100;

src/Resources/Locales/en_US.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@
699699
<x:String x:Key="Text.UpdateSubmodules.UseRemote" xml:space="preserve">Use --remote option</x:String>
700700
<x:String x:Key="Text.URL" xml:space="preserve">URL:</x:String>
701701
<x:String x:Key="Text.ViewLogs" xml:space="preserve">Logs</x:String>
702+
<x:String x:Key="Text.ViewLogs.Clear" xml:space="preserve">CLEAR ALL</x:String>
702703
<x:String x:Key="Text.Warn" xml:space="preserve">Warning</x:String>
703704
<x:String x:Key="Text.Welcome" xml:space="preserve">Welcome Page</x:String>
704705
<x:String x:Key="Text.Welcome.AddRootFolder" xml:space="preserve">Create Group</x:String>

src/Resources/Locales/zh_CN.axaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@
703703
<x:String x:Key="Text.UpdateSubmodules.UseRemote" xml:space="preserve">启用 '--remote'</x:String>
704704
<x:String x:Key="Text.URL" xml:space="preserve">仓库地址 :</x:String>
705705
<x:String x:Key="Text.ViewLogs" xml:space="preserve">日志列表</x:String>
706+
<x:String x:Key="Text.ViewLogs.Clear" xml:space="preserve">清空日志</x:String>
706707
<x:String x:Key="Text.Warn" xml:space="preserve">警告</x:String>
707708
<x:String x:Key="Text.Welcome" xml:space="preserve">起始页</x:String>
708709
<x:String x:Key="Text.Welcome.AddRootFolder" xml:space="preserve">新建分组</x:String>
@@ -759,4 +760,4 @@
759760
<x:String x:Key="Text.Worktree.Lock" xml:space="preserve">锁定工作树</x:String>
760761
<x:String x:Key="Text.Worktree.Remove" xml:space="preserve">移除工作树</x:String>
761762
<x:String x:Key="Text.Worktree.Unlock" xml:space="preserve">解除工作树锁定</x:String>
762-
</ResourceDictionary>
763+
</ResourceDictionary>

src/Resources/Locales/zh_TW.axaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@
703703
<x:String x:Key="Text.UpdateSubmodules.UseRemote" xml:space="preserve">啟用 [--remote] 選項</x:String>
704704
<x:String x:Key="Text.URL" xml:space="preserve">存放庫網址:</x:String>
705705
<x:String x:Key="Text.ViewLogs" xml:space="preserve">日誌清單</x:String>
706+
<x:String x:Key="Text.ViewLogs.Clear" xml:space="preserve">清除所有日誌</x:String>
706707
<x:String x:Key="Text.Warn" xml:space="preserve">警告</x:String>
707708
<x:String x:Key="Text.Welcome" xml:space="preserve">起始頁</x:String>
708709
<x:String x:Key="Text.Welcome.AddRootFolder" xml:space="preserve">新增群組</x:String>
@@ -759,4 +760,4 @@
759760
<x:String x:Key="Text.Worktree.Lock" xml:space="preserve">鎖定工作區</x:String>
760761
<x:String x:Key="Text.Worktree.Remove" xml:space="preserve">移除工作區</x:String>
761762
<x:String x:Key="Text.Worktree.Unlock" xml:space="preserve">解除鎖定工作區</x:String>
762-
</ResourceDictionary>
763+
</ResourceDictionary>

src/ViewModels/ViewLogs.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ public ViewLogs(Repository repo)
2121
_repo = repo;
2222
}
2323

24+
public void ClearAll()
25+
{
26+
SelectedLog = null;
27+
Logs.Clear();
28+
}
29+
2430
private Repository _repo = null;
2531
private CommandLog _selectedLog = null;
2632
}

src/Views/ViewLogs.axaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:vm="using:SourceGit.ViewModels"
66
xmlns:v="using:SourceGit.Views"
7+
xmlns:c="using:SourceGit.Converters"
78
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
89
x:Class="SourceGit.Views.ViewLogs"
910
x:DataType="vm:ViewLogs"
@@ -13,7 +14,7 @@
1314
Width="800" Height="500"
1415
CanResize="False"
1516
WindowStartupLocation="CenterOwner">
16-
<Grid RowDefinitions="Auto,*">
17+
<Grid RowDefinitions="Auto,*,Auto">
1718
<!-- TitleBar -->
1819
<Grid Grid.Row="0" Height="28" IsVisible="{Binding !#ThisControl.UseSystemWindowFrame}">
1920
<Border Background="{DynamicResource Brush.TitleBar}"
@@ -108,5 +109,13 @@
108109
FontFamily="{DynamicResource Fonts.Monospace}"/>
109110
</Border>
110111
</Grid>
112+
113+
<Grid Grid.Row="2" Margin="0,0,0,8">
114+
<Button Classes="flat primary"
115+
Content="{DynamicResource Text.ViewLogs.Clear}"
116+
HorizontalAlignment="Center"
117+
Command="{Binding ClearAll}"
118+
IsEnabled="{Binding Logs.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"/>
119+
</Grid>
111120
</Grid>
112121
</v:ChromelessWindow>

0 commit comments

Comments
 (0)