Skip to content

Commit

Permalink
Merge pull request #8 from jasonrhodes/Kerry350__client-and-server-np…
Browse files Browse the repository at this point in the history
…-dir-move

Updates app ids to solve routing problem when no base path is used
  • Loading branch information
Kerry350 authored Feb 4, 2020
2 parents b508b3b + e1f2eb8 commit f81207e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
4 changes: 2 additions & 2 deletions x-pack/plugins/infra/public/pages/infrastructure/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const InfrastructurePage = ({ match }: RouteComponentProps) => {
title: i18n.translate('xpack.infra.homePage.metricsExplorerTabTitle', {
defaultMessage: 'Metrics Explorer',
}),
path: `${match.path}/metrics-explorer`,
path: `${match.path}/explorer`,
},
{
title: i18n.translate('xpack.infra.homePage.settingsTabTitle', {
Expand All @@ -86,7 +86,7 @@ export const InfrastructurePage = ({ match }: RouteComponentProps) => {
<Switch>
<Route path={`${match.path}/inventory`} component={SnapshotPage} />
<Route
path={`${match.path}/metrics-explorer`}
path={`${match.path}/explorer`}
render={props => (
<WithSource>
{({ configuration, createDerivedIndexPattern }) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const RedirectToNodeDetail = ({
getToFromLocation(location)
)('');

return <Redirect to={`/infrastructure/metrics/${nodeType}/${nodeId}?${searchString}`} />;
return <Redirect to={`/metrics/detail/${nodeType}/${nodeId}?${searchString}`} />;
};

export const getNodeDetailUrl = ({
Expand Down
8 changes: 4 additions & 4 deletions x-pack/plugins/infra/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ export class Plugin
pluginsSetup.data.autocomplete.addQuerySuggestionProvider('kuery', kueryProvider);

core.application.register({
id: 'infra:logs',
id: 'logs',
title: i18n.translate('xpack.infra.logs.pluginTitle', {
defaultMessage: 'Logs',
}),
euiIconType: 'logsApp',
order: 8001,
appRoute: '/app/infra/logs',
appRoute: '/app/logs',
category: DEFAULT_APP_CATEGORIES.observability,
mount: async (params: AppMountParameters) => {
const [coreStart, pluginsStart] = await core.getStartServices();
Expand All @@ -76,13 +76,13 @@ export class Plugin
});

core.application.register({
id: 'infra:home',
id: 'metrics',
title: i18n.translate('xpack.infra.metrics.pluginTitle', {
defaultMessage: 'Metrics',
}),
euiIconType: 'metricsApp',
order: 8000,
appRoute: '/app/infra/infrastructure',
appRoute: '/app/metrics',
category: DEFAULT_APP_CATEGORIES.observability,
mount: async (params: AppMountParameters) => {
const [coreStart, pluginsStart] = await core.getStartServices();
Expand Down
26 changes: 11 additions & 15 deletions x-pack/plugins/infra/public/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,33 @@ export const PageRouter: React.FC<RouterProps> = ({ history }) => {
<Router history={history}>
<Switch>
{uiCapabilities?.infrastructure?.show && (
<RedirectWithQueryParams from="/" exact={true} to="/infrastructure/inventory" />
<RedirectWithQueryParams from="/" exact={true} to="/metrics/inventory" />
)}
{uiCapabilities?.infrastructure?.show && (
<RedirectWithQueryParams
from="/infrastructure"
exact={true}
to="/infrastructure/inventory"
/>
<RedirectWithQueryParams from="/metrics" exact={true} to="/metrics/inventory" />
)}
{uiCapabilities?.infrastructure?.show && (
<RedirectWithQueryParams
from="/infrastructure/snapshot"
exact={true}
to="/infrastructure/inventory"
/>
<RedirectWithQueryParams from="/metrics/snapshot" exact={true} to="/metrics/inventory" />
)}
{uiCapabilities?.infrastructure?.show && (
<RedirectWithQueryParams from="/home" exact={true} to="/infrastructure/inventory" />
<RedirectWithQueryParams from="/home" exact={true} to="/metrics/inventory" />
)}
{uiCapabilities?.infrastructure?.show && (
<Route path="/infrastructure/metrics/:type/:node" component={MetricDetail} />
<RedirectWithQueryParams
from="/metrics/metrics-explorer"
exact={true}
to="/metrics/explorer"
/>
)}
{uiCapabilities?.infrastructure?.show && (
<RedirectWithQueryParams from="/metrics" to="/infrastructure/metrics" />
<Route path="/metrics/detail/:type/:node" component={MetricDetail} />
)}
{uiCapabilities?.logs?.show && (
<RedirectWithQueryParams from="/logs" exact={true} to="/logs/stream" />
)}
{uiCapabilities?.logs?.show && <Route path="/logs" component={LogsPage} />}
{uiCapabilities?.infrastructure?.show && (
<Route path="/infrastructure" component={InfrastructurePage} />
<Route path="/metrics" component={InfrastructurePage} />
)}
<Route path="/link-to" component={LinkToPage} />
<Route component={NotFoundPage} />
Expand Down

0 comments on commit f81207e

Please sign in to comment.