Browse Source

Removing all the meta agile and git stuff

main
Jonathan 6 months ago
parent
commit
c95ee06449
  1. 86
      IGP/Pages/Documentation/Parts/DocumentComponent.razor
  2. 28
      IGP/Program.cs
  3. 6
      IGP/_Imports.razor
  4. 33
      Model/Agile/AgileSprintModel.cs
  5. 26
      Model/Agile/AgileTaskModel.cs
  6. 10
      Model/Agile/Enums/PriorityType.cs
  7. 13
      Model/Agile/Enums/ProjectType.cs
  8. 8
      Model/Agile/Enums/SprintType.cs
  9. 11
      Model/Agile/Enums/StatusType.cs
  10. 8
      Model/Agile/Enums/TaskType.cs
  11. 10
      Model/Doc/DocConnectionModel.cs
  12. 40
      Model/Doc/DocContentModel.cs
  13. 12
      Model/Doc/DocFrontMatterModel.cs
  14. 15
      Model/Doc/DocSectionModel.cs
  15. 21
      Model/Git/CommitType.cs
  16. 11
      Model/Git/GitChangeModel.cs
  17. 13
      Model/Git/GitPatchModel.cs
  18. 117
      Services/Development/AgileService.cs
  19. 133
      Services/Development/DocumentationService.cs
  20. 100
      Services/Development/GitService.cs
  21. 56
      Services/IServices.cs
  22. 9
      Services/Website/SearchService.cs

86
IGP/Pages/Documentation/Parts/DocumentComponent.razor

@ -1,86 +0,0 @@
@inject HttpClient httpClient
@if (content == null)
{
<LoadingComponent/>
}
else
{
<div class="doc">
<div class="docHeader">
<div class="docTitle">@docFrontMatter.Title</div>
<div class="docDates">
<div class="docDateUpdated"><b>Updated</b>: @docFrontMatter.UpdatedDate.ToString("MM/dd/yyyy")</div>
<div class="docDateCreated"><b>Created</b>: @docFrontMatter.CreatedDate.ToString("MM/dd/yyyy")</div>
</div>
</div>
<div class="docContent">@((MarkupString)Markdown.ToHtml(content, Pipeline))</div>
<div class="docFooter">
<LinkButtonComponent Href="@GitUrl">
Edit on GitHub <i class="fa-brands fa-github" style="font-size: 24px; margin-left: 5px;"></i>
</LinkButtonComponent>
</div>
</div>
}
<style>
.docTitle {
font-weight: bold;
}
.docHeader {
display: flex;
justify-content: space-between;
}
.docDates {
display: flex;
flex-direction: column;
}
.docFooter {
display: flex;
justify-content: flex-end;
}
th {
padding: 8px;
border: 1px solid gray;
}
td {
padding: 8px;
border: 1px solid gray;
}
</style>
@code {
[Parameter] public DocContentModel DocContentModel { get; set; } = default!;
DocFrontMatterModel docFrontMatter = null!;
private string? content;
private string Filepath => $"content/docs/{DocContentModel.Content}.md";
private string GitUrl => $"{Project.GitResourcesUrl}/{Filepath}";
private MarkdownPipeline Pipeline => MarkdownFiles.Pipeline;
private async Task<DocFrontMatterModel> LoadContent()
{
content = await MarkdownFiles.LoadMarkdown(httpClient, Filepath);
return docFrontMatter =
await MarkdownFiles.LoadFrontMatter<DocFrontMatterModel>(httpClient, Filepath);
}
protected override async Task OnParametersSetAsync()
{
await LoadContent();
}
protected override async Task OnInitializedAsync()
{
await LoadContent();
}
}

28
IGP/Program.cs

@ -58,10 +58,7 @@ builder.Services.AddScoped<IEntityDisplayService, EntityDisplayService>();
builder.Services.AddScoped<IEntityDialogService, EntityDialogService>();
builder.Services.AddScoped<IToastService, ToastService>();
builder.Services.AddScoped<IWebsiteService, WebsiteService>();
builder.Services.AddScoped<IAgileService, AgileService>();
builder.Services.AddScoped<IGitService, GitService>();
builder.Services.AddScoped<INoteService, NoteService>();
builder.Services.AddScoped<IDocumentationService, DocumentationService>();
builder.Services.AddScoped<ISearchService, SearchService>();
builder.Services.AddScoped<IVariableService, VariableService>();
builder.Services.AddScoped<IStorageService, StorageService>();
@ -82,28 +79,3 @@ builder.Services.AddMudServices();
await builder.Build().RunAsync();
/**
Ef Commands
```code
# Create
dotnet ef migrations add InitialCreate
```
```code
# Update
dotnet ef database update
```
```code
# Migrate
dotnet ef migrations add AddBlogCreatedTimestamp
```
```code
# Update
dotnet ef database update
```
*/

6
IGP/_Imports.razor

@ -31,13 +31,11 @@
@using Microsoft.Extensions.Localization
@using Microsoft.JSInterop
@using Model.Chart
@using Model.Doc
@using Model.Economy
@using Model.Entity
@using Model.Entity.Data
@using Model.Entity.Parts
@using Model.Feedback
@using Model.Git
@using Model.Hotkeys
@using Model.MemoryTester
@using Model.Notes
@ -45,8 +43,6 @@
@using Model.RoadMap.Enums
@using Model.Types
@using Model.Website
@using Model.Work.Tasks
@using Model.Work.Tasks.Enums
@using Services
@using Services.Immortal
@using System.Globalization
@ -56,4 +52,4 @@
@using Blazor.Analytics.Components
@using Blazor.Analytics.Abstractions
@using MudBlazor
@using MudBlazor.Services
@using MudBlazor.Services

33
Model/Agile/AgileSprintModel.cs

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using Model.Work.Tasks.Enums;
namespace Model.Work.Tasks;
public class AgileSprintModel
{
public int Id { get; set; }
public string Name { get; set; } = "Add name...";
public string Description { get; set; } = "Add description...";
public DateTime? StartDate { get; set; } = null;
public DateTime? EndDate { get; set; } = null;
public string Notes { get; set; } = "Add notes...";
[NotMapped] public virtual ICollection<AgileTaskModel> AgileTaskModels { get; set; } = new List<AgileTaskModel>();
public string GetSprintType()
{
var now = DateTime.Now;
if (StartDate == null || EndDate == null) return SprintType.Planned;
if (DateTime.Compare(now, EndDate.GetValueOrDefault()) > 0) return SprintType.Completed;
if (DateTime.Compare(now, StartDate.GetValueOrDefault()) >= 0) return SprintType.Current;
return SprintType.Planned;
}
}

26
Model/Agile/AgileTaskModel.cs

@ -1,26 +0,0 @@
using System;
using Model.Work.Tasks.Enums;
namespace Model.Work.Tasks;
public class AgileTaskModel
{
public int Id { get; set; } = 1;
public int? AgileSprintModelId { get; set; } = null;
public string Name { get; set; } = "Add name...";
public string Description { get; set; } = "Add description...";
public string Notes { get; set; } = "Add notes...";
public string Status { get; set; } = StatusType.Fun_Idea;
public string Priority { get; set; } = PriorityType.Medium;
public string Task { get; set; } = TaskType.Feature;
public int OrderPriority => Status == StatusType.In_Progress ? 1
: Status == StatusType.Todo ? 2
: Status == StatusType.Done ? 3
: Status == StatusType.Canceled ? 4
: Status == StatusType.To_Test ? 2
: Status == StatusType.Fun_Idea ? 5 : 6;
public DateTime? Created { get; set; } = null;
public DateTime? Finished { get; set; } = null;
}

10
Model/Agile/Enums/PriorityType.cs

@ -1,10 +0,0 @@
namespace Model.Work.Tasks.Enums;
public class PriorityType
{
public const string Blocker = "Blocker";
public const string High = "High";
public const string Medium = "Medium";
public const string Low = "Low";
public const string None = "None";
}

13
Model/Agile/Enums/ProjectType.cs

@ -1,13 +0,0 @@
namespace Model.Work.Tasks.Enums;
public class ProjectType
{
public const string Management = "Management";
public const string Immortal = "Management";
public const string Food = "Management";
public const string Job = "Management";
public const string Time = "Management";
public const string Maintence = "Management";
public const string Website = "Management";
public const string Tasks = "Management";
}

8
Model/Agile/Enums/SprintType.cs

@ -1,8 +0,0 @@
namespace Model.Work.Tasks.Enums;
public class SprintType
{
public const string Current = "Current";
public const string Planned = "Planned";
public const string Completed = "Completed";
}

11
Model/Agile/Enums/StatusType.cs

@ -1,11 +0,0 @@
namespace Model.Work.Tasks.Enums;
public class StatusType
{
public const string In_Progress = "In_Progress";
public const string Todo = "Todo";
public const string To_Test = "To_Test";
public const string Done = "Done";
public const string Canceled = "Canceled";
public const string Fun_Idea = "Fun_Idea";
}

8
Model/Agile/Enums/TaskType.cs

@ -1,8 +0,0 @@
namespace Model.Work.Tasks.Enums;
public class TaskType
{
public const string Feature = "Feature";
public const string Bug = "Bug";
public const string Document = "Document";
}

10
Model/Doc/DocConnectionModel.cs

@ -1,10 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace Model.Doc;
public class DocConnectionModel
{
[Key] public int Id { get; set; } = 1;
public int ParentId { get; set; } = 1;
public int ChildId { get; set; } = 1;
}

40
Model/Doc/DocContentModel.cs

@ -1,40 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Model.Doc;
public class DocContentModel
{
[Key] public int Id { get; set; } = 1;
public int? ParentId { get; set; } = null;
public int? DocSectionModelId { get; set; } = null;
public string Href { get; set; }
[NotMapped]
public virtual ICollection<DocContentModel> DocumentationModels { get; set; } = new List<DocContentModel>();
[NotMapped] public virtual DocContentModel Parent { get; set; }
[NotMapped] public virtual int PageOrder { get; set; }
public DateTime CreatedDate { get; set; }
public DateTime UpdatedDate { get; set; }
public string Name { get; set; } = "";
public string Description { get; set; } = null;
public string Content { get; set; } = "";
private string GetLink()
{
var link = Href;
if (Parent != null) link = $"{Parent.GetLink()}/" + link;
return link;
}
public string GetDocLink()
{
return $"docs/{GetLink()}";
}
}

12
Model/Doc/DocFrontMatterModel.cs

@ -1,12 +0,0 @@
using System;
using YamlDotNet.Serialization;
namespace Model.Doc;
public class DocFrontMatterModel
{
[YamlMember(Alias = "title")] public string Title { get; set; }
[YamlMember(Alias = "summary")] public string Summary { get; set; }
[YamlMember(Alias = "created_date")] public DateTime CreatedDate { get; set; }
[YamlMember(Alias = "updated_date")] public DateTime UpdatedDate { get; set; }
}

15
Model/Doc/DocSectionModel.cs

@ -1,15 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Model.Doc;
public class DocSectionModel
{
[Key] public int Id { get; set; }
public string Name { get; set; }
[NotMapped]
public virtual ICollection<DocContentModel> DocumentationModels { get; set; } = new List<DocContentModel>();
}

21
Model/Git/CommitType.cs

@ -1,21 +0,0 @@
namespace Model.Git;
public class CommitType
{
public const string Feature = "Feature";
public const string Game_Patch = "Game Patch";
public const string Fix = "Fix";
public const string Documents = "Documents";
public const string Style = "Style";
public const string Refactor = "Refactor";
public const string Perf = "Perf";
public const string Test = "Test";
public const string Build = "Build";
public const string CI = "CI";
public const string Chore = "Chore";
public const string Typo = "Typo";
public const string Revert = "Revert";
public const string Planning = "Planning";
public const string PrivacyPolicy = "Privacy Policy";
public const string None = "None";
}

11
Model/Git/GitChangeModel.cs

@ -1,11 +0,0 @@
namespace Model.Git;
public class GitChangeModel
{
public int Id { get; set; } = 1;
public int GitPatchModelId { get; set; } = 1;
public string Name { get; set; } = "Add name...";
public string Description { get; set; } = "Add desciption...";
public string Commit { get; set; } = CommitType.Feature;
public string Important { get; set; } = "False";
}

13
Model/Git/GitPatchModel.cs

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
namespace Model.Git;
public class GitPatchModel
{
public int Id { get; set; } = 1;
public string Name { get; set; } = "Add name...";
public DateTime Date { get; set; } = DateTime.Now;
public ICollection<GitChangeModel> GitChangeModels { get; set; } = new List<GitChangeModel>();
public string Important { get; set; } = "False";
}

117
Services/Development/AgileService.cs

@ -1,117 +0,0 @@
using System.Net.Http.Json;
using Model.Work.Tasks;
namespace Services.Development;
public class AgileService : IAgileService
{
private readonly HttpClient httpClient;
private bool isLoaded;
private event Action OnChange = default!;
public AgileService(HttpClient httpClient)
{
this.httpClient = httpClient;
}
#if NO_SQL
public List<AgileSprintModel>? AgileSprintModels { get; set; }
public List<AgileTaskModel>? AgileTaskModels { get; set; }
#else
private DatabaseContext Database { get; set; }
public DbSet<SprintModel> SprintModels => Database.SprintModels;
public DbSet<TaskModel> TaskModels => Database.TaskModels;
#endif
public void Subscribe(Action? action)
{
OnChange += action;
}
public void Unsubscribe(Action? action)
{
OnChange -= action;
}
public bool IsLoaded()
{
return isLoaded;
}
#if NO_SQL
public async Task Load()
{
if (isLoaded) return;
AgileSprintModels =
(await httpClient.GetFromJsonAsync<AgileSprintModel[]>("generated/AgileSprintModels.json")
?? Array.Empty<AgileSprintModel>()).ToList();
AgileTaskModels =
(await httpClient.GetFromJsonAsync<AgileTaskModel[]>("generated/AgileTaskModels.json")
?? Array.Empty<AgileTaskModel>()).ToList();
SortSql();
isLoaded = true;
NotifyDataChanged();
}
private void SortSql()
{
foreach (var agileTask in AgileTaskModels!)
if (agileTask.AgileSprintModelId != null)
SprintById(agileTask.AgileSprintModelId.Value)?.AgileTaskModels.Add(agileTask);
}
private AgileSprintModel? SprintById(int id)
{
foreach (var data in AgileSprintModels!)
if (data.Id == id)
return data;
return null;
}
private AgileTaskModel? TaskById(int id)
{
foreach (var data in AgileTaskModels!)
if (data.Id == id)
return data;
return null;
}
#else
public async Task Load(DatabaseContext database) {
Database = database;
if (isLoaded) {
return;
}
Database.SprintModels.AddRange(await httpClient.GetFromJsonAsync<SprintModel[]>("generated/AgileSprintModels.json"));
Database.TaskModels.AddRange(await httpClient.GetFromJsonAsync<TaskModel[]>("generated/AgileTaskModels.json"));
Database.SaveChanges();
isLoaded = true;
NotifyDataChanged();
}
#endif
public void Update()
{
NotifyDataChanged();
}
private void NotifyDataChanged()
{
OnChange?.Invoke();
}
}

133
Services/Development/DocumentationService.cs

@ -1,133 +0,0 @@
using System.Net.Http.Json;
using Model.Doc;
namespace Services.Development;
public class DocumentationService : IDocumentationService
{
private readonly HttpClient httpClient;
private bool isLoaded;
public DocumentationService(HttpClient httpClient)
{
this.httpClient = httpClient;
}
public List<DocContentModel> DocContentModels { get; set; } = new();
public List<DocContentModel> DocContentModelsByPageOrder { get; set; } = new();
public List<DocSectionModel> DocSectionModels { get; set; } = new();
public List<DocConnectionModel> DocConnectionModels { get; set; } = new();
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;
DocContentModels =
(await httpClient.GetFromJsonAsync<DocContentModel[]>("generated/DocContentModels.json") ??
Array.Empty<DocContentModel>()).ToList();
DocConnectionModels =
(await httpClient.GetFromJsonAsync<DocConnectionModel[]>("generated/DocConnectionModels.json") ??
Array.Empty<DocConnectionModel>()).ToList();
DocSectionModels =
(await httpClient.GetFromJsonAsync<DocSectionModel[]>("generated/DocSectionModels.json") ??
Array.Empty<DocSectionModel>()).ToList();
SortSql();
isLoaded = true;
NotifyDataChanged();
}
public void Update()
{
NotifyDataChanged();
}
private event Action? OnChange;
private DocContentModel? ContentById(int id)
{
foreach (var doc in DocContentModels!)
if (doc.Id == id)
return doc;
return null;
}
private void SortSql()
{
foreach (var connection in DocConnectionModels)
{
ContentById(connection.ParentId)!.DocumentationModels.Add(ContentById(connection.ChildId));
ContentById(connection.ChildId)!.Parent = ContentById(connection.ParentId);
}
foreach (var content in DocContentModels)
if (content.DocSectionModelId != null)
foreach (var section in DocSectionModels)
if (section.Id == content.DocSectionModelId)
section.DocumentationModels.Add(content);
ByPageOrder();
}
private void ByPageOrder()
{
DocContentModelsByPageOrder = new List<DocContentModel>();
var order = 1;
foreach (var documentation in DocContentModels)
{
if (documentation.Parent != null) continue;
documentation.PageOrder = order++;
DocContentModelsByPageOrder.Add(documentation);
void GetAllChildren(DocContentModel docs)
{
foreach (var doc in docs.DocumentationModels)
{
doc.PageOrder = order++;
DocContentModelsByPageOrder.Add(doc);
if (doc.DocumentationModels.Count > 0) GetAllChildren(doc);
}
}
GetAllChildren(documentation);
}
DocContentModelsByPageOrder = DocContentModelsByPageOrder.OrderBy(docContent => docContent.PageOrder).ToList();
}
private void NotifyDataChanged()
{
OnChange?.Invoke();
}
}

100
Services/Development/GitService.cs

@ -1,100 +0,0 @@
using System.Net.Http.Json;
using Model.Git;
#if NO_SQL
#else
using Contexts;
using Microsoft.EntityFrameworkCore;
#endif
namespace Services.Development;
public class GitService : IGitService
{
private readonly HttpClient httpClient;
private bool isLoaded;
private event Action OnChange = default!;
public GitService(HttpClient httpClient)
{
this.httpClient = httpClient;
}
#if NO_SQL
public List<GitChangeModel> GitChangeModels { get; set; } = default!;
public List<GitPatchModel> GitPatchModels { get; set; } = default!;
#else
public DbSet<ChangeModel> ChangeModels => Database.ChangeModels;
public DbSet<PatchModel> PatchModels => Database.PatchModels;
public DatabaseContext Database { get; set; }
#endif
public void Subscribe(Action action)
{
OnChange += action;
}
public void Unsubscribe(Action action)
{
OnChange -= action;
}
public bool IsLoaded()
{
return isLoaded;
}
#if NO_SQL
public async Task Load()
{
if (isLoaded) return;
GitChangeModels = (await httpClient.GetFromJsonAsync<GitChangeModel[]>("generated/GitChangeModels.json") ??
Array.Empty<GitChangeModel>()).ToList();
GitPatchModels = (await httpClient.GetFromJsonAsync<GitPatchModel[]>("generated/GitPatchModels.json") ??
Array.Empty<GitPatchModel>()).ToList();
isLoaded = true;
NotifyDataChanged();
}
#else
public async Task Load(DatabaseContext database) {
Database = database;
if (isLoaded) {
return;
}
Database.ChangeModels.AddRange(await httpClient.GetFromJsonAsync<ChangeModel[]>("generated/GitChangeModels.json"));
Database.PatchModels.AddRange(await httpClient.GetFromJsonAsync<PatchModel[]>("generated/GitPatchModels.json"));
Database.SaveChanges();
isLoaded = true;
NotifyDataChanged();
}
#endif
public void Update()
{
NotifyDataChanged();
}
private void NotifyDataChanged()
{
OnChange?.Invoke();
}
}

56
Services/IServices.cs

@ -1,14 +1,11 @@
using Model.BuildOrders;
using Model.Doc;
using Model.Economy;
using Model.Entity;
using Model.Feedback;
using Model.Git;
using Model.MemoryTester;
using Model.Notes;
using Model.Website;
using Model.Website.Enums;
using Model.Work.Tasks;
using Services.Immortal;
using Services.Website;
@ -139,23 +136,6 @@ public interface IWebsiteService
public bool IsLoaded();
}
public interface IAgileService
{
#if NO_SQL
public List<AgileSprintModel>? AgileSprintModels { get; set; }
public List<AgileTaskModel>? AgileTaskModels { get; set; }
#else
public DbSet<SprintModel> SprintModels { get; }
public DbSet<TaskModel> TaskModels { get; }
#endif
public void Subscribe(Action? action);
public void Unsubscribe(Action? action);
public void Update();
public Task Load();
public bool IsLoaded();
}
public interface INoteService
{
@ -169,42 +149,6 @@ public interface INoteService
public bool IsLoaded();
}
public interface IDocumentationService
{
public List<DocContentModel> DocContentModels { get; set; }
public List<DocConnectionModel> DocConnectionModels { get; set; }
public List<DocContentModel> DocContentModelsByPageOrder { get; set; }
public List<DocSectionModel> DocSectionModels { get; set; }
public void Subscribe(Action? action);
public void Unsubscribe(Action? action);
public void Update();
public Task Load();
public bool IsLoaded();
}
public interface IGitService
{
#if NO_SQL
public List<GitChangeModel> GitChangeModels { get; set; }
public List<GitPatchModel> GitPatchModels { get; set; }
#else
public DbSet<ChangeModel> ChangeModels { get; }
public DbSet<PatchModel> PatchModels { get; }
#endif
public void Subscribe(Action action);
public void Unsubscribe(Action action);
public void Update();
#if NO_SQL
public Task Load();
#else
public Task Load(DatabaseContext database);
#endif
public bool IsLoaded();
}
public interface INavigationService
{
public void Subscribe(Action action);

9
Services/Website/SearchService.cs

@ -5,7 +5,6 @@ namespace Services.Website;
public class SearchService : ISearchService
{
private readonly IDocumentationService documentationService;
private readonly INoteService noteService;
@ -13,14 +12,10 @@ public class SearchService : ISearchService
private bool isLoaded;
public SearchService(IWebsiteService websiteService, INoteService noteService,
IDocumentationService documentationService)
public SearchService(IWebsiteService websiteService, INoteService noteService)
{
this.websiteService = websiteService;
this.noteService = noteService;
this.documentationService = documentationService;
// All Unit Data
}
public List<SearchPointModel> SearchPoints { get; set; } = new();
@ -47,12 +42,10 @@ public class SearchService : ISearchService
{
await websiteService.Load();
await noteService.Load();
await documentationService.Load();
Searches.Add("Pages", new List<SearchPointModel>());
Searches.Add("Notes", new List<SearchPointModel>());
Searches.Add("Documents", new List<SearchPointModel>());
Searches.Add("Entities", new List<SearchPointModel>());
foreach (var webPage in websiteService.WebPageModels)

Loading…
Cancel
Save