fix error in last, add commas to rule count

ref #272
This commit is contained in:
Collin M. Barrett 2018-06-07 13:55:54 -05:00
parent ea5ae4b37f
commit e79d26ddbc
2 changed files with 7 additions and 2 deletions

View file

@ -14,6 +14,6 @@ public RulesController(RuleService ruleService)
}
[HttpGet]
public async Task<IActionResult> Index() => Json(new {Count = await _ruleService.GetCountAll()});
public async Task<IActionResult> Index() => Json(await _ruleService.GetCountAll());
}
}

View file

@ -58,12 +58,17 @@ export class Home extends React.Component<RouteComponentProps<{}>, IHomeState> {
private static renderTagline(state: IHomeState) {
return <p className="ml-2 mr-2">
The independent, comprehensive directory of <strong>{state.ruleCount
The independent, comprehensive directory of <strong>{this.insertCommasInNumber(state.ruleCount)
}</strong> unique rules across <strong>{state.lists.length
}</strong> filter and host lists for advertisements, trackers, malware, and annoyances.
</p>;
}
//https://stackoverflow.com/a/2901298/2343739
private static insertCommasInNumber(num: number) {
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
private static renderFilterListsTable(filterLists: IListDto[]) {
return <ReactTable
data={filterLists}