From 485e9335ef3da6cd27a5b4cf2155cbd3de9f585f Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 26 Apr 2016 21:13:57 +0300 Subject: [PATCH 1/6] Added aggregateBy() function with aggregation type as parameter. --- src/datasource-zabbix/DataProcessor.js | 8 ++++++++ src/datasource-zabbix/metricFunctions.js | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/datasource-zabbix/DataProcessor.js b/src/datasource-zabbix/DataProcessor.js index c47965e..e2743bd 100644 --- a/src/datasource-zabbix/DataProcessor.js +++ b/src/datasource-zabbix/DataProcessor.js @@ -147,6 +147,13 @@ export default class DataProcessor { return DataProcessor.groupBy(interval, groupByCallback, datapoints); } + static aggregateByWrapper(interval, aggregateFunc, datapoints) { + // Flatten all points in frame and then just use groupBy() + var flattenedPoints = _.flatten(datapoints, true); + var groupByCallback = DataProcessor.aggregationFunctions[aggregateFunc]; + return DataProcessor.groupBy(interval, groupByCallback, flattenedPoints); + } + static aggregateWrapper(groupByCallback, interval, datapoints) { var flattenedPoints = _.flatten(datapoints, true); return DataProcessor.groupBy(interval, groupByCallback, flattenedPoints); @@ -164,6 +171,7 @@ export default class DataProcessor { static get metricFunctions() { return { groupBy: this.groupByWrapper, + aggregateBy: this.aggregateByWrapper, average: _.partial(this.aggregateWrapper, this.AVERAGE), min: _.partial(this.aggregateWrapper, this.MIN), max: _.partial(this.aggregateWrapper, this.MAX), diff --git a/src/datasource-zabbix/metricFunctions.js b/src/datasource-zabbix/metricFunctions.js index aa0351c..024aa0d 100644 --- a/src/datasource-zabbix/metricFunctions.js +++ b/src/datasource-zabbix/metricFunctions.js @@ -73,6 +73,16 @@ addFuncDef({ defaultParams: ['1m'], }); +addFuncDef({ + name: 'aggregateBy', + category: 'Aggregate', + params: [ + { name: 'interval', type: 'string' }, + { name: 'function', type: 'string', options: ['avg', 'min', 'max', 'median'] } + ], + defaultParams: ['1m', 'avg'], +}); + addFuncDef({ name: 'trendValue', category: 'Trends', From f6f6bc8338006c925a6dacab19650b3ef3670eb7 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Tue, 26 Apr 2016 22:53:53 +0300 Subject: [PATCH 2/6] Query options moved to separate section with show/hide function. --- .../partials/query.editor.html | 47 +++++++++++++------ src/datasource-zabbix/query.controller.js | 38 +++++++++++++-- 2 files changed, 67 insertions(+), 18 deletions(-) diff --git a/src/datasource-zabbix/partials/query.editor.html b/src/datasource-zabbix/partials/query.editor.html index 50342cd..ab0376f 100644 --- a/src/datasource-zabbix/partials/query.editor.html +++ b/src/datasource-zabbix/partials/query.editor.html @@ -114,13 +114,6 @@ 'zbx-regex': ctrl.isRegex(ctrl.target.host.filter) }"> -
  • - Show disabled items  - - -
  • @@ -160,25 +153,49 @@ 'zbx-regex': ctrl.isRegex(ctrl.target.item.filter) }"> -
  • Options
  • -
  • - - -
  • -
  • + + + + {{ctrl.queryOptionsText}} +
  • -
    +
    + +
    +
    +
    +
      +
    • + Show disabled items +
    • +
    • + + +
    • +
    +
    +
    +
    +
    +
    -
    + + +
    -
    -
    +
    +
    - +
    -
    -
    +
    +
    - +
    - +
    - - -
    -
    -
    +
    +
    - +
    - +
    + +
    + + +
    - +
    -
    -
    +
    +
    +
    - + - + +
    + + +
    +
    + + +
    From 022bc263a4becdf8e74d1bd32ae2741d9e4ad10f Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Sat, 30 Apr 2016 21:40:40 +0300 Subject: [PATCH 6/6] Bump version. --- src/plugin.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugin.json b/src/plugin.json index a0e7240..e590738 100644 --- a/src/plugin.json +++ b/src/plugin.json @@ -31,8 +31,8 @@ {"name": "Metric Editor", "path": "img/screenshot-metric_editor.png"}, {"name": "Triggers", "path": "img/screenshot-triggers.png"} ], - "version": "3.0.0-beta7", - "updated": "2016-04-14" + "version": "3.0.0-beta8", + "updated": "2016-04-30" }, "includes": [