diff --git a/CHANGELOG.md b/CHANGELOG.md index e3ea13b0447..2f251a4c770 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ * **Graph**: Fixed graph legend table mode and always visible scrollbar [#6828](https://github.com/grafana/grafana/issues/6828) * **Templating**: Fixed template variable value groups/tags feature [#6752](https://github.com/grafana/grafana/issues/6752) +## Enhancements +* **Elasticsearch**: Added support for all moving average options [#7154](https://github.com/grafana/grafana/pull/7154), thx [@vaibhavinbayarea](https://github.com/vaibhavinbayarea) + # 4.1-beta1 (2016-12-21) ### Enhancements diff --git a/Makefile b/Makefile index 40597a33f79..16a1e3cf3dc 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ deps-go: go run build.go setup deps-js: - npm install + yarn install deps: deps-go deps-js diff --git a/README.md b/README.md index c4151fd9560..af83c63c41b 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,8 @@ To build less to css for the frontend you will need a recent version of **node ( npm (v2.5.0) and grunt (v0.4.5). Run the following: ```bash -npm install +npm install -g yarn +yarn install npm run build ``` diff --git a/appveyor.yml b/appveyor.yml index 756dbf8fba5..09674ca3502 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,7 +11,8 @@ environment: install: # install nodejs and npm - ps: Install-Product node $env:nodejs_version - - npm install + - npm install -g yarn + - yarn install - npm install -g grunt-cli # install gcc (needed for sqlite3) - choco install -y --limit-output mingw diff --git a/circle.yml b/circle.yml index ffc3450ad6b..7930ab1b875 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,6 @@ machine: node: - version: 5.11.1 + version: 6.9.2 environment: GOPATH: "/home/ubuntu/.go_workspace" ORG_PATH: "github.com/grafana" @@ -22,10 +22,10 @@ test: override: - bash scripts/circle-test.sh -deployment: - master: - branch: master - owner: grafana - commands: - - ./scripts/trigger_grafana_packer.sh ${TRIGGER_GRAFANA_PACKER_CIRCLECI_TOKEN} - - ./scripts/trigger_windows_build.sh ${APPVEYOR_TOKEN} +# deployment: +# master: +# branch: master +# owner: grafana +# commands: +# - ./scripts/trigger_grafana_packer.sh ${TRIGGER_GRAFANA_PACKER_CIRCLECI_TOKEN} +# - ./scripts/trigger_windows_build.sh ${APPVEYOR_TOKEN} diff --git a/docs/sources/project/building_from_source.md b/docs/sources/project/building_from_source.md index df07b4bdc62..11ca2d5b719 100644 --- a/docs/sources/project/building_from_source.md +++ b/docs/sources/project/building_from_source.md @@ -40,7 +40,8 @@ To build less to css for the frontend you will need a recent version of node (v0 npm (v2.5.0) and grunt (v0.4.5). Run the following: ``` -npm install +npm install -g yarn +yarn install npm install -g grunt-cli grunt ``` diff --git a/public/app/plugins/app/testdata/module.ts b/public/app/plugins/app/testdata/module.ts index dee1679637a..6fb0e0ba98c 100644 --- a/public/app/plugins/app/testdata/module.ts +++ b/public/app/plugins/app/testdata/module.ts @@ -5,6 +5,7 @@ export class ConfigCtrl { appEditCtrl: any; + /** @ngInject **/ constructor(private backendSrv) { this.appEditCtrl.setPreUpdateHook(this.initDatasource.bind(this)); } diff --git a/public/app/plugins/datasource/elasticsearch/bucket_agg.js b/public/app/plugins/datasource/elasticsearch/bucket_agg.js index 43ef4f91ab7..38f7eed056c 100644 --- a/public/app/plugins/datasource/elasticsearch/bucket_agg.js +++ b/public/app/plugins/datasource/elasticsearch/bucket_agg.js @@ -73,7 +73,7 @@ function (angular, _, queryDef) { $scope.validateModel = function() { $scope.index = _.indexOf(bucketAggs, $scope.agg); $scope.isFirst = $scope.index === 0; - $scope.isLast = $scope.index === bucketAggs.length - 1; + $scope.bucketAggCount = bucketAggs.length; var settingsLinkText = ""; var settings = $scope.agg.settings || {}; diff --git a/public/app/plugins/datasource/elasticsearch/datasource.js b/public/app/plugins/datasource/elasticsearch/datasource.js index f35547f25e5..38fd6337f22 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.js +++ b/public/app/plugins/datasource/elasticsearch/datasource.js @@ -231,6 +231,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes this.getFields = function(query) { return this._get('/_mapping').then(function(result) { + var typeMap = { 'float': 'number', 'double': 'number', @@ -238,13 +239,28 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes 'long': 'number', 'date': 'date', 'string': 'string', - 'text': 'text', + 'text': 'string', + 'scaled_float': 'number', 'nested': 'nested' }; + function shouldAddField(obj, key, query) { + if (key[0] === '_') { + return false; + } + + if (!query.type) { + return true; + } + + // equal query type filter, or via typemap translation + return query.type === obj.type || query.type === typeMap[obj.type]; + } + // Store subfield names: [system, process, cpu, total] -> system.process.cpu.total var fieldNameParts = []; var fields = {}; + function getFieldsRecursively(obj) { for (var key in obj) { var subObj = obj[key]; @@ -257,10 +273,7 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes var fieldName = fieldNameParts.concat(key).join('.'); // Hide meta-fields and check field type - if (key[0] !== '_' && - (!query.type || - query.type && typeMap[subObj.type] === query.type)) { - + if (shouldAddField(subObj, key, query)) { fields[fieldName] = { text: fieldName, type: subObj.type diff --git a/public/app/plugins/datasource/elasticsearch/metric_agg.js b/public/app/plugins/datasource/elasticsearch/metric_agg.js index 845794d79f3..9971c084882 100644 --- a/public/app/plugins/datasource/elasticsearch/metric_agg.js +++ b/public/app/plugins/datasource/elasticsearch/metric_agg.js @@ -29,6 +29,7 @@ function (angular, _, queryDef) { $scope.metricAggTypes = queryDef.getMetricAggTypes($scope.esVersion); $scope.extendedStats = queryDef.extendedStats; $scope.pipelineAggOptions = []; + $scope.modelSettingsValues = {}; $scope.init = function() { $scope.agg = metricAggs[$scope.index]; @@ -95,6 +96,12 @@ function (angular, _, queryDef) { $scope.settingsLinkText = 'Stats: ' + stats.join(', '); break; } + case 'moving_avg': { + $scope.movingAvgModelTypes = queryDef.movingAvgModelOptions; + $scope.modelSettings = queryDef.getMovingAvgSettings($scope.agg.settings.model, true); + $scope.updateMovingAvgModelSettings(); + break; + } case 'raw_document': { $scope.target.metrics = [$scope.agg]; $scope.target.bucketAggs = []; @@ -127,6 +134,25 @@ function (angular, _, queryDef) { $scope.onChange(); }; + $scope.updateMovingAvgModelSettings = function () { + var modelSettingsKeys = []; + var modelSettings = queryDef.getMovingAvgSettings($scope.agg.settings.model, false); + for (var i=0; i < modelSettings.length; i++) { + modelSettingsKeys.push(modelSettings[i].value); + } + + for (var key in $scope.agg.settings.settings) { + if (($scope.agg.settings.settings[key] === null) || (modelSettingsKeys.indexOf(key) === -1)) { + delete $scope.agg.settings.settings[key]; + } + } + }; + + $scope.onChangeClearInternal = function() { + delete $scope.agg.settings.minimize; + $scope.onChange(); + }; + $scope.onTypeChange = function() { $scope.agg.settings = {}; $scope.agg.meta = {}; diff --git a/public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html b/public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html index e3e6cd6f5ff..f94cf99939a 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html +++ b/public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html @@ -23,7 +23,7 @@ -