Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

dashboards with subfolders #516

Open
kaltinril opened this issue Feb 11, 2015 · 9 comments
Open

dashboards with subfolders #516

kaltinril opened this issue Feb 11, 2015 · 9 comments

Comments

@kaltinril
Copy link

simply creating sub folders under ../dashboards/ then adding .erb files does not allow them to be viewed on the site

http://myfancyserver.com/subfolder/board.erb

What file do I need to modify or play with so that dashing will look at sub folders in the dashboards directory?

EDIT for Clarification:

There will be MULTIPLE dashboards and sub folders.

An imaginary structure might be:

  • dashboards/servermonitor/space/production/
  • dashboards/servermonitor/space/development/
  • dashboards/queuemonitor/call/
  • dashboards/queuemonitor/processing/

Each of which might have its own dashboad with multiple widgets on them.

@terraboops
Copy link
Contributor

Dashing is really just a Sinatra app under the hood.

Here is the route that defines how the dashboards are accessed:

get '/:dashboard' do
protected!
tilt_html_engines.each do |suffix, _|
file = File.join(settings.views, "#{params[:dashboard]}.#{suffix}")
return render(suffix.to_sym, params[:dashboard].to_sym) if File.exist? file
end
halt 404
end

In your config.ru, you can add custom routes according to the Sinatra documentation: http://www.sinatrarb.com/intro.html#Routes

@kaltinril
Copy link
Author

Ah, alright, thank you, I'll play with the routes and see if I can get it to do all subfolders, recursively.

@terraboops
Copy link
Contributor

You can probably just use wildcard routes like get '/dashboards/*/:dashboard' and then use :dashboard to render the correct partial.

@terraboops
Copy link
Contributor

Any update on this? Can this be closed?

@kaltinril
Copy link
Author

I tried adding the suggestion to the config.ru and editing the app.rb file, but all it seems to do is add a folder path to the URL, and screw up the data so the data is no longer showing for the widgets.

I do not know anything about sinatra, and Ruby is still pretty foreign to me as well.

The page used to be served like this: site:3030/simple
Now the page is served like this: site:3030/dashboards/simple/simple

Seems like it just added folders to the URL, but thats it.

Also, it destroyed the Data.

@kaltinril
Copy link
Author

Sorry I edited dashing.rb apparently. However, trying app.rb (Which is in a different gem sub folder for ruby), doesn't seem to work either.

There are 2 folders:
c:\ruby193\lib\ruby\gems\1.9.1\gems\dashing-1.3.4\lib\dashing\app.rb
c:\ruby193\lib\ruby\gems\1.9.1\gems\dashing-1.3.1\lib\dashing.rb

@Floppy
Copy link

Floppy commented Jun 12, 2015

I have a PR open at the moment which supports this. See #306 and add a +1 for a merge if you like it :)

@Floppy
Copy link

Floppy commented Jun 12, 2015

Your issue with no data might be the same as mine: the request to the event source needs a leading / on it. Check the PR to see where it goes.

@kaltinril
Copy link
Author

I tried y our code Floppy and can get it most of the way working. However, it says "Drats!...." inside each widget. Indicating that even though it is correctly parsing the subdirectories, its somehow not correctly rendering the widgets.

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

No branches or pull requests

3 participants