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

Dashboard: Add a feature that creates a table panel when a spreadsheet file is dropped on the dashboard. #62688

Merged
merged 11 commits into from
Feb 9, 2023

Conversation

oscarkilhed
Copy link
Contributor

What is this feature?

draganddropfeature

This feature lets users drag spreadsheet files to a dashboard to create a table panel with a spreadsheet query set up to the Grafana datasource.

Why do we need this feature?

It lets users quickly get data they have locally into Grafana.

Who is this feature for?

New users of Grafana that just wants to try it out together with some data they have, without setting up a datasource.

Existing users that have data locally that they want to be able to view together with data from their set up datasources.

@oscarkilhed oscarkilhed requested review from a team as code owners February 1, 2023 14:29
@oscarkilhed oscarkilhed requested review from dprokop, ivanortegaalba and gabor and removed request for a team February 1, 2023 14:29
@oscarkilhed oscarkilhed added this to the 9.5.0 milestone Feb 1, 2023
@ryantxu
Copy link
Member

ryantxu commented Feb 1, 2023

This looks great! It would be even better if the drop would accept a dashboard JSON and then ask to import it... eg #61017

In addition to drag+drop CSV/text, we should also support general JSON. (use toDataFrame(...))

@codeincarnate
Copy link
Contributor

A couple of more things, the uneven padding (left vs top) becomes really obvious when the dropzone is shown and looks weird.

As for the note about the dropzone message it seems like we should be able to tell cases with 1 file and more than 1 file? Seems like it would also be good to provide more file type guidance here, like show a short list of accepted file types

Screenshot 2023-02-06 at 1 34 54 PM

@oscarkilhed
Copy link
Contributor Author

As for the note about the dropzone message it seems like we should be able to tell cases with 1 file and more than 1 file?

Most browsers won't divulge any info about the dragged files until they are dropped.

move accepted types and max size to file-import constants
show which file types are allowed in file type error
@oscarkilhed oscarkilhed requested a review from a team as a code owner February 6, 2023 12:59
@oscarkilhed oscarkilhed requested review from joshhunt and yaelleC and removed request for a team February 6, 2023 12:59
@oscarkilhed
Copy link
Contributor Author

@ryantxu the last commit added support for dropping json files that contain dataframes.

However, adding support for importing dropped dashboard json files comes with a whole host of UX questions.

return `${fileExtentions.slice(0, -1).join(', ')} or ${fileExtentions.slice(-1)}`;
}

export function filesToDataframes(files: File[]): Observable<FileImportResult> {
Copy link
Member

Choose a reason for hiding this comment

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

Rather than supporting multiple async files, can we limit this to a single file at a time? I don't think we want dropping a pile of csv files to generate a pile of table panels -- at least not to start!

Copy link
Member

Choose a reason for hiding this comment

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

looks like the drop component enforces that, so maybe this is fine 🤷

Copy link
Contributor

@codeincarnate codeincarnate left a comment

Choose a reason for hiding this comment

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

Thanks for the updates Oscar. LGTM! 🚀

Copy link
Member

@zoltanbedi zoltanbedi left a comment

Choose a reason for hiding this comment

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

Can you please add some docs around this?

@oscarkilhed oscarkilhed merged commit 8048a66 into main Feb 9, 2023
@oscarkilhed oscarkilhed deleted the oscark/drag-to-dashboard branch February 9, 2023 14:16
ryantxu pushed a commit that referenced this pull request Mar 2, 2023
…t file is dropped on the dashboard. (#62688)

* drag files to dashboard

* use file name as panel title

* add file size limitation, file type limitation and error handling

* Refactor file parsing for code sharing

move accepted types and max size to file-import constants
show which file types are allowed in file type error

* update codeowners

* Adjust max size to 1mb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants