From efbb58d01bedba2fb2231cc1aa1cf3d8fd093a36 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Thu, 7 Jun 2018 12:59:00 -0500 Subject: [PATCH] Revert "try adding rule count to tagline" This reverts commit 00d0d1526447b33058a90c624da093e4bc32ff13. --- .../V1/Controllers/RulesController.cs | 2 +- .../ClientApp/components/Home.tsx | 28 +++++-------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/FilterLists.Api/V1/Controllers/RulesController.cs b/src/FilterLists.Api/V1/Controllers/RulesController.cs index 2a1f9f8cc..2b2f0518e 100644 --- a/src/FilterLists.Api/V1/Controllers/RulesController.cs +++ b/src/FilterLists.Api/V1/Controllers/RulesController.cs @@ -14,6 +14,6 @@ public RulesController(RuleService ruleService) } [HttpGet] - public async Task Index() => Json(await _ruleService.GetCountAllActiveRules()); + public async Task Index() => Json(new {Count = await _ruleService.GetCountAllActiveRules()}); } } \ No newline at end of file diff --git a/src/FilterLists.Web/ClientApp/components/Home.tsx b/src/FilterLists.Web/ClientApp/components/Home.tsx index 6b2d4e037..d143eb65d 100644 --- a/src/FilterLists.Web/ClientApp/components/Home.tsx +++ b/src/FilterLists.Web/ClientApp/components/Home.tsx @@ -7,9 +7,7 @@ import ListDetails from "./ListDetails"; interface IFilterListsState { filterLists: IFilterListSummaryDto[]; - loadingLists: boolean; - ruleCount: number; - loadingRuleCount: boolean; + loading: boolean; } export class Home extends React.Component, IFilterListsState> { @@ -17,19 +15,17 @@ export class Home extends React.Component, IFilterListsS super(props); this.state = { filterLists: [], - loadingLists: true, - ruleCount: 0, - loadingRuleCount: true + loading: true }; } render() { - const contents = this.state.loadingLists || this.state.loadingRuleCount + const contents = this.state.loading ?

Loading...

:
- {Home.renderTagline(this.state.filterLists, this.state.ruleCount)} + {Home.renderTagline(this.state.filterLists)} {Home.renderFilterListsTable(this.state.filterLists)}
; return
@@ -43,24 +39,14 @@ export class Home extends React.Component, IFilterListsS .then(data => { this.setState({ filterLists: data, - loadingLists: false - }); - }); - fetch("https://filterlists.com/api/v1/rules") - .then(response => response.json() as Promise) - .then(data => { - this.setState({ - ruleCount: data, - loadingRuleCount: false + loading: false }); }); } - private static renderTagline(filterLists: IFilterListSummaryDto[], ruleCount: number) { + private static renderTagline(filterLists: IFilterListSummaryDto[]) { return

- The independent, comprehensive directory of {filterLists.length - } filter and host lists containing {ruleCount - } unique rules for advertisements, trackers, malware, and annoyances. + The independent, comprehensive directory of {filterLists.length} filter and host lists for advertisements, trackers, malware, and annoyances.

; }