From c36115c861c023f4dcb6cd5460f33e4c44b66984 Mon Sep 17 00:00:00 2001 From: vargburz Date: Fri, 13 Jan 2023 16:51:21 +0300 Subject: [PATCH] set dashboard timerange in date picker --- .../corpglory-dataexporter-panel/components/Panel.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/panels/corpglory-dataexporter-panel/components/Panel.tsx b/src/panels/corpglory-dataexporter-panel/components/Panel.tsx index 1af10d9..73527be 100644 --- a/src/panels/corpglory-dataexporter-panel/components/Panel.tsx +++ b/src/panels/corpglory-dataexporter-panel/components/Panel.tsx @@ -31,6 +31,7 @@ import { DataQuery, DataSourceSettings, TimeRange, + OrgRole, } from '@grafana/data'; import { RefreshEvent } from '@grafana/runtime'; @@ -40,6 +41,7 @@ import * as _ from 'lodash'; interface Props extends PanelProps {} export function Panel({ width, height, timeRange, eventBus }: Props) { + console.log('contextSrv', contextSrv, OrgRole.Admin); // TODO: Dashboard type const [dashboard, setDashboard] = useState(null); const [datasources, setDatasources] = useState(null); @@ -103,10 +105,10 @@ export function Panel({ width, height, timeRange, eventBus }: Props) { }, [dashboard, datasources]); // eslint-disable-line react-hooks/exhaustive-deps useEffect(() => { - if (tasks === null) { - return; - } - const dataFrame = getDataFrameForTaskTable(tasks); + // if (tasks === null) { + // return; + // } + const dataFrame = getDataFrameForTaskTable([]); setTasksDataFrame(dataFrame); }, [tasks]); // eslint-disable-line react-hooks/exhaustive-deps @@ -185,6 +187,7 @@ export function Panel({ width, height, timeRange, eventBus }: Props) { } function openDatasourceModal(): void { + setTimeRange(timeRange); setModalVisibility(true); }