mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DashboardScene: Use query options for relative time range calculation of the panel embed url (#79220)
This commit is contained in:
parent
31fb38723d
commit
9fb6cbf683
@ -7,6 +7,7 @@ import { ShareEmbed } from 'app/features/dashboard/components/ShareModal/ShareEm
|
|||||||
import { buildParams, shareDashboardType } from 'app/features/dashboard/components/ShareModal/utils';
|
import { buildParams, shareDashboardType } from 'app/features/dashboard/components/ShareModal/utils';
|
||||||
|
|
||||||
import { DashboardScene } from '../scene/DashboardScene';
|
import { DashboardScene } from '../scene/DashboardScene';
|
||||||
|
import { PanelTimeRange } from '../scene/PanelTimeRange';
|
||||||
import { getDashboardUrl } from '../utils/urlBuilders';
|
import { getDashboardUrl } from '../utils/urlBuilders';
|
||||||
import { getPanelIdForVizPanel } from '../utils/utils';
|
import { getPanelIdForVizPanel } from '../utils/utils';
|
||||||
|
|
||||||
@ -39,12 +40,13 @@ function SharePanelEmbedTabRenderer({ model }: SceneComponentProps<SharePanelEmb
|
|||||||
const id = getPanelIdForVizPanel(p);
|
const id = getPanelIdForVizPanel(p);
|
||||||
const timeRangeState = sceneGraph.getTimeRange(p);
|
const timeRangeState = sceneGraph.getTimeRange(p);
|
||||||
|
|
||||||
|
const timeFrom = timeRangeState instanceof PanelTimeRange ? timeRangeState.state.timeFrom : undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ShareEmbed
|
<ShareEmbed
|
||||||
panel={{
|
panel={{
|
||||||
id,
|
id,
|
||||||
timeFrom:
|
timeFrom,
|
||||||
typeof timeRangeState.state.value.raw.from === 'string' ? timeRangeState.state.value.raw.from : undefined,
|
|
||||||
}}
|
}}
|
||||||
range={timeRangeState.state.value}
|
range={timeRangeState.state.value}
|
||||||
dashboard={{ uid: dashUid ?? '', time: timeRangeState.state.value }}
|
dashboard={{ uid: dashUid ?? '', time: timeRangeState.state.value }}
|
||||||
|
Loading…
Reference in New Issue
Block a user