mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Hide Enterprise search panel when no nodes are present (#127100)
This commit is contained in:
parent
962347fdf2
commit
fc3aedcf78
3 changed files with 28 additions and 23 deletions
|
@ -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 (
|
||||
<ClusterItemContainer
|
||||
|
@ -126,7 +132,7 @@ export function EnterpriseSearchPanel(props) {
|
|||
id="xpack.monitoring.cluster.overview.entSearchPanel.nodesTotalLinkLabel"
|
||||
defaultMessage="Nodes: {nodesTotal}"
|
||||
values={{
|
||||
nodesTotal: formatNumber(props.stats.totalInstances, 'int_commas'),
|
||||
nodesTotal: formatNumber(nodesCount, 'int_commas'),
|
||||
}}
|
||||
/>
|
||||
</h3>
|
||||
|
|
|
@ -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']);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue