Skip to content

Commit

Permalink
Make dependencies tab configurable
Browse files Browse the repository at this point in the history
Signed-off-by: Pavol Loffay <ploffay@redhat.com>
  • Loading branch information
pavolloffay committed Nov 14, 2017
1 parent df12ead commit 62617dc
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().depsMenuEnabled === true) {
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({
],
},
],
depsMenuEnabled: true,
});

0 comments on commit 62617dc

Please sign in to comment.