From 3522365a970f78e47f73d91138b9361016df4317 Mon Sep 17 00:00:00 2001
From: Pavol Loffay
Date: Mon, 27 Nov 2017 16:02:13 +0100
Subject: [PATCH] Make dependencies tab configurable (#122)
---
src/components/App/TopNav.js | 18 +++++++++++-------
src/constants/default-config.js | 1 +
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/components/App/TopNav.js b/src/components/App/TopNav.js
index b943ab67ce..53fca971f5 100644
--- a/src/components/App/TopNav.js
+++ b/src/components/App/TopNav.js
@@ -20,6 +20,7 @@ import { Dropdown, Menu } from 'semantic-ui-react';
import TraceIDSearchInput from './TraceIDSearchInput';
import type { ConfigMenuItem, ConfigMenuGroup } from '../../types/config';
+import getConfig from '../../utils/config/get-config';
import prefixUrl from '../../utils/prefix-url';
import './TopNav.css';
@@ -56,11 +57,6 @@ function CustomNavDropdown({ label, items }: ConfigMenuGroup) {
}
const NAV_LINKS = [
- {
- key: 'dependencies',
- to: prefixUrl('/dependencies'),
- text: 'Dependencies',
- },
{
key: 'search',
to: prefixUrl('/search'),
@@ -68,6 +64,14 @@ const NAV_LINKS = [
},
];
+if (getConfig().dependenciesMenuEnabled) {
+ NAV_LINKS.push({
+ key: 'dependencies',
+ to: prefixUrl('/dependencies'),
+ text: 'Dependencies',
+ });
+}
+
export default function TopNav(props: TopNavProps) {
const { menuConfig } = props;
const menuItems = Array.isArray(menuConfig) ? menuConfig : [];
@@ -79,11 +83,11 @@ export default function TopNav(props: TopNavProps) {
- {NAV_LINKS.map(({ key, to, text }) =>
+ {NAV_LINKS.map(({ key, to, text }) => (
{text}
- )}
+ ))}
{menuItems.map(item => {
if (item.items) {
diff --git a/src/constants/default-config.js b/src/constants/default-config.js
index 4570544801..24d974fd09 100644
--- a/src/constants/default-config.js
+++ b/src/constants/default-config.js
@@ -46,4 +46,5 @@ export default deepFreeze({
],
},
],
+ dependenciesMenuEnabled: true,
});