Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rearrange nav controls #676

Merged
merged 2 commits into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/jaeger-ui/src/components/App/TopNav.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ describe('<TopNav>', () => {
});

describe('renders the default menu options', () => {
it('renders the "Jaeger UI" button', () => {
const items = wrapper.find(Link).findWhere(link => /Jaeger UI/.test(link.text()));
it('renders the "JAEGER UI" link', () => {
const items = wrapper.find(Link).findWhere(link => /JAEGER UI/.test(link.text()));
expect(items.length).toBe(1);
});

Expand Down
11 changes: 7 additions & 4 deletions packages/jaeger-ui/src/components/App/TopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,13 @@ export function TopNavImpl(props: Props) {
const { config, router } = props;
const { pathname } = router.location;
const menuItems = Array.isArray(config.menu) ? config.menu : [];

return (
<div>
<Menu theme="dark" mode="horizontal" selectable={false} className="ub-right" selectedKeys={[pathname]}>
<Menu.Item>
<TraceIDSearchInput />
</Menu.Item>
{menuItems.map(m => {
if (isItem(m)) {
return getItem(m);
Expand All @@ -117,10 +121,9 @@ export function TopNavImpl(props: Props) {
</Menu>
<Menu theme="dark" mode="horizontal" selectable={false} selectedKeys={[pathname]}>
<Menu.Item>
<Link to={prefixUrl('/')}>Jaeger UI</Link>
</Menu.Item>
<Menu.Item>
<TraceIDSearchInput />
<Link to={prefixUrl('/')} style={{ fontSize: '14px', fontWeight: 500 }}>
JAEGER UI
</Link>
</Menu.Item>
{NAV_LINKS.map(({ matches, to, text }) => {
const url = typeof to === 'string' ? to : to(props);
Expand Down
9 changes: 7 additions & 2 deletions packages/jaeger-ui/src/components/App/TraceIDSearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

import * as React from 'react';
import { Form, Input } from 'antd';
import { Form, Input, Icon } from 'antd';
import { RouteComponentProps, Router as RouterHistory, withRouter } from 'react-router-dom';

import { getUrl } from '../TracePage/url';
Expand All @@ -37,7 +37,12 @@ class TraceIDSearchInput extends React.PureComponent<Props> {
render() {
return (
<Form layout="horizontal" onSubmit={this.goToTrace} className="TraceIDSearchInput--form">
<Input autosize={null} name="idInput" placeholder="Lookup by Trace ID..." />
<Input
autosize={null}
name="idInput"
placeholder="Lookup by Trace ID..."
prefix={<Icon type="search" />}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice touch!

/>
</Form>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,26 @@ exports[`<TraceIDSearchInput /> renders as expected 1`] = `
className="ant-form ant-form-horizontal TraceIDSearchInput--form"
onSubmit={[Function]}
>
<input
autosize={null}
className="ant-input"
disabled={false}
name="idInput"
onKeyDown={[Function]}
placeholder="Lookup by Trace ID..."
type="text"
/>
<span
className="ant-input-affix-wrapper"
>
<span
className="ant-input-prefix"
>
<i
className="anticon anticon-search"
/>
</span>
<input
autosize={null}
className="ant-input"
disabled={false}
name="idInput"
onKeyDown={[Function]}
placeholder="Lookup by Trace ID..."
style={null}
type="text"
/>
</span>
</form>
`;