diff --git a/package.json b/package.json index b813fa8..586e370 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "transform_vis", - "version": "5.3.0-2", + "version": "5.5.0", "description": "Transform Visualization", "main": "index.js", "kibana": { diff --git a/public/directives/refresh_hack.js b/public/directives/refresh_hack.js index ced1bde..46d463d 100644 --- a/public/directives/refresh_hack.js +++ b/public/directives/refresh_hack.js @@ -1,6 +1,8 @@ import $ from 'jquery'; -const module = require('ui/modules').get('kibana/transform_vis', []); +import { uiModules } from 'ui/modules'; + +const module = uiModules.get('kibana/transform_vis', []); module.directive('refreshHack', function () { return { diff --git a/public/transform_vis.js b/public/transform_vis.js index 8780d86..71892dd 100644 --- a/public/transform_vis.js +++ b/public/transform_vis.js @@ -1,15 +1,16 @@ import 'plugins/transform_vis/transform_vis.less'; import 'plugins/transform_vis/transform_vis_controller'; -import TemplateVisTypeTemplateVisTypeProvider from 'ui/template_vis_type/template_vis_type'; +import { TemplateVisTypeProvider } from 'ui/template_vis_type/template_vis_type'; +import { VisTypesRegistryProvider } from 'ui/registry/vis_types'; import transformVisTemplate from 'plugins/transform_vis/transform_vis.html'; import transformVisParamsTemplate from 'plugins/transform_vis/transform_vis_params.html'; // register the provider with the visTypes registry -require('ui/registry/vis_types').register(TransformVisProvider); +VisTypesRegistryProvider.register(TransformVisProvider); function TransformVisProvider(Private) { - const TemplateVisType = Private(TemplateVisTypeTemplateVisTypeProvider); + const TemplateVisType = Private(TemplateVisTypeProvider); return new TemplateVisType({ name: 'transform', diff --git a/public/transform_vis_controller.js b/public/transform_vis_controller.js index 5445003..119bb0b 100644 --- a/public/transform_vis_controller.js +++ b/public/transform_vis_controller.js @@ -1,7 +1,10 @@ import _ from 'lodash'; -import AggResponseTabifyTabifyProvider from 'ui/agg_response/tabify/tabify'; -import uiModules from 'ui/modules'; +//import { AggResponseTabifyProvider } from 'ui/agg_response/tabify/tabify'; +import { uiModules } from 'ui/modules'; +import { FilterBarQueryFilterProvider } from 'ui/filter_bar/query_filter' +import { dashboardContextProvider } from 'plugins/kibana/dashboard/dashboard_context' import chrome from 'ui/chrome'; + const Mustache = require('mustache') const module = uiModules.get('kibana/transform_vis', ['kibana']); @@ -9,24 +12,24 @@ require('plugins/transform_vis/directives/refresh_hack'); module.controller('TransformVisController', function ($scope, $sce, Private, timefilter, es, config, indexPatterns) { - const queryFilter = Private(require('ui/filter_bar/query_filter')); - const dashboardContext = Private(require('plugins/timelion/services/dashboard_context')); + const queryFilter = Private(FilterBarQueryFilterProvider); + const dashboardContext = Private(dashboardContextProvider); $scope.options = chrome.getInjected('transformVisOptions'); $scope.applyHTML = function() { - if ($scope.options.allow_unsafe) { - return $sce.trustAsHtml($scope.vis.display); - } else { - return $scope.vis.display; - } + if ($scope.options.allow_unsafe) { + return $sce.trustAsHtml($scope.vis.display); + } else { + return $scope.vis.display; + } } $scope.refreshConfig = function() { - indexPatterns.get($scope.vis.params.outputs.indexpattern).then( function (indexPattern) { - $scope.vis.indexPattern = indexPattern; - }).then($scope.search); + indexPatterns.get($scope.vis.params.outputs.indexpattern).then( function (indexPattern) { + $scope.vis.indexPattern = indexPattern; + }).then($scope.search); } @@ -43,15 +46,15 @@ module.controller('TransformVisController', function ($scope, $sce, Private, tim if (!(typeof index === 'string' || index instanceof String)) { $scope.setDisplay("
No Index Pattern
"); return; - } + } - if ($scope.vis.indexPattern.timeFieldName) { + 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 }; context.bool.must.push(timefilterdsl); } - var body = JSON.parse( $scope.vis.params.outputs.querydsl.replace("\"_DASHBOARD_CONTEXT_\"",JSON.stringify(context)) ); + var body = JSON.parse( $scope.vis.params.outputs.querydsl.replace("\"_DASHBOARD_CONTEXT_\"",JSON.stringify(context)) ); es.search({ index: index,