|
1 |
| -import {useState} from 'react'; |
| 1 | +import {useContext, useState} from 'react'; |
2 | 2 | import styled from '@emotion/styled';
|
3 | 3 | import type {LegendComponentOption} from 'echarts';
|
4 | 4 | import type {Location} from 'history';
|
@@ -40,6 +40,7 @@ import type WidgetLegendSelectionState from '../widgetLegendSelectionState';
|
40 | 40 | import {BigNumberWidget} from '../widgets/bigNumberWidget/bigNumberWidget';
|
41 | 41 | import type {Meta} from '../widgets/common/types';
|
42 | 42 | import {WidgetFrame} from '../widgets/common/widgetFrame';
|
| 43 | +import {WidgetViewerContext} from '../widgetViewer/widgetViewerContext'; |
43 | 44 |
|
44 | 45 | import {useDashboardsMEPContext} from './dashboardsMEPContext';
|
45 | 46 | import WidgetCardChartContainer from './widgetCardChartContainer';
|
@@ -100,6 +101,7 @@ type Data = {
|
100 | 101 |
|
101 | 102 | function WidgetCard(props: Props) {
|
102 | 103 | const [data, setData] = useState<Data>();
|
| 104 | + const {setData: setWidgetViewerData} = useContext(WidgetViewerContext); |
103 | 105 |
|
104 | 106 | const onDataFetched = (newData: Data) => {
|
105 | 107 | if (props.onDataFetched && newData.tableResults) {
|
@@ -174,6 +176,14 @@ function WidgetCard(props: Props) {
|
174 | 176 |
|
175 | 177 | const onFullScreenViewClick = () => {
|
176 | 178 | if (!isWidgetViewerPath(location.pathname)) {
|
| 179 | + setWidgetViewerData({ |
| 180 | + pageLinks: data?.pageLinks, |
| 181 | + seriesData: data?.timeseriesResults, |
| 182 | + tableData: data?.tableResults, |
| 183 | + seriesResultsType: data?.timeseriesResultsTypes, |
| 184 | + totalIssuesCount: data?.totalIssuesCount, |
| 185 | + }); |
| 186 | + |
177 | 187 | props.router.push({
|
178 | 188 | pathname: `${location.pathname}${
|
179 | 189 | location.pathname.endsWith('/') ? '' : '/'
|
|
0 commit comments