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

Action Buttons #3737

Closed
kevinmartin opened this issue Nov 7, 2016 · 16 comments
Closed

Action Buttons #3737

kevinmartin opened this issue Nov 7, 2016 · 16 comments

Comments

@kevinmartin
Copy link

kevinmartin commented Nov 7, 2016

It would be great if, apart from creating questions, segments, and metrics, if we can create actions.

Use case scenarios:

  1. Assume a system that scores posts and comments based on potential level of spammy-ness that admin has to go ahead and review... A question is created to view Raw Data of all of these posts/comments. Two actions are created: Allow & Deny.
  2. A travel agency with group bookings needs to go ahead and manually set traveler information in hotel/airline. A question is created to view Raw Data of traveler information. Action is created to change status of booking after information has been sent to hotel/airline.

This would be especially great when doing a deep dive on a specific row and its relationships.

Actions would just be queries (usually INSERT or UPDATE) that also accepts variables based on information in the row you're taking action on.

⬇️ Please click the 👍 reaction instead of leaving a +1 or update? comment

@tlrobinson
Copy link
Contributor

Related to #2882

@kevinmartin
Copy link
Author

This is slightly different to #2882. Instead of outright editing data in a table (which can be potentially dangerous), the user would only be shown pre-created actions which are very specific.

@Globegitter
Copy link

Globegitter commented Sep 15, 2017

I think this is a great idea, instead of allowing blank update/edit of everything this would be a much safer appraoch and would allow to have non-technical people run potentially needed update tasks/actions. That would imo make metabase extremely powerful, instead of 'just' being great at analytics (and viewing the underlying data) to also be able to perform very specific crud actions.

@ACPK
Copy link

ACPK commented Jan 26, 2018

@Globegitter @kevinmartin @tlrobinson - Would you be interested in pair programming, as I'd love to implement this feature?

@jornh
Copy link
Contributor

jornh commented Feb 2, 2018

I have made a very minimal implementation of something similar. It differs from what’s proposed here by performing a HTTP POST to an API outside Metabase instead of making direct database writes. I think that’s preferable in most cases for a number of reasons (mainly isolation/not having to duplicate business logic).

Currently what I have only works for picking points on line/area/bar visualizations as that fit my current needs, though extending it to cover e.g. table row clicks should be trivial. For my current use I post to an open source tool StreamSets which in a no-code solution validates and picks input and updates my backend.

I’m up for pairing on getting this into the shape of a mergeable PR (with tests etc.) covering more scenarios.

Thoughts?

@zolrath
Copy link

zolrath commented Jun 17, 2018

I would love the ability to define a button for a row that makes allows me to make an HTTP request using data from the given row and potentially some form of authorization header.

Being able to make well defined API requests within Metabase would allow Metabase itself to remain read-only but allow us to define more complex write relationships in our own APIs that we can easily trigger.

@joekh

This comment has been minimized.

@jornh
Copy link
Contributor

jornh commented Sep 6, 2018

@joekh I've implemented what I mentioned above in #3737 (comment) a while back (around v0.27-ish), and it sits on my Metabase fork. Nothing has been merged back to official Metabase. It could be revived.

What's your particular use case? Would something similar to what @zolrath mention above cover what you need as well?

A related issue #8461 to get peoples minds going about requirements/use cases/UX also just popped in ☝️

@joekh
Copy link

joekh commented Sep 6, 2018

Hey @jornh, thanks for getting back to me.
My use case is very similar to @zolrath , so in my dashboard I would like to add an action button that can for example execute a post Http request and change a value in a specific table. For example clear the alerts table :). Let me know if this would be possible. Thank you!

@jornh
Copy link
Contributor

jornh commented Sep 7, 2018

Thanks for the details @joekh - it sounds doable.

  • 1. As a first step I'll get my current code up to a version 0.30.2 mergeable state.

  • 3. Also, my current implementation only works on Bar/Line/Area graphs. I guess you need it on tables?

  • 2. As mentioned over in Associate URL templates with tables in data model #8461 (comment) my current POST Endpoint URL and "Action label" displayed in the menu is hardcoded, so next will be to get that configurable.

  • 4. ... then we'll have to see what other loose ends there are for your use case(s) ...

    • move POST'ing to Backend to not expose tokens etc.

Does that sound like sensible steps? If you see anything obvious missing please chime in.

@joekh
Copy link

joekh commented Sep 7, 2018

Hey @jornh!
Those look like perfect steps. As you mentioned in point (3), the button will be needed on tables too exactly.
I also have a question, in the case of a table, let's say there's a button for each row, do u think when clicking the button u can gather info from that row that you will use in the POST request?
Thank!

@jornh
Copy link
Contributor

jornh commented Sep 7, 2018

The "button" currently available on the graph is actually just a menu item, like:

Image stolen from #8461 ... hope it can work on tables as well...

Yep, hear you regarding POST'ing the selected object (maybe even selected objects? - can't really remember) as JSON. It's already in there.

@joekh

This comment was marked as resolved.

@varnika1912

This comment was marked as spam.

@cdeweyx
Copy link

cdeweyx commented May 25, 2023

@metabase/success-engineering think we can close this?

@mazameli
Copy link
Contributor

Closing as resolved! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests