mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
parent
a586405dbb
commit
dd37cc1335
3 changed files with 31 additions and 7 deletions
|
|
@ -26,10 +26,24 @@ public async Task<IEnumerable<ListSummaryDto>> GetAllSummariesAsync()
|
|||
|
||||
public async Task<ListDetailsDto> GetDetailsAsync(int id)
|
||||
{
|
||||
return await DbContext.FilterLists.AsNoTracking()
|
||||
.ProjectTo<ListDetailsDto>()
|
||||
.FirstAsync(x => x.Id == id)
|
||||
.FilterParentListFromMaintainerAdditionalLists();
|
||||
var details = await DbContext.FilterLists.AsNoTracking()
|
||||
.ProjectTo<ListDetailsDto>()
|
||||
.FirstAsync(x => x.Id == id)
|
||||
.FilterParentListFromMaintainerAdditionalLists();
|
||||
details.RuleCount = await GetActiveRuleCount(details);
|
||||
return details;
|
||||
}
|
||||
|
||||
private async Task<int> GetActiveRuleCount(ListDetailsDto details)
|
||||
{
|
||||
return await DbContext.Snapshots.Where(s => s.FilterListId == details.Id && s.IsCompleted)
|
||||
.Include(s => s.AddedSnapshotRules)
|
||||
.SelectMany(sr => sr.AddedSnapshotRules)
|
||||
.CountAsync() -
|
||||
await DbContext.Snapshots.Where(s => s.FilterListId == details.Id && s.IsCompleted)
|
||||
.Include(s => s.RemovedSnapshotRules)
|
||||
.SelectMany(sr => sr.RemovedSnapshotRules)
|
||||
.CountAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@ public class ListDetailsDto
|
|||
public string Name { get; set; }
|
||||
public string PolicyUrl { get; set; }
|
||||
public DateTime? PublishedDate { get; set; }
|
||||
public int RuleCount { get; set; }
|
||||
public string SubmissionUrl { get; set; }
|
||||
public ListSyntaxDto Syntax { get; set; }
|
||||
public string ViewUrl { get; set; }
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ function ListInfo(props: any) {
|
|||
<Description description={props.details.description} url={props.details.descriptionSourceUrl}/>
|
||||
<ul className="list-group list-group-flush">
|
||||
<Languages languages={props.details.languages}/>
|
||||
<RuleCount count={props.details.ruleCount}/>
|
||||
<PublishedDate date={props.details.publishedDate}/>
|
||||
<DiscontinuedDate date={props.details.discontinuedDate}/>
|
||||
<License license={props.details.license}/>
|
||||
|
|
@ -92,8 +93,7 @@ function Languages(props: any) {
|
|||
? <li className="list-group-item">
|
||||
<p className="m-0">Languages:</p>
|
||||
<ul>
|
||||
{props.languages.map(
|
||||
(language: any) => <li>{language}</li>)}
|
||||
{props.languages.map((language: any) => <li>{language}</li>)}
|
||||
</ul>
|
||||
</li>
|
||||
: <li className="list-group-item">
|
||||
|
|
@ -102,6 +102,14 @@ function Languages(props: any) {
|
|||
: null;
|
||||
}
|
||||
|
||||
function RuleCount(props: any) {
|
||||
return props.count
|
||||
? <li className="list-group-item">
|
||||
<p>Rule Count: {props.count.toLocaleString()}</p>
|
||||
</li>
|
||||
: null;
|
||||
}
|
||||
|
||||
function PublishedDate(props: any) {
|
||||
return props.date
|
||||
? <li className="list-group-item">
|
||||
|
|
@ -298,6 +306,7 @@ interface IFilterListDetailsDto {
|
|||
maintainers: IListMaintainerDto[];
|
||||
policyUrl: string;
|
||||
publishedDate: string;
|
||||
ruleCount: number;
|
||||
submissionUrl: string;
|
||||
syntax: IListSyntaxDto[];
|
||||
viewUrl: string;
|
||||
|
|
@ -331,4 +340,4 @@ interface IListSyntaxDto {
|
|||
interface ISyntaxSupportedSoftwareDto {
|
||||
homeUrl: string;
|
||||
name: string;
|
||||
}
|
||||
};
|
||||
Loading…
Reference in a new issue