-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiple panels export at once #32
Conversation
Title a bit obscure :0 |
src/routes/tasks.ts
Outdated
@@ -1,26 +1,34 @@ | |||
import { Target } from '../target' | |||
|
|||
import * as express from 'express' | |||
import {Datasource} from "@corpglory/tsdb-kit"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import {Datasource} from "@corpglory/tsdb-kit"; | |
import { Datasource } from "@corpglory/tsdb-kit"; |
let datasource = body.datasourceRequest; | ||
let datasourceName = body.datasourceName; | ||
let user = body.user; | ||
const body = req.body; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it was Java, I would validate each param and throw exception if necessary
src/routes/tasks.ts
Outdated
panelUrl: string, | ||
datasourceRequest: Datasource, | ||
datasourceName: string | ||
}; | ||
|
||
async function addTask(req, res) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can define a type for req
, a type which has all these params you expect
src/routes/tasks.ts
Outdated
let target = new Target(panelUrl, user, datasource, targets, from, to, datasourceName); | ||
target.export(); | ||
const names = data.map(item => item.datasourceName).join(', '); | ||
res.status(200).send('Exporting ' + names + ' data from ' + new Date(from).toLocaleString() + ' to ' + new Date(to).toLocaleString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you would try something like
`Exporting ${names} data from ${new Date(from).toLocaleString()} to ${new Date(to).toLocaleString()}`
but I don't like new Date(...).toLocaleString()
part
@sblrok but can we still export a singe metric from list? |
Added button for export all from export panel CorpGlory/grafana-data-exporter-panel#42
Changes
When creating a task, several panels are expected to be exported, instead of one, as it was before