Browse Source

set dashboard timerange in date picker

pull/9/head
vargburz 2 years ago
parent
commit
c36115c861
  1. 11
      src/panels/corpglory-dataexporter-panel/components/Panel.tsx

11
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<PanelOptions> {}
export function Panel({ width, height, timeRange, eventBus }: Props) {
console.log('contextSrv', contextSrv, OrgRole.Admin);
// TODO: Dashboard type
const [dashboard, setDashboard] = useState<any | null>(null);
const [datasources, setDatasources] = useState<DataSourceSettings[] | null>(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);
}

Loading…
Cancel
Save