Skip to content

Commit b95a10a

Browse files
committed
[triggersActions] app. Hash Router -> Router
1 parent e570f0f commit b95a10a

File tree

16 files changed

+45
-32
lines changed

16 files changed

+45
-32
lines changed

x-pack/plugins/apm/public/components/app/ServiceDetails/AlertIntegrations/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export function AlertIntegrations(props: Props) {
8282
}
8383
),
8484
href: plugin.core.http.basePath.prepend(
85-
'/app/kibana#/management/insightsAndAlerting/triggersActions/alerts'
85+
'/app/management/insightsAndAlerting/triggersActions/alerts'
8686
),
8787
icon: 'tableOfContents'
8888
}

x-pack/plugins/infra/public/alerting/metric_threshold/components/alert_dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const MetricsAlertDropdown = () => {
3535
icon="tableOfContents"
3636
key="manageLink"
3737
href={kibana.services?.application?.getUrlForApp(
38-
'kibana#/management/insightsAndAlerting/triggersActions/alerts'
38+
'management/insightsAndAlerting/triggersActions/alerts'
3939
)}
4040
>
4141
<FormattedMessage id="xpack.infra.alerting.manageAlerts" defaultMessage="Manage alerts" />

x-pack/plugins/infra/public/components/alerting/inventory/alert_dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const InventoryAlertDropdown = () => {
3535
icon="tableOfContents"
3636
key="manageLink"
3737
href={kibana.services?.application?.getUrlForApp(
38-
'kibana#/management/insightsAndAlerting/triggersActions/alerts'
38+
'management/insightsAndAlerting/triggersActions/alerts'
3939
)}
4040
>
4141
<FormattedMessage id="xpack.infra.alerting.manageAlerts" defaultMessage="Manage alerts" />

x-pack/plugins/infra/public/components/alerting/logs/alert_dropdown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export const AlertDropdown = () => {
1515
const [flyoutVisible, setFlyoutVisible] = useState(false);
1616
const manageAlertsLinkProps = useLinkProps(
1717
{
18-
app: 'kibana',
19-
hash: 'management/insightsAndAlerting/triggersActions/alerts',
18+
app: 'management',
19+
pathname: '/insightsAndAlerting/triggersActions/alerts',
2020
},
2121
{
2222
hrefOnly: true,

x-pack/plugins/triggers_actions_ui/public/application/app.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66
import React, { lazy } from 'react';
7-
import { Switch, Route, Redirect, HashRouter } from 'react-router-dom';
7+
import { Switch, Route, Redirect, Router } from 'react-router-dom';
88
import {
99
ChromeStart,
1010
DocLinksStart,
@@ -14,8 +14,9 @@ import {
1414
ApplicationStart,
1515
ChromeBreadcrumb,
1616
CoreStart,
17+
ScopedHistory,
1718
} from 'kibana/public';
18-
import { BASE_PATH, Section, routeToAlertDetails } from './constants';
19+
import { Section, routeToAlertDetails } from './constants';
1920
import { AppContextProvider, useAppDependencies } from './app_context';
2021
import { hasShowAlertsCapability } from './lib/capabilities';
2122
import { ActionTypeModel, AlertTypeModel } from '../types';
@@ -44,6 +45,7 @@ export interface AppDeps {
4445
capabilities: ApplicationStart['capabilities'];
4546
actionTypeRegistry: TypeRegistry<ActionTypeModel>;
4647
alertTypeRegistry: TypeRegistry<AlertTypeModel>;
48+
history: ScopedHistory;
4749
}
4850

4951
export const App = (appDeps: AppDeps) => {
@@ -52,11 +54,11 @@ export const App = (appDeps: AppDeps) => {
5254
const sectionsRegex = sections.join('|');
5355

5456
return (
55-
<HashRouter>
57+
<Router history={appDeps.history}>
5658
<AppContextProvider appDeps={appDeps}>
5759
<AppWithoutRouter sectionsRegex={sectionsRegex} />
5860
</AppContextProvider>
59-
</HashRouter>
61+
</Router>
6062
);
6163
};
6264

@@ -67,7 +69,7 @@ export const AppWithoutRouter = ({ sectionsRegex }: { sectionsRegex: string }) =
6769
return (
6870
<Switch>
6971
<Route
70-
path={`${BASE_PATH}/:section(${sectionsRegex})`}
72+
path={`/:section(${sectionsRegex})`}
7173
component={suspendedComponentWithProps(TriggersActionsUIHome, 'xl')}
7274
/>
7375
{canShowAlerts && (
@@ -76,7 +78,7 @@ export const AppWithoutRouter = ({ sectionsRegex }: { sectionsRegex: string }) =
7678
component={suspendedComponentWithProps(AlertDetailsRoute, 'xl')}
7779
/>
7880
)}
79-
<Redirect from={`${BASE_PATH}`} to={`${BASE_PATH}/${DEFAULT_SECTION}`} />
81+
<Redirect from={'/'} to={`${DEFAULT_SECTION}`} />
8082
</Switch>
8183
);
8284
};

x-pack/plugins/triggers_actions_ui/public/application/constants/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77
export { BASE_ALERT_API_PATH } from '../../../../alerting/common';
88
export { BASE_ACTION_API_PATH } from '../../../../actions/common';
99

10-
export const BASE_PATH = '/management/insightsAndAlerting/triggersActions';
11-
1210
export type Section = 'connectors' | 'alerts';
1311

14-
export const routeToHome = `${BASE_PATH}`;
15-
export const routeToConnectors = `${BASE_PATH}/connectors`;
16-
export const routeToAlerts = `${BASE_PATH}/alerts`;
17-
export const routeToAlertDetails = `${BASE_PATH}/alert/:alertId`;
12+
export const routeToHome = `/`;
13+
export const routeToConnectors = `/connectors`;
14+
export const routeToAlerts = `/alerts`;
15+
export const routeToAlertDetails = `/alert/:alertId`;
1816

1917
export { TIME_UNITS } from './time_units';
2018
export enum SORT_ORDERS {

x-pack/plugins/triggers_actions_ui/public/application/home.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
} from '@elastic/eui';
2222

2323
import { i18n } from '@kbn/i18n';
24-
import { BASE_PATH, Section, routeToConnectors, routeToAlerts } from './constants';
24+
import { Section, routeToConnectors, routeToAlerts } from './constants';
2525
import { getCurrentBreadcrumb } from './lib/breadcrumb';
2626
import { getCurrentDocTitle } from './lib/doc_title';
2727
import { useAppDependencies } from './app_context';
@@ -76,7 +76,7 @@ export const TriggersActionsUIHome: React.FunctionComponent<RouteComponentProps<
7676
}
7777

7878
const onSectionChange = (newSection: Section) => {
79-
history.push(`${BASE_PATH}/${newSection}`);
79+
history.push(`/${newSection}`);
8080
};
8181

8282
// Set breadcrumb and page title

x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ describe('getCurrentBreadcrumb', () => {
1313
text: i18n.translate('xpack.triggersActionsUI.connectors.breadcrumbTitle', {
1414
defaultMessage: 'Connectors',
1515
}),
16-
href: `#${routeToConnectors}`,
16+
href: `${routeToConnectors}`,
1717
});
1818
expect(getCurrentBreadcrumb('alerts')).toMatchObject({
1919
text: i18n.translate('xpack.triggersActionsUI.alerts.breadcrumbTitle', {
2020
defaultMessage: 'Alerts',
2121
}),
22-
href: `#${routeToAlerts}`,
22+
href: `${routeToAlerts}`,
2323
});
2424
expect(getCurrentBreadcrumb('home')).toMatchObject({
2525
text: i18n.translate('xpack.triggersActionsUI.home.breadcrumbTitle', {
2626
defaultMessage: 'Alerts and Actions',
2727
}),
28-
href: `#${routeToHome}`,
28+
href: `${routeToHome}`,
2929
});
3030
});
3131
});

x-pack/plugins/triggers_actions_ui/public/application/lib/breadcrumb.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ export const getCurrentBreadcrumb = (type: string): { text: string; href: string
1515
text: i18n.translate('xpack.triggersActionsUI.connectors.breadcrumbTitle', {
1616
defaultMessage: 'Connectors',
1717
}),
18-
href: `#${routeToConnectors}`,
18+
href: `${routeToConnectors}`,
1919
};
2020
case 'alerts':
2121
return {
2222
text: i18n.translate('xpack.triggersActionsUI.alerts.breadcrumbTitle', {
2323
defaultMessage: 'Alerts',
2424
}),
25-
href: `#${routeToAlerts}`,
25+
href: `${routeToAlerts}`,
2626
};
2727
default:
2828
return {
2929
text: i18n.translate('xpack.triggersActionsUI.home.breadcrumbTitle', {
3030
defaultMessage: 'Alerts and Actions',
3131
}),
32-
href: `#${routeToHome}`,
32+
href: `${routeToHome}`,
3333
};
3434
}
3535
};

x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe('connector_add_flyout', () => {
127127
const manageLink = callout.find('EuiButton');
128128
expect(manageLink).toHaveLength(1);
129129
expect(manageLink.getElements()[0].props.href).toMatchInlineSnapshot(
130-
`"/app/kibana#/management/stack/license_management/"`
130+
`"/app//management/stack/license_management/"`
131131
);
132132

133133
const subscriptionLink = callout.find('EuiButtonEmpty');

0 commit comments

Comments
 (0)