|
|
@ -31,6 +31,7 @@ import { |
|
|
|
DataQuery, |
|
|
|
DataQuery, |
|
|
|
DataSourceSettings, |
|
|
|
DataSourceSettings, |
|
|
|
TimeRange, |
|
|
|
TimeRange, |
|
|
|
|
|
|
|
OrgRole, |
|
|
|
} from '@grafana/data'; |
|
|
|
} from '@grafana/data'; |
|
|
|
import { RefreshEvent } from '@grafana/runtime'; |
|
|
|
import { RefreshEvent } from '@grafana/runtime'; |
|
|
|
|
|
|
|
|
|
|
@ -40,6 +41,7 @@ import * as _ from 'lodash'; |
|
|
|
interface Props extends PanelProps<PanelOptions> {} |
|
|
|
interface Props extends PanelProps<PanelOptions> {} |
|
|
|
|
|
|
|
|
|
|
|
export function Panel({ width, height, timeRange, eventBus }: Props) { |
|
|
|
export function Panel({ width, height, timeRange, eventBus }: Props) { |
|
|
|
|
|
|
|
console.log('contextSrv', contextSrv, OrgRole.Admin); |
|
|
|
// TODO: Dashboard type
|
|
|
|
// TODO: Dashboard type
|
|
|
|
const [dashboard, setDashboard] = useState<any | null>(null); |
|
|
|
const [dashboard, setDashboard] = useState<any | null>(null); |
|
|
|
const [datasources, setDatasources] = useState<DataSourceSettings[] | 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
|
|
|
|
}, [dashboard, datasources]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
if (tasks === null) { |
|
|
|
// if (tasks === null) {
|
|
|
|
return; |
|
|
|
// return;
|
|
|
|
} |
|
|
|
// }
|
|
|
|
const dataFrame = getDataFrameForTaskTable(tasks); |
|
|
|
const dataFrame = getDataFrameForTaskTable([]); |
|
|
|
setTasksDataFrame(dataFrame); |
|
|
|
setTasksDataFrame(dataFrame); |
|
|
|
}, [tasks]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
|
|
}, [tasks]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
|
|
|
|
|
|
|
|
|
@ -185,6 +187,7 @@ export function Panel({ width, height, timeRange, eventBus }: Props) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function openDatasourceModal(): void { |
|
|
|
function openDatasourceModal(): void { |
|
|
|
|
|
|
|
setTimeRange(timeRange); |
|
|
|
setModalVisibility(true); |
|
|
|
setModalVisibility(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|