mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'develop' into develop-scrollable-panels
This commit is contained in:
commit
856a0393ab
@ -37,6 +37,7 @@
|
||||
|
||||
## Fixes
|
||||
* **Gzip**: Fixes bug gravatar images when gzip was enabled [#5952](https://github.com/grafana/grafana/issues/5952)
|
||||
* **Alert list**: Now shows alert state changes even after adding manual annotations on dashboard [#9951](https://github.com/grafana/grafana/issues/9951)
|
||||
|
||||
# 4.6.2 (2017-11-16)
|
||||
|
||||
|
3
docker/blocks/prometheus2/Dockerfile
Normal file
3
docker/blocks/prometheus2/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
||||
FROM prom/prometheus:v2.0.0
|
||||
ADD prometheus.yml /etc/prometheus/
|
||||
ADD alert.rules /etc/prometheus/
|
10
docker/blocks/prometheus2/alert.rules
Normal file
10
docker/blocks/prometheus2/alert.rules
Normal file
@ -0,0 +1,10 @@
|
||||
# Alert Rules
|
||||
|
||||
ALERT AppCrash
|
||||
IF process_open_fds > 0
|
||||
FOR 15s
|
||||
LABELS { severity="critical" }
|
||||
ANNOTATIONS {
|
||||
summary = "Number of open fds > 0",
|
||||
description = "Just testing"
|
||||
}
|
35
docker/blocks/prometheus2/prometheus.yml
Normal file
35
docker/blocks/prometheus2/prometheus.yml
Normal file
@ -0,0 +1,35 @@
|
||||
# my global config
|
||||
global:
|
||||
scrape_interval: 10s # By default, scrape targets every 15 seconds.
|
||||
evaluation_interval: 10s # By default, scrape targets every 15 seconds.
|
||||
# scrape_timeout is set to the global default (10s).
|
||||
|
||||
# Load and evaluate rules in this file every 'evaluation_interval' seconds.
|
||||
#rule_files:
|
||||
# - "alert.rules"
|
||||
# - "first.rules"
|
||||
# - "second.rules"
|
||||
|
||||
# alerting:
|
||||
# alertmanagers:
|
||||
# - scheme: http
|
||||
# static_configs:
|
||||
# - targets:
|
||||
# - "127.0.0.1:9093"
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'prometheus'
|
||||
static_configs:
|
||||
- targets: ['localhost:9090']
|
||||
|
||||
- job_name: 'node_exporter'
|
||||
static_configs:
|
||||
- targets: ['127.0.0.1:9100']
|
||||
|
||||
- job_name: 'fake-data-gen'
|
||||
static_configs:
|
||||
- targets: ['127.0.0.1:9091']
|
||||
|
||||
- job_name: 'grafana'
|
||||
static_configs:
|
||||
- targets: ['127.0.0.1:3000']
|
@ -22,6 +22,7 @@ func GetAnnotations(c *middleware.Context) Response {
|
||||
PanelId: c.QueryInt64("panelId"),
|
||||
Limit: c.QueryInt64("limit"),
|
||||
Tags: c.QueryStrings("tags"),
|
||||
Type: c.Query("type"),
|
||||
}
|
||||
|
||||
repo := annotations.GetRepository()
|
||||
|
@ -194,7 +194,8 @@ func (hs *HttpServer) metricsEndpoint(ctx *macaron.Context) {
|
||||
}
|
||||
|
||||
func (hs *HttpServer) healthHandler(ctx *macaron.Context) {
|
||||
if ctx.Req.Method != "GET" || ctx.Req.URL.Path != "/api/health" {
|
||||
notHeadOrGet := ctx.Req.Method != http.MethodGet && ctx.Req.Method != http.MethodHead
|
||||
if notHeadOrGet || ctx.Req.URL.Path != "/api/health" {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ type ItemQuery struct {
|
||||
DashboardId int64 `json:"dashboardId"`
|
||||
PanelId int64 `json:"panelId"`
|
||||
Tags []string `json:"tags"`
|
||||
Type string `json:"type"`
|
||||
|
||||
Limit int64 `json:"limit"`
|
||||
}
|
||||
|
@ -158,6 +158,10 @@ func (r *SqlAnnotationRepo) Find(query *annotations.ItemQuery) ([]*annotations.I
|
||||
params = append(params, query.From, query.To)
|
||||
}
|
||||
|
||||
if query.Type == "alert" {
|
||||
sql.WriteString(` AND annotation.alert_id > 0`)
|
||||
}
|
||||
|
||||
if len(query.Tags) > 0 {
|
||||
keyValueFilters := []string{}
|
||||
|
||||
|
@ -42,6 +42,7 @@ func TestAnnotations(t *testing.T) {
|
||||
UserId: 1,
|
||||
DashboardId: 1,
|
||||
Text: "hello",
|
||||
Type: "alert",
|
||||
Epoch: 10,
|
||||
Tags: []string{"outage", "error", "type:outage", "server:server-1"},
|
||||
}
|
||||
@ -91,6 +92,19 @@ func TestAnnotations(t *testing.T) {
|
||||
So(items, ShouldHaveLength, 0)
|
||||
})
|
||||
|
||||
Convey("Should not find one when type filter does not match", func() {
|
||||
items, err := repo.Find(&annotations.ItemQuery{
|
||||
OrgId: 1,
|
||||
DashboardId: 1,
|
||||
From: 1,
|
||||
To: 15,
|
||||
Type: "alert",
|
||||
})
|
||||
|
||||
So(err, ShouldBeNil)
|
||||
So(items, ShouldHaveLength, 0)
|
||||
})
|
||||
|
||||
Convey("Should find one when all tag filters does match", func() {
|
||||
items, err := repo.Find(&annotations.ItemQuery{
|
||||
OrgId: 1,
|
||||
|
@ -381,10 +381,11 @@ func TestDashboardDataAccess(t *testing.T) {
|
||||
childDash2 := insertTestDashboard("child dash 2", 1, folder2.Id, false, "prod")
|
||||
|
||||
currentUser := createUser("viewer", "Viewer", false)
|
||||
var rootFolderId int64 = 0
|
||||
|
||||
Convey("and one folder is expanded, the other collapsed", func() {
|
||||
Convey("should return dashboards in root and expanded folder", func() {
|
||||
query := &search.FindPersistedDashboardsQuery{FolderIds: []int64{folder1.Id}, SignedInUser: &m.SignedInUser{UserId: currentUser.Id, OrgId: 1}, OrgId: 1}
|
||||
query := &search.FindPersistedDashboardsQuery{FolderIds: []int64{rootFolderId, folder1.Id}, SignedInUser: &m.SignedInUser{UserId: currentUser.Id, OrgId: 1}, OrgId: 1}
|
||||
err := SearchDashboards(query)
|
||||
So(err, ShouldBeNil)
|
||||
So(len(query.Result), ShouldEqual, 4)
|
||||
|
@ -35,7 +35,7 @@ func NewMysqlQueryEndpoint(datasource *models.DataSource) (tsdb.TsdbQueryEndpoin
|
||||
MacroEngine: NewMysqlMacroEngine(),
|
||||
}
|
||||
|
||||
cnnstr := fmt.Sprintf("%s:%s@%s(%s)/%s?collation=utf8mb4_unicode_ci&parseTime=true&loc=UTC",
|
||||
cnnstr := fmt.Sprintf("%s:%s@%s(%s)/%s?collation=utf8mb4_unicode_ci&parseTime=true&loc=UTC&allowNativePasswords=true",
|
||||
datasource.User,
|
||||
datasource.Password,
|
||||
"tcp",
|
||||
|
@ -48,7 +48,10 @@ function (_, $, coreModule) {
|
||||
segment.html = selected.html || selected.value;
|
||||
segment.fake = false;
|
||||
segment.expandable = selected.expandable;
|
||||
segment.type = selected.type;
|
||||
|
||||
if (selected.type) {
|
||||
segment.type = selected.type;
|
||||
}
|
||||
}
|
||||
else if (segment.custom !== 'false') {
|
||||
segment.value = value;
|
||||
|
@ -52,7 +52,7 @@ export class SearchSrv {
|
||||
}
|
||||
|
||||
search(options) {
|
||||
if (!options.query) {
|
||||
if (!options.query && !options.tag) {
|
||||
return this.browse();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import { SearchSrv } from 'app/core/services/search_srv';
|
||||
export class DashboardListCtrl {
|
||||
public sections: any [];
|
||||
tags: any [];
|
||||
selectedTagFilter: any;
|
||||
query: any;
|
||||
navModel: any;
|
||||
canDelete = false;
|
||||
@ -15,27 +16,40 @@ export class DashboardListCtrl {
|
||||
this.navModel = navModelSrv.getNav('dashboards', 'dashboards');
|
||||
this.query = {query: '', mode: 'tree', tag: []};
|
||||
|
||||
this.getDashboards();
|
||||
// this.getDashboards().then(() => {
|
||||
// this.getTags();
|
||||
// });
|
||||
this.getDashboards().then(() => {
|
||||
this.getTags();
|
||||
});
|
||||
}
|
||||
|
||||
getDashboards() {
|
||||
return this.searchSrv.browse().then((result) => {
|
||||
if (this.query.query.length === 0 && this.query.tag.length === 0) {
|
||||
return this.searchSrv.browse().then((result) => {
|
||||
return this.initDashboardList(result);
|
||||
});
|
||||
}
|
||||
|
||||
this.sections = result;
|
||||
|
||||
for (let section of this.sections) {
|
||||
section.checked = false;
|
||||
|
||||
for (let dashboard of section.items) {
|
||||
dashboard.checked = false;
|
||||
}
|
||||
}
|
||||
return this.searchSrv.search(this.query).then((result) => {
|
||||
return this.initDashboardList(result);
|
||||
});
|
||||
}
|
||||
|
||||
initDashboardList(result: any) {
|
||||
if (!result) {
|
||||
this.sections = [];
|
||||
return;
|
||||
}
|
||||
|
||||
this.sections = result;
|
||||
|
||||
for (let section of this.sections) {
|
||||
section.checked = false;
|
||||
|
||||
for (let dashboard of section.items) {
|
||||
dashboard.checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
selectionChanged() {
|
||||
|
||||
let selectedDashboards = 0;
|
||||
@ -119,11 +133,16 @@ export class DashboardListCtrl {
|
||||
});
|
||||
}
|
||||
|
||||
// getTags() {
|
||||
// return this.backendSrv.get('/api/dashboards/tags').then((results) => {
|
||||
// this.tags = results;
|
||||
// });
|
||||
// }
|
||||
toggleFolder(section) {
|
||||
return this.searchSrv.toggleFolder(section);
|
||||
}
|
||||
|
||||
getTags() {
|
||||
return this.searchSrv.getDashboardTags().then((results) => {
|
||||
this.tags = [{ term: 'Filter By Tag', disabled: true }].concat(results);
|
||||
this.selectedTagFilter = this.tags[0];
|
||||
});
|
||||
}
|
||||
|
||||
filterByTag(tag, evt) {
|
||||
this.query.tag.push(tag);
|
||||
@ -134,6 +153,12 @@ export class DashboardListCtrl {
|
||||
}
|
||||
}
|
||||
|
||||
filterChange() {
|
||||
this.query.tag.push(this.selectedTagFilter.term);
|
||||
this.selectedTagFilter = this.tags[0];
|
||||
this.getDashboards();
|
||||
}
|
||||
|
||||
removeTag(tag, evt) {
|
||||
this.query.tag = _.without(this.query.tag, tag);
|
||||
this.getDashboards();
|
||||
|
@ -54,23 +54,31 @@
|
||||
<div class="admin-list-table" style="height: 80%">
|
||||
<div gemini-scrollbar>
|
||||
<div ng-show="ctrl.sections.length > 0">
|
||||
<!-- <div>
|
||||
<select class="gf-form-input" ng-model="ctrl.query.tags" ng-options="t.term for t in ctrl.tags" />
|
||||
</div> -->
|
||||
<div>
|
||||
<select
|
||||
class="gf-form-input"
|
||||
ng-model="ctrl.selectedTagFilter"
|
||||
ng-options="t.term disable when t.disabled for t in ctrl.tags"
|
||||
ng-change="ctrl.filterChange(tag, $index)"
|
||||
/>
|
||||
</div>
|
||||
<div ng-repeat="section in ctrl.sections" class="search-section">
|
||||
<gf-form-switch
|
||||
switch-class="gf-form-switch--table-cell"
|
||||
on-change="ctrl.selectionChanged()"
|
||||
checked="section.checked">
|
||||
</gf-form-switch>
|
||||
<a class="search-section__header pointer" ng-show="::section.title" ng-click="section.collapsed = !section.collapsed">
|
||||
<i class="search-section__header__icon" ng-class="section.icon"></i>
|
||||
<span class="search-section__header__text">{{::section.title}}</span>
|
||||
<i class="fa fa-minus search-section__header__toggle" ng-hide="section.collapsed"></i>
|
||||
<i class="fa fa-plus search-section__header__toggle" ng-show="section.collapsed"></i>
|
||||
</a>
|
||||
|
||||
<div ng-if="!section.collapsed">
|
||||
<div class="search-section__header pointer" ng-show="::section.title">
|
||||
<gf-form-switch
|
||||
switch-class="gf-form-switch--table-cell"
|
||||
on-change="ctrl.selectionChanged()"
|
||||
checked="section.checked">
|
||||
</gf-form-switch>
|
||||
<a ng-click="ctrl.toggleFolder(section)">
|
||||
<i class="search-section__header__icon" ng-class="section.icon"></i>
|
||||
<span class="search-section__header__text">{{::section.title}}</span>
|
||||
<i class="fa fa-minus search-section__header__toggle" ng-show="section.expanded"></i>
|
||||
<i class="fa fa-plus search-section__header__toggle" ng-hide="section.expanded"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div ng-if="section.expanded">
|
||||
<div ng-repeat="item in section.items" class="search-item" ng-class="{'selected': item.selected}">
|
||||
<gf-form-switch
|
||||
switch-class="gf-form-switch--table-cell"
|
||||
@ -124,7 +132,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<em class="muted" ng-hide="ctrl.dashboards.length > 0">
|
||||
<em class="muted" ng-hide="ctrl.sections.length > 0">
|
||||
No Dashboards or Folders found.
|
||||
</em>
|
||||
</div>
|
||||
|
@ -61,6 +61,63 @@ describe('DashboardListCtrl', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('when searching dashboards', () => {
|
||||
beforeEach(() => {
|
||||
const response = [
|
||||
{
|
||||
id: 410,
|
||||
title: "afolder",
|
||||
type: "dash-folder",
|
||||
items: [
|
||||
{
|
||||
id: 399,
|
||||
title: "Dashboard Test",
|
||||
url: "dashboard/db/dashboard-test",
|
||||
icon: 'fa fa-folder',
|
||||
tags: [],
|
||||
isStarred: false,
|
||||
folderId: 410,
|
||||
folderTitle: "afolder",
|
||||
folderSlug: "afolder"
|
||||
}
|
||||
],
|
||||
tags: [],
|
||||
isStarred: false
|
||||
},
|
||||
{
|
||||
id: 0,
|
||||
title: "Root",
|
||||
icon: 'fa fa-folder-open',
|
||||
uri: "db/something-else",
|
||||
type: "dash-db",
|
||||
items: [
|
||||
{
|
||||
id: 500,
|
||||
title: "Dashboard Test",
|
||||
url: "dashboard/db/dashboard-test",
|
||||
icon: 'fa fa-folder',
|
||||
tags: [],
|
||||
isStarred: false
|
||||
}
|
||||
],
|
||||
tags: [],
|
||||
isStarred: false,
|
||||
}
|
||||
];
|
||||
ctrl = createCtrlWithStubs(response);
|
||||
ctrl.query.query = 'd';
|
||||
return ctrl.getDashboards();
|
||||
});
|
||||
|
||||
it('should set checked to false on all sections and children', () => {
|
||||
expect(ctrl.sections.length).toEqual(2);
|
||||
expect(ctrl.sections[0].checked).toEqual(false);
|
||||
expect(ctrl.sections[0].items[0].checked).toEqual(false);
|
||||
expect(ctrl.sections[1].checked).toEqual(false);
|
||||
expect(ctrl.sections[1].items[0].checked).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when selecting dashboards', () => {
|
||||
let ctrl;
|
||||
|
||||
|
@ -11,7 +11,6 @@ import {metricsTabDirective} from './metrics_tab';
|
||||
|
||||
class MetricsPanelCtrl extends PanelCtrl {
|
||||
scope: any;
|
||||
loading: boolean;
|
||||
datasource: any;
|
||||
datasourceName: any;
|
||||
$q: any;
|
||||
|
@ -29,6 +29,7 @@ export class PanelCtrl {
|
||||
containerHeight: any;
|
||||
events: Emitter;
|
||||
timing: any;
|
||||
loading: boolean;
|
||||
|
||||
constructor($scope, $injector) {
|
||||
this.$injector = $injector;
|
||||
|
@ -1,2 +0,0 @@
|
||||
declare var test: any;
|
||||
export default test;
|
@ -1,28 +1,27 @@
|
||||
define([
|
||||
'lodash',
|
||||
'app/core/table_model',
|
||||
],
|
||||
function (_, TableModel) {
|
||||
'use strict';
|
||||
import _ from 'lodash';
|
||||
import TableModel from 'app/core/table_model';
|
||||
|
||||
function InfluxSeries(options) {
|
||||
export default class InfluxSeries {
|
||||
|
||||
series: any;
|
||||
alias: any;
|
||||
annotation: any;
|
||||
|
||||
constructor(options) {
|
||||
this.series = options.series;
|
||||
this.alias = options.alias;
|
||||
this.annotation = options.annotation;
|
||||
}
|
||||
|
||||
var p = InfluxSeries.prototype;
|
||||
|
||||
p.getTimeSeries = function() {
|
||||
getTimeSeries() {
|
||||
var output = [];
|
||||
var self = this;
|
||||
var i, j;
|
||||
|
||||
if (self.series.length === 0) {
|
||||
if (this.series.length === 0) {
|
||||
return output;
|
||||
}
|
||||
|
||||
_.each(self.series, function(series) {
|
||||
_.each(this.series, (series) => {
|
||||
var columns = series.columns.length;
|
||||
var tags = _.map(series.tags, function(value, key) {
|
||||
return key + ': ' + value;
|
||||
@ -35,8 +34,8 @@ function (_, TableModel) {
|
||||
seriesName = seriesName + '.' + columnName;
|
||||
}
|
||||
|
||||
if (self.alias) {
|
||||
seriesName = self._getSeriesName(series, j);
|
||||
if (this.alias) {
|
||||
seriesName = this._getSeriesName(series, j);
|
||||
} else if (series.tags) {
|
||||
seriesName = seriesName + ' {' + tags.join(', ') + '}';
|
||||
}
|
||||
@ -53,9 +52,9 @@ function (_, TableModel) {
|
||||
});
|
||||
|
||||
return output;
|
||||
};
|
||||
}
|
||||
|
||||
p._getSeriesName = function(series, index) {
|
||||
_getSeriesName(series, index) {
|
||||
var regex = /\$(\w+)|\[\[([\s\S]+?)\]\]/g;
|
||||
var segments = series.name.split('.');
|
||||
|
||||
@ -72,30 +71,29 @@ function (_, TableModel) {
|
||||
if (!series.tags) { return match; }
|
||||
return series.tags[tag];
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
p.getAnnotations = function () {
|
||||
getAnnotations() {
|
||||
var list = [];
|
||||
var self = this;
|
||||
|
||||
_.each(this.series, function (series) {
|
||||
_.each(this.series, (series) => {
|
||||
var titleCol = null;
|
||||
var timeCol = null;
|
||||
var tagsCol = [];
|
||||
var textCol = null;
|
||||
|
||||
_.each(series.columns, function(column, index) {
|
||||
_.each(series.columns, (column, index) => {
|
||||
if (column === 'time') { timeCol = index; return; }
|
||||
if (column === 'sequence_number') { return; }
|
||||
if (!titleCol) { titleCol = index; }
|
||||
if (column === self.annotation.titleColumn) { titleCol = index; return; }
|
||||
if (_.includes((self.annotation.tagsColumn || '').replace(' ', '').split(","), column)) { tagsCol.push(index); return; }
|
||||
if (column === self.annotation.textColumn) { textCol = index; return; }
|
||||
if (column === this.annotation.titleColumn) { titleCol = index; return; }
|
||||
if (_.includes((this.annotation.tagsColumn || '').replace(' ', '').split(","), column)) { tagsCol.push(index); return; }
|
||||
if (column === this.annotation.textColumn) { textCol = index; return; }
|
||||
});
|
||||
|
||||
_.each(series.values, function (value) {
|
||||
_.each(series.values, (value) => {
|
||||
var data = {
|
||||
annotation: self.annotation,
|
||||
annotation: this.annotation,
|
||||
time: + new Date(value[timeCol]),
|
||||
title: value[titleCol],
|
||||
// Remove empty values, then split in different tags for comma separated values
|
||||
@ -108,18 +106,17 @@ function (_, TableModel) {
|
||||
});
|
||||
|
||||
return list;
|
||||
};
|
||||
}
|
||||
|
||||
p.getTable = function() {
|
||||
var table = new TableModel.default();
|
||||
var self = this;
|
||||
getTable() {
|
||||
var table = new TableModel();
|
||||
var i, j;
|
||||
|
||||
if (self.series.length === 0) {
|
||||
if (this.series.length === 0) {
|
||||
return table;
|
||||
}
|
||||
|
||||
_.each(self.series, function(series, seriesIndex) {
|
||||
_.each(this.series, (series, seriesIndex) => {
|
||||
|
||||
if (seriesIndex === 0) {
|
||||
table.columns.push({text: 'Time', type: 'time'});
|
||||
@ -151,7 +148,11 @@ function (_, TableModel) {
|
||||
});
|
||||
|
||||
return table;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return InfluxSeries;
|
||||
});
|
@ -1,5 +1,3 @@
|
||||
///<reference path="../../../headers/common.d.ts" />
|
||||
|
||||
import _ from 'lodash';
|
||||
|
||||
export default class ResponseParser {
|
||||
|
@ -1,5 +1,3 @@
|
||||
import {describe, it, expect} from 'test/lib/common';
|
||||
|
||||
import InfluxQuery from '../influx_query';
|
||||
|
||||
describe('InfluxQuery', function() {
|
||||
@ -12,7 +10,7 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
var queryText = query.render();
|
||||
expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($__interval) fill(null)');
|
||||
expect(queryText).toBe('SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($__interval) fill(null)');
|
||||
});
|
||||
});
|
||||
|
||||
@ -24,7 +22,7 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
var queryText = query.render();
|
||||
expect(queryText).to.be('SELECT mean("value") FROM "5m_avg"."cpu" WHERE $timeFilter GROUP BY time($__interval) fill(null)');
|
||||
expect(queryText).toBe('SELECT mean("value") FROM "5m_avg"."cpu" WHERE $timeFilter GROUP BY time($__interval) fill(null)');
|
||||
});
|
||||
});
|
||||
|
||||
@ -43,7 +41,7 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
var queryText = query.render();
|
||||
expect(queryText).to.be('SELECT mean("value") /100 AS "text" FROM "cpu" WHERE $timeFilter GROUP BY time($__interval) fill(null)');
|
||||
expect(queryText).toBe('SELECT mean("value") /100 AS "text" FROM "cpu" WHERE $timeFilter GROUP BY time($__interval) fill(null)');
|
||||
});
|
||||
});
|
||||
|
||||
@ -57,7 +55,7 @@ describe('InfluxQuery', function() {
|
||||
|
||||
var queryText = query.render();
|
||||
|
||||
expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE ("hostname" = \'server\\\\1\') AND $timeFilter'
|
||||
expect(queryText).toBe('SELECT mean("value") FROM "cpu" WHERE ("hostname" = \'server\\\\1\') AND $timeFilter'
|
||||
+ ' GROUP BY time($__interval)');
|
||||
});
|
||||
|
||||
@ -69,7 +67,7 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
var queryText = query.render();
|
||||
expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE ("app" =~ /e.*/) AND $timeFilter GROUP BY time($__interval)');
|
||||
expect(queryText).toBe('SELECT mean("value") FROM "cpu" WHERE ("app" =~ /e.*/) AND $timeFilter GROUP BY time($__interval)');
|
||||
});
|
||||
});
|
||||
|
||||
@ -82,7 +80,7 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
var queryText = query.render();
|
||||
expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE ("hostname" = \'server1\' AND "app" = \'email\') AND ' +
|
||||
expect(queryText).toBe('SELECT mean("value") FROM "cpu" WHERE ("hostname" = \'server1\' AND "app" = \'email\') AND ' +
|
||||
'$timeFilter GROUP BY time($__interval)');
|
||||
});
|
||||
});
|
||||
@ -96,7 +94,7 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
var queryText = query.render();
|
||||
expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE ("hostname" = \'server1\' OR "hostname" = \'server2\') AND ' +
|
||||
expect(queryText).toBe('SELECT mean("value") FROM "cpu" WHERE ("hostname" = \'server1\' OR "hostname" = \'server2\') AND ' +
|
||||
'$timeFilter GROUP BY time($__interval)');
|
||||
});
|
||||
});
|
||||
@ -110,7 +108,7 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
var queryText = query.render();
|
||||
expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE ("value" > 5) AND $timeFilter');
|
||||
expect(queryText).toBe('SELECT mean("value") FROM "cpu" WHERE ("value" > 5) AND $timeFilter');
|
||||
});
|
||||
});
|
||||
|
||||
@ -123,7 +121,7 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
var queryText = query.render();
|
||||
expect(queryText).to.be('SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($__interval), "host"');
|
||||
expect(queryText).toBe('SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($__interval), "host"');
|
||||
});
|
||||
});
|
||||
|
||||
@ -135,7 +133,7 @@ describe('InfluxQuery', function() {
|
||||
groupBy: [],
|
||||
}, templateSrv, {});
|
||||
var queryText = query.render();
|
||||
expect(queryText).to.be('SELECT "value" FROM "cpu" WHERE $timeFilter');
|
||||
expect(queryText).toBe('SELECT "value" FROM "cpu" WHERE $timeFilter');
|
||||
});
|
||||
});
|
||||
|
||||
@ -147,7 +145,7 @@ describe('InfluxQuery', function() {
|
||||
groupBy: [{type: 'time'}, {type: 'fill', params: ['0']}],
|
||||
}, templateSrv, {});
|
||||
var queryText = query.render();
|
||||
expect(queryText).to.be('SELECT "value" FROM "cpu" WHERE $timeFilter GROUP BY time($__interval) fill(0)');
|
||||
expect(queryText).toBe('SELECT "value" FROM "cpu" WHERE $timeFilter GROUP BY time($__interval) fill(0)');
|
||||
});
|
||||
});
|
||||
|
||||
@ -160,10 +158,10 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
query.addGroupBy('tag(host)');
|
||||
expect(query.target.groupBy.length).to.be(3);
|
||||
expect(query.target.groupBy[1].type).to.be('tag');
|
||||
expect(query.target.groupBy[1].params[0]).to.be('host');
|
||||
expect(query.target.groupBy[2].type).to.be('fill');
|
||||
expect(query.target.groupBy.length).toBe(3);
|
||||
expect(query.target.groupBy[1].type).toBe('tag');
|
||||
expect(query.target.groupBy[1].params[0]).toBe('host');
|
||||
expect(query.target.groupBy[2].type).toBe('fill');
|
||||
});
|
||||
|
||||
it('should add tag last if no fill', function() {
|
||||
@ -173,8 +171,8 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
query.addGroupBy('tag(host)');
|
||||
expect(query.target.groupBy.length).to.be(1);
|
||||
expect(query.target.groupBy[0].type).to.be('tag');
|
||||
expect(query.target.groupBy.length).toBe(1);
|
||||
expect(query.target.groupBy[0].type).toBe('tag');
|
||||
});
|
||||
|
||||
});
|
||||
@ -188,8 +186,8 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
query.addSelectPart(query.selectModels[0], 'mean');
|
||||
expect(query.target.select[0].length).to.be(2);
|
||||
expect(query.target.select[0][1].type).to.be('mean');
|
||||
expect(query.target.select[0].length).toBe(2);
|
||||
expect(query.target.select[0][1].type).toBe('mean');
|
||||
});
|
||||
|
||||
it('should replace sum by mean', function() {
|
||||
@ -199,8 +197,8 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
query.addSelectPart(query.selectModels[0], 'sum');
|
||||
expect(query.target.select[0].length).to.be(2);
|
||||
expect(query.target.select[0][1].type).to.be('sum');
|
||||
expect(query.target.select[0].length).toBe(2);
|
||||
expect(query.target.select[0][1].type).toBe('sum');
|
||||
});
|
||||
|
||||
it('should add math before alias', function() {
|
||||
@ -210,8 +208,8 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
query.addSelectPart(query.selectModels[0], 'math');
|
||||
expect(query.target.select[0].length).to.be(4);
|
||||
expect(query.target.select[0][2].type).to.be('math');
|
||||
expect(query.target.select[0].length).toBe(4);
|
||||
expect(query.target.select[0][2].type).toBe('math');
|
||||
});
|
||||
|
||||
it('should add math last', function() {
|
||||
@ -221,8 +219,8 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
query.addSelectPart(query.selectModels[0], 'math');
|
||||
expect(query.target.select[0].length).to.be(3);
|
||||
expect(query.target.select[0][2].type).to.be('math');
|
||||
expect(query.target.select[0].length).toBe(3);
|
||||
expect(query.target.select[0][2].type).toBe('math');
|
||||
});
|
||||
|
||||
it('should replace math', function() {
|
||||
@ -232,8 +230,8 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
query.addSelectPart(query.selectModels[0], 'math');
|
||||
expect(query.target.select[0].length).to.be(3);
|
||||
expect(query.target.select[0][2].type).to.be('math');
|
||||
expect(query.target.select[0].length).toBe(3);
|
||||
expect(query.target.select[0][2].type).toBe('math');
|
||||
});
|
||||
|
||||
it('should add math when one only query part', function() {
|
||||
@ -243,8 +241,8 @@ describe('InfluxQuery', function() {
|
||||
}, templateSrv, {});
|
||||
|
||||
query.addSelectPart(query.selectModels[0], 'math');
|
||||
expect(query.target.select[0].length).to.be(2);
|
||||
expect(query.target.select[0][1].type).to.be('math');
|
||||
expect(query.target.select[0].length).toBe(2);
|
||||
expect(query.target.select[0][1].type).toBe('math');
|
||||
});
|
||||
|
||||
describe('when render adhoc filters', function() {
|
||||
@ -256,7 +254,7 @@ describe('InfluxQuery', function() {
|
||||
{key: 'key2', operator: '!=', value: 'value2'},
|
||||
]);
|
||||
|
||||
expect(queryText).to.be('"key1" = \'value1\' AND "key2" != \'value2\'');
|
||||
expect(queryText).toBe('"key1" = \'value1\' AND "key2" != \'value2\'');
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,3 @@
|
||||
import {describe, it, expect} from 'test/lib/common';
|
||||
import InfluxSeries from '../influx_series';
|
||||
|
||||
describe('when generating timeseries from influxdb response', function() {
|
||||
@ -19,24 +18,24 @@ describe('when generating timeseries from influxdb response', function() {
|
||||
var series = new InfluxSeries(options);
|
||||
var result = series.getTimeSeries();
|
||||
|
||||
expect(result.length).to.be(3);
|
||||
expect(result[0].target).to.be('cpu.mean {app: test, server: server1}');
|
||||
expect(result[0].datapoints[0][0]).to.be(10);
|
||||
expect(result[0].datapoints[0][1]).to.be(1431946625000);
|
||||
expect(result[0].datapoints[1][0]).to.be(20);
|
||||
expect(result[0].datapoints[1][1]).to.be(1431946626000);
|
||||
expect(result.length).toBe(3);
|
||||
expect(result[0].target).toBe('cpu.mean {app: test, server: server1}');
|
||||
expect(result[0].datapoints[0][0]).toBe(10);
|
||||
expect(result[0].datapoints[0][1]).toBe(1431946625000);
|
||||
expect(result[0].datapoints[1][0]).toBe(20);
|
||||
expect(result[0].datapoints[1][1]).toBe(1431946626000);
|
||||
|
||||
expect(result[1].target).to.be('cpu.max {app: test, server: server1}');
|
||||
expect(result[1].datapoints[0][0]).to.be(11);
|
||||
expect(result[1].datapoints[0][1]).to.be(1431946625000);
|
||||
expect(result[1].datapoints[1][0]).to.be(21);
|
||||
expect(result[1].datapoints[1][1]).to.be(1431946626000);
|
||||
expect(result[1].target).toBe('cpu.max {app: test, server: server1}');
|
||||
expect(result[1].datapoints[0][0]).toBe(11);
|
||||
expect(result[1].datapoints[0][1]).toBe(1431946625000);
|
||||
expect(result[1].datapoints[1][0]).toBe(21);
|
||||
expect(result[1].datapoints[1][1]).toBe(1431946626000);
|
||||
|
||||
expect(result[2].target).to.be('cpu.min {app: test, server: server1}');
|
||||
expect(result[2].datapoints[0][0]).to.be(9);
|
||||
expect(result[2].datapoints[0][1]).to.be(1431946625000);
|
||||
expect(result[2].datapoints[1][0]).to.be(19);
|
||||
expect(result[2].datapoints[1][1]).to.be(1431946626000);
|
||||
expect(result[2].target).toBe('cpu.min {app: test, server: server1}');
|
||||
expect(result[2].datapoints[0][0]).toBe(9);
|
||||
expect(result[2].datapoints[0][1]).toBe(1431946625000);
|
||||
expect(result[2].datapoints[1][0]).toBe(19);
|
||||
expect(result[2].datapoints[1][1]).toBe(1431946626000);
|
||||
|
||||
});
|
||||
});
|
||||
@ -47,9 +46,9 @@ describe('when generating timeseries from influxdb response', function() {
|
||||
var series = new InfluxSeries(options);
|
||||
var result = series.getTimeSeries();
|
||||
|
||||
expect(result[0].target).to.be('new series');
|
||||
expect(result[1].target).to.be('new series');
|
||||
expect(result[2].target).to.be('new series');
|
||||
expect(result[0].target).toBe('new series');
|
||||
expect(result[1].target).toBe('new series');
|
||||
expect(result[2].target).toBe('new series');
|
||||
});
|
||||
|
||||
});
|
||||
@ -60,9 +59,9 @@ describe('when generating timeseries from influxdb response', function() {
|
||||
var series = new InfluxSeries(options);
|
||||
var result = series.getTimeSeries();
|
||||
|
||||
expect(result[0].target).to.be('alias: cpu -> server1 (cpu)');
|
||||
expect(result[1].target).to.be('alias: cpu -> server1 (cpu)');
|
||||
expect(result[2].target).to.be('alias: cpu -> server1 (cpu)');
|
||||
expect(result[0].target).toBe('alias: cpu -> server1 (cpu)');
|
||||
expect(result[1].target).toBe('alias: cpu -> server1 (cpu)');
|
||||
expect(result[2].target).toBe('alias: cpu -> server1 (cpu)');
|
||||
});
|
||||
|
||||
});
|
||||
@ -90,8 +89,8 @@ describe('when generating timeseries from influxdb response', function() {
|
||||
var series = new InfluxSeries(options);
|
||||
var result = series.getTimeSeries();
|
||||
|
||||
expect(result[0].target).to.be('cpu {app: test, server: server1}');
|
||||
expect(result[1].target).to.be('cpu {app: test2, server: server2}');
|
||||
expect(result[0].target).toBe('cpu {app: test, server: server1}');
|
||||
expect(result[1].target).toBe('cpu {app: test2, server: server2}');
|
||||
});
|
||||
});
|
||||
|
||||
@ -122,18 +121,18 @@ describe('when generating timeseries from influxdb response', function() {
|
||||
var series = new InfluxSeries(options);
|
||||
var result = series.getTimeSeries();
|
||||
|
||||
expect(result.length).to.be(2);
|
||||
expect(result[0].target).to.be('cpu.mean {app: test, server: server1}');
|
||||
expect(result[0].datapoints[0][0]).to.be(10);
|
||||
expect(result[0].datapoints[0][1]).to.be(1431946625000);
|
||||
expect(result[0].datapoints[1][0]).to.be(12);
|
||||
expect(result[0].datapoints[1][1]).to.be(1431946626000);
|
||||
expect(result.length).toBe(2);
|
||||
expect(result[0].target).toBe('cpu.mean {app: test, server: server1}');
|
||||
expect(result[0].datapoints[0][0]).toBe(10);
|
||||
expect(result[0].datapoints[0][1]).toBe(1431946625000);
|
||||
expect(result[0].datapoints[1][0]).toBe(12);
|
||||
expect(result[0].datapoints[1][1]).toBe(1431946626000);
|
||||
|
||||
expect(result[1].target).to.be('cpu.mean {app: test2, server: server2}');
|
||||
expect(result[1].datapoints[0][0]).to.be(15);
|
||||
expect(result[1].datapoints[0][1]).to.be(1431946625000);
|
||||
expect(result[1].datapoints[1][0]).to.be(16);
|
||||
expect(result[1].datapoints[1][1]).to.be(1431946626000);
|
||||
expect(result[1].target).toBe('cpu.mean {app: test2, server: server2}');
|
||||
expect(result[1].datapoints[0][0]).toBe(15);
|
||||
expect(result[1].datapoints[0][1]).toBe(1431946625000);
|
||||
expect(result[1].datapoints[1][0]).toBe(16);
|
||||
expect(result[1].datapoints[1][1]).toBe(1431946626000);
|
||||
});
|
||||
});
|
||||
|
||||
@ -143,7 +142,7 @@ describe('when generating timeseries from influxdb response', function() {
|
||||
var series = new InfluxSeries(options);
|
||||
var result = series.getTimeSeries();
|
||||
|
||||
expect(result[0].target).to.be('new series');
|
||||
expect(result[0].target).toBe('new series');
|
||||
});
|
||||
|
||||
});
|
||||
@ -154,8 +153,8 @@ describe('when generating timeseries from influxdb response', function() {
|
||||
var series = new InfluxSeries(options);
|
||||
var result = series.getTimeSeries();
|
||||
|
||||
expect(result[0].target).to.be('alias: cpu -> server1 (cpu)');
|
||||
expect(result[1].target).to.be('alias: cpu -> server2 (cpu)');
|
||||
expect(result[0].target).toBe('alias: cpu -> server1 (cpu)');
|
||||
expect(result[1].target).toBe('alias: cpu -> server2 (cpu)');
|
||||
});
|
||||
|
||||
});
|
||||
@ -180,7 +179,7 @@ describe('when generating timeseries from influxdb response', function() {
|
||||
var series = new InfluxSeries(options);
|
||||
var result = series.getTimeSeries();
|
||||
|
||||
expect(result[0].target).to.be('alias: prod -> count');
|
||||
expect(result[0].target).toBe('alias: prod -> count');
|
||||
});
|
||||
});
|
||||
|
||||
@ -201,9 +200,9 @@ describe('when generating timeseries from influxdb response', function() {
|
||||
var series = new InfluxSeries(options);
|
||||
var table = series.getTable();
|
||||
|
||||
expect(table.type).to.be('table');
|
||||
expect(table.columns.length).to.be(5);
|
||||
expect(table.rows[0]).to.eql([1431946625000, 'Africa', 'server2', 23, 10]);
|
||||
expect(table.type).toBe('table');
|
||||
expect(table.columns.length).toBe(5);
|
||||
expect(table.rows[0]).toEqual([1431946625000, 'Africa', 'server2', 23, 10]);
|
||||
});
|
||||
});
|
||||
|
||||
@ -228,7 +227,7 @@ describe('when generating timeseries from influxdb response', function() {
|
||||
var series = new InfluxSeries(options);
|
||||
var annotations = series.getAnnotations();
|
||||
|
||||
expect(annotations[0].tags.length).to.be(0);
|
||||
expect(annotations[0].tags.length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
@ -254,9 +253,9 @@ describe('when generating timeseries from influxdb response', function() {
|
||||
var series = new InfluxSeries(options);
|
||||
var annotations = series.getAnnotations();
|
||||
|
||||
expect(annotations[0].tags.length).to.be(2);
|
||||
expect(annotations[0].tags[0]).to.be('America');
|
||||
expect(annotations[0].tags[1]).to.be('backend');
|
||||
expect(annotations[0].tags.length).toBe(2);
|
||||
expect(annotations[0].tags[0]).toBe('America');
|
||||
expect(annotations[0].tags[1]).toBe('backend');
|
||||
});
|
||||
});
|
||||
});
|
@ -1,6 +1,3 @@
|
||||
|
||||
import {describe, it, expect} from 'test/lib/common';
|
||||
|
||||
import queryPart from '../query_part';
|
||||
|
||||
describe('InfluxQueryPart', () => {
|
||||
@ -12,8 +9,8 @@ describe('InfluxQueryPart', () => {
|
||||
params: ['10s'],
|
||||
});
|
||||
|
||||
expect(part.text).to.be('derivative(10s)');
|
||||
expect(part.render('mean(value)')).to.be('derivative(mean(value), 10s)');
|
||||
expect(part.text).toBe('derivative(10s)');
|
||||
expect(part.render('mean(value)')).toBe('derivative(mean(value), 10s)');
|
||||
});
|
||||
|
||||
it('should nest spread function', () => {
|
||||
@ -21,8 +18,8 @@ describe('InfluxQueryPart', () => {
|
||||
type: 'spread'
|
||||
});
|
||||
|
||||
expect(part.text).to.be('spread()');
|
||||
expect(part.render('value')).to.be('spread(value)');
|
||||
expect(part.text).toBe('spread()');
|
||||
expect(part.render('value')).toBe('spread(value)');
|
||||
});
|
||||
|
||||
it('should handle suffix parts', () => {
|
||||
@ -31,8 +28,8 @@ describe('InfluxQueryPart', () => {
|
||||
params: ['/ 100'],
|
||||
});
|
||||
|
||||
expect(part.text).to.be('math(/ 100)');
|
||||
expect(part.render('mean(value)')).to.be('mean(value) / 100');
|
||||
expect(part.text).toBe('math(/ 100)');
|
||||
expect(part.render('mean(value)')).toBe('mean(value) / 100');
|
||||
});
|
||||
|
||||
it('should handle alias parts', () => {
|
||||
@ -41,8 +38,8 @@ describe('InfluxQueryPart', () => {
|
||||
params: ['test'],
|
||||
});
|
||||
|
||||
expect(part.text).to.be('alias(test)');
|
||||
expect(part.render('mean(value)')).to.be('mean(value) AS "test"');
|
||||
expect(part.text).toBe('alias(test)');
|
||||
expect(part.render('mean(value)')).toBe('mean(value) AS "test"');
|
||||
});
|
||||
|
||||
});
|
@ -1,9 +1,10 @@
|
||||
import _ from 'lodash';
|
||||
import {describe, it, expect} from 'test/lib/common';
|
||||
import ResponseParser from '../response_parser';
|
||||
|
||||
describe("influxdb response parser", () => {
|
||||
this.parser = new ResponseParser();
|
||||
describe('influxdb response parser', () => {
|
||||
|
||||
const parser = new ResponseParser();
|
||||
|
||||
describe("SHOW TAG response", () => {
|
||||
var query = 'SHOW TAG KEYS FROM "cpu"';
|
||||
var response = {
|
||||
@ -20,10 +21,10 @@ describe("influxdb response parser", () => {
|
||||
]
|
||||
};
|
||||
|
||||
var result = this.parser.parse(query, response);
|
||||
var result = parser.parse(query, response);
|
||||
|
||||
it("expects three results", () => {
|
||||
expect(_.size(result)).to.be(3);
|
||||
expect(_.size(result)).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
@ -45,12 +46,12 @@ describe("influxdb response parser", () => {
|
||||
]
|
||||
};
|
||||
|
||||
var result = this.parser.parse(query, response);
|
||||
var result = parser.parse(query, response);
|
||||
|
||||
it("should get two responses", () => {
|
||||
expect(_.size(result)).to.be(2);
|
||||
expect(result[0].text).to.be("server1");
|
||||
expect(result[1].text).to.be("server2");
|
||||
expect(_.size(result)).toBe(2);
|
||||
expect(result[0].text).toBe("server1");
|
||||
expect(result[1].text).toBe("server2");
|
||||
});
|
||||
});
|
||||
|
||||
@ -80,13 +81,13 @@ describe("influxdb response parser", () => {
|
||||
]
|
||||
};
|
||||
|
||||
var result = this.parser.parse(query, response);
|
||||
var result = parser.parse(query, response);
|
||||
|
||||
it("should get two responses", () => {
|
||||
expect(_.size(result)).to.be(3);
|
||||
expect(result[0].text).to.be('site');
|
||||
expect(result[1].text).to.be('api');
|
||||
expect(result[2].text).to.be('webapi');
|
||||
expect(_.size(result)).toBe(3);
|
||||
expect(result[0].text).toBe('site');
|
||||
expect(result[1].text).toBe('api');
|
||||
expect(result[2].text).toBe('webapi');
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -110,9 +111,9 @@ describe("influxdb response parser", () => {
|
||||
]
|
||||
};
|
||||
|
||||
var result = this.parser.parse(query, response);
|
||||
var result = parser.parse(query, response);
|
||||
it("should get two responses", () => {
|
||||
expect(_.size(result)).to.be(6);
|
||||
expect(_.size(result)).toBe(6);
|
||||
});
|
||||
});
|
||||
|
||||
@ -131,10 +132,10 @@ describe("influxdb response parser", () => {
|
||||
]
|
||||
};
|
||||
|
||||
var result = this.parser.parse(query, response);
|
||||
var result = parser.parse(query, response);
|
||||
|
||||
it("should get two responses", () => {
|
||||
expect(_.size(result)).to.be(1);
|
||||
expect(_.size(result)).toBe(1);
|
||||
});
|
||||
});
|
||||
});
|
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@
|
||||
|
||||
"includes": [
|
||||
{"type": "dashboard", "name": "Prometheus Stats", "path": "dashboards/prometheus_stats.json"},
|
||||
{"type": "dashboard", "name": "Prometheus 2.0 Stats", "path": "dashboards/prometheus_2_stats.json"},
|
||||
{"type": "dashboard", "name": "Grafana Stats", "path": "dashboards/grafana_stats.json"}
|
||||
],
|
||||
|
||||
|
@ -688,7 +688,14 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) {
|
||||
}
|
||||
|
||||
elem.bind("plotselected", function (event, ranges) {
|
||||
if (panel.xaxis.mode !== 'time') {
|
||||
// Skip if panel in histogram or series mode
|
||||
plot.clearSelection();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ranges.ctrlKey || ranges.metaKey) && contextSrv.isEditor) {
|
||||
// Add annotation
|
||||
setTimeout(() => {
|
||||
eventManager.updateTime(ranges.xaxis);
|
||||
}, 100);
|
||||
@ -703,6 +710,11 @@ function graphDirective($rootScope, timeSrv, popoverSrv, contextSrv) {
|
||||
});
|
||||
|
||||
elem.bind("plotclick", function (event, pos, item) {
|
||||
if (panel.xaxis.mode !== 'time') {
|
||||
// Skip if panel in histogram or series mode
|
||||
return;
|
||||
}
|
||||
|
||||
if ((pos.ctrlKey || pos.metaKey) && contextSrv.isEditor) {
|
||||
// Skip if range selected (added in "plotselected" event handler)
|
||||
let isRangeSelection = pos.x !== pos.x1;
|
||||
|
@ -104,7 +104,7 @@ describe('SingleStatCtrl', function() {
|
||||
});
|
||||
|
||||
it('should set formatted value', function() {
|
||||
expect(ctx.data.valueFormatted).to.be(moment(1505634997920).format('MM/DD/YYYY H:mm:ss a'));
|
||||
expect(ctx.data.valueFormatted).to.be(moment(1505634997920).format('MM/DD/YYYY h:mm:ss a'));
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -10,8 +10,8 @@ $black: #000;
|
||||
// -------------------------
|
||||
$black: #000;
|
||||
$dark-1: #141414;
|
||||
$dark-2: #1f1d1d;
|
||||
$dark-3: #292929;
|
||||
$dark-2: #1f1f20;
|
||||
$dark-3: #262628;
|
||||
$dark-4: #333333;
|
||||
$dark-5: #444444;
|
||||
$gray-1: #555555;
|
||||
@ -49,7 +49,7 @@ $critical: #ed2e18;
|
||||
|
||||
// Scaffolding
|
||||
// -------------------------
|
||||
$body-bg: rgb(24,20,20);
|
||||
$body-bg: rgb(23,24,25);
|
||||
$page-bg: $dark-2;
|
||||
$body-color: $gray-4;
|
||||
$text-color: $gray-4;
|
||||
@ -63,8 +63,8 @@ $text-shadow-faint: 1px 1px 4px rgb(45, 45, 45);
|
||||
|
||||
// gradients
|
||||
$brand-gradient: linear-gradient(to right, rgba(255,213,0,0.7) 0%, rgba(255,68,0,0.7) 99%, rgba(255,68,0,0.7) 100%);
|
||||
$page-gradient: linear-gradient(180deg, rgb(36, 36, 36) 40px, rgba(178, 31, 31, 0.03) 100px, rgba(253, 187, 45, 0.03));
|
||||
$dashboard-gradient: linear-gradient(180deg, #242424 10px, rgba(15, 15, 15, 1) 100px, rgb(10, 10, 10));
|
||||
$page-gradient: linear-gradient(180deg, #222426 10px, rgba(15, 15, 16, .03) 100px, rgba(10, 10, 11, .03));
|
||||
$dashboard-gradient: linear-gradient(180deg, #222426 10px, rgba(15, 15, 16, 0.3) 100px, rgb(10, 10, 0.3));
|
||||
|
||||
// Links
|
||||
// -------------------------
|
||||
@ -90,11 +90,11 @@ $component-active-bg: $brand-primary !default;
|
||||
|
||||
// Panel
|
||||
// -------------------------
|
||||
$panel-bg: $dark-2;
|
||||
$panel-border-color: $dark-3;
|
||||
$panel-bg: #212124;
|
||||
$panel-border-color: $dark-1;
|
||||
$panel-border: solid 1px $panel-border-color;
|
||||
$panel-drop-zone-bg: repeating-linear-gradient(-128deg, #111, #111 10px, #191919 10px, #222 20px);
|
||||
$panel-header-hover-bg: $dark-3;
|
||||
$panel-header-hover-bg: $dark-4;
|
||||
$panel-header-menu-hover-bg: $dark-5;
|
||||
|
||||
$divider-border-color: #555;
|
||||
@ -103,10 +103,10 @@ $divider-border-color: #555;
|
||||
$tight-form-border: #050505;
|
||||
$tight-form-bg: $dark-3;
|
||||
|
||||
$tight-form-func-bg: #333;
|
||||
$tight-form-func-highlight-bg: #444;
|
||||
$tight-form-func-bg: #333334;
|
||||
$tight-form-func-highlight-bg: #444445;
|
||||
|
||||
$modal-backdrop-bg: #3a4754;
|
||||
$modal-backdrop-bg: #353c42 ;
|
||||
$code-tag-bg: $gray-1;
|
||||
$code-tag-border: lighten($code-tag-bg, 2%);
|
||||
|
||||
@ -295,8 +295,8 @@ $graph-tooltip-bg: $dark-1;
|
||||
$checkboxImageUrl: '../img/checkbox.png';
|
||||
|
||||
// cards
|
||||
$card-background: linear-gradient(135deg, #2f2f2f, #262626);
|
||||
$card-background-hover: linear-gradient(135deg, #343434, #262626);
|
||||
$card-background: linear-gradient(135deg, #2f2f32, #262628);
|
||||
$card-background-hover: linear-gradient(135deg, #343436, #262628);
|
||||
$card-shadow: -1px -1px 0 0 hsla(0, 0%, 100%, .1), 1px 1px 0 0 rgba(0, 0, 0, .3);
|
||||
|
||||
// info box
|
||||
|
@ -15,8 +15,8 @@ $black: #000;
|
||||
// -------------------------
|
||||
$black: #000;
|
||||
$dark-1: #141414;
|
||||
$dark-2: #1f1d1d;
|
||||
$dark-3: #292929;
|
||||
$dark-2: #1d1d1f;
|
||||
$dark-3: #262628;
|
||||
$dark-4: #373737;
|
||||
$dark-5: #444444;
|
||||
$gray-1: #555555;
|
||||
|
@ -280,7 +280,7 @@
|
||||
|
||||
.graph-annotation__header {
|
||||
background-color: $popover-border-color;
|
||||
padding: 0.40rem 0.65rem;
|
||||
padding: 6px 10px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
@ -8,13 +8,6 @@
|
||||
.tabbed-view-header {
|
||||
padding: 1.5em 1rem 0 1rem;
|
||||
}
|
||||
|
||||
.gf-tabs-link.active {
|
||||
background-color: $panel-bg;
|
||||
}
|
||||
.tabbed-view-body {
|
||||
min-height: 200px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@
|
||||
&.active:focus {
|
||||
@include border-radius(3px);
|
||||
border-color: rgba(216, 131, 40, 0.77);
|
||||
border-bottom: 2px solid $panel-bg;
|
||||
border-bottom: 1px solid $page-bg;
|
||||
color: $link-color;
|
||||
position: relative;
|
||||
top: 1px;
|
||||
|
@ -2,7 +2,7 @@
|
||||
padding: $dashboard-padding;
|
||||
width: 100%;
|
||||
min-height: 100%;
|
||||
background: $dashboard-gradient;
|
||||
// background: $dashboard-gradient;
|
||||
}
|
||||
|
||||
.template-variable {
|
||||
|
Loading…
Reference in New Issue
Block a user