From c3f0f8368307653a867c7f149d8a0aa166f176f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20=C3=81ngel=20Gonz=C3=A1lez?= Date: Fri, 18 May 2018 16:04:23 +0200 Subject: [PATCH] Add specific filter for monitoring --- .../kibana-visualization.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/public/kibana-integrations/kibana-visualization.js b/public/kibana-integrations/kibana-visualization.js index 146c2c7a3..3d9874f8a 100644 --- a/public/kibana-integrations/kibana-visualization.js +++ b/public/kibana-integrations/kibana-visualization.js @@ -62,6 +62,15 @@ const app = modules.get('apps/webinar_app', []) visualization.searchSource .query({ language: 'lucene', query: implicitFilter }) .set('filter', discoverList.length > 1 ? discoverList[1] : {}); + } else { + + // Get filter for cluster/manager regardless environment + const monitoringFilter = discoverList[1].filter(item => item && item.meta && item.meta.key && ['cluster.name','manager.name'].includes(item.meta.key)); + + // Applying specific filter to Agents status + if(Array.isArray(monitoringFilter) && monitoringFilter.length) { + visualization.searchSource.filter(monitoringFilter[0]); + } } let params = {}; @@ -110,6 +119,15 @@ const app = modules.get('apps/webinar_app', []) visualization.searchSource .query({ language: 'lucene', query: implicitFilter }) .set('filter', discoverList.length > 1 ? discoverList[1] : {}); + } else { + + // Get filter for cluster/manager regardless environment + const monitoringFilter = discoverList[1].filter(item => item && item.meta && item.meta.key && ['cluster.name','manager.name'].includes(item.meta.key)); + + // Applying specific filter to Agents status + if(Array.isArray(monitoringFilter) && monitoringFilter.length) { + visualization.searchSource.filter(monitoringFilter[0]); + } } } }