Skip to content

Commit

Permalink
Merge pull request #7 from fbaligand/master
Browse files Browse the repository at this point in the history
Add support for Kibana 5.5.0
  • Loading branch information
PhaedrusTheGreek authored Jul 10, 2017
2 parents 8699da0 + 39c1dd5 commit 919cd69
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "transform_vis",
"version": "5.3.0-2",
"version": "5.5.0",
"description": "Transform Visualization",
"main": "index.js",
"kibana": {
Expand Down
4 changes: 3 additions & 1 deletion public/directives/refresh_hack.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
7 changes: 4 additions & 3 deletions public/transform_vis.js
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
33 changes: 18 additions & 15 deletions public/transform_vis_controller.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
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']);

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);

}

Expand All @@ -43,15 +46,15 @@ module.controller('TransformVisController', function ($scope, $sce, Private, tim
if (!(typeof index === 'string' || index instanceof String)) {
$scope.setDisplay("<center><i>No Index Pattern</i></center>");
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,
Expand Down

0 comments on commit 919cd69

Please sign in to comment.