-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[InfraUI] Infrastructure navigation changes #32892
Merged
Kerry350
merged 16 commits into
elastic:master
from
Kerry350:27916-change-infra-navigation
Mar 18, 2019
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8f1544f
Reorganise primary and sub navigation of Infrastructure
Kerry350 9f27c82
Remove dead code
Kerry350 39b0077
Merge remote-tracking branch 'upstream/master' into 27916-change-infr…
Kerry350 037518f
Bump z-index on suggestions panel
Kerry350 3624017
Ensure documentTitle responds to updates
Kerry350 1f0078f
Use the same noop function and remove disabled option
Kerry350 cd5542d
Use buttonSize="m" and add "Hosts" translation back
Kerry350 7663a1f
Remove all "Home" wording
Kerry350 32d061c
Remove unused translations with script
Kerry350 c1d22e4
Merge remote-tracking branch 'upstream/master' into 27916-change-infr…
Kerry350 ea80a16
Merge remote-tracking branch 'upstream/master' into 27916-change-infr…
Kerry350 99ce1b4
Don't nest <Link /> within a tab
Kerry350 3999ab2
Comment out metrics-explorer tab until needed
Kerry350 b59424f
Merge remote-tracking branch 'upstream/master' into 27916-change-infr…
Kerry350 d4a0217
Merge remote-tracking branch 'upstream/master' into 27916-change-infr…
Kerry350 cd04728
Don't create duplicate History entries
Kerry350 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
x-pack/plugins/infra/public/components/navigation/routed_tabs.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { EuiTab, EuiTabs } from '@elastic/eui'; | ||
import React from 'react'; | ||
import { Route } from 'react-router-dom'; | ||
|
||
interface TabConfiguration { | ||
title: string; | ||
path: string; | ||
} | ||
|
||
interface RoutedTabsProps { | ||
tabs: TabConfiguration[]; | ||
} | ||
|
||
export class RoutedTabs extends React.Component<RoutedTabsProps> { | ||
public render() { | ||
return <EuiTabs>{this.renderTabs()}</EuiTabs>; | ||
} | ||
|
||
private renderTabs() { | ||
return this.props.tabs.map(tab => { | ||
return ( | ||
<Route | ||
key={`${tab.path}${tab.title}`} | ||
path={tab.path} | ||
children={({ match, history }) => ( | ||
<EuiTab | ||
onClick={() => (match ? undefined : history.push(tab.path))} | ||
isSelected={match !== null} | ||
> | ||
{tab.title} | ||
</EuiTab> | ||
)} | ||
/> | ||
); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
x-pack/plugins/infra/public/pages/infrastructure/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { InjectedIntl, injectI18n } from '@kbn/i18n/react'; | ||
import React from 'react'; | ||
import { Route, RouteComponentProps, Switch } from 'react-router-dom'; | ||
import { DocumentTitle } from '../../components/document_title'; | ||
import { HelpCenterContent } from '../../components/help_center_content'; | ||
import { RoutedTabs } from '../../components/navigation/routed_tabs'; | ||
import { ColumnarPage } from '../../components/page'; | ||
import { MetricsExplorerPage } from './metrics_explorer'; | ||
import { SnapshotPage } from './snapshot'; | ||
|
||
interface InfrastructurePageProps extends RouteComponentProps { | ||
intl: InjectedIntl; | ||
} | ||
|
||
export const InfrastructurePage = injectI18n(({ match, intl }: InfrastructurePageProps) => ( | ||
<ColumnarPage> | ||
<DocumentTitle | ||
title={intl.formatMessage({ | ||
id: 'xpack.infra.homePage.documentTitle', | ||
defaultMessage: 'Infrastructure', | ||
})} | ||
/> | ||
|
||
<HelpCenterContent | ||
feedbackLink="https://discuss.elastic.co/c/infrastructure" | ||
feedbackLinkText={intl.formatMessage({ | ||
id: 'xpack.infra.infrastructure.infrastructureHelpContent.feedbackLinkText', | ||
defaultMessage: 'Provide feedback for Infrastructure', | ||
})} | ||
/> | ||
|
||
<RoutedTabs | ||
tabs={[ | ||
{ | ||
title: 'Snapshot', | ||
path: `${match.path}/snapshot`, | ||
}, | ||
// { | ||
// title: 'Metrics explorer', | ||
// path: `${match.path}/metrics-explorer`, | ||
// }, | ||
]} | ||
/> | ||
|
||
<Switch> | ||
<Route path={`${match.path}/snapshot`} component={SnapshotPage} /> | ||
<Route path={`${match.path}/metrics-explorer`} component={MetricsExplorerPage} /> | ||
</Switch> | ||
</ColumnarPage> | ||
)); |
32 changes: 32 additions & 0 deletions
32
x-pack/plugins/infra/public/pages/infrastructure/metrics_explorer/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { InjectedIntl, injectI18n } from '@kbn/i18n/react'; | ||
import React from 'react'; | ||
import { DocumentTitle } from '../../../components/document_title'; | ||
|
||
interface MetricsExplorerPageProps { | ||
intl: InjectedIntl; | ||
} | ||
|
||
export const MetricsExplorerPage = injectI18n(({ intl }: MetricsExplorerPageProps) => ( | ||
<div> | ||
<DocumentTitle | ||
title={(previousTitle: string) => | ||
intl.formatMessage( | ||
{ | ||
id: 'xpack.infra.infrastructureMetricsExplorerPage.documentTitle', | ||
defaultMessage: '{previousTitle} | Metrics explorer', | ||
}, | ||
{ | ||
previousTitle, | ||
} | ||
) | ||
} | ||
/> | ||
Metrics Explorer | ||
</div> | ||
)); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the EUI docs recommend the small button size for groups, but how about setting
buttonSize="m"
on this one? To my eye the heights and spacing inlook a lot more harmonious than with the default size
s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I agree. I have changed this, but there is a little bit of an issue with the EUI typings for this component.
The
<EuiButtonGroup />
component allows "m" forbuttonSize
. But, that component in it's tree renders a<EuiButton />
which only allows "s" and "l". There is a mismatch here; I can either leave the change in, we ignore the console warning for now, and I file a ticket against EUI. Or don't make the change so we don't have an error, file against EUI, change it once the EUI side is changed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I hadn't noticed that. I would say we should file an issue in EUI (or a PR, given the simplicity of the change) and leave it in for now.