diff --git a/conf/defaults.ini b/conf/defaults.ini index 29cb40206c5..ae913f51642 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -4,7 +4,7 @@ # # possible values : production, development -app_mode = production +app_mode = FusionReactor # instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty instance_name = ${HOSTNAME} @@ -1357,6 +1357,10 @@ news_feed_enabled = true # Set the number of data source queries that can be executed concurrently in mixed queries. Default is the number of CPUs. concurrent_query_limit = +[kiosk] +# Enable the kiosk section +mode = off + #################################### Query History ############################# [query_history] # Enable the Query history diff --git a/packages/grafana-data/src/types/config.ts b/packages/grafana-data/src/types/config.ts index 5703028f2cb..83fb225b79a 100644 --- a/packages/grafana-data/src/types/config.ts +++ b/packages/grafana-data/src/types/config.ts @@ -170,6 +170,7 @@ export interface GrafanaConfig { alertingMinInterval: number; authProxyEnabled: boolean; exploreEnabled: boolean; + kioskMode: string; queryHistoryEnabled: boolean; helpEnabled: boolean; profileEnabled: boolean; diff --git a/packages/grafana-runtime/src/config.ts b/packages/grafana-runtime/src/config.ts index 2709d5cf9a6..ff1a190fd6c 100644 --- a/packages/grafana-runtime/src/config.ts +++ b/packages/grafana-runtime/src/config.ts @@ -63,6 +63,7 @@ export class GrafanaBootConfig implements GrafanaConfig { angularSupportEnabled = false; authProxyEnabled = false; exploreEnabled = false; + kioskMode = 'off'; queryHistoryEnabled = false; helpEnabled = false; profileEnabled = false; diff --git a/pkg/api/dtos/frontend_settings.go b/pkg/api/dtos/frontend_settings.go index 166dae62160..be08b576e87 100644 --- a/pkg/api/dtos/frontend_settings.go +++ b/pkg/api/dtos/frontend_settings.go @@ -146,15 +146,16 @@ type FrontendSettingsDTO struct { LiveEnabled bool `json:"liveEnabled"` AutoAssignOrg bool `json:"autoAssignOrg"` - VerifyEmailEnabled bool `json:"verifyEmailEnabled"` - SigV4AuthEnabled bool `json:"sigV4AuthEnabled"` - AzureAuthEnabled bool `json:"azureAuthEnabled"` - RbacEnabled bool `json:"rbacEnabled"` - ExploreEnabled bool `json:"exploreEnabled"` - HelpEnabled bool `json:"helpEnabled"` - ProfileEnabled bool `json:"profileEnabled"` - NewsFeedEnabled bool `json:"newsFeedEnabled"` - QueryHistoryEnabled bool `json:"queryHistoryEnabled"` + VerifyEmailEnabled bool `json:"verifyEmailEnabled"` + SigV4AuthEnabled bool `json:"sigV4AuthEnabled"` + AzureAuthEnabled bool `json:"azureAuthEnabled"` + RbacEnabled bool `json:"rbacEnabled"` + ExploreEnabled bool `json:"exploreEnabled"` + KioskMode string `json:"kioskMode"` + HelpEnabled bool `json:"helpEnabled"` + ProfileEnabled bool `json:"profileEnabled"` + NewsFeedEnabled bool `json:"newsFeedEnabled"` + QueryHistoryEnabled bool `json:"queryHistoryEnabled"` GoogleAnalyticsId string `json:"googleAnalyticsId"` GoogleAnalytics4Id string `json:"googleAnalytics4Id"` diff --git a/pkg/api/frontendsettings.go b/pkg/api/frontendsettings.go index 215714b6f83..1edb9da0f8b 100644 --- a/pkg/api/frontendsettings.go +++ b/pkg/api/frontendsettings.go @@ -129,6 +129,7 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro ProfileEnabled: setting.ProfileEnabled, NewsFeedEnabled: setting.NewsFeedEnabled, QueryHistoryEnabled: hs.Cfg.QueryHistoryEnabled, + KioskMode: setting.KioskMode, GoogleAnalyticsId: hs.Cfg.GoogleAnalyticsID, GoogleAnalytics4Id: hs.Cfg.GoogleAnalytics4ID, GoogleAnalytics4SendManualPageViews: hs.Cfg.GoogleAnalytics4SendManualPageViews, diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 45d9e2ae608..c22e6ca424a 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -130,6 +130,9 @@ var ( // Explore UI ExploreEnabled bool + //kiosk mode + KioskMode string + // Help UI HelpEnabled bool @@ -1156,6 +1159,9 @@ func (cfg *Cfg) Load(args CommandLineArgs) error { explore := iniFile.Section("explore") ExploreEnabled = explore.Key("enabled").MustBool(true) + kiosk := iniFile.Section("kiosk") + KioskMode = valueAsString(kiosk, "mode", "off") + help := iniFile.Section("help") HelpEnabled = help.Key("enabled").MustBool(true) diff --git a/public/app/core/components/AppChrome/AppChrome.tsx b/public/app/core/components/AppChrome/AppChrome.tsx index 5f7bc35fe96..bef1007f7e2 100644 --- a/public/app/core/components/AppChrome/AppChrome.tsx +++ b/public/app/core/components/AppChrome/AppChrome.tsx @@ -22,7 +22,7 @@ export interface Props extends PropsWithChildren<{}> {} export function AppChrome({ children }: Props) { const { chrome } = useGrafana(); const state = chrome.useState(); - const searchBarHidden = state.searchBarHidden || state.kioskMode === KioskMode.TV; + const searchBarHidden = state.searchBarHidden || state.kioskMode === KioskMode.TV || true; const theme = useTheme2(); const styles = useStyles2(getStyles); diff --git a/public/app/core/components/AppChrome/AppChromeService.tsx b/public/app/core/components/AppChrome/AppChromeService.tsx index a7a89bfceb2..3339dceceb9 100644 --- a/public/app/core/components/AppChrome/AppChromeService.tsx +++ b/public/app/core/components/AppChrome/AppChromeService.tsx @@ -141,6 +141,8 @@ export class AppChromeService { this.update({ kioskMode: KioskMode.TV }); break; case '1': + case 'embed': + this.update({kioskMode: KioskMode.Embed }); case true: this.update({ kioskMode: KioskMode.Full }); } @@ -150,6 +152,8 @@ export class AppChromeService { switch (mode) { case KioskMode.TV: return 'tv'; + case KioskMode.Embed: + return 'embed'; case KioskMode.Full: return true; default: diff --git a/public/app/core/navigation/kiosk.ts b/public/app/core/navigation/kiosk.ts index 64452c4265a..65c2e414da7 100644 --- a/public/app/core/navigation/kiosk.ts +++ b/public/app/core/navigation/kiosk.ts @@ -1,17 +1,33 @@ import { UrlQueryMap } from '@grafana/data'; import { KioskMode } from '../../types'; +import config from '../config'; // TODO Remove after topnav feature toggle is permanent and old NavBar is removed export function getKioskMode(queryParams: UrlQueryMap): KioskMode | null { - switch (queryParams.kiosk) { - case 'tv': - return KioskMode.TV; - // legacy support - case '1': - case true: - return KioskMode.Full; - default: - return null; + if (config.KioskMode === 'off') { + switch (queryParams.kiosk) { + case 'tv': + return KioskMode.TV; + // legacy support + case '1': + case 'full': + case true: + return KioskMode.Full; + case 'embed': + return KioskMode.Embed; + default: + return null; + } + } else { + switch (config.KioskMode) { + // legacy support + case 'full': + return KioskMode.Full; + case 'embed': + return KioskMode.Embed; + default: + return null; + } } } diff --git a/public/app/features/dashboard/components/DashNav/DashNav.tsx b/public/app/features/dashboard/components/DashNav/DashNav.tsx index 0f78422beaf..657313c19a4 100644 --- a/public/app/features/dashboard/components/DashNav/DashNav.tsx +++ b/public/app/features/dashboard/components/DashNav/DashNav.tsx @@ -169,7 +169,7 @@ export const DashNav = React.memo((props) => { const { canStar, canShare, isStarred } = dashboard.meta; const buttons: ReactNode[] = []; - if (kioskMode || isPlaylistRunning()) { + if ((kioskMode && kioskMode !== KioskMode.Embed) || isPlaylistRunning()) { return []; } diff --git a/public/app/features/dashboard/containers/DashboardPage.tsx b/public/app/features/dashboard/containers/DashboardPage.tsx index 8770bdec767..6de4bbb2e0d 100644 --- a/public/app/features/dashboard/containers/DashboardPage.tsx +++ b/public/app/features/dashboard/containers/DashboardPage.tsx @@ -321,9 +321,9 @@ export class UnthemedDashboardPage extends PureComponent { } const inspectPanel = this.getInspectPanel(); - const showSubMenu = !editPanel && !kioskMode && !this.props.queryParams.editview; + const showSubMenu = !editPanel && (!kioskMode || kioskMode === KioskMode.Embed) && !this.props.queryParams.editview; - const showToolbar = kioskMode !== KioskMode.Full && !queryParams.editview; + const showToolbar = kioskMode !== KioskMode.Full && !queryParams.editview; const pageClassName = cx({ 'panel-in-fullscreen': Boolean(viewPanel), diff --git a/public/app/types/dashboard.ts b/public/app/types/dashboard.ts index 8a37867ab97..df9f732e879 100644 --- a/public/app/types/dashboard.ts +++ b/public/app/types/dashboard.ts @@ -96,6 +96,7 @@ export interface DashboardInitError { export enum KioskMode { TV = 'tv', Full = 'full', + Embed = 'embed', } export type GetMutableDashboardModelFn = () => DashboardModel | null;