forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'query-editor-breakout'
Conflicts: CHANGELOG.md
- Loading branch information
Showing
53 changed files
with
1,701 additions
and
1,383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
---- | ||
page_title: Data source Plugin API | ||
page_description: Data Source Plugin Description | ||
page_keywords: grafana, data source, plugin, api, docs | ||
--- | ||
|
||
# Data source plugin API | ||
|
||
All data sources in Grafana are implemented as plugins. | ||
|
||
## Breaking change in 2.2 | ||
|
||
In Grafana 2.2 a breaking change was introduced for how data source query editors | ||
are structured, defined and loaded. This was in order to support mixing multiple data sources | ||
in the same panel. | ||
|
||
In Grafana 2.2, the query editor is no longer defined using the partials section in | ||
`plugin.json`, but defined via an angular directive named using convention naming | ||
scheme like `metricQueryEditor<data source type name>`. For example | ||
|
||
Graphite defines a directive like this: | ||
|
||
```javascript | ||
module.directive('metricQueryEditorGraphite', function() { | ||
return {controller: 'GraphiteQueryCtrl', templateUrl: 'app/plugins/datasource/graphite/partials/query.editor.html'}; | ||
}); | ||
``` | ||
|
||
Even though the data source type name is with lowercase `g`, the directive uses capital `G` in `Graphite` because | ||
that is how angular directives needs to be named in order to match an element with name `<metric-query-editor-graphite />`. | ||
You also specify the query controller here instead of in the query.editor.html partial like before. | ||
|
||
### query.editor.html | ||
|
||
This partial needs to be updated, remove the `np-repeat` this is done in the outer partial now,m the query.editor.html | ||
should only render a single query. Take a look at the Graphite or InfluxDB partials for `query.editor.html` for reference. | ||
You should also add a `tight-form-item` with `{{target.refId}}`, all queries needs to be assigned a letter (`refId`). | ||
These query reference letters are going to be utilized in a later feature. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,48 @@ | ||
<div ng-include src="datasource.meta.partials.query"></div> | ||
<div class="editor-row"> | ||
|
||
<div class="tight-form-container"> | ||
<query-editor-loader ng-repeat="target in panel.targets" ng-class="{'tight-form-disabled': target.hide}" > | ||
</query-editor-loader> | ||
</div> | ||
|
||
<div style="margin: 20px 0 0 0"> | ||
<button class="btn btn-inverse" ng-click="addDataQuery()" ng-hide="datasource.meta.mixed"> | ||
<i class="fa fa-plus"></i> | ||
Query | ||
</button> | ||
|
||
<div class="dropdown" ng-if="datasource.meta.mixed"> | ||
<button class="btn btn-inverse dropdown-toggle" data-toggle="dropdown"> | ||
<i class="fa fa-plus"></i> | ||
Query <span class="caret"></span> | ||
</button> | ||
|
||
<ul class="dropdown-menu" role="menu"> | ||
<li ng-repeat="datasource in datasources" role="menuitem" ng-hide="datasource.meta.builtIn"> | ||
<a ng-click="addDataQuery(datasource);">{{datasource.name}}</a> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
</div> | ||
|
||
<datasource-editor-view datasource="panel.datasource" name="metric-query-options"></datasource-editor-view> | ||
</div> | ||
|
||
<div class="editor-row" style="margin-top: 30px"> | ||
<button class="btn btn-inverse pull-right" ng-click="addDataQuery(panel.target)"> | ||
<i class="fa fa-plus"></i> | ||
Add query | ||
</button> | ||
|
||
<div class="pull-right dropdown" style="margin-right: 10px;"> | ||
<div class="pull-right dropdown" style="margin-right: 10px;"> | ||
<button class="btn btn-inverse dropdown-toggle" data-toggle="dropdown" bs-tooltip="'Datasource'"> | ||
<i class="fa fa-database"></i> | ||
{{datasource.name}} <span class="caret"></span> | ||
{{datasource.name}} <span class="caret"></span> | ||
</button> | ||
|
||
<ul class="dropdown-menu" role="menu"> | ||
<li ng-repeat="datasource in datasources" role="menuitem"> | ||
<a ng-click="setDatasource(datasource.value);">{{datasource.name}}</a> | ||
</li> | ||
</ul> | ||
</div> | ||
<ul class="dropdown-menu" role="menu"> | ||
<li ng-repeat="datasource in datasources" role="menuitem"> | ||
<a ng-click="setDatasource(datasource);">{{datasource.name}}</a> | ||
</li> | ||
</ul> | ||
</div> | ||
|
||
<div class="clearfix"></div> | ||
</div> |
Oops, something went wrong.