From 62e834802dae0bd15504785503060d7875c7b4ad Mon Sep 17 00:00:00 2001
From: Herbert Eiselt <herbert.eiselt@highstreet-technologies.com>
Date: Thu, 28 Mar 2019 19:00:35 +0100
Subject: Add SDN-R odlux performance

A UI displaying performance monitoring data

Change-Id: I2a9c28549aee1bcac366354c343a63f884bf09e0
Issue-ID: SDNC-585
Signed-off-by: Herbert Eiselt <herbert.eiselt@highstreet-technologies.com>
---
 sdnr/wt/odlux/apps/inventoryApp/src/views/dashboard.tsx | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

(limited to 'sdnr/wt/odlux/apps/inventoryApp/src/views/dashboard.tsx')

diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/views/dashboard.tsx b/sdnr/wt/odlux/apps/inventoryApp/src/views/dashboard.tsx
index 8d07fa88c..b2361af7f 100644
--- a/sdnr/wt/odlux/apps/inventoryApp/src/views/dashboard.tsx
+++ b/sdnr/wt/odlux/apps/inventoryApp/src/views/dashboard.tsx
@@ -6,13 +6,13 @@ import { Result, InventoryType } from '../models/inventory';
 
 const url = `${ window.location.origin}/database/sdnevents/inventoryequipment/_search`;
 
-const fetchData: DataCallback = async (page, rowsPerPage, orderBy, order, filter) => { 
+const fetchData: DataCallback = async (page, rowsPerPage, orderBy, order, filter) => {
   const from = rowsPerPage && page != null && !isNaN(+page)
     ? (+page) * rowsPerPage
     : null;
 
   const filterKeys = filter && Object.keys(filter) || [];
-  
+
   const query = {
     ...filterKeys.length > 0 ? {
       query: {
@@ -30,7 +30,7 @@ const fetchData: DataCallback = async (page, rowsPerPage, orderBy, order, filter
     ...from ? { "from": from } : {},
     ...orderBy && order ? { "sort": [{ [orderBy]: order }] } : {},
   };
-  
+
   const result = await fetch(url, {
     method: "POST",       // *GET, POST, PUT, DELETE, etc.
     mode: "no-cors",      // no-cors, cors, *same-origin
@@ -45,8 +45,13 @@ const fetchData: DataCallback = async (page, rowsPerPage, orderBy, order, filter
   if (result.ok) {
     const queryResult: Result<InventoryType> = await result.json();
     const data = {
-      page: Math.min(page || 0, queryResult.hits.total || 0 / (rowsPerPage || 1)), rowCount: queryResult.hits.total, rows: queryResult && queryResult.hits && queryResult.hits.hits && queryResult.hits.hits.map(h => (
-      { ...h._source, _id: h._id }
+      page: Math.min(page || 0, queryResult.hits.total || 0 / (rowsPerPage || 1)),
+      rowCount: queryResult.hits.total,
+      rows: queryResult && queryResult.hits && queryResult.hits.hits && queryResult.hits.hits.map(h => (
+        {
+          ...h._source,
+          _id: h._id
+        }
       )) || []
     };
     return data;
-- 
cgit 1.2.3-korg

