mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Log Explorer] Hide Discover announcement callouts (#166835)
## 📓 Summary
Closes #166056
This PR adds a new override to the `uiSetting` service, allowing it to
override specific UI preferences.
In this case, we'll overwrite the `hideAnnouncements` preference to be
true, so that discover-specific announcements won't be displayed for the
Log Explorer app.
50dade20
-1902-4f4a-8615-3e1f7a964522
---------
Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
39aebd66be
commit
b04b07ec52
2 changed files with 27 additions and 2 deletions
|
@ -8,9 +8,10 @@
|
|||
import React, { useMemo } from 'react';
|
||||
import { ScopedHistory } from '@kbn/core-application-browser';
|
||||
import { DataPublicPluginStart } from '@kbn/data-plugin/public';
|
||||
import { DiscoverStart } from '@kbn/discover-plugin/public';
|
||||
import { DiscoverAppState, DiscoverStart } from '@kbn/discover-plugin/public';
|
||||
import type { BehaviorSubject } from 'rxjs';
|
||||
import { DiscoverAppState } from '@kbn/discover-plugin/public/application/main/services/discover_app_state_container';
|
||||
import { IUiSettingsClient } from '@kbn/core-ui-settings-browser';
|
||||
import { HIDE_ANNOUNCEMENTS } from '@kbn/discover-utils';
|
||||
import {
|
||||
createLogExplorerProfileCustomizations,
|
||||
CreateLogExplorerProfileCustomizationsDeps,
|
||||
|
@ -39,6 +40,7 @@ export const createLogExplorer = ({
|
|||
}: CreateLogExplorerArgs) => {
|
||||
const overrideServices = {
|
||||
data: createDataServiceProxy(data),
|
||||
uiSettings: createUiSettingsServiceProxy(core.uiSettings),
|
||||
};
|
||||
|
||||
return ({ scopedHistory, state$ }: LogExplorerProps) => {
|
||||
|
@ -76,3 +78,24 @@ const createDataServiceProxy = (data: DataPublicPluginStart) => {
|
|||
search: () => searchServiceProxy,
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Create proxy for the uiSettings service, in which settings preferences are overwritten
|
||||
* with custom values
|
||||
*/
|
||||
const createUiSettingsServiceProxy = (uiSettings: IUiSettingsClient) => {
|
||||
const overrides: Record<string, any> = {
|
||||
[HIDE_ANNOUNCEMENTS]: true,
|
||||
};
|
||||
|
||||
return createPropertyGetProxy(uiSettings, {
|
||||
get:
|
||||
() =>
|
||||
(key, ...args) => {
|
||||
if (key in overrides) {
|
||||
return overrides[key];
|
||||
}
|
||||
|
||||
return uiSettings.get(key, ...args);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
"@kbn/core-application-browser",
|
||||
"@kbn/share-plugin",
|
||||
"@kbn/unified-data-table",
|
||||
"@kbn/core-ui-settings-browser",
|
||||
"@kbn/discover-utils",
|
||||
"@kbn/deeplinks-observability"
|
||||
],
|
||||
"exclude": ["target/**/*"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue