open source update. Fixed Database filters, added docs page

This commit is contained in:
2022-04-03 13:13:59 -04:00
parent 932b3b9e16
commit 73cc82709c
17 changed files with 273 additions and 37 deletions
+7 -5
View File
@@ -5,13 +5,17 @@ using Contexts;
using Microsoft.EntityFrameworkCore;
using Model.Work.Tasks;
namespace Services.Work;
namespace Services.Development;
public class AgileService : IAgileService {
private readonly HttpClient httpClient;
private bool isLoaded;
private event Action _onChange;
public AgileService(HttpClient httpClient) {
this.httpClient = httpClient;
}
@@ -46,8 +50,8 @@ public class AgileService : IAgileService {
return;
}
SprintModels = (await httpClient.GetFromJsonAsync<SprintModel[]>("generated/SprintModels.json")).ToList();
TaskModels =(await httpClient.GetFromJsonAsync<TaskModel[]>("generated/TaskModels.json")).ToList();
SprintModels = (await httpClient.GetFromJsonAsync<SprintModel[]>("generated/SprintModels.json")?? Array.Empty<SprintModel>() ).ToList();
TaskModels =(await httpClient.GetFromJsonAsync<TaskModel[]>("generated/TaskModels.json") ?? Array.Empty<TaskModel>()).ToList();
isLoaded = true;
@@ -76,8 +80,6 @@ public class AgileService : IAgileService {
NotifyDataChanged();
}
private event Action _onChange;
private void NotifyDataChanged() {
_onChange?.Invoke();
}
@@ -0,0 +1,71 @@
using System.Net.Http.Json;
using Model.Documentation;
#if NO_SQL
#else
using Contexts;
using Microsoft.EntityFrameworkCore;
#endif
namespace Services.Development;
public class DocumentationService : IDocumentationService
{
private readonly HttpClient httpClient;
private bool isLoaded;
private event Action _onChange;
public DocumentationService(HttpClient httpClient)
{
this.httpClient = httpClient;
}
public List<DocumentationModel> DocumentationModels { get; set; }
public void Subscribe(Action action)
{
_onChange += action;
}
public void Unsubscribe(Action action)
{
_onChange -= action;
}
public bool IsLoaded()
{
return isLoaded;
}
public async Task Load()
{
if (isLoaded) return;
DocumentationModels =
(await httpClient.GetFromJsonAsync<DocumentationModel[]>("generated/DocumentationModels.json") ?? Array.Empty<DocumentationModel>()).ToList();
isLoaded = true;
NotifyDataChanged();
}
public void Update()
{
NotifyDataChanged();
}
private void NotifyDataChanged()
{
_onChange?.Invoke();
}
}
+4 -6
View File
@@ -1,6 +1,4 @@
using System.Net.Http.Json;
using System.Net.Http.Json;
using Model.Work.Git;
#if NO_SQL
@@ -10,7 +8,7 @@ using Contexts;
using Microsoft.EntityFrameworkCore;
#endif
namespace Services.Work;
namespace Services.Development;
public class GitService : IGitService {
private readonly HttpClient httpClient;
@@ -53,8 +51,8 @@ public class GitService : IGitService {
return;
}
ChangeModels = (await httpClient.GetFromJsonAsync<ChangeModel[]>("generated/ChangeModels.json")).ToList();
PatchModels = (await httpClient.GetFromJsonAsync<PatchModel[]>("generated/PatchModels.json")).ToList();
ChangeModels = (await httpClient.GetFromJsonAsync<ChangeModel[]>("generated/ChangeModels.json") ?? Array.Empty<ChangeModel>()).ToList();
PatchModels = (await httpClient.GetFromJsonAsync<PatchModel[]>("generated/PatchModels.json") ?? Array.Empty<PatchModel>()).ToList();
isLoaded = true;
+3 -6
View File
@@ -1,8 +1,5 @@
using System.Net.Http.Json;
using System.Net.Http.Json;
using Model.Immortal.Notes;
using Model.Work.Git;
#if NO_SQL
@@ -11,7 +8,7 @@ using Contexts;
using Microsoft.EntityFrameworkCore;
#endif
namespace Services.Work;
namespace Services.Development;
public class NoteService : INoteService {
private readonly HttpClient httpClient;
@@ -52,7 +49,7 @@ public class NoteService : INoteService {
return;
}
NoteModels = (await httpClient.GetFromJsonAsync<NoteModel[]>("generated/NoteModels.json")).ToList();
NoteModels = (await httpClient.GetFromJsonAsync<NoteModel[]>("generated/NoteModels.json") ?? Array.Empty<NoteModel>()).ToList();
isLoaded = true;