Skip to content

Commit

Permalink
removed unused import
Browse files Browse the repository at this point in the history
  • Loading branch information
gmmorris committed May 11, 2020
1 parent 74f076f commit 67674f1
Showing 1 changed file with 7 additions and 28 deletions.
35 changes: 7 additions & 28 deletions x-pack/plugins/triggers_actions_ui/public/application/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React, { lazy, Suspense } from 'react';
import { Switch, Route, Redirect, HashRouter, RouteComponentProps } from 'react-router-dom';
import React, { lazy } from 'react';
import { Switch, Route, Redirect, HashRouter } from 'react-router-dom';
import {
ChromeStart,
DocLinksStart,
Expand All @@ -15,7 +15,6 @@ import {
ChromeBreadcrumb,
CoreStart,
} from 'kibana/public';
import { EuiLoadingSpinner, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { BASE_PATH, Section, routeToAlertDetails } from './constants';
import { AppContextProvider, useAppDependencies } from './app_context';
import { hasShowAlertsCapability } from './lib/capabilities';
Expand All @@ -31,11 +30,6 @@ const AlertDetailsRoute = lazy(() =>
import('./sections/alert_details/components/alert_details_route')
);

const TriggersActionsUIHome = lazy(async () => import('./home'));
const AlertDetailsRoute = lazy(() =>
import('./sections/alert_details/components/alert_details_route')
);

export interface AppDeps {
dataPlugin: DataPublicPluginStart;
charts: ChartsPluginStart;
Expand Down Expand Up @@ -74,30 +68,15 @@ export const AppWithoutRouter = ({ sectionsRegex }: { sectionsRegex: string }) =
<Switch>
<Route
path={`${BASE_PATH}/:section(${sectionsRegex})`}
component={suspendedRouteComponent(TriggersActionsUIHome)}
component={suspendedComponentWithProps(TriggersActionsUIHome, 'xl')}
/>
{canShowAlerts && (
<Route path={routeToAlertDetails} component={suspendedRouteComponent(AlertDetailsRoute)} />
<Route
path={routeToAlertDetails}
component={suspendedComponentWithProps(AlertDetailsRoute, 'xl')}
/>
)}
<Redirect from={`${BASE_PATH}`} to={`${BASE_PATH}/${DEFAULT_SECTION}`} />
</Switch>
);
};

function suspendedRouteComponent<T = unknown>(
RouteComponent: React.ComponentType<RouteComponentProps<T>>
) {
return (props: RouteComponentProps<T>) => (
<Suspense
fallback={
<EuiFlexGroup justifyContent="center">
<EuiFlexItem grow={false}>
<EuiLoadingSpinner size="xl" />
</EuiFlexItem>
</EuiFlexGroup>
}
>
<RouteComponent {...props} />
</Suspense>
);
}

0 comments on commit 67674f1

Please sign in to comment.