diff --git a/x-pack/plugins/monitoring/public/components/cluster/overview/enterprise_search_panel.js b/x-pack/plugins/monitoring/public/components/cluster/overview/enterprise_search_panel.js index 1459ccb2ecac630..b8ff05213c1c032 100644 --- a/x-pack/plugins/monitoring/public/components/cluster/overview/enterprise_search_panel.js +++ b/x-pack/plugins/monitoring/public/components/cluster/overview/enterprise_search_panel.js @@ -31,6 +31,12 @@ import { getSafeForExternalLink } from '../../../lib/get_safe_for_external_link' export function EnterpriseSearchPanel(props) { const { setupMode } = props; const setupModeData = get(setupMode.data, 'enterprise_search'); + const nodesCount = props.stats.totalInstances || 0; + + // Do not show if we are not in setup mode + if (!nodesCount && !setupMode.enabled) { + return null; + } return ( diff --git a/x-pack/test/functional/apps/monitoring/cluster/overview.js b/x-pack/test/functional/apps/monitoring/cluster/overview.js index 25e52535a39b288..d4c646d48b92df8 100644 --- a/x-pack/test/functional/apps/monitoring/cluster/overview.js +++ b/x-pack/test/functional/apps/monitoring/cluster/overview.js @@ -112,13 +112,9 @@ export default function ({ getService, getPageObjects }) { expect(await overview.getKbnConnections()).to.be('174'); expect(await overview.getKbnMemoryUsage()).to.be('15.33%\n219.6 MB / 1.4 GB'); }); - - it('does not show logstash panel', async () => { - expect(await overview.doesLsPanelExist()).to.be(false); - }); }); - describe('for Yellow cluster with Basic license and no Kibana and Logstash', () => { + describe('for Yellow cluster with Basic license and no other stack components', () => { const { setup, tearDown } = getLifecycleMethods(getService, getPageObjects); before(async () => { @@ -156,12 +152,8 @@ export default function ({ getService, getPageObjects }) { expect(await overview.getEsReplicaShards()).to.be('0'); }); - it('shows kibana panel', async () => { - expect(await overview.doesKbnPanelExist()).to.be(false); - }); - - it('does not show logstash panel', async () => { - expect(await overview.doesLsPanelExist()).to.be(false); + it('shows only elasticsearch panel', async () => { + expect(await overview.getPresentPanels()).to.eql(['Elasticsearch']); }); }); diff --git a/x-pack/test/functional/services/monitoring/cluster_overview.js b/x-pack/test/functional/services/monitoring/cluster_overview.js index e6c58ba4eac0307..ff146c94de732f9 100644 --- a/x-pack/test/functional/services/monitoring/cluster_overview.js +++ b/x-pack/test/functional/services/monitoring/cluster_overview.js @@ -10,11 +10,14 @@ import expect from '@kbn/expect'; export function MonitoringClusterOverviewProvider({ getService }) { const testSubjects = getService('testSubjects'); const retry = getService('retry'); + const find = getService('find'); const SUBJ_CLUSTER_ALERTS = `clusterAlertsContainer`; const SUBJ_CLUSTER_NAME = `overviewTabsclusterName`; - const SUBJ_ES_PANEL = `clusterItemContainerElasticsearch`; + const SUBJ_CLUSTER_ITEM_CONTAINER_PREFIX = `clusterItemContainer`; + + const SUBJ_ES_PANEL = `${SUBJ_CLUSTER_ITEM_CONTAINER_PREFIX}Elasticsearch`; const SUBJ_ES_STATUS = `${SUBJ_ES_PANEL} > statusIcon`; const SUBJ_ES_VERSION = `${SUBJ_ES_PANEL} > esVersion`; const SUBJ_ES_UPTIME = `${SUBJ_ES_PANEL} > esUptime`; @@ -29,7 +32,7 @@ export function MonitoringClusterOverviewProvider({ getService }) { const SUBJ_ES_REPLICA_SHARDS = `${SUBJ_ES_PANEL} > esReplicaShards`; const SUBJ_ES_ML_JOBS = `${SUBJ_ES_PANEL} > esMlJobs`; - const SUBJ_KBN_PANEL = `clusterItemContainerKibana`; + const SUBJ_KBN_PANEL = `${SUBJ_CLUSTER_ITEM_CONTAINER_PREFIX}Kibana`; const SUBJ_KBN_STATUS = `${SUBJ_KBN_PANEL} > statusIcon`; const SUBJ_KBN_REQUESTS = `${SUBJ_KBN_PANEL} > kbnRequests`; const SUBJ_KBN_MAX_RESPONSE_TIME = `${SUBJ_KBN_PANEL} > kbnMaxResponseTime`; @@ -38,7 +41,7 @@ export function MonitoringClusterOverviewProvider({ getService }) { const SUBJ_KBN_OVERVIEW = `${SUBJ_KBN_PANEL} > kbnOverview`; const SUBJ_KBN_INSTANCES = `${SUBJ_KBN_PANEL} > kbnInstances`; - const SUBJ_LS_PANEL = `clusterItemContainerLogstash`; + const SUBJ_LS_PANEL = `${SUBJ_CLUSTER_ITEM_CONTAINER_PREFIX}Logstash`; const SUBJ_LS_EVENTS_RECEIVED = `${SUBJ_LS_PANEL} > lsEventsReceived`; const SUBJ_LS_EVENTS_EMITTED = `${SUBJ_LS_PANEL} > lsEventsEmitted`; const SUBJ_LS_NODES = `${SUBJ_LS_PANEL} > lsNodes`; @@ -47,14 +50,14 @@ export function MonitoringClusterOverviewProvider({ getService }) { const SUBJ_LS_PIPELINES = `${SUBJ_LS_PANEL} > lsPipelines`; const SUBJ_LS_OVERVIEW = `${SUBJ_LS_PANEL} > lsOverview`; - const SUBJ_BEATS_PANEL = `clusterItemContainerBeats`; + const SUBJ_BEATS_PANEL = `${SUBJ_CLUSTER_ITEM_CONTAINER_PREFIX}Beats`; const SUBJ_BEATS_OVERVIEW = `${SUBJ_BEATS_PANEL} > beatsOverview`; const SUBJ_BEATS_TOTAL_EVENTS = `${SUBJ_BEATS_PANEL} > beatsTotalEvents`; const SUBJ_BEATS_BYTES_SENT = `${SUBJ_BEATS_PANEL} > beatsBytesSent`; const SUBJ_BEATS_LISTING = `${SUBJ_BEATS_PANEL} > beatsListing`; const SUBJ_BEATS_TYPES_COUNTS = `${SUBJ_BEATS_PANEL} > beatTypeCount`; - const SUBJ_ENT_SEARCH_PANEL = `clusterItemContainerEnterprise Search`; + const SUBJ_ENT_SEARCH_PANEL = `${SUBJ_CLUSTER_ITEM_CONTAINER_PREFIX}Enterprise Search`; const SUBJ_ENT_SEARCH_TOTAL_NODES = `${SUBJ_ENT_SEARCH_PANEL} > entSearchTotalNodes`; const SUBJ_ENT_SEARCH_OVERVIEW = `${SUBJ_ENT_SEARCH_PANEL} > entSearchOverview`; const SUBJ_ENT_SEARCH_ENGINES = `${SUBJ_ENT_SEARCH_PANEL} > appSearchEngines`; @@ -89,6 +92,16 @@ export function MonitoringClusterOverviewProvider({ getService }) { return testSubjects.click('alerts-modal-button'); } + async getPresentPanels() { + const panelElements = await find.allByCssSelector( + `[data-test-subj^="${SUBJ_CLUSTER_ITEM_CONTAINER_PREFIX}"]` + ); + const panelTestSubjects = await Promise.all( + panelElements.map((e) => e.getAttribute('data-test-subj')) + ); + return panelTestSubjects.map((e) => e.replace(SUBJ_CLUSTER_ITEM_CONTAINER_PREFIX, '')); + } + getEsStatus() { return testSubjects.getVisibleText(SUBJ_ES_STATUS); } @@ -140,9 +153,6 @@ export function MonitoringClusterOverviewProvider({ getService }) { return testSubjects.getVisibleText(SUBJ_ES_ML_JOBS); } - doesKbnPanelExist() { - return testSubjects.exists(SUBJ_KBN_PANEL); - } getKbnStatus() { return testSubjects.getVisibleText(SUBJ_KBN_STATUS); } @@ -168,9 +178,6 @@ export function MonitoringClusterOverviewProvider({ getService }) { return testSubjects.click(SUBJ_KBN_INSTANCES); } - doesLsPanelExist() { - return testSubjects.exists(SUBJ_LS_PANEL); - } getLsEventsReceived() { return testSubjects.getVisibleText(SUBJ_LS_EVENTS_RECEIVED); }