From 765b0dbc588077651a06da792add02e095ff432f Mon Sep 17 00:00:00 2001 From: Collin Barrett Date: Fri, 21 Sep 2018 20:29:41 -0500 Subject: [PATCH] validate lists table data ref #505 --- .../Extensions/ConfigureServicesCollection.cs | 4 +- .../home/components/listsTable/ListsTable.tsx | 50 ++++++++++--------- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/FilterLists.Api/DependencyInjection/Extensions/ConfigureServicesCollection.cs b/src/FilterLists.Api/DependencyInjection/Extensions/ConfigureServicesCollection.cs index 40d351559..4ffde532b 100644 --- a/src/FilterLists.Api/DependencyInjection/Extensions/ConfigureServicesCollection.cs +++ b/src/FilterLists.Api/DependencyInjection/Extensions/ConfigureServicesCollection.cs @@ -37,8 +37,8 @@ private static void AddMvcCustom(this IServiceCollection services) => .SetCompatibilityVersion(CompatibilityVersion.Version_2_1) .AddJsonOptions(opts => { - //opts.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; - //opts.SerializerSettings.ContractResolver = new SkipEmptyContractResolver(); + opts.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; + opts.SerializerSettings.ContractResolver = new SkipEmptyContractResolver(); }); private static void AddRoutingCustom(this IServiceCollection services) => diff --git a/src/FilterLists.Web/ClientApp/modules/home/components/listsTable/ListsTable.tsx b/src/FilterLists.Web/ClientApp/modules/home/components/listsTable/ListsTable.tsx index ff245682d..c98f70d4a 100644 --- a/src/FilterLists.Web/ClientApp/modules/home/components/listsTable/ListsTable.tsx +++ b/src/FilterLists.Web/ClientApp/modules/home/components/listsTable/ListsTable.tsx @@ -53,7 +53,9 @@ export const ListsTable = (props: IProps) => { (s: ISoftwareDto, i: number) => )} , sortable: false, - Cell: (c: any) => c.value.map((s: number, i: number) => ), + Cell: (c: any) => c.value + ? c.value.map((s: number, i: number) => ) + : null, width: 155, headerClassName: "d-none d-md-block", className: "d-none d-md-block", @@ -67,19 +69,20 @@ export const ListsTable = (props: IProps) => { filterMethod: (f: any, r: any) => r[f.id].map((e: any) => e.name).join().toUpperCase().includes(f.value.toUpperCase()), sortable: false, - Cell: (c: any) => -
- {c.value.map((e: any, i: number) => - - {e.name} - )} -
, + Cell: (c: any) => c.value + ?
+ {c.value.map((e: any, i: number) => + + {e.name} + )} +
+ : null, width: 215, headerClassName: "d-none d-md-block", className: "d-none d-md-block", @@ -102,15 +105,16 @@ export const ListsTable = (props: IProps) => { )} , sortable: false, - Cell: (c: any) => -
- {c.value.map((e: ILanguageDto, i: number) => - - {e.iso6391} - )} -
, + Cell: (c: any) => c.value + ?
+ {c.value.map((e: ILanguageDto, i: number) => + + {e.iso6391} + )} +
+ : null, style: { whiteSpace: "inherit" }, width: 95, headerClassName: "d-none d-md-block",