Skip to content

Commit

Permalink
[8.6] [Discover] Fix theme for Alerts popover (#145390) (#145631)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.6`:
- [[Discover] Fix theme for Alerts popover
(#145390)](#145390)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Julia
Rechkunova","email":"[email protected]"},"sourceCommit":{"committedDate":"2022-11-17T21:32:39Z","message":"[Discover]
Fix theme for Alerts popover (#145390)\n\nCloses
https://github.com/elastic/kibana/issues/143070\r\n\r\n##
Summary\r\n\r\nThis PR adds theme provider to the Alerts
popover.\r\n\r\nDark theme:\r\n<img width=\"534\" alt=\"Screenshot
2022-11-16 at 16 37
49\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/202226249-a46f6608-4f35-40ce-bfbf-847e9a7ba81a.png\">\r\n\r\nLight
theme:\r\n<img width=\"531\" alt=\"Screenshot 2022-11-16 at 16 38
17\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/202226260-9e67a8dd-f6a4-40ff-ae28-2691b9a082bf.png\">\r\n\r\nCo-authored-by:
Matthias Wilhelm
<[email protected]>","sha":"e33392bff0a022bb246f8d560a336ebdac0555f9","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:DataDiscovery","backport:prev-minor","v8.7.0"],"number":145390,"url":"https://github.com/elastic/kibana/pull/145390","mergeCommit":{"message":"[Discover]
Fix theme for Alerts popover (#145390)\n\nCloses
https://github.com/elastic/kibana/issues/143070\r\n\r\n##
Summary\r\n\r\nThis PR adds theme provider to the Alerts
popover.\r\n\r\nDark theme:\r\n<img width=\"534\" alt=\"Screenshot
2022-11-16 at 16 37
49\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/202226249-a46f6608-4f35-40ce-bfbf-847e9a7ba81a.png\">\r\n\r\nLight
theme:\r\n<img width=\"531\" alt=\"Screenshot 2022-11-16 at 16 38
17\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/202226260-9e67a8dd-f6a4-40ff-ae28-2691b9a082bf.png\">\r\n\r\nCo-authored-by:
Matthias Wilhelm
<[email protected]>","sha":"e33392bff0a022bb246f8d560a336ebdac0555f9"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145390","number":145390,"mergeCommit":{"message":"[Discover]
Fix theme for Alerts popover (#145390)\n\nCloses
https://github.com/elastic/kibana/issues/143070\r\n\r\n##
Summary\r\n\r\nThis PR adds theme provider to the Alerts
popover.\r\n\r\nDark theme:\r\n<img width=\"534\" alt=\"Screenshot
2022-11-16 at 16 37
49\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/202226249-a46f6608-4f35-40ce-bfbf-847e9a7ba81a.png\">\r\n\r\nLight
theme:\r\n<img width=\"531\" alt=\"Screenshot 2022-11-16 at 16 38
17\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/202226260-9e67a8dd-f6a4-40ff-ae28-2691b9a082bf.png\">\r\n\r\nCo-authored-by:
Matthias Wilhelm
<[email protected]>","sha":"e33392bff0a022bb246f8d560a336ebdac0555f9"}}]}]
BACKPORT-->

Co-authored-by: Julia Rechkunova <[email protected]>
  • Loading branch information
kibanamachine and jughosta authored Nov 17, 2022
1 parent 953ece5 commit 520e876
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const getTopNavLinks = ({
run: async (anchorElement: HTMLElement) => {
openAlertsPopover({
I18nContext: services.core.i18n.Context,
theme$: services.core.theme.theme$,
anchorElement,
searchSource: savedSearch.searchSource,
services,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@

import React, { useCallback, useState, useMemo } from 'react';
import ReactDOM from 'react-dom';
import { I18nStart } from '@kbn/core/public';
import type { Observable } from 'rxjs';
import type { CoreTheme, I18nStart } from '@kbn/core/public';
import { EuiWrappingPopover, EuiContextMenu } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import type { DataView, ISearchSource } from '@kbn/data-plugin/common';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { KibanaContextProvider, KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
import { DiscoverServices } from '../../../../build_services';
import { updateSearchSource } from '../../utils/update_search_source';

Expand Down Expand Up @@ -177,6 +178,7 @@ function closeAlertsPopover() {

export function openAlertsPopover({
I18nContext,
theme$,
anchorElement,
searchSource,
services,
Expand All @@ -185,6 +187,7 @@ export function openAlertsPopover({
updateDataViewList,
}: {
I18nContext: I18nStart['Context'];
theme$: Observable<CoreTheme>;
anchorElement: HTMLElement;
searchSource: ISearchSource;
services: DiscoverServices;
Expand All @@ -203,16 +206,18 @@ export function openAlertsPopover({
const element = (
<I18nContext>
<KibanaContextProvider services={services}>
<AlertsPopover
onClose={closeAlertsPopover}
anchorElement={anchorElement}
searchSource={searchSource}
savedQueryId={savedQueryId}
adHocDataViews={adHocDataViews}
I18nContext={I18nContext}
services={services}
updateDataViewList={updateDataViewList}
/>
<KibanaThemeProvider theme$={theme$}>
<AlertsPopover
onClose={closeAlertsPopover}
anchorElement={anchorElement}
searchSource={searchSource}
savedQueryId={savedQueryId}
adHocDataViews={adHocDataViews}
I18nContext={I18nContext}
services={services}
updateDataViewList={updateDataViewList}
/>
</KibanaThemeProvider>
</KibanaContextProvider>
</I18nContext>
);
Expand Down

0 comments on commit 520e876

Please sign in to comment.