2020-07-14 16:32:28 +02:00
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
|
|
* or more contributor license agreements. Licensed under the Elastic License;
|
|
|
|
* you may not use this file except in compliance with the Elastic License.
|
|
|
|
*/
|
|
|
|
|
2020-09-17 13:36:58 +02:00
|
|
|
import { Subject } from 'rxjs';
|
|
|
|
import { AppNavLinkStatus, AppUpdater, ApplicationStart } from '../../../../src/core/public';
|
2020-07-14 16:32:28 +02:00
|
|
|
|
2020-09-17 13:36:58 +02:00
|
|
|
export function toggleOverviewLinkInNav(
|
|
|
|
updater$: Subject<AppUpdater>,
|
|
|
|
{ capabilities }: ApplicationStart
|
|
|
|
) {
|
|
|
|
const { apm, logs, metrics, uptime } = capabilities.navLinks;
|
2020-07-14 16:32:28 +02:00
|
|
|
const someVisible = Object.values({ apm, logs, metrics, uptime }).some((visible) => visible);
|
|
|
|
if (!someVisible) {
|
2020-09-17 13:36:58 +02:00
|
|
|
updater$.next(() => ({
|
|
|
|
navLinkStatus: AppNavLinkStatus.hidden,
|
|
|
|
}));
|
2020-07-14 16:32:28 +02:00
|
|
|
}
|
|
|
|
}
|