Skip to content
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

Merged
merged 2 commits into from
Oct 2, 2020
Merged

Conversation

sblrok
Copy link
Contributor

@sblrok sblrok commented Oct 2, 2020

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

@jonyrock
Copy link
Member

jonyrock commented Oct 2, 2020

Title a bit obscure :0

@@ -1,26 +1,34 @@
import { Target } from '../target'

import * as express from 'express'
import {Datasource} from "@corpglory/tsdb-kit";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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;
Copy link
Member

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

panelUrl: string,
datasourceRequest: Datasource,
datasourceName: string
};

async function addTask(req, res) {
Copy link
Member

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

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());
Copy link
Member

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

@jonyrock
Copy link
Member

jonyrock commented Oct 2, 2020

@sblrok but can we still export a singe metric from list?

@rozetko rozetko changed the title Changes for single export button support Support multiple panels export at once Oct 2, 2020
@rozetko rozetko merged commit f07480c into master Oct 2, 2020
@rozetko rozetko deleted the single-export-button-#42 branch October 2, 2020 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants