diff --git a/public/app/features/dashboard/dashgrid/PanelChrome.tsx b/public/app/features/dashboard/dashgrid/PanelChrome.tsx index 167be5db01c..8db583dba45 100644 --- a/public/app/features/dashboard/dashgrid/PanelChrome.tsx +++ b/public/app/features/dashboard/dashgrid/PanelChrome.tsx @@ -1,18 +1,7 @@ -// Libraries import React, { Component } from 'react'; import classNames from 'classnames'; import { Subscription } from 'rxjs'; -// Components -import { PanelHeader } from './PanelHeader/PanelHeader'; -import { ErrorBoundary, PanelContextProvider, PanelContext, SeriesVisibilityChangeMode } from '@grafana/ui'; -// Utils & Services -import { getTimeSrv, TimeSrv } from '../services/TimeSrv'; -import { applyPanelTimeOverrides } from 'app/features/dashboard/utils/panel'; -import { profiler } from 'app/core/profiler'; -import config from 'app/core/config'; -// Types -import { DashboardModel, PanelModel } from '../state'; -import { PANEL_BORDER } from 'app/core/constants'; +import { locationService } from '@grafana/runtime'; import { AbsoluteTimeRange, AnnotationChangeEvent, @@ -28,13 +17,23 @@ import { toDataFrameDTO, toUtc, } from '@grafana/data'; +import { ErrorBoundary, PanelContext, PanelContextProvider, SeriesVisibilityChangeMode } from '@grafana/ui'; import { selectors } from '@grafana/e2e-selectors'; + +import { PanelHeader } from './PanelHeader/PanelHeader'; +import { getTimeSrv, TimeSrv } from '../services/TimeSrv'; +import { applyPanelTimeOverrides } from 'app/features/dashboard/utils/panel'; +import { profiler } from 'app/core/profiler'; +import config from 'app/core/config'; +import { DashboardModel, PanelModel } from '../state'; +import { PANEL_BORDER } from 'app/core/constants'; import { loadSnapshotData } from '../utils/loadSnapshotData'; import { RefreshEvent, RenderEvent } from 'app/types/events'; import { changeSeriesColorConfigFactory } from 'app/plugins/panel/timeseries/overrides/colorSeriesConfigFactory'; import { seriesVisibilityConfigFactory } from './SeriesVisibilityConfigFactory'; import { deleteAnnotation, saveAnnotation, updateAnnotation } from '../../annotations/api'; import { getDashboardQueryRunner } from '../../query/state/DashboardQueryRunner/DashboardQueryRunner'; +import { isSoloRoute } from '../../../routes/utils'; const DEFAULT_PLUGIN_ERROR = 'Error in plugin'; @@ -428,6 +427,7 @@ export class PanelChrome extends Component { const containerClassNames = classNames({ 'panel-container': true, + 'panel-container--absolute': isSoloRoute(locationService.getLocation().pathname), 'panel-container--transparent': transparent, 'panel-container--no-title': this.hasOverlayHeader(), [`panel-alert-state--${alertState}`]: alertState !== undefined, diff --git a/public/app/features/dashboard/dashgrid/PanelChromeAngular.tsx b/public/app/features/dashboard/dashgrid/PanelChromeAngular.tsx index fd1e14727ae..769d1913053 100644 --- a/public/app/features/dashboard/dashgrid/PanelChromeAngular.tsx +++ b/public/app/features/dashboard/dashgrid/PanelChromeAngular.tsx @@ -1,21 +1,19 @@ -// Libraries import React, { PureComponent } from 'react'; import classNames from 'classnames'; import { Subscription } from 'rxjs'; import { connect, MapDispatchToProps, MapStateToProps } from 'react-redux'; -// Components +import { AngularComponent, getAngularLoader, locationService } from '@grafana/runtime'; +import { getDefaultTimeRange, LoadingState, PanelData, PanelPlugin } from '@grafana/data'; +import { selectors } from '@grafana/e2e-selectors'; + import { PanelHeader } from './PanelHeader/PanelHeader'; -// Utils & Services import { getTimeSrv, TimeSrv } from '../services/TimeSrv'; -import { AngularComponent, getAngularLoader } from '@grafana/runtime'; import { setPanelAngularComponent } from '../state/reducers'; import config from 'app/core/config'; -// Types import { DashboardModel, PanelModel } from '../state'; import { StoreState } from 'app/types'; -import { getDefaultTimeRange, LoadingState, PanelData, PanelPlugin } from '@grafana/data'; import { PANEL_BORDER } from 'app/core/constants'; -import { selectors } from '@grafana/e2e-selectors'; +import { isSoloRoute } from '../../../routes/utils'; interface OwnProps { panel: PanelModel; @@ -192,6 +190,7 @@ export class PanelChromeAngularUnconnected extends PureComponent { const containerClassNames = classNames({ 'panel-container': true, + 'panel-container--absolute': isSoloRoute(locationService.getLocation().pathname), 'panel-container--transparent': transparent, 'panel-container--no-title': this.hasOverlayHeader(), 'panel-has-alert': panel.alert !== undefined, diff --git a/public/app/routes/utils.test.ts b/public/app/routes/utils.test.ts new file mode 100644 index 00000000000..bdf98a25409 --- /dev/null +++ b/public/app/routes/utils.test.ts @@ -0,0 +1,19 @@ +import { isSoloRoute } from './utils'; + +describe('isSoloRoute', () => { + describe('when called with a solo route', () => { + it('then it should return true', () => { + expect( + isSoloRoute( + 'http://localhost:3000/render/d-solo/4vEk45n7k/dash?orgId=1&from=1629329071059&to=1629350671060&panelId=5&width=1000&height=500&tz=Europe%2FStockholm' + ) + ).toBe(true); + }); + }); + + describe('when called without a solo route', () => { + it('then it should return false', () => { + expect(isSoloRoute('http://localhost:3000/d/4vEk45n7k/the-variables-system?orgId=1')).toBe(false); + }); + }); +}); diff --git a/public/app/routes/utils.ts b/public/app/routes/utils.ts new file mode 100644 index 00000000000..5cdf4a1d310 --- /dev/null +++ b/public/app/routes/utils.ts @@ -0,0 +1,3 @@ +export function isSoloRoute(path: string): boolean { + return path?.toLowerCase().includes('/d-solo/'); +}