From 63677f70bf0663ef3fae47b4fce64d9de7f428f4 Mon Sep 17 00:00:00 2001 From: Rory& Date: Tue, 9 Jul 2024 00:18:44 +0200 Subject: Older changes --- BugMine.DevTools.CLI/Worker.cs | 31 ++++- BugMine.Sdk/BugMineClient.cs | 1 + BugMine.Sdk/BugMineIssue.cs | 4 +- BugMine.Sdk/BugMineProject.cs | 6 +- BugMine.Sdk/Events/State/BugMineRoomMetadata.cs | 2 +- BugMine.Sdk/Events/State/ProjectInfo.cs | 2 +- BugMine.Sdk/Events/Timeline/BugMineIssueComment.cs | 4 +- BugMine.Sdk/Events/Timeline/BugMineIssueData.cs | 6 +- BugMine.Web/Components/ProjectContainer.razor | 152 -------------------- .../ScopedContainers/IssueContainer.razor | 101 ++++++++++++++ .../ScopedContainers/ProjectContainer.razor | 155 +++++++++++++++++++++ BugMine.Web/Pages/Projects/Boards/Index.razor | 19 +++ BugMine.Web/Pages/Projects/Issues/NewIssue.razor | 13 +- BugMine.Web/Pages/Projects/Issues/ViewIssue.razor | 24 ++++ BugMine.Web/Pages/Projects/NewProject.razor | 4 +- BugMine.Web/Pages/Projects/ViewProject.razor | 53 +++++-- BugMine.Web/Pages/Projects/ViewProject.razor.css | 8 ++ LibMatrix | 2 +- 18 files changed, 409 insertions(+), 178 deletions(-) delete mode 100644 BugMine.Web/Components/ProjectContainer.razor create mode 100644 BugMine.Web/Components/ScopedContainers/IssueContainer.razor create mode 100644 BugMine.Web/Components/ScopedContainers/ProjectContainer.razor create mode 100644 BugMine.Web/Pages/Projects/Boards/Index.razor create mode 100644 BugMine.Web/Pages/Projects/Issues/ViewIssue.razor create mode 100644 BugMine.Web/Pages/Projects/ViewProject.razor.css diff --git a/BugMine.DevTools.CLI/Worker.cs b/BugMine.DevTools.CLI/Worker.cs index 4b3d3f4..93e31c9 100644 --- a/BugMine.DevTools.CLI/Worker.cs +++ b/BugMine.DevTools.CLI/Worker.cs @@ -36,6 +36,7 @@ public class Worker(ILogger logger, HomeserverProviderService hsProvider 4) Get room count 5) Summarize all projects 6) Mass create regular rooms + 7) Create issues in project7 L) Logout Q) Quit @@ -88,6 +89,34 @@ public class Worker(ILogger logger, HomeserverProviderService hsProvider Console.WriteLine($"Created 1000 rooms in {sw.Elapsed}"); break; } + case ConsoleKey.D7: { + Console.Write("Slug: "); + var slug = Console.ReadLine(); + var project = await Client.GetProject(slug); + if (project == null) { + Console.WriteLine("Project not found."); + break; + } + Console.Write("Count: "); + if (!int.TryParse(Console.ReadLine(), out var count)) { + Console.WriteLine("Invalid count."); + break; + } + await Task.WhenAll(Enumerable.Range(0,count).Select(async _ => { + await project.CreateIssue(new() { + Name = Guid.NewGuid().ToString()[..8] + }); + })); + break; + } + case ConsoleKey.D8: { + await foreach (var board in Client.GetProjects(ignoreInvalidBoards: true).WithCancellation(stoppingToken)) { + await foreach (var issue in board.GetIssues().WithCancellation(stoppingToken)) { + Console.WriteLine(issue.Data.TypedContent); + } + } + break; + } case ConsoleKey.L: { File.Delete("auth.json"); await ExecuteAsync(stoppingToken); @@ -145,7 +174,7 @@ public class Worker(ILogger logger, HomeserverProviderService hsProvider private async Task SummarizeProject(BugMineProject project) { string result = $"Project: {project.Info.Name}, slug: {project.ProjectSlug}, metadata: {project.Metadata.ToJson(indent: false)}"; - await foreach (var issue in project.GetIssues()) { + await foreach (var issue in project.GetIssues(chunkLimit:50000)) { // Console.WriteLine($" - {issue.Data.RawContent.ToJson(indent: false)}"); result += $"\n - {issue.Data.RawContent.ToJson(indent: false)}"; } diff --git a/BugMine.Sdk/BugMineClient.cs b/BugMine.Sdk/BugMineClient.cs index d55ff4d..a012dde 100644 --- a/BugMine.Sdk/BugMineClient.cs +++ b/BugMine.Sdk/BugMineClient.cs @@ -1,6 +1,7 @@ using System.Text.Json.Serialization; using System.Text.RegularExpressions; using ArcaneLibs.Extensions; +using BugMine.Sdk.Events.State; using BugMine.Web.Classes.Exceptions; using LibMatrix; using LibMatrix.Homeservers; diff --git a/BugMine.Sdk/BugMineIssue.cs b/BugMine.Sdk/BugMineIssue.cs index 6cf3409..7b01b32 100644 --- a/BugMine.Sdk/BugMineIssue.cs +++ b/BugMine.Sdk/BugMineIssue.cs @@ -4,8 +4,8 @@ using LibMatrix.RoomTypes; namespace BugMine.Web.Classes; public class BugMineIssue(GenericRoom room, StateEventResponse data) { - public GenericRoom Room { get; } = room; - public StateEventResponse Data { get; } = data; + public GenericRoom Room => room ?? throw new ArgumentNullException(nameof(room)); + public StateEventResponse Data => data ?? throw new ArgumentNullException(nameof(data)); // public async IAsyncEnumerable GetRelatedEventsAsync() { // // } diff --git a/BugMine.Sdk/BugMineProject.cs b/BugMine.Sdk/BugMineProject.cs index 1f56659..453b597 100644 --- a/BugMine.Sdk/BugMineProject.cs +++ b/BugMine.Sdk/BugMineProject.cs @@ -1,4 +1,6 @@ using ArcaneLibs.Extensions; +using BugMine.Sdk.Events.State; +using BugMine.Sdk.Events.Timeline; using LibMatrix.RoomTypes; namespace BugMine.Web.Classes; @@ -37,8 +39,8 @@ public class BugMineProject(GenericRoom room) { return new BugMineIssue(Room, evt); } - public async IAsyncEnumerable GetIssues() { - await foreach (var evt in room.GetRelatedEventsAsync(Metadata.RoomCreationEventId, "gay.rory.bugmine.issue", BugMineIssueData.EventId)) { + public async IAsyncEnumerable GetIssues(int chunkLimit = 250) { + await foreach (var evt in room.GetRelatedEventsAsync(Metadata.RoomCreationEventId, "gay.rory.bugmine.issue", BugMineIssueData.EventId, chunkLimit: chunkLimit)) { yield return new BugMineIssue(Room, evt); } } diff --git a/BugMine.Sdk/Events/State/BugMineRoomMetadata.cs b/BugMine.Sdk/Events/State/BugMineRoomMetadata.cs index 734fd37..5fafa5a 100644 --- a/BugMine.Sdk/Events/State/BugMineRoomMetadata.cs +++ b/BugMine.Sdk/Events/State/BugMineRoomMetadata.cs @@ -1,6 +1,6 @@ using LibMatrix.EventTypes; -namespace BugMine.Web.Classes; +namespace BugMine.Sdk.Events.State; [MatrixEvent(EventName = EventId)] public class BugMineRoomMetadata : EventContent { diff --git a/BugMine.Sdk/Events/State/ProjectInfo.cs b/BugMine.Sdk/Events/State/ProjectInfo.cs index 2d15bff..b1ec2d9 100644 --- a/BugMine.Sdk/Events/State/ProjectInfo.cs +++ b/BugMine.Sdk/Events/State/ProjectInfo.cs @@ -1,6 +1,6 @@ using LibMatrix.EventTypes; -namespace BugMine.Web.Classes; +namespace BugMine.Sdk.Events.State; [MatrixEvent(EventName = EventId)] public class ProjectInfo : EventContent { diff --git a/BugMine.Sdk/Events/Timeline/BugMineIssueComment.cs b/BugMine.Sdk/Events/Timeline/BugMineIssueComment.cs index 50c73a1..782439a 100644 --- a/BugMine.Sdk/Events/Timeline/BugMineIssueComment.cs +++ b/BugMine.Sdk/Events/Timeline/BugMineIssueComment.cs @@ -1,10 +1,10 @@ using LibMatrix.EventTypes; -namespace BugMine.Web.Classes; +namespace BugMine.Sdk.Events.Timeline; [MatrixEvent(EventName = EventId)] public class BugMineIssueComment : TimelineEventContent { - public const string EventId = "gay.rory.bugmine.comment"; + public const string EventId = "gay.rory.bugmine.issue.comment"; public string Comment { get; set; } public string Author { get; set; } public DateTime Timestamp { get; set; } diff --git a/BugMine.Sdk/Events/Timeline/BugMineIssueData.cs b/BugMine.Sdk/Events/Timeline/BugMineIssueData.cs index 480102a..859add3 100644 --- a/BugMine.Sdk/Events/Timeline/BugMineIssueData.cs +++ b/BugMine.Sdk/Events/Timeline/BugMineIssueData.cs @@ -1,8 +1,10 @@ +using BugMine.Sdk.Events.State; +using BugMine.Web.Classes; using LibMatrix.EventTypes; -namespace BugMine.Web.Classes; +namespace BugMine.Sdk.Events.Timeline; -[MatrixEvent(EventName = ProjectInfo.EventId)] +[MatrixEvent(EventName = EventId)] public class BugMineIssueData : TimelineEventContent { public const string EventId = "gay.rory.bugmine.issue"; public string Name { get; set; } diff --git a/BugMine.Web/Components/ProjectContainer.razor b/BugMine.Web/Components/ProjectContainer.razor deleted file mode 100644 index f7621be..0000000 --- a/BugMine.Web/Components/ProjectContainer.razor +++ /dev/null @@ -1,152 +0,0 @@ -@using System.Text.Json.Serialization -@using ArcaneLibs.Extensions -@using BugMine.Web.Classes.Exceptions -@using LibMatrix -@inject ILogger Logger - -@if (Constants.Debug) { -

Debug, beware: here be dragons!

-

ProjectContainer debug info:

-
Slug: @ProjectSlug
-
Progress: @Progress.ToString()
- @if (ProjectContext is null) { -
ProjectContext is null!
- } - else { -
- Context json dump -
@ProjectContext.ToJson()
-
- @if (ProjectContext?.Project?.Room is not null) { - Dispose room - } - } - -
-} -@if (ProjectContext.Client is null) { -

Authenticating

-} -else if (ProjectContext?.Project is null) { - @if (Progress == Status.Loading) { -

Loading project

- } - else if (Progress == Status.NotInRoom) { -

You are not in the project room.

-

You must join before you can view or interact with this project.

- Attempt to join - } - else if (Progress == Status.RoomNotFound) { -

Project not found.

-

If you believe this is an error, please contact the project in order to obtain a new room.

- } -} -else { - @ChildContent -} - -@code { - private Status? _progress = Status.Loading; - - [Parameter] - public string ProjectSlug { get; set; } = null!; - - [Parameter] - public ProjectContainerContext? ProjectContext { get; set; } - - [Parameter] - public RenderFragment ChildContent { get; set; } - - [Parameter] - public Func? Loaded { get; set; } - - private Status? Progress { - get => _progress; - set { - _progress = value; - StateHasChanged(); - } - } - - protected override async Task OnInitializedAsync() { - if (ProjectContext is null) { - Logger.LogError("ProjectContext is null"); - ProjectContext = new(); - } - - if (ProjectContext.Project != null) { - Logger.LogWarning("ProjectContext.Project is not null"); - } - - ProjectContext.Client ??= await BugMineStorage.GetCurrentSessionOrNavigate(); - if (ProjectContext.Client == null) { - return; - } - - Progress = Status.Loading; - - try { - ProjectContext.Project = await ProjectContext.Client.GetProject(ProjectSlug); - } - catch (MatrixException e) { - if (e.ErrorCode == BugMineException.ErrorCodes.UserNotInRoom) { - Progress = Status.NotInRoom; - return; - } - else if (e.ErrorCode == BugMineException.ErrorCodes.ProjectNotFound) { - Progress = Status.RoomNotFound; - return; - } - - throw; - } - - Progress = Status.Done; - if (Loaded != null) { - await Loaded.Invoke(); - } - - - StateHasChanged(); - } - - private async Task TryJoin() { - var room = await ProjectContext.Client.ResolveProjectSlug(ProjectSlug); - bool success = false; - while (!success) { - try { - await room.JoinAsync(); - if (!string.IsNullOrWhiteSpace(room.RoomId)) { - success = true; - } - else { - await Task.Delay(1000); - } - } - catch (MatrixException e) { - // if (e.ErrorCode == MatrixException.ErrorCodes.) { - // await Task.Delay(1000); - // continue; - // } - - throw; - } - } - - await OnInitializedAsync(); - } - - public class ProjectContainerContext { - public BugMineClient? Client { get; set; } - - public BugMineProject? Project { get; set; } - } - - private enum Status { - Loading, - NotInRoom, - RoomNotFound, - Done - } - -} \ No newline at end of file diff --git a/BugMine.Web/Components/ScopedContainers/IssueContainer.razor b/BugMine.Web/Components/ScopedContainers/IssueContainer.razor new file mode 100644 index 0000000..dac3e97 --- /dev/null +++ b/BugMine.Web/Components/ScopedContainers/IssueContainer.razor @@ -0,0 +1,101 @@ +@using System.Text.Json.Serialization +@using ArcaneLibs.Extensions +@using BugMine.Web.Classes.Exceptions +@using LibMatrix +@inject ILogger Logger + +@if (Constants.Debug) { +
+ IssueContainer Debug info - Debug build, here be dragons! +

IssueContainer debug info:

+ @*
Slug: @ProjectSlug
*@ + @*
Progress: @Progress.ToString()
*@ + @* @if (ProjectContext is null) { *@ + @*
ProjectContext is null!
*@ + @* } *@ + @* else { *@ + @*
*@ + @* Context json dump *@ + @*
@ProjectContext.ToJson()
*@ + @*
*@ + @* @if (ProjectContext?.Project?.Room is not null) { *@ + @* Dispose room *@ + @* } *@ + @* } *@ +
+ +
+} +@if (ProjectContext?.Client is null) { +

Authenticating

+} +else { + + @ChildContent + +} + +@code { + private Status? _progress = Status.Loading; + + [Parameter] + public string IssueId { get; set; } = null!; + + [Parameter, CascadingParameter] + public ProjectContainer.ProjectContainerContext? ProjectContext { get; set; } + + [Parameter] + public IssueContainerContext? IssueContext { get; set; } + + [Parameter] + public RenderFragment ChildContent { get; set; } + + [Parameter] + public Func? Loaded { get; set; } + + private Status? Progress { + get => _progress; + set { + _progress = value; + StateHasChanged(); + } + } + + protected override async Task OnInitializedAsync() { + if (ProjectContext is null) { + Logger.LogError("ProjectContext is null"); + ProjectContext = new(); + } + + if (ProjectContext.Project != null) { + Logger.LogWarning("ProjectContext.Project is not null"); + } + + ProjectContext.Client ??= await BugMineStorage.GetCurrentSessionOrNavigate(); + if (ProjectContext.Client == null) { + return; + } + + Progress = Status.Loading; + + + Progress = Status.Done; + if (Loaded != null) { + await Loaded.Invoke(); + } + + StateHasChanged(); + } + + public class IssueContainerContext { + public ProjectContainer.ProjectContainerContext ProjectContext { get; set; } + } + + private enum Status { + Loading, + NotInRoom, + RoomNotFound, + Done + } + +} \ No newline at end of file diff --git a/BugMine.Web/Components/ScopedContainers/ProjectContainer.razor b/BugMine.Web/Components/ScopedContainers/ProjectContainer.razor new file mode 100644 index 0000000..44578a7 --- /dev/null +++ b/BugMine.Web/Components/ScopedContainers/ProjectContainer.razor @@ -0,0 +1,155 @@ +@using System.Text.Json.Serialization +@using ArcaneLibs.Extensions +@using BugMine.Web.Classes.Exceptions +@using LibMatrix +@inject ILogger Logger + +@if (Constants.Debug) { +
+ ProjectContainer Debug info - Debug build, here be dragons! +

ProjectContainer debug info:

+
Slug: @ProjectSlug
+
Progress: @Progress.ToString()
+ @if (ProjectContext is null) { +
ProjectContext is null!
+ } + else { +
+ Context json dump +
@ProjectContext.ToJson()
+
+ @if (ProjectContext?.Project?.Room is not null) { + Dispose room + } + } +
+ +
+} +@if (ProjectContext.Client is null) { +

Authenticating

+} +else if (ProjectContext?.Project is null) { + @if (Progress == Status.Loading) { +

Loading project

+ } + else if (Progress == Status.NotInRoom) { +

You are not in the project room.

+

You must join before you can view or interact with this project.

+ Attempt to join + } + else if (Progress == Status.RoomNotFound) { +

Project not found.

+

If you believe this is an error, please contact the project in order to obtain a new room.

+ } +} +else { + + @ChildContent + +} + +@code { + private Status? _progress = Status.Loading; + + [Parameter] + public string ProjectSlug { get; set; } = null!; + + [Parameter] + public ProjectContainerContext? ProjectContext { get; set; } + + [Parameter] + public RenderFragment ChildContent { get; set; } + + [Parameter] + public Func? Loaded { get; set; } + + private Status? Progress { + get => _progress; + set { + _progress = value; + StateHasChanged(); + } + } + + protected override async Task OnInitializedAsync() { + if (ProjectContext is null) { + Logger.LogError("ProjectContext is null"); + ProjectContext = new(); + } + + if (ProjectContext.Project != null) { + Logger.LogWarning("ProjectContext.Project is not null"); + } + + ProjectContext.Client ??= await BugMineStorage.GetCurrentSessionOrNavigate(); + if (ProjectContext.Client == null) { + return; + } + + Progress = Status.Loading; + + try { + ProjectContext.Project = await ProjectContext.Client.GetProject(ProjectSlug); + } + catch (MatrixException e) { + if (e.ErrorCode == BugMineException.ErrorCodes.UserNotInRoom) { + Progress = Status.NotInRoom; + return; + } + else if (e.ErrorCode == BugMineException.ErrorCodes.ProjectNotFound) { + Progress = Status.RoomNotFound; + return; + } + + throw; + } + + Progress = Status.Done; + if (Loaded != null) { + await Loaded.Invoke(); + } + + StateHasChanged(); + } + + private async Task TryJoin() { + var room = await ProjectContext.Client.ResolveProjectSlug(ProjectSlug); + bool success = false; + while (!success) { + try { + await room.JoinAsync(); + if (!string.IsNullOrWhiteSpace(room.RoomId)) { + success = true; + } + else { + await Task.Delay(1000); + } + } + catch (MatrixException e) { + // if (e.ErrorCode == MatrixException.ErrorCodes.) { + // await Task.Delay(1000); + // continue; + // } + + throw; + } + } + + await OnInitializedAsync(); + } + + public class ProjectContainerContext { + public BugMineClient? Client { get; set; } + + public BugMineProject? Project { get; set; } + } + + private enum Status { + Loading, + NotInRoom, + RoomNotFound, + Done + } + +} \ No newline at end of file diff --git a/BugMine.Web/Pages/Projects/Boards/Index.razor b/BugMine.Web/Pages/Projects/Boards/Index.razor new file mode 100644 index 0000000..c1953c8 --- /dev/null +++ b/BugMine.Web/Pages/Projects/Boards/Index.razor @@ -0,0 +1,19 @@ +@page "/Projects/{ProjectSlug}/Boards" +@using BugMine.Web.Components.ScopedContainers +

Boards

+ +

@ProjectContext.Project.Info.Name

+
+ +@code { + + [Parameter] + public string ProjectSlug { get; set; } + + public ProjectContainer.ProjectContainerContext ProjectContext { get; set; } = new(); + + private async Task OnProjectLoaded() { + + } + +} \ No newline at end of file diff --git a/BugMine.Web/Pages/Projects/Issues/NewIssue.razor b/BugMine.Web/Pages/Projects/Issues/NewIssue.razor index 159e20d..118a00c 100644 --- a/BugMine.Web/Pages/Projects/Issues/NewIssue.razor +++ b/BugMine.Web/Pages/Projects/Issues/NewIssue.razor @@ -1,8 +1,17 @@ @page "/Projects/{ProjectSlug}/Issues/New" +@using ArcaneLibs.Extensions +@using BugMine.Sdk.Events.Timeline +@using BugMine.Web.Components.ScopedContainers

New issue

-

Hi from NewIssue!

+

Title:

+ + @if (Constants.Debug) { +

Debug info:

+

Issue data:

+
@IssueData.ToJson()
+ }
@code { @@ -11,5 +20,7 @@ public string ProjectSlug { get; set; } = null!; public ProjectContainer.ProjectContainerContext? ProjectContext { get; set; } = new(); + + public BugMineIssueData IssueData { get; set; } = new(); } \ No newline at end of file diff --git a/BugMine.Web/Pages/Projects/Issues/ViewIssue.razor b/BugMine.Web/Pages/Projects/Issues/ViewIssue.razor new file mode 100644 index 0000000..e33f74d --- /dev/null +++ b/BugMine.Web/Pages/Projects/Issues/ViewIssue.razor @@ -0,0 +1,24 @@ +@page "/Projects/{ProjectSlug}/Issues/{IssueId}" +@using ArcaneLibs.Extensions +@using BugMine.Sdk.Events.Timeline +@using BugMine.Web.Components.ScopedContainers +

New issue

+ + + +

meow

+
+
+ +@code { + + [Parameter] + public string ProjectSlug { get; set; } = null!; + + [Parameter] + public string IssueId { get; set; } = null!; + + public ProjectContainer.ProjectContainerContext? ProjectContext { get; set; } = new(); + public IssueContainer.IssueContainerContext? IssueContext { get; set; } = new(); + +} \ No newline at end of file diff --git a/BugMine.Web/Pages/Projects/NewProject.razor b/BugMine.Web/Pages/Projects/NewProject.razor index f8c7dfd..2a7c7da 100644 --- a/BugMine.Web/Pages/Projects/NewProject.razor +++ b/BugMine.Web/Pages/Projects/NewProject.razor @@ -1,6 +1,8 @@ @page "/Projects/New" @using ArcaneLibs.Extensions +@using BugMine.Sdk.Events.State @using LibMatrix +@inject ILogger Logger

New project

Project name: @@ -62,7 +64,7 @@ else { } catch (MatrixException e) { - + Logger.LogError(e, "Failed to create project"); } } diff --git a/BugMine.Web/Pages/Projects/ViewProject.razor b/BugMine.Web/Pages/Projects/ViewProject.razor index 91cc4d0..c1a2aa1 100644 --- a/BugMine.Web/Pages/Projects/ViewProject.razor +++ b/BugMine.Web/Pages/Projects/ViewProject.razor @@ -1,28 +1,36 @@ @page "/Projects/{ProjectSlug}/" -@using LibMatrix -@using BugMine.Web.Classes.Exceptions +@using System.Collections.Frozen +@using System.Reflection @using ArcaneLibs.Extensions +@using BugMine.Sdk.Events.Timeline +@using BugMine.Web.Pages.Projects.Issues +@using BugMine.Web.Components.ScopedContainers +@using LibMatrix -

Hi from ViewProject!

-

@ProjectContext!.Project!.Info.Name

- - @if (Progress == "loading-issues") { +

@ProjectContext!.Project!.Info.Name

+

@Followers.Count followers - @Issues?.Count issues

+ New issue + @if (Progress == Status.Loading) {

Loading issues, got @(Issues?.Count ?? 0) so far...

} @*

@Project.Description

*@ @if (Issues != null) { @foreach (var issue in Issues) { -
@issue.Data.RawContent.ToJson()
+ var issueData = issue.Data.TypedContent as BugMineIssueData; +
+
@* Color based on tags... *@ +

@issueData.Name

+
} }
@code { - private string? _progress = "loading"; + private Status? _progress = Status.Loading; public ProjectContainer.ProjectContainerContext? ProjectContext { get; set; } = new(); @@ -30,8 +38,9 @@ public string ProjectSlug { get; set; } = null!; private List? Issues { get; set; } + private FrozenSet Followers { get; set; } = FrozenSet.Empty; - private string? Progress { + private Status? Progress { get => _progress; set { _progress = value; @@ -40,14 +49,34 @@ } protected async Task OnProjectLoaded() { - Progress = "loading-issues"; - await foreach (var issue in ProjectContext.Project.GetIssues()) { + Progress = Status.Loading; + ProjectContext!.Project!.Room.GetMembersListAsync().ContinueWith(x => { + Followers = x.Result; + StateHasChanged(); + }); + await foreach (var issue in ProjectContext.Project.GetIssues(chunkLimit: 1000)) { Issues ??= new List(); Issues.Add(issue); - StateHasChanged(); + // StateHasChanged(); + if (Issues.Count % 1000 == 0) { + StateHasChanged(); + Console.WriteLine($"Got issue {Issues.Count} {issue.Data.RawContent.ToJson()}"); + } } + Progress = Status.Done; + StateHasChanged(); } + private enum Status { + Loading, + Done + } + + private string GetIssueUrl(BugMineIssue issue) => + typeof(ViewIssue).GetCustomAttributes().First().Template + .Replace("{ProjectSlug}", ProjectSlug) + .Replace("{IssueId}", issue.Data.EventId); + } \ No newline at end of file diff --git a/BugMine.Web/Pages/Projects/ViewProject.razor.css b/BugMine.Web/Pages/Projects/ViewProject.razor.css new file mode 100644 index 0000000..6f67e52 --- /dev/null +++ b/BugMine.Web/Pages/Projects/ViewProject.razor.css @@ -0,0 +1,8 @@ +.issue-card { + display: flex; + padding: 1rem; + border-radius: 0.5rem; + background-color: var(--bs-dark); + box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5); + transition: background-color 1s, box-shadow 3s; +} \ No newline at end of file diff --git a/LibMatrix b/LibMatrix index e1f9907..6e1402b 160000 --- a/LibMatrix +++ b/LibMatrix @@ -1 +1 @@ -Subproject commit e1f99073f3d9788a4b48d2bb7091e3894dcefa1a +Subproject commit 6e1402baa6ad8517a8a8446832fed1d4b48cee51 -- cgit 1.5.1