Skip to content

Commit

Permalink
Make dependencies tab configurable (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavolloffay authored and yurishkuro committed Nov 27, 2017
1 parent 27c3d58 commit 3522365
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/components/App/TopNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -56,18 +57,21 @@ function CustomNavDropdown({ label, items }: ConfigMenuGroup) {
}

const NAV_LINKS = [
{
key: 'dependencies',
to: prefixUrl('/dependencies'),
text: 'Dependencies',
},
{
key: 'search',
to: prefixUrl('/search'),
text: 'Search',
},
];

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 : [];
Expand All @@ -79,11 +83,11 @@ export default function TopNav(props: TopNavProps) {
<div className="ui input">
<TraceIDSearchInput />
</div>
{NAV_LINKS.map(({ key, to, text }) =>
{NAV_LINKS.map(({ key, to, text }) => (
<Link key={key} to={to} className="item">
{text}
</Link>
)}
))}
<div className="right menu">
{menuItems.map(item => {
if (item.items) {
Expand Down
1 change: 1 addition & 0 deletions src/constants/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ export default deepFreeze({
],
},
],
dependenciesMenuEnabled: true,
});

0 comments on commit 3522365

Please sign in to comment.