summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/inventoryApp/src
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-03-31 12:40:19 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-31 12:40:19 +0000
commit6ec75490615fc3238926531b1fe555ee0adb9b27 (patch)
tree6c7ff74b6683e14b9f08e6d582c49388f7b0f0b0 /sdnr/wt/odlux/apps/inventoryApp/src
parentd693378eaecbe21675c89688ef89353949254350 (diff)
parent62e834802dae0bd15504785503060d7875c7b4ad (diff)
Merge "Add SDN-R odlux performance"
Diffstat (limited to 'sdnr/wt/odlux/apps/inventoryApp/src')
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/plugin.tsx4
-rw-r--r--sdnr/wt/odlux/apps/inventoryApp/src/views/dashboard.tsx15
2 files changed, 12 insertions, 7 deletions
diff --git a/sdnr/wt/odlux/apps/inventoryApp/src/plugin.tsx b/sdnr/wt/odlux/apps/inventoryApp/src/plugin.tsx
index 52e1d4802..6022d9569 100644
--- a/sdnr/wt/odlux/apps/inventoryApp/src/plugin.tsx
+++ b/sdnr/wt/odlux/apps/inventoryApp/src/plugin.tsx
@@ -9,9 +9,9 @@ import { Dashboard } from './views/dashboard';
export function register() {
applicationManager.registerApplication({
- name: "inventoryApp",
+ name: "inventory",
icon: faShoppingBag,
rootComponent: Dashboard,
- menuEntry: "Inventory App"
+ menuEntry: "Inventory"
});
}
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;