From ca8c3bcad3d0f5f341aa2df82b2e4b792dee1c00 Mon Sep 17 00:00:00 2001 From: cardidi Date: Sun, 6 Apr 2025 17:38:30 +0800 Subject: [PATCH] feat: Modify some functions --- .../.idea/dataSources.xml | 5 +++ Flawless-Version-Control.sln.DotSettings.user | 21 +++++---- Flawless.Client/App.axaml | 2 +- Flawless.Client/Flawless.Client.csproj | 4 -- .../ViewModels/RepositoryViewModel.cs | 44 ++++++++++++------- Flawless.Client/Views/MainWindowView.axaml | 3 +- .../RepositoryPage/RepoSettingPageView.axaml | 11 ++++- .../RepoWorkspacePageView.axaml | 24 ++++------ Flawless.Client/Views/RepositoryView.axaml | 12 ++--- Flawless.Client/Views/SettingView.axaml | 38 +++++++++++++--- Flawless.Server/Flawless.Server.csproj | 1 - 11 files changed, 101 insertions(+), 64 deletions(-) diff --git a/.idea/.idea.Flawless-Version-Control/.idea/dataSources.xml b/.idea/.idea.Flawless-Version-Control/.idea/dataSources.xml index 2227939..6d274ce 100644 --- a/.idea/.idea.Flawless-Version-Control/.idea/dataSources.xml +++ b/.idea/.idea.Flawless-Version-Control/.idea/dataSources.xml @@ -7,6 +7,11 @@ true org.postgresql.Driver jdbc:postgresql://localhost:5432/postgres + + + + + $ProjectFileDir$ diff --git a/Flawless-Version-Control.sln.DotSettings.user b/Flawless-Version-Control.sln.DotSettings.user index 121117d..ef0f228 100644 --- a/Flawless-Version-Control.sln.DotSettings.user +++ b/Flawless-Version-Control.sln.DotSettings.user @@ -5,8 +5,11 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded + ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded @@ -24,6 +27,8 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded @@ -34,13 +39,13 @@ <Assembly Path="C:\Users\Cardi\.nuget\packages\irihi.ursa.themes.semi\1.10.0\lib\netstandard2.0\Ursa.Themes.Semi.dll" /> <Assembly Path="C:\Users\Cardi\.nuget\packages\reactiveui\20.1.1\lib\net8.0\ReactiveUI.dll" /> </AssemblyExplorer> - <SessionState ContinuousTestingMode="0" IsActive="True" IsLocked="True" Name="PathValidationTest" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> - <TestAncestor> - <TestId>MSTest::5B1CB26D-99F5-491A-B368-7E3552FE67E9::net9.0::Flawless.Abstract.Test.WorkPathTestUnit</TestId> - </TestAncestor> + <SessionState ContinuousTestingMode="0" IsActive="True" IsLocked="True" Name="PathValidationTest" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> + <TestAncestor> + <TestId>MSTest::5B1CB26D-99F5-491A-B368-7E3552FE67E9::net9.0::Flawless.Abstract.Test.WorkPathTestUnit</TestId> + </TestAncestor> </SessionState> - <SessionState ContinuousTestingMode="0" Name="PathValidationTest #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> - <TestAncestor> - <TestId>MSTest::5B1CB26D-99F5-491A-B368-7E3552FE67E9::net9.0::Flawless.Abstract.Test.WorkPathTestUnit.PathValidationTest</TestId> - </TestAncestor> + <SessionState ContinuousTestingMode="0" Name="PathValidationTest #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> + <TestAncestor> + <TestId>MSTest::5B1CB26D-99F5-491A-B368-7E3552FE67E9::net9.0::Flawless.Abstract.Test.WorkPathTestUnit.PathValidationTest</TestId> + </TestAncestor> </SessionState> \ No newline at end of file diff --git a/Flawless.Client/App.axaml b/Flawless.Client/App.axaml index 4ff221c..b047e97 100644 --- a/Flawless.Client/App.axaml +++ b/Flawless.Client/App.axaml @@ -3,7 +3,7 @@ xmlns:semi="https://irihi.tech/semi" xmlns:ursa="https://irihi.tech/ursa/themes/semi" x:Class="Flawless.Client.App" - RequestedThemeVariant="Light"> + RequestedThemeVariant="Default"> diff --git a/Flawless.Client/Flawless.Client.csproj b/Flawless.Client/Flawless.Client.csproj index eb15b74..f29b58b 100644 --- a/Flawless.Client/Flawless.Client.csproj +++ b/Flawless.Client/Flawless.Client.csproj @@ -67,8 +67,4 @@ - - - - diff --git a/Flawless.Client/ViewModels/RepositoryViewModel.cs b/Flawless.Client/ViewModels/RepositoryViewModel.cs index de4e554..b503af1 100644 --- a/Flawless.Client/ViewModels/RepositoryViewModel.cs +++ b/Flawless.Client/ViewModels/RepositoryViewModel.cs @@ -24,14 +24,16 @@ using ChangeType = Flawless.Client.Service.LocalFileTreeAccessor.ChangeType; namespace Flawless.Client.ViewModels; -public class LocalChangesNode +public partial class LocalChangesNode : ReactiveModel { - public required string FullPath { get; set; } + [Reactive] private string _fullPath; - public required string Type { get; set; } + [Reactive] private string _type; - public DateTime? ModifiedTime { get; set; } + [Reactive] private DateTime? _modifiedTime; + [Reactive] private LocalChangesNode? _parent; + public bool Included { get @@ -42,31 +44,34 @@ public class LocalChangesNode set { if (Contents != null) foreach (var n in Contents) n.Included = value; - _actualIncluded = value; + this.RaiseAndSetIfChanged(ref _actualIncluded, value, nameof(Included)); + _parent?.RaisePropertyChanged(nameof(Included)); } } private bool _actualIncluded; - + public ObservableCollection? Contents { get; set; } - public static LocalChangesNode FromFolder(string folderPath) + public static LocalChangesNode FromFolder(LocalChangesNode? parent, string folderPath) { return new LocalChangesNode { Type = "Folder", FullPath = folderPath, - Contents = new() + Contents = new(), + Parent = parent }; } - public static LocalChangesNode FromWorkspaceFile(LocalFileTreeAccessor.ChangeRecord file) + public static LocalChangesNode FromWorkspaceFile(LocalChangesNode? parent, LocalFileTreeAccessor.ChangeRecord file) { return new LocalChangesNode { Type = file.Type.ToString(), FullPath = file.File.WorkPath, - ModifiedTime = file.File.ModifyTime + ModifiedTime = file.File.ModifyTime, + Parent = parent }; } } @@ -147,7 +152,12 @@ public partial class RepositoryViewModel : RoutableViewModelBase Columns = { new CheckBoxColumn( - string.Empty, n => n.Included, (n, v) => n.Included = v), + null, n => n.Included, (n, v) => n.Included = v, + null, new CheckBoxColumnOptions + { + CanUserResizeColumn = false, + CanUserSortColumn = false, + }), new HierarchicalExpanderColumn( new TextColumn( @@ -177,7 +187,7 @@ public partial class RepositoryViewModel : RoutableViewModelBase Columns = { new TextColumn( - string.Empty, n => n.CommitId == LocalDatabase.CurrentCommit.ToString() ? "*" : String.Empty), + string.Empty, n => n.CommitId == LocalDatabase.CurrentCommit.ToString() ? "HEAD" : String.Empty), new TextColumn( "Message", x => x.Message), @@ -263,10 +273,10 @@ public partial class RepositoryViewModel : RoutableViewModelBase foreach (var file in changesNode) { - var n = LocalChangesNode.FromWorkspaceFile(file); - var parentNode = AddParentToMap(file.File.WorkPath); - if (parentNode == null) nodes.Add(n); - else parentNode.Contents!.Add(n); + var parent = AddParentToMap(file.File.WorkPath); + var n = LocalChangesNode.FromWorkspaceFile(parent, file); + if (parent == null) nodes.Add(n); + else parent.Contents!.Add(n); } return nodes; @@ -282,8 +292,8 @@ public partial class RepositoryViewModel : RoutableViewModelBase if (folderMap.TryGetValue(path, out var node)) return node; // 生成当前文件夹,并先找到这个文件夹的直接文件夹 - node = LocalChangesNode.FromFolder(path); var parent = AddParentToMap(path); + node = LocalChangesNode.FromFolder(parent, path); folderMap.Add(path, node); if (parent != null) parent.Contents!.Add(node); else nodes.Add(node); diff --git a/Flawless.Client/Views/MainWindowView.axaml b/Flawless.Client/Views/MainWindowView.axaml index 3add040..901aea5 100644 --- a/Flawless.Client/Views/MainWindowView.axaml +++ b/Flawless.Client/Views/MainWindowView.axaml @@ -6,12 +6,11 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:vm="using:Flawless.Client.ViewModels" - xmlns:views="clr-namespace:Flawless.Client.Views" x:DataType="vm:MainWindowViewModel" Title="Flawless Version Control" mc:Ignorable="d" d:DesignWidth="1280" d:DesignHeight="800" x:CompileBindings="True" - CanResize="True" MinWidth="1024" MinHeight="768" + CanResize="True" MinWidth="1024" MinHeight="768" Width="1280" Height="800" Icon="/Assets/avalonia-logo.ico"> diff --git a/Flawless.Client/Views/RepositoryPage/RepoSettingPageView.axaml b/Flawless.Client/Views/RepositoryPage/RepoSettingPageView.axaml index c1519b0..80ef347 100644 --- a/Flawless.Client/Views/RepositoryPage/RepoSettingPageView.axaml +++ b/Flawless.Client/Views/RepositoryPage/RepoSettingPageView.axaml @@ -9,7 +9,7 @@ x:Class="Flawless.Client.Views.RepositoryPage.RepoSettingPageView"> - + - + + + + + + + +