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

Passing information to dashboard #49

Closed
Event-Software opened this issue Jul 24, 2014 · 8 comments
Closed

Passing information to dashboard #49

Event-Software opened this issue Jul 24, 2014 · 8 comments
Labels

Comments

@Event-Software
Copy link

How can I pull up a dashboard for a specific resource. Like

/dashing/dashboard/23 or /dashing/dashboard/?id=23

Since there is no controller for me to access, i'm not sure how to pull the param out and send it to the job.

@gottfrois
Copy link
Owner

not sure what you want to achieve. Can you explain ?

@Event-Software
Copy link
Author

For instance, I want to show a dashboard with information on it pertinent to a given user. How many times that user has posted, or how many times that user has been mentioned. That user is no necessarlly me.

So in the app i want to be able to go to

http://myapp/dashing/dashboards/user?id=3

And then see widgets with information about that user.

@gottfrois
Copy link
Owner

You could have one dashboard per resource where every widgets would be prefixed by the user id (in order to send the right data to the right widgets).

But you cannot "instantiate" dashboard dynamically. You have to create them in advance since there are just html files.

@Event-Software
Copy link
Author

Hmm. I don't want to dynamically change any of the dashboards. I only want to change what query it runs for the data. The User Posts (for examples) widget will look and act the same way, but for User 4 it will show one thing, and for User 6 it will show another. There could be [1..N] users, All I would like is to let the job know which user it is querying for.

@nanda-nainadurai
Copy link

I was having the exact same requirement and happy that it has already been raised. Is there any work-in-progress on this or is the feature already up ?

@nanda-nainadurai
Copy link

Hi @Event-Software, were you able to implement this ? If so, could you please share it ? Thanks.

@ravishi
Copy link
Contributor

ravishi commented Sep 7, 2014

Hey, I have a working example of this at https://github.com/labhackercd/painel-social.

I'm sorry if most comments are in portuguese, though.

The trick is done by PanelsController.show. I moved my dashboard from app/views/dashboards into the show view of my resource (app/views/panels/show.html.erb), changed some of the data-ids so that they will change depending on the panel being displayed and told my controller to render it using Dashing.config.dashboard_layout_path as its :layout.

It works like a charm, although I think it'll show some performance issues when dealing with more panels because Dashing receives its data through a unique stream at /dashing/events, and with lots of panels that channel would be HUGE. But there's probably a way to create filtered streams, so we'll probably do it in the future.

Be wary that we use a slightly different version of dashing-rails, but that has nothing to do with what you want to accomplish here.

@gottfrois
Copy link
Owner

Hey thx @ravishi for the example, my head is not much in the gem those time.. Your help is handy ;)

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

No branches or pull requests

4 participants