fix: some errors and visual glitches
This commit is contained in:
parent
c0d22d3959
commit
c63a2506d2
@ -1210,6 +1210,7 @@ public class RepositoryService : BaseService<RepositoryService>
|
|||||||
{
|
{
|
||||||
// Check if current version is the latest
|
// Check if current version is the latest
|
||||||
var api = Api.C;
|
var api = Api.C;
|
||||||
|
if (!await UpdateCommitsHistoryFromServerAsync(repo)) return null;
|
||||||
var requireUpdate = await IsPointedToCommitNotPeekResultFromServerAsync(repo);
|
var requireUpdate = await IsPointedToCommitNotPeekResultFromServerAsync(repo);
|
||||||
if (!requireUpdate.HasValue) return null;
|
if (!requireUpdate.HasValue) return null;
|
||||||
|
|
||||||
@ -1261,7 +1262,7 @@ public class RepositoryService : BaseService<RepositoryService>
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var requireDepot = isBaseline ? [] : new[] {localDb.CurrentCommit.ToString()!};
|
var requireDepot = isBaseline ? [] : new[] {repo.Commits.First().DepotId.ToString()};
|
||||||
var rsp = await api.Gateway.CreateCommit(repo.OwnerName, repo.Name,
|
var rsp = await api.Gateway.CreateCommit(repo.OwnerName, repo.Name,
|
||||||
new StreamPart(str, Path.GetFileName(tempDepotPath)), message, snapshot, requireDepot, "");
|
new StreamPart(str, Path.GetFileName(tempDepotPath)), message, snapshot, requireDepot, "");
|
||||||
|
|
||||||
@ -1283,7 +1284,7 @@ public class RepositoryService : BaseService<RepositoryService>
|
|||||||
}
|
}
|
||||||
|
|
||||||
var rsp = await api.Gateway.CreateCommit(repo.OwnerName, repo.Name, null!,
|
var rsp = await api.Gateway.CreateCommit(repo.OwnerName, repo.Name, null!,
|
||||||
message, snapshot, [], localDb.CurrentCommit?.ToString() ?? "");
|
message, snapshot, [], repo.Commits.First().DepotId.ToString());
|
||||||
|
|
||||||
commitId = rsp.CommitId;
|
commitId = rsp.CommitId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,11 +3,18 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:vm="using:Flawless.Client.ViewModels"
|
xmlns:vm="using:Flawless.Client.ViewModels"
|
||||||
|
xmlns:u="https://irihi.tech/ursa"
|
||||||
x:DataType="vm:RepositoryViewModel"
|
x:DataType="vm:RepositoryViewModel"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="Flawless.Client.Views.RepositoryPage.RepoFileTreePageView">
|
x:Class="Flawless.Client.Views.RepositoryPage.RepoFileTreePageView">
|
||||||
<Grid ColumnDefinitions="2*, *">
|
<Grid RowDefinitions="Auto, *">
|
||||||
<TreeDataGrid Grid.Column="0" Grid.ColumnSpan="2" Source="{Binding FileTree}">
|
<StackPanel Orientation="Horizontal" Spacing="4" Margin="0, 6"
|
||||||
|
HorizontalAlignment="Stretch" IsVisible="{Binding !IsDeveloperRole}">
|
||||||
|
<u:IconButton
|
||||||
|
Icon="{StaticResource SemiIconDownload}" Content="Pull" HorizontalAlignment="Stretch"
|
||||||
|
Command="{Binding PullLatestRepositoryCommand}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<TreeDataGrid Grid.Row="1" Source="{Binding FileTree}">
|
||||||
</TreeDataGrid>
|
</TreeDataGrid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@ -9,15 +9,11 @@
|
|||||||
x:Class="Flawless.Client.Views.RepositoryPage.RepoIssuePageView">
|
x:Class="Flawless.Client.Views.RepositoryPage.RepoIssuePageView">
|
||||||
|
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Spacing="8" Margin="0 0 0 12">
|
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Spacing="8" Margin="6">
|
||||||
<u:IconButton Icon="{StaticResource SemiIconRefresh}" Content="Refresh"
|
<u:IconButton Icon="{StaticResource SemiIconRefresh}" Content="Refresh"
|
||||||
Command="{Binding RefreshRepositoryIssuesAsyncCommand}"/>
|
Command="{Binding RefreshRepositoryIssuesAsyncCommand}"/>
|
||||||
<u:IconButton Icon="{StaticResource SemiIconPlus}" Content="Create"
|
<u:IconButton Icon="{StaticResource SemiIconPlus}" Content="Create"
|
||||||
Command="{Binding CreateIssueCommand}"/>
|
Command="{Binding CreateIssueCommand}"/>
|
||||||
<!-- <ComboBox ItemsSource="{Binding IssueFilters}" SelectedIndex="0" -->
|
|
||||||
<!-- Width="120" PlaceholderText="筛选状态"/> -->
|
|
||||||
<!-- <ComboBox ItemsSource="{Binding IssueTags}" SelectedIndex="0" -->
|
|
||||||
<!-- Width="160" PlaceholderText="筛选标签"/> -->
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<ListBox ItemsSource="{Binding Repository.Issues}" SelectionMode="Single">
|
<ListBox ItemsSource="{Binding Repository.Issues}" SelectionMode="Single">
|
||||||
|
|||||||
@ -21,15 +21,15 @@
|
|||||||
<TreeDataGrid Grid.Row="1" Grid.Column="0" Source="{Binding LocalChange}" CanUserSortColumns="True"/>
|
<TreeDataGrid Grid.Row="1" Grid.Column="0" Source="{Binding LocalChange}" CanUserSortColumns="True"/>
|
||||||
<Border Grid.Row="1" Grid.Column="2" Classes="Shadow" Theme="{StaticResource CardBorder}">
|
<Border Grid.Row="1" Grid.Column="2" Classes="Shadow" Theme="{StaticResource CardBorder}">
|
||||||
<StackPanel Spacing="8">
|
<StackPanel Spacing="8">
|
||||||
<u:ElasticWrapPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
|
<StackPanel Orientation="Horizontal" Spacing="4" HorizontalAlignment="Stretch">
|
||||||
<u:IconButton
|
<u:IconButton
|
||||||
Icon="{StaticResource SemiIconDownload}" Content="Pull" HorizontalAlignment="Stretch"
|
Icon="{StaticResource SemiIconDownload}" Content="Pull" HorizontalAlignment="Stretch"
|
||||||
Command="{Binding PullLatestRepositoryCommand}"/>
|
Command="{Binding PullLatestRepositoryCommand}"/>
|
||||||
<u:IconButton
|
<u:IconButton
|
||||||
Icon="{StaticResource SemiIconBackward}" Content="Revert Select" HorizontalAlignment="Stretch"
|
Icon="{StaticResource SemiIconBackward}" Content="Revert" HorizontalAlignment="Stretch"
|
||||||
Command="{Binding RevertSelectedChangesCommand}"/>
|
Command="{Binding RevertSelectedChangesCommand}"/>
|
||||||
</u:ElasticWrapPanel>
|
</StackPanel>
|
||||||
<u:Divider></u:Divider>
|
<u:Divider/>
|
||||||
<TextBox Text="{Binding LocalDatabase.CommitMessage}"
|
<TextBox Text="{Binding LocalDatabase.CommitMessage}"
|
||||||
Classes="TextArea" MaxHeight="300" Watermark="Description of this commit"/>
|
Classes="TextArea" MaxHeight="300" Watermark="Description of this commit"/>
|
||||||
<u:IconButton Content="Commit" Icon="{StaticResource SemiIconUpload}" HorizontalAlignment="Stretch"
|
<u:IconButton Content="Commit" Icon="{StaticResource SemiIconUpload}" HorizontalAlignment="Stretch"
|
||||||
|
|||||||
@ -17,15 +17,15 @@
|
|||||||
<Label FontWeight="400" FontSize="28" Content="{Binding Repository.StandaloneName}"/>
|
<Label FontWeight="400" FontSize="28" Content="{Binding Repository.StandaloneName}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TabControl TabStripPlacement="Top" Margin="0 20 0 0">
|
<TabControl TabStripPlacement="Top" Margin="0 20 0 0">
|
||||||
<TabItem>
|
<!-- <TabItem> -->
|
||||||
<TabItem.Header>
|
<!-- <TabItem.Header> -->
|
||||||
<StackPanel Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">
|
<!-- <StackPanel Orientation="Horizontal" Spacing="6" VerticalAlignment="Center"> -->
|
||||||
<PathIcon MaxHeight="14" MaxWidth="14" Data="{StaticResource SemiIconBox}"/>
|
<!-- <PathIcon MaxHeight="14" MaxWidth="14" Data="{StaticResource SemiIconBox}"/> -->
|
||||||
<Label Content="Dashboard"/>
|
<!-- <Label Content="Dashboard"/> -->
|
||||||
</StackPanel>
|
<!-- </StackPanel> -->
|
||||||
</TabItem.Header>
|
<!-- </TabItem.Header> -->
|
||||||
<page:RepoDashboardPageView/>
|
<!-- <page:RepoDashboardPageView/> -->
|
||||||
</TabItem>
|
<!-- </TabItem> -->
|
||||||
<TabItem IsVisible="{Binding IsDeveloperRole}">
|
<TabItem IsVisible="{Binding IsDeveloperRole}">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">
|
<StackPanel Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">
|
||||||
|
|||||||
@ -423,7 +423,7 @@ public class RepositoryInnieController(
|
|||||||
{
|
{
|
||||||
// Use existed depots
|
// Use existed depots
|
||||||
var mainDepotId = Guid.Parse(req.MainDepotId!);
|
var mainDepotId = Guid.Parse(req.MainDepotId!);
|
||||||
var preDepot = await StencilWorkspaceSnapshotViaDatabaseAsync(rp.Id, mainDepotId, test, sizeMap);
|
var preDepot = await StencilWorkspaceSnapshotViaDatabaseAsync(rp.Id, mainDepotId, test, sizeMap, null);
|
||||||
|
|
||||||
if (preDepot == null)
|
if (preDepot == null)
|
||||||
return BadRequest(new FailedResponse("Not a valid main depot!", "NoMainDepot"));
|
return BadRequest(new FailedResponse("Not a valid main depot!", "NoMainDepot"));
|
||||||
@ -441,7 +441,7 @@ public class RepositoryInnieController(
|
|||||||
{
|
{
|
||||||
// Get a new depot from request - this will flat to direct depot reference to avoid deep search that
|
// Get a new depot from request - this will flat to direct depot reference to avoid deep search that
|
||||||
// raise memory issue.
|
// raise memory issue.
|
||||||
var actualRequiredDepots = new HashSet<Guid>();
|
var directDependDepots = new HashSet<Guid>();
|
||||||
|
|
||||||
// Read and create a new depot
|
// Read and create a new depot
|
||||||
using var cacheStream = new MemoryStream(new byte[req.Depot.Length], true);
|
using var cacheStream = new MemoryStream(new byte[req.Depot.Length], true);
|
||||||
@ -457,21 +457,13 @@ public class RepositoryInnieController(
|
|||||||
// Yes
|
// Yes
|
||||||
foreach (var subDepot in req.RequiredDepots?.Select(Guid.Parse) ?? [])
|
foreach (var subDepot in req.RequiredDepots?.Select(Guid.Parse) ?? [])
|
||||||
{
|
{
|
||||||
await StencilWorkspaceSnapshotViaDatabaseAsync(rp.Id, subDepot, test, sizeMap);
|
await StencilWorkspaceSnapshotViaDatabaseAsync(rp.Id, subDepot, test, sizeMap, directDependDepots);
|
||||||
|
|
||||||
var rest = test.Count;
|
var rest = test.Count;
|
||||||
if (rest == 0)
|
|
||||||
{
|
|
||||||
actualRequiredDepots.Add(subDepot);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If test is changed?
|
// Quit if nothing to do.
|
||||||
if (unresolvedCount != rest)
|
unresolvedCount = rest;
|
||||||
{
|
if (rest == 0) break;
|
||||||
actualRequiredDepots.Add(subDepot);
|
|
||||||
unresolvedCount = rest;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If still not able to resolve
|
// If still not able to resolve
|
||||||
@ -489,7 +481,7 @@ public class RepositoryInnieController(
|
|||||||
await dbContext.Repositories
|
await dbContext.Repositories
|
||||||
.Where(r => r.Id == rp.Id)
|
.Where(r => r.Id == rp.Id)
|
||||||
.SelectMany(r => r.Depots)
|
.SelectMany(r => r.Depots)
|
||||||
.Where(cm => actualRequiredDepots.Contains(cm.DepotId))
|
.Where(cm => directDependDepots.Contains(cm.DepotId))
|
||||||
.ToArrayAsync());
|
.ToArrayAsync());
|
||||||
|
|
||||||
// Create commit and let it alloc a main key
|
// Create commit and let it alloc a main key
|
||||||
@ -590,7 +582,8 @@ public class RepositoryInnieController(
|
|||||||
private async Task<RepositoryDepot?> StencilWorkspaceSnapshotViaDatabaseAsync(
|
private async Task<RepositoryDepot?> StencilWorkspaceSnapshotViaDatabaseAsync(
|
||||||
Guid rpId, Guid depotId,
|
Guid rpId, Guid depotId,
|
||||||
HashSet<WorkspaceFile> unresolved,
|
HashSet<WorkspaceFile> unresolved,
|
||||||
Dictionary<WorkspaceFile, long> sizeMap)
|
Dictionary<WorkspaceFile, long> sizeMap,
|
||||||
|
HashSet<Guid>? directDependDepots)
|
||||||
{
|
{
|
||||||
var depot = await dbContext.Repositories
|
var depot = await dbContext.Repositories
|
||||||
.SelectMany(r => r.Depots)
|
.SelectMany(r => r.Depots)
|
||||||
@ -598,24 +591,28 @@ public class RepositoryInnieController(
|
|||||||
.ThenInclude(repositoryDepot => repositoryDepot.Dependencies)
|
.ThenInclude(repositoryDepot => repositoryDepot.Dependencies)
|
||||||
.FirstOrDefaultAsync(r => r.DepotId == depotId);
|
.FirstOrDefaultAsync(r => r.DepotId == depotId);
|
||||||
|
|
||||||
await RecurringAsync(transformer, rpId, depot, unresolved, sizeMap);
|
await RecurringAsync(transformer, rpId, depot, unresolved, sizeMap, directDependDepots);
|
||||||
return depot;
|
return depot;
|
||||||
|
|
||||||
static async ValueTask RecurringAsync(
|
static async ValueTask RecurringAsync(
|
||||||
PathTransformer transformer, Guid rpId,
|
PathTransformer transformer, Guid rpId,
|
||||||
RepositoryDepot? depot, HashSet<WorkspaceFile> unresolved,
|
RepositoryDepot? depot, HashSet<WorkspaceFile> unresolved,
|
||||||
Dictionary<WorkspaceFile, long> sizeMap)
|
Dictionary<WorkspaceFile, long> sizeMap,
|
||||||
|
HashSet<Guid>? directDependDepots)
|
||||||
{
|
{
|
||||||
if (depot == null) return;
|
if (depot == null) return;
|
||||||
var path = transformer.GetDepotPath(rpId, depot.DepotId);
|
var path = transformer.GetDepotPath(rpId, depot.DepotId);
|
||||||
|
|
||||||
// require do not extend lifetime scope.
|
// require do not extend lifetime scope.
|
||||||
await using (var fs = new BufferedStream(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)))
|
await using (var fs = new BufferedStream(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)))
|
||||||
|
{
|
||||||
|
var before = unresolved.Count;
|
||||||
await StencilWorkspaceSnapshotAsync(fs, unresolved, sizeMap);
|
await StencilWorkspaceSnapshotAsync(fs, unresolved, sizeMap);
|
||||||
|
if (before != unresolved.Count && directDependDepots != null) directDependDepots.Add(depot.DepotId);
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < depot.Dependencies.Count && unresolved.Count > 0; i++)
|
for (var i = 0; i < depot.Dependencies.Count && unresolved.Count > 0; i++)
|
||||||
await RecurringAsync(transformer, rpId, depot.Dependencies[i], unresolved, sizeMap);
|
await RecurringAsync(transformer, rpId, depot.Dependencies[i], unresolved, sizeMap, directDependDepots);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ public class RepositoryOutieController(AppDbContext dbContext, UserManager<AppUs
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("repo_create")]
|
[HttpPost("repo_create")]
|
||||||
public async Task<ActionResult<RepositoryInfoResponse>> CreateRepositoryAsync([FromQuery] string repositoryName, [FromQuery] string description)
|
public async Task<ActionResult<RepositoryInfoResponse>> CreateRepositoryAsync([FromQuery] string repositoryName, [FromQuery] string? description)
|
||||||
{
|
{
|
||||||
repositoryName = repositoryName.Trim().Replace(' ', '_');
|
repositoryName = repositoryName.Trim().Replace(' ', '_');
|
||||||
if (repositoryName.Length <= 3)
|
if (repositoryName.Length <= 3)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user