|
|
@ -3,7 +3,7 @@ import { PanelOptions, TaskTableRowConfig, QueryTableRowConfig, DatasourceType } |
|
|
|
import { convertTimestampToDate, getDashboardUid } from '../../../utils'; |
|
|
|
import { convertTimestampToDate, getDashboardUid } from '../../../utils'; |
|
|
|
import { CLOSE_ICON_BASE_64, DOWNLOAD_ICON_BASE_64, SELECT_ICON_BASE_64, UNSELECT_ICON_BASE_64 } from '../../../icons'; |
|
|
|
import { CLOSE_ICON_BASE_64, DOWNLOAD_ICON_BASE_64, SELECT_ICON_BASE_64, UNSELECT_ICON_BASE_64 } from '../../../icons'; |
|
|
|
|
|
|
|
|
|
|
|
import { getStaticFile, getTasks, queryApi } from '../../../services/api_service'; |
|
|
|
import { deleteTask, getStaticFile, getTasks, queryApi } from '../../../services/api_service'; |
|
|
|
import { getDashboardByUid, getDatasources } from '../../../services/grafana_backend_service'; |
|
|
|
import { getDashboardByUid, getDatasources } from '../../../services/grafana_backend_service'; |
|
|
|
|
|
|
|
|
|
|
|
import { contextSrv } from 'grafana/app/core/core'; |
|
|
|
import { contextSrv } from 'grafana/app/core/core'; |
|
|
@ -108,9 +108,17 @@ export function Panel({ width, height, timeRange, eventBus }: Props) { |
|
|
|
}, [queries]); |
|
|
|
}, [queries]); |
|
|
|
|
|
|
|
|
|
|
|
function refresh(): void { |
|
|
|
function refresh(): void { |
|
|
|
console.log('rfrsh') |
|
|
|
|
|
|
|
getTasks() |
|
|
|
getTasks() |
|
|
|
.then((tasks) => setTasks(tasks)) |
|
|
|
.then((tasks) => { |
|
|
|
|
|
|
|
setTasks(tasks); |
|
|
|
|
|
|
|
for (let task of tasks) { |
|
|
|
|
|
|
|
// TODO: ExportStatus enum
|
|
|
|
|
|
|
|
if (task.status === 'exporting') { |
|
|
|
|
|
|
|
setTimeout(refresh, 1000); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
.catch((err) => console.error(err)); |
|
|
|
.catch((err) => console.error(err)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -317,17 +325,19 @@ export function Panel({ width, height, timeRange, eventBus }: Props) { |
|
|
|
return dataFrames[0]; |
|
|
|
return dataFrames[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function onDeleteClick(e: DataLinkClickEvent): void { |
|
|
|
async function onDeleteClick(e: DataLinkClickEvent): Promise<void> { |
|
|
|
// TODO: make DELETE request to the api
|
|
|
|
|
|
|
|
const rowIndex = e.origin.rowIndex; |
|
|
|
const rowIndex = e.origin.rowIndex; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const task = _.find(tasks, (task, idx) => idx === rowIndex); |
|
|
|
|
|
|
|
await deleteTask(task?.filename); |
|
|
|
|
|
|
|
|
|
|
|
const filteredTasks = _.filter(tasks, (task, idx) => idx !== rowIndex); |
|
|
|
const filteredTasks = _.filter(tasks, (task, idx) => idx !== rowIndex); |
|
|
|
setTasks(filteredTasks); |
|
|
|
setTasks(filteredTasks); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function onDownloadClick(e: DataLinkClickEvent): void { |
|
|
|
function onDownloadClick(e: DataLinkClickEvent): void { |
|
|
|
// TODO: make DELETE request to the api
|
|
|
|
|
|
|
|
const rowIndex = e.origin.rowIndex; |
|
|
|
const rowIndex = e.origin.rowIndex; |
|
|
|
const task = _.find(tasks, (task, idx) => idx !== rowIndex); |
|
|
|
const task = _.find(tasks, (task, idx) => idx === rowIndex); |
|
|
|
getStaticFile(task?.filename); |
|
|
|
getStaticFile(task?.filename); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|