From 2a623cfec1660d148d7b31571f214fb70e54b725 Mon Sep 17 00:00:00 2001 From: Jason Greenberg Date: Thu, 16 Nov 2017 14:44:37 -0500 Subject: [PATCH] 5.6.4 support --- .node-version | 2 +- CHANGES.md | 6 ++++++ package.json | 2 +- public/transform_vis_controller.js | 24 +++++++++++++++++------- public/transform_vis_params.html | 2 +- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.node-version b/.node-version index 22cb9e5..a003776 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -6.10.2 +6.11.5 diff --git a/CHANGES.md b/CHANGES.md index 9c48f79..6fdda34 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +* Nov 16 2017 + * Versions + * 5.6.4 + * Changes + * Support changes in Index Pattern service + * Jul 10 2017 * Versions * 5.5.0 diff --git a/package.json b/package.json index 586e370..b279bbc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "transform_vis", - "version": "5.5.0", + "version": "5.6.4", "description": "Transform Visualization", "main": "index.js", "kibana": { diff --git a/public/transform_vis_controller.js b/public/transform_vis_controller.js index a10d745..8b3145d 100644 --- a/public/transform_vis_controller.js +++ b/public/transform_vis_controller.js @@ -2,6 +2,8 @@ import { uiModules } from 'ui/modules'; import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter' import { dashboardContextProvider } from 'plugins/kibana/dashboard/dashboard_context' +import { SavedObjectsClientProvider } from 'ui/saved_objects'; + import chrome from 'ui/chrome'; const Mustache = require('mustache'); @@ -39,14 +41,15 @@ module.controller('TransformVisController', function ($scope, $sce, Private, tim $scope.search = function () { const context = dashboardContext(); - const index = $scope.vis.params.outputs.indexpattern; // This is part of what should be a wider config validation - if (!(typeof index === 'string' || index instanceof String)) { + if ($scope.vis.indexPattern === undefined || $scope.vis.indexPattern.id === undefined) { $scope.setDisplay('
No Index Pattern
'); return; - } - + } + + const index = $scope.vis.indexPattern.title; + if ($scope.vis.indexPattern && $scope.vis.indexPattern.timeFieldName) { const timefilterdsl = {range: {}}; timefilterdsl.range[$scope.vis.indexPattern.timeFieldName] = {gte: timefilter.time.from, lte: timefilter.time.to}; @@ -109,14 +112,21 @@ module.controller('TransformVisController', function ($scope, $sce, Private, tim }); -module.controller('TransformVisEditorController', function ($scope, indexPatterns) { +module.controller('TransformVisEditorController', function ($scope, Private, indexPatterns) { $scope.options = chrome.getInjected('transformVisOptions'); - indexPatterns.getIds().then(function (list) { - $scope.indexPatternOptions = list; + const savedObjectsClient = Private(SavedObjectsClientProvider); + + const patterns = savedObjectsClient.find({ + type: 'index-pattern', + fields: ['title'], + perPage: 10000 + }).then(response => { + $scope.indexPatternOptions = response.savedObjects; }); + $scope.$watch('vis.params.outputs.indexpattern', function () { indexPatterns.get($scope.vis.params.outputs.indexpattern).then(function (indexPattern) { $scope.savedVis.searchSource.set('index', indexPattern); diff --git a/public/transform_vis_params.html b/public/transform_vis_params.html index 8d2565f..72a4b4b 100644 --- a/public/transform_vis_params.html +++ b/public/transform_vis_params.html @@ -4,7 +4,7 @@ + ng-options="option.id as option.attributes.title for option in indexPatternOptions">