Merge branch 'feature/sortseries' of https://github.com/Verivox-GmbH/grafana-zabbix into Verivox-GmbH-feature/sortseries
This commit is contained in:
11
package.json
11
package.json
@@ -4,7 +4,8 @@
|
|||||||
"version": "3.6.0",
|
"version": "3.6.0",
|
||||||
"description": "Zabbix plugin for Grafana",
|
"description": "Zabbix plugin for Grafana",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"build": "./node_modules/.bin/grunt"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -16,15 +17,15 @@
|
|||||||
"url": "https://github.com/alexanderzobnin/grafana-zabbix/issues"
|
"url": "https://github.com/alexanderzobnin/grafana-zabbix/issues"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel": "~6.5.1",
|
|
||||||
"babel-plugin-transform-es2015-for-of": "^6.6.0",
|
"babel-plugin-transform-es2015-for-of": "^6.6.0",
|
||||||
"babel-plugin-transform-es2015-modules-systemjs": "^6.5.0",
|
"babel-plugin-transform-es2015-modules-systemjs": "^6.5.0",
|
||||||
"babel-preset-es2015": "^6.5.0",
|
"babel-preset-es2015": "^6.5.0",
|
||||||
|
"babel": "~6.5.1",
|
||||||
"benchmark":"^2.1.4",
|
"benchmark":"^2.1.4",
|
||||||
"chai": "~3.5.0",
|
"chai": "~3.5.0",
|
||||||
"grunt": "~0.4.5",
|
|
||||||
"grunt-babel": "~6.0.0",
|
"grunt-babel": "~6.0.0",
|
||||||
"grunt-benchmark": "^1.0.0",
|
"grunt-benchmark": "^1.0.0",
|
||||||
|
"grunt-cli": "~1.2.0",
|
||||||
"grunt-contrib-clean": "~0.6.0",
|
"grunt-contrib-clean": "~0.6.0",
|
||||||
"grunt-contrib-copy": "~0.8.2",
|
"grunt-contrib-copy": "~0.8.2",
|
||||||
"grunt-contrib-jshint": "^1.0.0",
|
"grunt-contrib-jshint": "^1.0.0",
|
||||||
@@ -35,6 +36,7 @@
|
|||||||
"grunt-mocha-test": "~0.12.7",
|
"grunt-mocha-test": "~0.12.7",
|
||||||
"grunt-sass": "^1.1.0",
|
"grunt-sass": "^1.1.0",
|
||||||
"grunt-systemjs-builder": "^0.2.5",
|
"grunt-systemjs-builder": "^0.2.5",
|
||||||
|
"grunt": "~0.4.5",
|
||||||
"jsdom": "~3.1.2",
|
"jsdom": "~3.1.2",
|
||||||
"jshint-stylish": "^2.1.0",
|
"jshint-stylish": "^2.1.0",
|
||||||
"load-grunt-tasks": "~3.2.0",
|
"load-grunt-tasks": "~3.2.0",
|
||||||
@@ -42,7 +44,8 @@
|
|||||||
"moment": "~2.14.1",
|
"moment": "~2.14.1",
|
||||||
"prunk": "~1.2.1",
|
"prunk": "~1.2.1",
|
||||||
"q": "~1.4.1",
|
"q": "~1.4.1",
|
||||||
"sinon-chai": "~2.8.0",
|
"sinon-chai": "~2.13.0",
|
||||||
|
"sinon":"^3.2.1",
|
||||||
"tether-drop": "^1.4.2"
|
"tether-drop": "^1.4.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -36,6 +36,12 @@ function limit(order, n, orderByFunc, timeseries) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sortSeries(direction, timeseries) {
|
||||||
|
return _.orderBy(timeseries, [function (ts) {
|
||||||
|
return ts.target.toLowerCase();
|
||||||
|
}], direction);
|
||||||
|
}
|
||||||
|
|
||||||
function setAlias(alias, timeseries) {
|
function setAlias(alias, timeseries) {
|
||||||
timeseries.target = alias;
|
timeseries.target = alias;
|
||||||
return timeseries;
|
return timeseries;
|
||||||
@@ -125,6 +131,7 @@ let metricFunctions = {
|
|||||||
sumSeries: sumSeries,
|
sumSeries: sumSeries,
|
||||||
top: _.partial(limit, 'top'),
|
top: _.partial(limit, 'top'),
|
||||||
bottom: _.partial(limit, 'bottom'),
|
bottom: _.partial(limit, 'bottom'),
|
||||||
|
sortSeries: sortSeries,
|
||||||
timeShift: timeShift,
|
timeShift: timeShift,
|
||||||
setAlias: setAlias,
|
setAlias: setAlias,
|
||||||
setAliasByRegex: setAliasByRegex,
|
setAliasByRegex: setAliasByRegex,
|
||||||
|
|||||||
@@ -181,6 +181,15 @@ addFuncDef({
|
|||||||
defaultParams: [5, 'avg'],
|
defaultParams: [5, 'avg'],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addFuncDef({
|
||||||
|
name: 'sortSeries',
|
||||||
|
category: 'Filter',
|
||||||
|
params: [
|
||||||
|
{ name: 'direction', type: 'string', options: ['asc', 'desc'] }
|
||||||
|
],
|
||||||
|
defaultParams: ['asc']
|
||||||
|
});
|
||||||
|
|
||||||
// Trends
|
// Trends
|
||||||
|
|
||||||
addFuncDef({
|
addFuncDef({
|
||||||
|
|||||||
Reference in New Issue
Block a user