ripienaar / gdash

A dashboard for Graphite
http://www.devco.net/
Apache License 2.0
754 stars 117 forks source link

Timepicker #65

Closed hamann closed 11 years ago

hamann commented 11 years ago

Hi,

I've added a timepicker to choose a date range instead of typing the url params manually. I'm not a web developer, so it's possible that it needs a bit refactoring.

falkenbt commented 11 years ago

Thanks for the contribution! Works for me.

Currently if you click on "select date", the dates are being reset. Could you restore them so that one could easily tweak the date settings?

Also I would like to stick the from/to settings to the session, so that you can switch between dashboards using the same time interval. Is that something you could include or would you consider this a seperate feature?

hamann commented 11 years ago

That's a good idea! The dates will be stored now into a cookie.

falkenbt commented 11 years ago

I've seen two issues with this:

  1. Try setting a date, click 'show'. Then modify one of either start and end. This influences the other date which should not happen. (Tested on FF and Chrome)
  2. The cookie data has no effect when switching between dashboards
chjohnst commented 11 years ago

I tested this on Safari (will try chrome tomorrow) but for 1) not sure what you mean, otherwise the patch worked good for me.

hamann commented 11 years ago

What falkenbt means is, when you want to change one of the dates, the time will be stripped from the other one. That's odd and I will investigate into this.

About switching dashboards - at the moment the dates are stored, but you have to explicitly click on 'select date' and 'show' again. Would it be sufficient to store the dates in SessionStorage and using the dates automatically when switching between dashboards as long as you are in the same window/tab or click on a new 'reset' button?

falkenbt commented 11 years ago

Sounds good to me. The cookie storage would probably work for this as well but SessionStorage is indeed more powerful and could maybe be used in the future for other things.

Just a sidenote: I probably won't use the reset button a lot because we already have the links to the default relative times next to the timepicker.

hamann commented 11 years ago

With my last changes switching dashboards with selected dates should work now, but the page gets loaded twice. I don't know how to change this behaviour. Maybe someone with a better JS experience could have a look at it?

keymon commented 11 years ago

This is a nice feature.

I would extend the cookie feature to all the time settings. In that case, we should set the cookie in the controller instead of javascript.

criemen commented 11 years ago

This sounds like a very nice feature. I would especially prefer if the selected time (via the time picker or via the shortcut links) could be saved in the session/in a cookie, as I want to always view my dashboards for the last 4 hours, not the last hour, but I tend to forget clicking on the Last 4 hours button. Thanks for your work!

hamann commented 11 years ago

I moved the cookie handling from javascript in the controller. Simplified the js code a lot and allowes us to store all time settings.

falkenbt commented 11 years ago

sounds good, I will try to test this but I'm really busy currently.

keymon commented 11 years ago

I have just tested this feature. So far so good, but I suggest redirect to the /category/dashboard/time/from/to url if the cookie is set and no time is selected. Makes sense keep the url in sync with the current visualization.

I sent you a PR fixing conflicts and adding the redirect. Merge it and count with my +1.

hamann commented 11 years ago

Done. Thx, keymon

falkenbt commented 11 years ago

@keymon still +1? Wanna merge?

keymon commented 11 years ago

Yes, I will do.