kibana:如何使用自定义可视化插件注入控制器功能

kibana: How to inject controller function with custom visualization plugin

我正在尝试为 kibana 创建一个简单的视频插件。当前出现此错误:“[ng:areq] 参数 'VideoController' 不是函数,未定义”。在尝试将其作为插件打包到 kibana 之前,我已经静态地执行并测试了它。任何帮助将不胜感激。

  define(function(require) {
  require('plugins/kvideo/kvideo.css');
  require('angular');  
  require('ng-video/dist/ng-video');  
  //require('plugins/kvideo/default');    
  const APP_NAME = 'myApp';

  (function Default($angular) {      
    $angular.module(APP_NAME, ['ngVideo']);
  })(window.angular);
  var module = require('ui/modules').get('kvideo');
  //testing this plugin1
  module = (function VideoController($angular) {    
    $angular.module(APP_NAME).controller('VideoController',function videoController($scope, video) {
        $scope.playlistOpen = false;
        $scope.videos = {
            first:  '/home/test/Downloads/SampleVideo_1280x720_1mb.mp4',
            second: '/home/test/Downloads/SampleVideo_1280x720_2mb.mp4'
        };
        $scope.playVideo = function playVideo(sourceUrl) {
            video.addSource('mp4', sourceUrl, true);
        };        
        $scope.getVideoName = function getVideoName(videoModel) {
            switch (videoModel.src) {
                case ($scope.videos.first): return "Big Buck Bunny";
                case ($scope.videos.second): return "The Bear";
                default: return "Unknown Video";
            }
        };
        video.addSource('mp4', $scope.videos.first);
        video.addSource('mp4', $scope.videos.second);
    });
  })(window.angular);

  function VideoProvider(Private) {
    var TemplateVisType = Private(require('ui/template_vis_type/TemplateVisType'));
    return new TemplateVisType({
      name: 'trVideo',
      title: 'Video',
      icon: 'fa-camera-retro',
      description: 'Display random video on kibana dashboard',
      requiresSearch: false,
      template: require('plugins/kvideo/kvideo.html')
      // params: {
      //   //editor: require('plugins/kvideo/kvideo-editor.html')        
      // }      
    });
  }

  require('ui/registry/vis_types').register(VideoProvider);  
  return VideoProvider;
});

你不能把所有这些都命名为同一个东西,试试:

module = (function VideoControllerModule($angular) {    
    $angular.module(APP_NAME).controller('VideoController',function videoController($scope, video) {

抱歉耽搁了,如果有人想看代码,你可以查看我的gitlink->https://github.com/manmohan-nec/kvideo.git[ " video plugin for kibana using ng-video"]1