Browse Source

Fix export all button for SQL datasources (#33)

pull/1/head
Dmitry Nalobin 4 years ago committed by GitHub
parent
commit
a4fa589816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/routes/tasks.ts

7
src/routes/tasks.ts

@ -10,9 +10,9 @@ type TRequest = {
data: Array<{
panelUrl: string,
datasourceRequest: Datasource,
datasourceName: string
datasourceName: string,
target: object,
}>,
target: object,
user: string,
}
};
@ -22,7 +22,6 @@ async function addTask(req: TRequest, res) {
const from = parseInt(body.from);
const to = parseInt(body.to);
const data = body.data;
const targets = [body.target];
const user = body.user;
if(isNaN(from) || isNaN(to)) {
@ -34,7 +33,7 @@ async function addTask(req: TRequest, res) {
res.status(200).send(`Exporting ${names} data from ${new Date(from).toLocaleString()} to ${new Date(to).toLocaleString()}`);
data.forEach(request => {
const target = new Target(request.panelUrl, user, request.datasourceRequest, targets, from, to, request.datasourceName);
const target = new Target(request.panelUrl, user, request.datasourceRequest, [request.target], from, to, request.datasourceName);
target.export();
});
}

Loading…
Cancel
Save