Browse Source

feat(Search) Adding summaries to search

main
Jonathan McCaffrey 4 years ago committed by GitHub
parent
commit
a64d59bb46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. BIN
      IGP/Database.db
  2. 16
      IGP/Dialog/SearchDialogComponent.razor
  3. 2
      IGP/wwwroot/generated/AgileTaskModels.json
  4. 2
      IGP/wwwroot/generated/WebPageModels.json
  5. 2
      Model/Website/SearchPointModel.cs
  6. 25
      Services/Website/SearchService.cs

BIN
IGP/Database.db

Binary file not shown.

16
IGP/Dialog/SearchDialogComponent.razor

@ -33,11 +33,17 @@
<div class="searchContents"> <div class="searchContents">
@foreach (var searchPoint in searchPoints) @foreach (var searchPoint in searchPoints)
{ {
<button class="searchLink @searchPoint.PointType.ToLower()" <div>
label="@searchPoint.Title" <button class="searchLink @searchPoint.PointType.ToLower()"
@onclick="() => OnSearch(searchPoint)"> label="@searchPoint.Title"
@searchPoint.Title @onclick="() => OnSearch(searchPoint)">
</button> @searchPoint.Title
</button>
@if (!searchPoint.Summary.Trim().Equals(""))
{
<i> - @searchPoint.Summary</i>
}
</div>
} }
</div> </div>
</div> </div>

2
IGP/wwwroot/generated/AgileTaskModels.json

File diff suppressed because one or more lines are too long

2
IGP/wwwroot/generated/WebPageModels.json

@ -1 +1 @@
[{"Id":1,"WebSectionModelId":2,"Name":"Database","Description":"Database of game information","Href":"database","IsPrivate":"False"},{"Id":2,"WebSectionModelId":1,"Name":"Build Calculator","Description":"Build order calculator for determining army timings","Href":"build-calculator","IsPrivate":"False"},{"Id":3,"WebSectionModelId":1,"Name":"Harass Calculator","Description":"Alloy harassment calculator","Href":"harass-calculator","IsPrivate":"False"},{"Id":4,"WebSectionModelId":1,"Name":"Memory Tester","Description":"Testing memory","Href":"memory-tester","IsPrivate":"False"},{"Id":5,"WebSectionModelId":1,"Name":"Comparion Charts","Description":"Ecnomy charts to compare build orders","Href":"comparison-charts","IsPrivate":"True"},{"Id":6,"WebSectionModelId":2,"Name":"Notes","Description":"General player notes","Href":"notes","IsPrivate":"False"},{"Id":7,"WebSectionModelId":2,"Name":"Key Mapping","Description":"General key mapping info","Href":"keymapping","IsPrivate":"True"},{"Id":8,"WebSectionModelId":4,"Name":"Milestones","Description":" ","Href":"https://github.com/JonathanMcCaffrey/IGP-Fan-Reference/milestones","IsPrivate":"False"},{"Id":9,"WebSectionModelId":4,"Name":"Commits","Description":" ","Href":"https://github.com/JonathanMcCaffrey/IGP-Fan-Reference/commits/main","IsPrivate":"False"},{"Id":10,"WebSectionModelId":4,"Name":"Tasks","Description":" ","Href":"https://github.com/JonathanMcCaffrey/IGP-Fan-Reference/projects/3","IsPrivate":"False"},{"Id":11,"WebSectionModelId":4,"Name":"Code","Description":" ","Href":"https://github.com/JonathanMcCaffrey/IGP-Fan-Reference","IsPrivate":"False"},{"Id":12,"WebSectionModelId":2,"Name":"Documentation","Description":"Explaining how to use this website","Href":"documentation","IsPrivate":"True"},{"Id":13,"WebSectionModelId":3,"Name":"About","Description":"Answering general questions on the website","Href":"about","IsPrivate":"False"},{"Id":14,"WebSectionModelId":3,"Name":"Contact","Description":"My contact info","Href":"contact","IsPrivate":"False"},{"Id":15,"WebSectionModelId":3,"Name":"Streams","Description":"Stream info","Href":"streams","IsPrivate":"False"},{"Id":16,"WebSectionModelId":4,"Name":"Wiki","Description":" ","Href":"https://github.com/JonathanMcCaffrey/IGP-Fan-Reference/wiki","IsPrivate":"False"},{"Id":17,"WebSectionModelId":5,"Name":"Permissions","Description":"Permission Settings","Href":"permissions","IsPrivate":"False"},{"Id":18,"WebSectionModelId":5,"Name":"Data Collection","Description":"Data Collection Settings","Href":"data-collection","IsPrivate":"True"},{"Id":19,"WebSectionModelId":5,"Name":"Storage","Description":"Storage Settings","Href":"storage","IsPrivate":"False"},{"Id":20,"WebSectionModelId":1,"Name":"Economy Comparison","Description":"Compare economies","Href":"economy-comparison","IsPrivate":"False"}] [{"Id":1,"WebSectionModelId":2,"Name":"Database","Description":"Database of game information","Href":"database","IsPrivate":"False"},{"Id":2,"WebSectionModelId":1,"Name":"Build Calculator","Description":"Build order calculator for determining army timings","Href":"build-calculator","IsPrivate":"False"},{"Id":3,"WebSectionModelId":1,"Name":"Harass Calculator","Description":"Alloy harassment calculator","Href":"harass-calculator","IsPrivate":"False"},{"Id":4,"WebSectionModelId":1,"Name":"Memory Tester","Description":"Testing memory","Href":"memory-tester","IsPrivate":"False"},{"Id":5,"WebSectionModelId":1,"Name":"Comparion Charts","Description":"Ecnomy charts to compare build orders","Href":"comparison-charts","IsPrivate":"True"},{"Id":6,"WebSectionModelId":2,"Name":"Notes","Description":"General player notes","Href":"notes","IsPrivate":"False"},{"Id":7,"WebSectionModelId":2,"Name":"Key Mapping","Description":"General key mapping info","Href":"keymapping","IsPrivate":"True"},{"Id":8,"WebSectionModelId":4,"Name":"Milestones","Description":"Link to Milestones on GitHub","Href":"https://github.com/JonathanMcCaffrey/IGP-Fan-Reference/milestones","IsPrivate":"False"},{"Id":9,"WebSectionModelId":4,"Name":"Commits","Description":"Link to Commits on GitHub","Href":"https://github.com/JonathanMcCaffrey/IGP-Fan-Reference/commits/main","IsPrivate":"False"},{"Id":10,"WebSectionModelId":4,"Name":"Tasks","Description":"Link to Tasks on GitHub","Href":"https://github.com/JonathanMcCaffrey/IGP-Fan-Reference/projects/3","IsPrivate":"False"},{"Id":11,"WebSectionModelId":4,"Name":"Code","Description":"Link to Code on GitHub","Href":"https://github.com/JonathanMcCaffrey/IGP-Fan-Reference","IsPrivate":"False"},{"Id":12,"WebSectionModelId":2,"Name":"Documentation","Description":"Explaining how to use this website","Href":"documentation","IsPrivate":"True"},{"Id":13,"WebSectionModelId":3,"Name":"About","Description":"Answering general questions on the website","Href":"about","IsPrivate":"False"},{"Id":14,"WebSectionModelId":3,"Name":"Contact","Description":"My contact info","Href":"contact","IsPrivate":"False"},{"Id":15,"WebSectionModelId":3,"Name":"Streams","Description":"Stream info","Href":"streams","IsPrivate":"False"},{"Id":16,"WebSectionModelId":4,"Name":"Wiki","Description":"Link to Wiki on GitHub","Href":"https://github.com/JonathanMcCaffrey/IGP-Fan-Reference/wiki","IsPrivate":"False"},{"Id":17,"WebSectionModelId":5,"Name":"Permissions","Description":"Permission Settings","Href":"permissions","IsPrivate":"False"},{"Id":18,"WebSectionModelId":5,"Name":"Data Collection","Description":"Data Collection Settings","Href":"data-collection","IsPrivate":"True"},{"Id":19,"WebSectionModelId":5,"Name":"Storage","Description":"Storage Settings","Href":"storage","IsPrivate":"False"},{"Id":20,"WebSectionModelId":1,"Name":"Economy Comparison","Description":"Compare economies","Href":"economy-comparison","IsPrivate":"False"}]

2
Model/Website/SearchPointModel.cs

@ -3,6 +3,8 @@
public class SearchPointModel public class SearchPointModel
{ {
public string Title { get; set; } = ""; public string Title { get; set; } = "";
public string Summary { get; set; } = "";
public string Tags { get; set; } = ""; public string Tags { get; set; } = "";
public string PointType { get; set; } = ""; public string PointType { get; set; } = "";
public string Href { get; set; } = ""; public string Href { get; set; } = "";

25
Services/Website/SearchService.cs

@ -61,6 +61,7 @@ public class SearchService : ISearchService
{ {
Title = webPage.Name, Title = webPage.Name,
PointType = "WebPage", PointType = "WebPage",
Summary = $"{webPage.Description}",
Href = webPage.Href Href = webPage.Href
}); });
@ -72,7 +73,9 @@ public class SearchService : ISearchService
SearchPoints.Add(new SearchPointModel SearchPoints.Add(new SearchPointModel
{ {
Title = note.Name, Title = note.Name,
PointType = "Note", Href = note.GetNoteLink() PointType = "Note",
Href = note.GetNoteLink(),
Summary = note.Description
}); });
Searches["Notes"].Add(SearchPoints.Last()); Searches["Notes"].Add(SearchPoints.Last());
@ -81,29 +84,25 @@ public class SearchService : ISearchService
foreach (var entity in DATA.Get().Values) foreach (var entity in DATA.Get().Values)
{ {
var summary =
entity.Info().Description.Length > 35
? entity.Info().Description.Substring(0, 30).Trim() + "..."
: entity.Info().Description.Length > 0
? entity.Info().Description
: "";
SearchPoints.Add(new SearchPointModel SearchPoints.Add(new SearchPointModel
{ {
Title = entity.Info().Name, Title = entity.Info().Name,
Tags = $"{entity.EntityType},{entity.Descriptive}", Tags = $"{entity.EntityType},{entity.Descriptive}",
PointType = "Entity", PointType = "Entity",
Summary = $"{entity.EntityType}, {summary}",
Href = $"database/{entity.Info().Name.ToLower()}" Href = $"database/{entity.Info().Name.ToLower()}"
}); });
Searches["Entities"].Add(SearchPoints.Last()); Searches["Entities"].Add(SearchPoints.Last());
} }
foreach (var doc in documentationService.DocContentModels)
{
SearchPoints.Add(new SearchPointModel
{
Title = doc.Name,
PointType = "Document", Href = doc.GetDocLink()
});
Searches["Documents"].Add(SearchPoints.Last());
}
isLoaded = true; isLoaded = true;
NotifyDataChanged(); NotifyDataChanged();

Loading…
Cancel
Save