[Fleet] Use theme service to display in Dark Mode when set on User Profile (#161819)

Closes https://github.com/elastic/kibana/issues/161135

## What does this PR do?
* Fixes the darkMode theme in fleet page.

## Issue References
* https://github.com/elastic/kibana/issues/161135

## Video/Screenshot Demo 
##### Before

![250689182-c9c4fe55-c007-424a-aedc-b863f1fd0c88-2](71dd9889-3e2d-4b5b-8825-5f7f18206903)

![250689299-34149e80-40b8-493d-a8fc-3079c8cb199c](fdd1b8af-6a5f-4e6c-892e-73baf58d1aab)

###### FIX:

![250690628-2774dc86-487e-489e-b0a2-a1c06539172d](4525bbfa-7771-4611-a099-751c7be54ec6)

![250691578-74d860fa-1db5-47c4-a3b7-425e86720e06](0b03267a-dfb7-48dd-adc3-e9fc3ad5013b)

---
This code was written and reviewed by GitStart Community. Growing future
engineers, one PR at a time.

---------

Co-authored-by: KlingerMatheus <klinger.matheus@gitstart.dev>
Co-authored-by: gitstart_bot <gitstart_bot@users.noreply.github.com>
Co-authored-by: Klinger Matheus <50892465+KlingerMatheus@users.noreply.github.com>
Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
GitStart 2023-07-19 15:56:35 +03:00 committed by GitHub
parent 4540b38380
commit 39807919f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -255,7 +255,8 @@ export const FleetAppContext: React.FC<{
theme$,
fleetStatus,
}) => {
const isDarkMode = useObservable<boolean>(startServices.uiSettings.get$('theme:darkMode'));
const darkModeObservable = useObservable(startServices.theme.theme$);
const isDarkMode = darkModeObservable && darkModeObservable.darkMode;
return (
<RedirectAppLinks application={startServices.application}>

View file

@ -59,7 +59,7 @@ describe('step select agent policy', () => {
});
test('should not select agent policy by default if multiple exists', async () => {
useGetAgentPoliciesMock.mockReturnValueOnce({
useGetAgentPoliciesMock.mockReturnValue({
data: {
items: [
{ id: 'policy-1', name: 'Policy 1' },