mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
TopNav: KioskMode rewrite move to AppChrome responsibility and make it a global feature (#55149)
* Initial progress * Moving keybindingSrv to context * Simplfy KioskMode * Removed unused logic * Make kiosk=tv behave as before but when topnav is enabled * Minor fix * Fixing tests * Fixing bug with notice when entering kiosk mode * Fixed test
This commit is contained in:
@@ -18,7 +18,7 @@ import {
|
||||
import { AppChromeUpdate } from 'app/core/components/AppChrome/AppChromeUpdate';
|
||||
import { NavToolbarSeparator } from 'app/core/components/AppChrome/NavToolbarSeparator';
|
||||
import config from 'app/core/config';
|
||||
import { toggleKioskMode } from 'app/core/navigation/kiosk';
|
||||
import { useGrafana } from 'app/core/context/GrafanaContext';
|
||||
import { DashboardCommentsModal } from 'app/features/dashboard/components/DashboardComments/DashboardCommentsModal';
|
||||
import { SaveDashboardDrawer } from 'app/features/dashboard/components/SaveDashboard/SaveDashboardDrawer';
|
||||
import { ShareModal } from 'app/features/dashboard/components/ShareModal';
|
||||
@@ -45,7 +45,7 @@ const selectors = e2eSelectors.pages.Dashboard.DashNav;
|
||||
export interface OwnProps {
|
||||
dashboard: DashboardModel;
|
||||
isFullscreen: boolean;
|
||||
kioskMode: KioskMode;
|
||||
kioskMode?: KioskMode | null;
|
||||
hideTimePicker: boolean;
|
||||
folderTitle?: string;
|
||||
title: string;
|
||||
@@ -73,6 +73,7 @@ type Props = OwnProps & ConnectedProps<typeof connector>;
|
||||
|
||||
export const DashNav = React.memo<Props>((props) => {
|
||||
const forceUpdate = useForceUpdate();
|
||||
const { chrome } = useGrafana();
|
||||
|
||||
const onStarDashboard = () => {
|
||||
const dashboardSrv = getDashboardSrv();
|
||||
@@ -90,7 +91,7 @@ export const DashNav = React.memo<Props>((props) => {
|
||||
};
|
||||
|
||||
const onToggleTVMode = () => {
|
||||
toggleKioskMode();
|
||||
chrome.onToggleKioskMode();
|
||||
};
|
||||
|
||||
const onOpenSettings = () => {
|
||||
@@ -127,7 +128,7 @@ export const DashNav = React.memo<Props>((props) => {
|
||||
const { canStar, canShare, isStarred } = dashboard.meta;
|
||||
const buttons: ReactNode[] = [];
|
||||
|
||||
if (kioskMode !== KioskMode.Off || isPlaylistRunning()) {
|
||||
if (kioskMode || isPlaylistRunning()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -235,7 +236,7 @@ export const DashNav = React.memo<Props>((props) => {
|
||||
const { snapshot } = dashboard;
|
||||
const snapshotUrl = snapshot && snapshot.originalUrl;
|
||||
const buttons: ReactNode[] = [];
|
||||
const tvButton = (
|
||||
const tvButton = config.featureToggles.topnav ? null : (
|
||||
<ToolbarButton
|
||||
tooltip={t({ id: 'dashboard.toolbar.tv-button', message: 'Cycle view mode' })}
|
||||
icon="monitor"
|
||||
|
||||
Reference in New Issue
Block a user