Code Monkey home page Code Monkey logo

Comments (20)

deepakmldeveloper avatar deepakmldeveloper commented on August 18, 2024

Hi,

Are you able to resolve the issues?

Thanks

from kibana-time-plugin.

nreese avatar nreese commented on August 18, 2024

There has been a lot of refactoring in Kibana between 7.0 and 7.5.

It looks like SimpleEmitter used at https://github.com/nreese/kibana-time-plugin/blob/master/public/timeController.js#L9 no longer exists in 7.5. Try replacing it with import EventEmitter from 'events';

from kibana-time-plugin.

deepakmldeveloper avatar deepakmldeveloper commented on August 18, 2024

from kibana-time-plugin.

deepakmldeveloper avatar deepakmldeveloper commented on August 18, 2024

Hi,

I made following changes:

//import { SimpleEmitter } from 'events';
import { EventEmitter } from 'events';

and

//const msearchEmitter = new SimpleEmitter();
const msearchEmitter = new EventEmitter();

in timeController.js file. But still following error is coming:

TypeError: emitter.on is not a function
listen.js:34
Detected an unhandled Promise rejection.
TypeError: emitter.on is not a function fatal_errors_service.tsx:118

Any suggestion?

Thanks

from kibana-time-plugin.

nreese avatar nreese commented on August 18, 2024

try putting a break point in listen.js and seeing what is getting passed in.

from kibana-time-plugin.

deepakmldeveloper avatar deepakmldeveloper commented on August 18, 2024

from kibana-time-plugin.

deepakmldeveloper avatar deepakmldeveloper commented on August 18, 2024

Hi,

Did you get chance to work on this bug?

Thanks

from kibana-time-plugin.

nreese avatar nreese commented on August 18, 2024

I have not had time to look into the issue

here is a guide for using chrome debugger to isolate the issue https://dzone.com/articles/debug-javascript-using-chrome-developer-tools

from kibana-time-plugin.

deepakmldeveloper avatar deepakmldeveloper commented on August 18, 2024

HI,

Following code is not executing:
$scope.$listen(timefilter, 'timeUpdate', () => {
$scope.$evalAsync(() => setTime());
});
it throws
message: "emitter.on is not a function"
stack: "TypeError: emitter.on is not a function↵ at ChildScope.$rootScope.constructor.$listen (http://localhost:5601/fya/bundles/commons.bundle.js:151308:13)↵ at Object. (http://localhost:5601/fya/bundles/commons.bundle.js:25847:10)↵ at Object.invoke (webpack://%5Bname%5D/./node_modules/angular/angular.js?:5143:19)↵ at $controllerInit (webpack://%5Bname%5D/./node_modules/angular/angular.js?:11707:34)↵ at nodeLinkFn (webpack://%5Bname%5D/./node_modules/angular/angular.js?:10520:33)↵ at compositeLinkFn (webpack://%5Bname%5D/./node_modules/angular/angular.js?:9835:13)↵ at publicLinkFn (webpack://%5Bname%5D/./node_modules/angular/angular.js?:9700:30)↵ at _callee$ (http://localhost:5601/fya/bundles/commons.bundle.js:183443:84)↵ at tryCatch (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:45:40)↵ at Generator.invoke [as _invoke] (webpack://%5Bname%5D/./node_modules/regenerator-runtime/runtime.js?:271:22)"
proto: Error
constructor: ƒ TypeError()
message: ""
name: "TypeError"
toString: ƒ toString()
proto: Object

Let's know if you have any idea?

Thanks

from kibana-time-plugin.

deepakmldeveloper avatar deepakmldeveloper commented on August 18, 2024

Hi,

I commented following function in timeContoller.js

/*
$scope.$listen(timefilter, 'timeUpdate', () => {
$scope.$evalAsync(() => setTime());
});
*/

After that plugin is getting displayed, but I don't know how it will affect the whole plugin. Please let me know what to do next? How should i re-rewrite this code?

Thanks

from kibana-time-plugin.

nreese avatar nreese commented on August 18, 2024

After that plugin is getting displayed, but I don't know how it will affect the whole plugin. Please let me know what to do next? How should i re-rewrite this code?

I believe that subscript is to update the time slider when the Kibana global time picker changes. With that listen removed, does the time slider update when the global time picker changes?

If it does not, try adding the following, globalState is an angular service that gets injected in module.controller definition.

$scope.$listen(globalState, 'fetch_with_changes', diff => {
      if (diff.includes('time')) {
        setTime();
      }
});

from kibana-time-plugin.

ch-bas avatar ch-bas commented on August 18, 2024

Hi folks,
if you make these changes, the plugin should work fine:
remove:

import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { VisTypesRegistryProvider } from 'ui/registry/vis_types';

and replace it by:

import { AngularVisController } from 'ui/vis/vis_types/angular_vis_type';
import KbnTimeVisController  from './timeController'

import { setup as visualizations } from '../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy';
import { npSetup } from 'ui/new_platform';



  const timePickeerDefinition = {
    name: 'time',
    title: 'Time widget',
    icon: 'clock',
    visualization: AngularVisController,
    description: 'Add time inputs to your dashboards.',
    visConfig: {
      template: visTemplate,
      defaults: {
          enable_quick: true,
          enable_relative: true,
          enable_absolut: true,
          enable_animation: true,
      }
    },
    editorConfig: {
      optionsTemplate: optionsTemplate
    },
    requestHandler: 'none',
    responseHandler: 'none'
  };

npSetup.plugins.expressions.registerFunction(timePickeerDefinition);
visualizations.types.createBaseVisualization(timePickeerDefinition);

and then in timeController.js, comment this:
$scope.$listen(timefilter, 'timeUpdate', () => { $scope.$evalAsync(() => setTime()); });

from kibana-time-plugin.

deepakmldeveloper avatar deepakmldeveloper commented on August 18, 2024

from kibana-time-plugin.

Arvin-developer avatar Arvin-developer commented on August 18, 2024

Hi folks,
if you make these changes, the plugin should work fine:
remove:

import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { VisTypesRegistryProvider } from 'ui/registry/vis_types';

and replace it by:

import { AngularVisController } from 'ui/vis/vis_types/angular_vis_type';
import KbnTimeVisController  from './timeController'

import { setup as visualizations } from '../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy';
import { npSetup } from 'ui/new_platform';



  const timePickeerDefinition = {
    name: 'time',
    title: 'Time widget',
    icon: 'clock',
    visualization: AngularVisController,
    description: 'Add time inputs to your dashboards.',
    visConfig: {
      template: visTemplate,
      defaults: {
          enable_quick: true,
          enable_relative: true,
          enable_absolut: true,
          enable_animation: true,
      }
    },
    editorConfig: {
      optionsTemplate: optionsTemplate
    },
    requestHandler: 'none',
    responseHandler: 'none'
  };

npSetup.plugins.expressions.registerFunction(timePickeerDefinition);
visualizations.types.createBaseVisualization(timePickeerDefinition);

and then in timeController.js, comment this:
$scope.$listen(timefilter, 'timeUpdate', () => { $scope.$evalAsync(() => setTime()); });

Thanks for your help !
I follow those setting on opendistro kibana 7.4.2 , the web error also exit and no diagram display :

vendors.bundle.dll.js:28 Uncaught TypeError: emitter.on is not a function
at ChildScope.$rootScope.constructor.$listen (commons.bundle.js:85)
at Object. (kibana.bundle.js:1)
at Object.invoke (vendors.bundle.dll.js:239)
at $controllerInit (vendors.bundle.dll.js:239)
at nodeLinkFn (vendors.bundle.dll.js:239)
at compositeLinkFn (vendors.bundle.dll.js:239)
at publicLinkFn (vendors.bundle.dll.js:239)
at commons.bundle.js:83
at new Promise ()
at AngularVisController.render (commons.bundle.js:83)

If you have any adivce , please help to reply , thanks !

from kibana-time-plugin.

ch-bas avatar ch-bas commented on August 18, 2024

Hi @Arvin-developer , that was already answered, you should remove
$scope.$listen(timefilter, 'timeUpdate', () => { $scope.$evalAsync(() => setTime()); });

from kibana-time-plugin.

Arvin-developer avatar Arvin-developer commented on August 18, 2024

Hi @Arvin-developer , that was already answered, you should remove
$scope.$listen(timefilter, 'timeUpdate', () => { $scope.$evalAsync(() => setTime()); });

Thanks for your help !
I had remove this code on timeController.js , and restart the kibana ,but meet the new exception :

FATAL Error: Optimizations failure.
4579 modules

ERROR in ./plugins/kibana-time-plugin/public/time.js
Module not found: Error: Can't resolve '../../../src/legacy/core_plugins/vis

ualizations/public/np_ready/public/legacy' in 'C:\inetpub\odfe-1.4.0-kibana_DEV
plugins\kibana-time-plugin\public'

Is maybe kibana version different to 7.5 so that miss the js source ?

from kibana-time-plugin.

ch-bas avatar ch-bas commented on August 18, 2024

Please make sure that you are pointing to the write destination, because the file does exist in Kibana 7.5.

from kibana-time-plugin.

Arvin-developer avatar Arvin-developer commented on August 18, 2024

Please make sure that you are pointing to the write destination, because the file does exist in Kibana 7.5.

Thanks @ch-bas
My kibana version is opendistro kibana 7.4.2 , there is no src\legacy\core_plugins\visualizations\public\np_ready\public\legacy.js file , so error happend .
Maybe we can not add this plugin on difference opendistro kibana 7.4.2 , it will need to modify many js code .

from kibana-time-plugin.

prasinos avatar prasinos commented on August 18, 2024

Hi folks,
if you make these changes, the plugin should work fine:
remove:

import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { VisTypesRegistryProvider } from 'ui/registry/vis_types';

and replace it by:

import { AngularVisController } from 'ui/vis/vis_types/angular_vis_type';
import KbnTimeVisController  from './timeController'

import { setup as visualizations } from '../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy';
import { npSetup } from 'ui/new_platform';



  const timePickeerDefinition = {
    name: 'time',
    title: 'Time widget',
    icon: 'clock',
    visualization: AngularVisController,
    description: 'Add time inputs to your dashboards.',
    visConfig: {
      template: visTemplate,
      defaults: {
          enable_quick: true,
          enable_relative: true,
          enable_absolut: true,
          enable_animation: true,
      }
    },
    editorConfig: {
      optionsTemplate: optionsTemplate
    },
    requestHandler: 'none',
    responseHandler: 'none'
  };

npSetup.plugins.expressions.registerFunction(timePickeerDefinition);
visualizations.types.createBaseVisualization(timePickeerDefinition);

and then in timeController.js, comment this:
$scope.$listen(timefilter, 'timeUpdate', () => { $scope.$evalAsync(() => setTime()); });

Hi @ch-bas,

I modified time.js and timeController.js as you describe but I am getting the following error:

Version: 7.5.2 Build: 27675 Error: Register requires an function register@http://host.removed.com:5601/bundles/plugin/expressions.bundle.js:3:12420 registerFunction@http://host.removed.com:5601/bundles/plugin/expressions.bundle.js:3:7982 @http://host.removed.com:5601/bundles/commons.bundle.js:3:6403163 __webpack_require__@http://host.removed.com:5601/bundles/kibana.bundle.js:3:1463 @http://host.removed.com:5601/bundles/commons.bundle.js:3:796141 __webpack_require__@http://host.removed.com:5601/bundles/kibana.bundle.js:3:1463 __kbnBundles__.kibana<@http://host.removed.com:5601/bundles/kibana.bundle.js:3:739512 __webpack_require__@http://host.removed.com:5601/bundles/kibana.bundle.js:3:1463 requireLegacyFiles@http://host.removed.com:5601/bundles/kibana.bundle.js:3:739114 start@http://host.removed.com:5601/bundles/commons.bundle.js:3:2485247 _callee2$@http://host.removed.com:5601/bundles/commons.bundle.js:3:2480213 tryCatch@http://host.removed.com:5601/built_assets/dlls/vendors.bundle.dll.js:489:789856 invoke@http://host.removed.com:5601/built_assets/dlls/vendors.bundle.dll.js:489:793705 defineIteratorMethods/</prototype[method]@http://host.removed.com:5601/built_assets/dlls/vendors.bundle.dll.js:489:790980 asyncGeneratorStep@http://host.removed.com:5601/bundles/commons.bundle.js:3:2472100 _next@http://host.removed.com:5601/bundles/commons.bundle.js:3:2472411 notify/<@http://host.removed.com:5601/built_assets/dlls/vendors.bundle.dll.js:314:123090 flush@http://host.removed.com:5601/built_assets/dlls/vendors.bundle.dll.js:109:959249
I am using Kibana 7.5.2 on docker with the directory of the plugin mounted on /usr/share/kibana/plugins/kibana-time-plugin in the container.
Is there any other modification I should do? Thank you.

from kibana-time-plugin.

ch-bas avatar ch-bas commented on August 18, 2024

Maybe this will help #64 .

from kibana-time-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.