prometheus/promdash — pull request #17 by juliusv (2014-01-03 13:25:45+00:00)
Title: Fix server selection in graphs.

I accidentally broke this in my graph/frame-widget PR by not passing in the raw `servers` array (only `serversById`) into the `graph` directive anymore... I decided to now simply pass in `servers` to the directive instead and do the generation of `serversById` separately in each graph scope. Yes, this uses a tiny bit more memory, but seems to encapsulate its usage a bit better.

In the graph controller, I decided to not use a `$watch` to recalculate `serversById`, but just do it once in the beginning: when I used a `$watch`, it would trigger the recomputation too late (after `refreshGraph`, where the result is already needed), and also, the `servers` list cannot currently change without reloading the entire page, so it should be fine to compute it only once.