enhance: add a button to clear all git command logs

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-04-17 16:07:40 +08:00
parent c1e31ac4e3
commit 021aab8408
No known key found for this signature in database
6 changed files with 22 additions and 5 deletions

View file

@ -62,8 +62,7 @@ async function calculateTranslationRate() {
// Add an empty line before the first x:String
xmlStr = xmlStr.replace(' <x:String', '\n <x:String');
await fs.writeFile(filePath, xmlStr, 'utf8');
await fs.writeFile(filePath, xmlStr + '\n', 'utf8');
if (missingKeys.length > 0) {
const progress = ((enUSKeys.size - missingKeys.length) / enUSKeys.size) * 100;

View file

@ -699,6 +699,7 @@
<x:String x:Key="Text.UpdateSubmodules.UseRemote" xml:space="preserve">Use --remote option</x:String>
<x:String x:Key="Text.URL" xml:space="preserve">URL:</x:String>
<x:String x:Key="Text.ViewLogs" xml:space="preserve">Logs</x:String>
<x:String x:Key="Text.ViewLogs.Clear" xml:space="preserve">CLEAR ALL</x:String>
<x:String x:Key="Text.Warn" xml:space="preserve">Warning</x:String>
<x:String x:Key="Text.Welcome" xml:space="preserve">Welcome Page</x:String>
<x:String x:Key="Text.Welcome.AddRootFolder" xml:space="preserve">Create Group</x:String>

View file

@ -703,6 +703,7 @@
<x:String x:Key="Text.UpdateSubmodules.UseRemote" xml:space="preserve">启用 '--remote'</x:String>
<x:String x:Key="Text.URL" xml:space="preserve">仓库地址 </x:String>
<x:String x:Key="Text.ViewLogs" xml:space="preserve">日志列表</x:String>
<x:String x:Key="Text.ViewLogs.Clear" xml:space="preserve">清空日志</x:String>
<x:String x:Key="Text.Warn" xml:space="preserve">警告</x:String>
<x:String x:Key="Text.Welcome" xml:space="preserve">起始页</x:String>
<x:String x:Key="Text.Welcome.AddRootFolder" xml:space="preserve">新建分组</x:String>
@ -759,4 +760,4 @@
<x:String x:Key="Text.Worktree.Lock" xml:space="preserve">锁定工作树</x:String>
<x:String x:Key="Text.Worktree.Remove" xml:space="preserve">移除工作树</x:String>
<x:String x:Key="Text.Worktree.Unlock" xml:space="preserve">解除工作树锁定</x:String>
</ResourceDictionary>
</ResourceDictionary>

View file

@ -703,6 +703,7 @@
<x:String x:Key="Text.UpdateSubmodules.UseRemote" xml:space="preserve">啟用 [--remote] 選項</x:String>
<x:String x:Key="Text.URL" xml:space="preserve">存放庫網址:</x:String>
<x:String x:Key="Text.ViewLogs" xml:space="preserve">日誌清單</x:String>
<x:String x:Key="Text.ViewLogs.Clear" xml:space="preserve">清除所有日誌</x:String>
<x:String x:Key="Text.Warn" xml:space="preserve">警告</x:String>
<x:String x:Key="Text.Welcome" xml:space="preserve">起始頁</x:String>
<x:String x:Key="Text.Welcome.AddRootFolder" xml:space="preserve">新增群組</x:String>
@ -759,4 +760,4 @@
<x:String x:Key="Text.Worktree.Lock" xml:space="preserve">鎖定工作區</x:String>
<x:String x:Key="Text.Worktree.Remove" xml:space="preserve">移除工作區</x:String>
<x:String x:Key="Text.Worktree.Unlock" xml:space="preserve">解除鎖定工作區</x:String>
</ResourceDictionary>
</ResourceDictionary>

View file

@ -21,6 +21,12 @@ namespace SourceGit.ViewModels
_repo = repo;
}
public void ClearAll()
{
SelectedLog = null;
Logs.Clear();
}
private Repository _repo = null;
private CommandLog _selectedLog = null;
}

View file

@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:SourceGit.ViewModels"
xmlns:v="using:SourceGit.Views"
xmlns:c="using:SourceGit.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.ViewLogs"
x:DataType="vm:ViewLogs"
@ -13,7 +14,7 @@
Width="800" Height="500"
CanResize="False"
WindowStartupLocation="CenterOwner">
<Grid RowDefinitions="Auto,*">
<Grid RowDefinitions="Auto,*,Auto">
<!-- TitleBar -->
<Grid Grid.Row="0" Height="28" IsVisible="{Binding !#ThisControl.UseSystemWindowFrame}">
<Border Background="{DynamicResource Brush.TitleBar}"
@ -108,5 +109,13 @@
FontFamily="{DynamicResource Fonts.Monospace}"/>
</Border>
</Grid>
<Grid Grid.Row="2" Margin="0,0,0,8">
<Button Classes="flat primary"
Content="{DynamicResource Text.ViewLogs.Clear}"
HorizontalAlignment="Center"
Command="{Binding ClearAll}"
IsEnabled="{Binding Logs.Count, Converter={x:Static c:IntConverters.IsGreaterThanZero}}"/>
</Grid>
</Grid>
</v:ChromelessWindow>