diff --git a/pkg/plugins/datasource_plugin.go b/pkg/plugins/datasource_plugin.go index e46c2709649..e62157a7a13 100644 --- a/pkg/plugins/datasource_plugin.go +++ b/pkg/plugins/datasource_plugin.go @@ -8,15 +8,13 @@ import ( type DataSourcePlugin struct { FrontendPluginBase - Annotations bool `json:"annotations"` - Metrics bool `json:"metrics"` - Alerting bool `json:"alerting"` - MinInterval bool `json:"minInterval,omitempty"` - CacheTimeout bool `json:"cacheTimeout,omitempty"` - MaxDataPoints bool `json:"maxDataPoints,omitempty"` - BuiltIn bool `json:"builtIn,omitempty"` - Mixed bool `json:"mixed,omitempty"` - HasHelp bool `json:"hasHelp,omitempty"` + Annotations bool `json:"annotations"` + Metrics bool `json:"metrics"` + Alerting bool `json:"alerting"` + QueryOptions map[string]bool `json:"queryOptions,omitempty"` + BuiltIn bool `json:"builtIn,omitempty"` + Mixed bool `json:"mixed,omitempty"` + HasQueryHelp bool `json:"hasQueryHelp,omitempty"` Routes []*AppPluginRoute `json:"-"` } @@ -31,12 +29,12 @@ func (p *DataSourcePlugin) Load(decoder *json.Decoder, pluginDir string) error { } // look for help markdown - helpPath := filepath.Join(p.PluginDir, "HELP.md") + helpPath := filepath.Join(p.PluginDir, "QUERY_HELP.md") if _, err := os.Stat(helpPath); os.IsNotExist(err) { - helpPath = filepath.Join(p.PluginDir, "help.md") + helpPath = filepath.Join(p.PluginDir, "query_help.md") } if _, err := os.Stat(helpPath); err == nil { - p.HasHelp = true + p.HasQueryHelp = true } DataSources[p.Id] = p diff --git a/public/app/core/utils/kbn.js b/public/app/core/utils/kbn.js index 6f8340d5940..37888fb10ac 100644 --- a/public/app/core/utils/kbn.js +++ b/public/app/core/utils/kbn.js @@ -163,21 +163,15 @@ function($, _) { ms: 0.001 }; - kbn.calculateInterval = function(range, resolution, userInterval) { + kbn.calculateInterval = function(range, resolution, lowLimitInterval) { var lowLimitMs = 1; // 1 millisecond default low limit - var intervalMs, lowLimitInterval; + var intervalMs; - if (userInterval) { - if (userInterval[0] === '>') { - lowLimitInterval = userInterval.slice(1); - lowLimitMs = kbn.interval_to_ms(lowLimitInterval); - } - else { - return { - intervalMs: kbn.interval_to_ms(userInterval), - interval: userInterval, - }; + if (lowLimitInterval) { + if (lowLimitInterval[0] === '>') { + lowLimitInterval = lowLimitInterval.slice(1); } + lowLimitMs = kbn.interval_to_ms(lowLimitInterval); } intervalMs = kbn.round_interval((range.to.valueOf() - range.from.valueOf()) / resolution); diff --git a/public/app/features/panel/metrics_tab.ts b/public/app/features/panel/metrics_tab.ts index e57a685d4e4..4feaf516438 100644 --- a/public/app/features/panel/metrics_tab.ts +++ b/public/app/features/panel/metrics_tab.ts @@ -16,12 +16,10 @@ export class MetricsTabCtrl { addQueryDropdown: any; queryTroubleshooterOpen: boolean; helpOpen: boolean; - hasHelp: boolean; - helpHtml: string; - hasMinInterval: boolean; - hasCacheTimeout: boolean; - hasMaxDataPoints: boolean; optionsOpen: boolean; + hasQueryHelp: boolean; + helpHtml: string; + queryOptions: any; /** @ngInject */ constructor($scope, private $sce, private datasourceSrv, private backendSrv, private $timeout) { @@ -46,10 +44,8 @@ export class MetricsTabCtrl { } updateDatasourceOptions() { - this.hasHelp = this.current.meta.hasHelp; - this.hasMinInterval = this.current.meta.minInterval === true; - this.hasCacheTimeout = this.current.meta.cacheTimeout === true; - this.hasMaxDataPoints = this.current.meta.maxDataPoints === true; + this.hasQueryHelp = this.current.meta.hasQueryHelp; + this.queryOptions = this.current.meta.queryOptions; } getOptions(includeBuiltin) { @@ -89,7 +85,7 @@ export class MetricsTabCtrl { this.queryTroubleshooterOpen = false; this.helpOpen = !this.helpOpen; - this.backendSrv.get(`/api/plugins/${this.current.meta.id}/markdown/help`).then(res => { + this.backendSrv.get(`/api/plugins/${this.current.meta.id}/markdown/query_help`).then(res => { var md = new Remarkable(); this.helpHtml = this.$sce.trustAsHtml(md.render(res)); }); diff --git a/public/app/features/panel/partials/metrics_tab.html b/public/app/features/panel/partials/metrics_tab.html index d9ad033e9ea..e15f7f3f552 100644 --- a/public/app/features/panel/partials/metrics_tab.html +++ b/public/app/features/panel/partials/metrics_tab.html @@ -15,12 +15,12 @@
$__interval_ms
for numeric variable that can be used in math expressions.
1m
if your data is written every minute.
+ 1m
if your data is written every minute.
+