1
0

fix: Some timing issue has been fixed

This commit is contained in:
Ca2didi 2025-05-20 16:07:07 +08:00
parent 1a48cd1712
commit b21dae1192
6 changed files with 34 additions and 18 deletions

View File

@ -243,7 +243,7 @@ namespace Flawless.Client.Remote
/// <exception cref="ApiException">Thrown when the request returns a non-success status code.</exception>
[Headers("Accept: text/plain, application/json, text/json")]
[Post("/api/repo/{userName}/{repositoryName}/fetch_depot")]
Task<ApiResponse<Stream>> FetchDepot(string userName, string repositoryName, [Query] string depotId);
Task<ApiResponse<Stream>> FetchDepot(string userName, string repositoryName, [Query] string depotId, CancellationToken cancellationToken = default);
/// <returns>OK</returns>
/// <exception cref="ApiException">Thrown when the request returns a non-success status code.</exception>

View File

@ -275,11 +275,11 @@ public partial class RepositoryViewModel : RoutableViewModelBase
private async Task StartupTasksAsync()
{
await RefreshRepositoryRoleInfoAsyncCommand.Execute();
await RefreshRepositoryIssuesAsyncCommand.Execute();
await RefreshStatisticDataCommand.Execute();
await RefreshWebhooksCommand.Execute();
await DetectLocalChangesAsyncCommand.Execute();
await RefreshRepositoryRoleInfoAsync();
await RefreshRepositoryIssuesAsync();
await RefreshStatisticDataAsync();
await RefreshWebhooksAsync();
await DetectLocalChangesAsync();
await RendererFileTreeAsync();
SyncCommitsFromRepository();
}
@ -659,6 +659,8 @@ public partial class RepositoryViewModel : RoutableViewModelBase
[ReactiveCommand]
private async ValueTask RefreshRepositoryIssuesAsync()
{
if (!IsReporterRole) return;
using var l = UIHelper.MakeLoading("Refreshing issues...");
await RepositoryService.C.UpdateIssuesListFromServerAsync(Repository);
}
@ -756,6 +758,8 @@ public partial class RepositoryViewModel : RoutableViewModelBase
[ReactiveCommand]
private async ValueTask DetectLocalChangesAsync()
{
if (!IsDeveloperRole) return;
using var l = UIHelper.MakeLoading("Refreshing local changes...");
var ns = await Task.Run(async () =>
{
@ -773,7 +777,16 @@ public partial class RepositoryViewModel : RoutableViewModelBase
foreach (var n in LocalChangeSetRaw)
n.Included = true;
}
[ReactiveCommand]
private void OpenFolder()
{
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo() {
FileName = PathUtility.GetWorkspacePath(Api.C.Username.Value!, Repository.OwnerName, Repository.Name),
UseShellExecute = true,
Verb = "open"
});
}
[ReactiveCommand]
private void DeselectAllChanges()
@ -783,8 +796,10 @@ public partial class RepositoryViewModel : RoutableViewModelBase
}
[ReactiveCommand]
private async Task RefreshStatisticData()
private async Task RefreshStatisticDataAsync()
{
if (!IsOwnerRole) return;
try
{
var api = Api.C;
@ -800,13 +815,12 @@ public partial class RepositoryViewModel : RoutableViewModelBase
foreach (var dp in rsp.Depots)
DepotsStats.Add(new DepotStatsInfo{ Id = dp.DepotName, Size = dp.DepotSize});
ByDay = new[]
{
ByDay = [
new ColumnSeries<DateTimePoint>
{
Values = rsp.CommitByDay.Select(k => new DateTimePoint(k.Day.LocalDateTime, k.Count)).ToList(),
}
};
];
}
catch (Exception e)
{

View File

@ -7,10 +7,10 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Flawless.Client.Views.RepositoryPage.RepoCommitPageView">
<Grid ColumnDefinitions="2*, *">
<TreeDataGrid Grid.Column="0" Source="{Binding Commits}">
<TreeDataGrid Grid.Column="0" Source="{Binding Commits, Mode=TwoWay}">
<TreeDataGrid.ContextMenu>
<ContextMenu>
<MenuItem Header="View File Tree"/>
<!-- <MenuItem Header="View File Tree"/> -->
<MenuItem Header="Reset To">
<MenuItem Header="Keep" Command="{Binding RevertFileTreeToSelectedCommitKeepCommand}"/>
<MenuItem Header="Soft" Command="{Binding RevertFileTreeToSelectedCommitSoftCommand}"/>

View File

@ -13,8 +13,10 @@
<u:IconButton
Icon="{StaticResource SemiIconDownload}" Content="Pull" HorizontalAlignment="Stretch"
Command="{Binding PullLatestRepositoryCommand}"/>
<u:IconButton Icon="{StaticResource SemiIconExternalOpen}" Content="Open Folder"
Command="{Binding OpenFolderCommand}"/>
</StackPanel>
<TreeDataGrid Grid.Row="1" Source="{Binding FileTree}">
<TreeDataGrid Grid.Row="1" Source="{Binding FileTree, Mode=TwoWay}">
</TreeDataGrid>
</Grid>
</UserControl>

View File

@ -97,11 +97,11 @@
</ScrollViewer>
</TabItem>
<TabItem Header="Statics" IsVisible="{Binding IsOwnerRole}">
<ScrollViewer Width="600" HorizontalAlignment="Stretch">
<ScrollViewer Width="600" HorizontalAlignment="Left" Margin="6">
<StackPanel Spacing="16" HorizontalAlignment="Stretch">
<StackPanel Orientation="Horizontal" Spacing="10">
<u:IconButton Content="Refresh" Icon="{StaticResource SemiIconRefresh}"
Command="{Binding RefreshWebhooksCommand}"/>
Command="{Binding RefreshStatisticDataCommand}"/>
</StackPanel>
<StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
<Label>Every Day Commits</Label>

View File

@ -15,8 +15,8 @@
Command="{Binding SelectAllChangesCommand}"/>
<u:IconButton Icon="{StaticResource SemiIconList}" Content="None"
Command="{Binding DeselectAllChangesCommand}"/>
<!-- <u:IconButton Icon="{StaticResource SemiIconDownload}" Content="Open Folder" -->
<!-- Command="{Binding OpenFolderInSystemDefaultExplorerCommand}"/> -->
<u:IconButton Icon="{StaticResource SemiIconExternalOpen}" Content="Open Folder"
Command="{Binding OpenFolderCommand}"/>
</StackPanel>
<TreeDataGrid Grid.Row="1" Grid.Column="0" Source="{Binding LocalChange}" CanUserSortColumns="True"/>
<Border Grid.Row="1" Grid.Column="2" Classes="Shadow" Theme="{StaticResource CardBorder}">