grafana/grafana — pull request #945 by ikreymer (2014-10-16 05:22:32+00:00)
Title: InfluxDB Continuous Query Editor

This pull request adds a very basic continuous query editor for Grafana on the main Dashboard configuration panel, as shown below:

![image](https://cloud.githubusercontent.com/assets/1015759/4657852/d52d40e4-54f2-11e4-8240-bb032db6174f.png)

This basic editor provides support for adding and removing continuous queries, and sorting them by either id, query string or the series name that they write into.
Continuous Queries are often a key part of using InfluxDB, but there is no way to edit them besides InfluxDB cli interface. This is a big impediment to usability of Grafana with InfluxDB in certain cases where large amounts of data is involved and using unaggregated data is not feasible. Somewhat related to #420.

A few notes:

* Continuous Queries are supported only for InfluxDB. For other data sources, an error message is shown.

* Not sure if the dashboard editor is the right place for this. Initially I thought of adding a feature along with templates and annotations, but since the CQs are not really saved as part of the Dashboard, the global settings made more sense.

* The queries are entered in a simple text box. I didn't use the query builder to start off, but that could be a future improvement. Would have to account for $timeRange and template variables if they are included in the query builder, probably evaluate at add time. (Currently template variables are not used).

* Only tested with InfluxDB 1.8.x conventions. I imagine CQ syntax will continue to change in InfluxDB so will have to add support for newer features (such as named continuous queries, once they're supported).

This is my first PR for Grafana, so feel free to add suggestions for improvement, better following conventions, etc...