mirror of https://github.com/grafana/grafana.git
				
				
				
			Playlists: Fix kiosk mode not activating when starting a playlist (#84262)
* Playlists: Fix Kiosk mode not activating when starting a playlist * oops remove debugger
This commit is contained in:
		
							parent
							
								
									a883df633e
								
							
						
					
					
						commit
						4fc4a1c4a8
					
				|  | @ -3,7 +3,7 @@ import classNames from 'classnames'; | ||||||
| import React, { PropsWithChildren, useEffect } from 'react'; | import React, { PropsWithChildren, useEffect } from 'react'; | ||||||
| 
 | 
 | ||||||
| import { GrafanaTheme2 } from '@grafana/data'; | import { GrafanaTheme2 } from '@grafana/data'; | ||||||
| import { locationService } from '@grafana/runtime'; | import { locationSearchToObject, locationService } from '@grafana/runtime'; | ||||||
| import { useStyles2, LinkButton, useTheme2 } from '@grafana/ui'; | import { useStyles2, LinkButton, useTheme2 } from '@grafana/ui'; | ||||||
| import config from 'app/core/config'; | import config from 'app/core/config'; | ||||||
| import { useGrafana } from 'app/core/context/GrafanaContext'; | import { useGrafana } from 'app/core/context/GrafanaContext'; | ||||||
|  | @ -67,6 +67,12 @@ export function AppChrome({ children }: Props) { | ||||||
|     // eslint-disable-next-line react-hooks/exhaustive-deps
 |     // eslint-disable-next-line react-hooks/exhaustive-deps
 | ||||||
|   }, [chrome, url]); |   }, [chrome, url]); | ||||||
| 
 | 
 | ||||||
|  |   // Sync updates from kiosk mode query string back into app chrome
 | ||||||
|  |   useEffect(() => { | ||||||
|  |     const queryParams = locationSearchToObject(search); | ||||||
|  |     chrome.setKioskModeFromUrl(queryParams.kiosk); | ||||||
|  |   }, [chrome, search]); | ||||||
|  | 
 | ||||||
|   // Chromeless routes are without topNav, mega menu, search & command palette
 |   // Chromeless routes are without topNav, mega menu, search & command palette
 | ||||||
|   // We check chromeless twice here instead of having a separate path so {children}
 |   // We check chromeless twice here instead of having a separate path so {children}
 | ||||||
|   // doesn't get re-mounted when chromeless goes from true to false.
 |   // doesn't get re-mounted when chromeless goes from true to false.
 | ||||||
|  |  | ||||||
|  | @ -191,13 +191,19 @@ export class AppChromeService { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   public setKioskModeFromUrl(kiosk: UrlQueryValue) { |   public setKioskModeFromUrl(kiosk: UrlQueryValue) { | ||||||
|  |     let newKioskMode: KioskMode | undefined; | ||||||
|  | 
 | ||||||
|     switch (kiosk) { |     switch (kiosk) { | ||||||
|       case 'tv': |       case 'tv': | ||||||
|         this.update({ kioskMode: KioskMode.TV }); |         newKioskMode = KioskMode.TV; | ||||||
|         break; |         break; | ||||||
|       case '1': |       case '1': | ||||||
|       case true: |       case true: | ||||||
|         this.update({ kioskMode: KioskMode.Full }); |         newKioskMode = KioskMode.Full; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     if (newKioskMode && newKioskMode !== this.state.getValue().kioskMode) { | ||||||
|  |       this.update({ kioskMode: newKioskMode }); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue