-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Fleet] Support for showing an Integration Detail Custom (UI Extension) tab #83805
[Fleet] Support for showing an Integration Detail Custom (UI Extension) tab #83805
Conversation
return ( | ||
(CustomView && ( | ||
<ExtensionWrapper> | ||
<CustomView /> | ||
</ExtensionWrapper> | ||
)) || <Redirect to={getPath('integration_details', { pkgkey: pkgkey ?? '' })} /> | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind breaking this up multiple statements? It took me a bit to unpack this at first, and I still got it wrong :)
Also, at least by reading, "get url for integrations_details with key empty string" seems odd. e.g. /app/fleet#/integrations/detail/
. I think it works in the app, but let's explicitly send the user to named/working view like 'integrations_all`
Perhaps something like:
return ( | |
(CustomView && ( | |
<ExtensionWrapper> | |
<CustomView /> | |
</ExtensionWrapper> | |
)) || <Redirect to={getPath('integration_details', { pkgkey: pkgkey ?? '' })} /> | |
); | |
const redirectUrl = pkgkey | |
? getPath("integration_details", { pkgkey }) | |
: getPath("integration_all"); | |
return CustomView ? ( | |
<ExtensionWrapper> | |
<CustomView /> | |
</ExtensionWrapper> | |
) : ( | |
<Redirect to={redirectUrl} /> | |
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, Agreed. This is condition check because I'm trying to grab the value from the current URL. I'm actually going to change to build it manually based on Component's input props (we have what we need). I will also look to see if there is a utility function that does that from a centralized location (I seem remember such utility, but maybe it was server side).
<UIExtensionsContext.Provider value={extensions}> | ||
<FleetStatusProvider> | ||
<IntraAppStateProvider kibanaScopedHistory={history}> | ||
<PackageInstallProvider notifications={coreStart.notifications}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you note why PackageInstallProvider
was moved outside Router
? I realize this is still Draft and don't ask because I'm against it. Just add a note to highlight and explain the goal when it's ready for review.
I haven't thought about Router & Context recently enough to know what might be affected or potential consequences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually - now that I look at this again (the refactored version), I don't think it matters. In order to avoid any potential issues, I will move it back inside of <Router>
. Thanks @jfsiii
…integrations-policies-list
…integration-custom-tab # Conflicts: # x-pack/plugins/fleet/public/applications/fleet/sections/epm/screens/detail/index.tsx
…integration-custom-tab
…integration-custom-tab
import { AppMountParameters } from 'kibana/public'; | ||
import { EuiCode, EuiEmptyPrompt, EuiErrorBoundary, EuiPanel } from '@elastic/eui'; | ||
import { createHashHistory, History } from 'history'; | ||
import { Router, Redirect, Route, Switch } from 'react-router-dom'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the subtle change from using HashRouter
to using Router
along with History's createHashHistory
. This is so that it can support testing.
}), | ||
render: (ui, options) => { | ||
let renderResponse: RenderResult; | ||
act(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was having some errors on the test runs output about react state updates being done outside of act()
- I think they are coming from useRequest
, but even after I added this they did not go away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try to trigger the timers after the render I know jest offer a way to do that maybe it will fix the warnings?
} | ||
}); | ||
|
||
it('should not show a custom tab', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I plan to complete these, but might not be part of this PR. I would like to get this due to the major surgery done the Plugin refactoring due to continued master merge conflicts.
} | ||
|
||
// Don't show `custom` tab if a custom component is not registered | ||
if (panelId === 'custom' && !showCustomTab) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q. Should the custom tab be visible to packages that are not installed?
I think thats ok, since the custom tab is meant to show integration specific links/info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I don't think we should show the tab unless the integration is installed
Pinging @elastic/ingest-management (Team:Ingest Management) |
|
||
http.get.mockImplementation(async (path) => { | ||
if (typeof path === 'string') { | ||
if (path === '/api/fleet/epm/packages/nginx-0.3.7') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI - as I continue to work on this test file, I think I will eventually suggest that we break out these API request test "handlers" into another test utility so that they can be used with other tests.
💚 Build SucceededMetrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments nothing blocking, really cool to have a base for UI tests 🚀
@@ -265,7 +65,7 @@ export function renderApp( | |||
extensions: UIExtensionsStorage | |||
) { | |||
ReactDOM.render( | |||
<IngestManagerApp | |||
<FleetApp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 of renaming rest of IngestManager plugin
}), | ||
render: (ui, options) => { | ||
let renderResponse: RenderResult; | ||
act(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try to trigger the timers after the render I know jest offer a way to do that maybe it will fix the warnings?
case 'custom': | ||
return CustomView ? ( | ||
<ExtensionWrapper> | ||
<CustomView /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we pass some props to that custom view, like the name, version, ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good point @nchaulet . I can see that information being useful to Integrations (maybe even the lastestVersion
as well).
I will change the signature for the Component's props and add those in in a subsequent PR. Thanks for the feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM from a functionality standpoint
* master: (25 commits) [Alerting] fixes buggy default message behaviour (elastic#84202) [Graph] Use new ES client and change license API (elastic#84398) [DOCS] Adds redirect to known plugins page (elastic#84001) Update IndexPatternSelect to get fields from indexPatternService instead of savedObject attributes (elastic#84376) Adding timestamps to created events so the sorting is stable (elastic#84515) [DOCS] Redirects for drilldown links (elastic#83846) [Fleet] Support for showing an Integration Detail Custom (UI Extension) tab (elastic#83805) [Enterprise Search] Migrate shared Schema components (elastic#84381) [Discover] Unskip date_nanos and shard links functional tests (elastic#82878) [APM] ML anomaly detection integration: Displaying anomaly job results in the Transaction duration chart is not as intended (elastic#84415) Support for painless language autocomplete within monaco (elastic#80577) [Lens] Time scale ui (elastic#83904) removing beta callouts (elastic#84510) [Lens] (Accessibility) add aria-label to chart type icon (elastic#84493) Trusted Apps signer API. (elastic#83661) increase stdout max listeners for legacy logging (elastic#84497) [APM] Service overview: Add throughput chart (elastic#84439) [Discover] Unskip main functional tests (elastic#84300) Uptime overview overhaul (elastic#83406) [APM] Adjust time formats based on the difference between start and end (elastic#84470) ...
Summary
Checklist