Skip to content
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

[Integrations] Fix missing setting modal in integrations app #103317

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
</>
);
});