Skip to content

Commit

Permalink
Fix missing setting modal in integrations app (#103317)
Browse files Browse the repository at this point in the history
  • Loading branch information
kpollich authored Jun 24, 2021
1 parent 23c8d18 commit fb7b596
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions x-pack/plugins/fleet/public/applications/integrations/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import React, { memo, useEffect, useState } from 'react';
import type { AppMountParameters } from 'kibana/public';
import { EuiCode, EuiEmptyPrompt, EuiErrorBoundary, EuiPanel } from '@elastic/eui';
import { EuiCode, EuiEmptyPrompt, EuiErrorBoundary, EuiPanel, EuiPortal } from '@elastic/eui';
import type { History } from 'history';
import { createHashHistory } from 'history';
import { Router, Redirect, Route, Switch } from 'react-router-dom';
Expand All @@ -29,10 +29,10 @@ import type { FleetConfigType, FleetStartServices } from '../../plugin';
import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public';
import { EuiThemeProvider } from '../../../../../../src/plugins/kibana_react/common';

import { AgentPolicyContextProvider } from './hooks';
import { AgentPolicyContextProvider, useUrlModal } from './hooks';
import { INTEGRATIONS_ROUTING_PATHS } from './constants';

import { Error, Loading } from './components';
import { Error, Loading, SettingFlyout } from './components';

import type { UIExtensionsStorage } from './types';

Expand Down Expand Up @@ -234,12 +234,24 @@ export const IntegrationsAppContext: React.FC<{
);

export const AppRoutes = memo(() => {
const { modal, setModal } = useUrlModal();
return (
<Switch>
<Route path={INTEGRATIONS_ROUTING_PATHS.integrations}>
<EPMApp />
</Route>
<Redirect to={INTEGRATIONS_ROUTING_PATHS.integrations_all} />
</Switch>
<>
{modal === 'settings' && (
<EuiPortal>
<SettingFlyout
onClose={() => {
setModal(null);
}}
/>
</EuiPortal>
)}
<Switch>
<Route path={INTEGRATIONS_ROUTING_PATHS.integrations}>
<EPMApp />
</Route>
<Redirect to={INTEGRATIONS_ROUTING_PATHS.integrations_all} />
</Switch>
</>
);
});

0 comments on commit fb7b596

Please sign in to comment.