[embeddable refactor] decouple MapEmbeddable from Security Solution plugin#182737
Conversation
|
/ci |
|
/ci |
| const content = !storageValue ? null : ( | ||
| <Embeddable> | ||
| <InPortal node={portalNode}> | ||
| <MapToolTip /> | ||
| </InPortal> | ||
|
|
||
| <EmbeddableMap maintainRatio={!isIndexError}> | ||
| {isIndexError ? ( | ||
| <IndexPatternsMissingPrompt data-test-subj="missing-prompt" /> | ||
| ) : ( | ||
| <services.maps.Map | ||
| // eslint-disable-next-line react/display-name | ||
| getTooltipRenderer={() => (tooltipProps: RenderTooltipContentParams) => | ||
| <OutPortal node={portalNode} {...tooltipProps} />} | ||
| mapCenter={{ lon: -1.05469, lat: 15.96133, zoom: 1 }} | ||
| layerList={layerList} | ||
| filters={appliedFilters} | ||
| query={query} | ||
| onApiAvailable={(api: MapApi) => { | ||
| // Wire up to app refresh action | ||
| setQuery({ | ||
| id: 'embeddedMap', // Scope to page type if using map elsewhere | ||
| inspect: null, | ||
| loading: false, | ||
| refetch: () => api.reload(), | ||
| }); | ||
| }} | ||
| /> | ||
| )} | ||
| </EmbeddableMap> | ||
| </Embeddable> | ||
| ); |
There was a problem hiding this comment.
Thanks for cleaning this up for Security Solution @nreese ,
I've tested locally and found there's some styling issue:
I have a suggested solution to fix this:
-
Please rename:
EmbeddableMap toEmbeddableMapRatioHolder -
Please add:
const EmbeddableMapWrapper = styled.div`
position: relative;
`;
const EmbeddableMap = styled.div`
height: 100%;
width: 100%;
position: absolute;
top: 0;
`;
- Please update the content:
| const content = !storageValue ? null : ( | |
| <Embeddable> | |
| <InPortal node={portalNode}> | |
| <MapToolTip /> | |
| </InPortal> | |
| <EmbeddableMap maintainRatio={!isIndexError}> | |
| {isIndexError ? ( | |
| <IndexPatternsMissingPrompt data-test-subj="missing-prompt" /> | |
| ) : ( | |
| <services.maps.Map | |
| // eslint-disable-next-line react/display-name | |
| getTooltipRenderer={() => (tooltipProps: RenderTooltipContentParams) => | |
| <OutPortal node={portalNode} {...tooltipProps} />} | |
| mapCenter={{ lon: -1.05469, lat: 15.96133, zoom: 1 }} | |
| layerList={layerList} | |
| filters={appliedFilters} | |
| query={query} | |
| onApiAvailable={(api: MapApi) => { | |
| // Wire up to app refresh action | |
| setQuery({ | |
| id: 'embeddedMap', // Scope to page type if using map elsewhere | |
| inspect: null, | |
| loading: false, | |
| refetch: () => api.reload(), | |
| }); | |
| }} | |
| /> | |
| )} | |
| </EmbeddableMap> | |
| </Embeddable> | |
| ); | |
| const content = !storageValue ? null : ( | |
| <Embeddable> | |
| <InPortal node={portalNode}> | |
| <MapToolTip /> | |
| </InPortal> | |
| <EmbeddableMapWrapper> | |
| <EmbeddableMapRatioHolder maintainRatio={!isIndexError} /> | |
| {isIndexError ? ( | |
| <IndexPatternsMissingPrompt data-test-subj="missing-prompt" /> | |
| ) : ( | |
| <EmbeddableMap> | |
| <services.maps.Map | |
| // eslint-disable-next-line react/display-name | |
| getTooltipRenderer={() => (tooltipProps: RenderTooltipContentParams) => | |
| <OutPortal node={portalNode} {...tooltipProps} />} | |
| mapCenter={{ lon: -1.05469, lat: 15.96133, zoom: 1 }} | |
| layerList={layerList} | |
| filters={appliedFilters} | |
| query={query} | |
| onApiAvailable={(api: MapApi) => { | |
| // Wire up to app refresh action | |
| setQuery({ | |
| id: 'embeddedMap', // Scope to page type if using map elsewhere | |
| inspect: null, | |
| loading: false, | |
| refetch: () => api.reload(), | |
| }); | |
| }} | |
| /> | |
| </EmbeddableMap> | |
| )} | |
| </EmbeddableMapWrapper> | |
| </Embeddable> | |
| ); | |
expected:
|
@elasticmachine merge upstream |
Resolved with 590602b
Resolved with b559286
Data is getting refetched. To view this, open up browser debugging tools and open network tab. Set network throttling to "Slow 3G". Loading icons will appear for the layers as they reload
|
|
@elasticmachine merge upstream |
nickpeihl
left a comment
There was a problem hiding this comment.
lgtm! great to simplify the usage with the Map component!
code review and tested Network Map in Security with sample data 🎩
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
Unknown metric groupsESLint disabled line counts
References to deprecated APIs
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |


Part of #182020
@elastic/kibana-presentation is refactoring the Embeddable framework. Part of this effort is decoupling plugins from the legacy Embeddable framework. The Maps plugin provides a react component from the plugins start contract that can be used instead of natively using MapEmbeddable.
This PR swaps out the native MapEmbeddable implementation with the react component exposed from the Maps plugin.