We have an existing web-application that is self contained. It makes restful calls to a service we have developed and the service then makes all the elastic search calls and returns json back to the web-app.
We want to bundle the web-app into a kibana plugin. All of the javascript code in this app is not node.js type javascript, but rather, object-based, like this:
//////////////////////////////////////////////////////////////////////////
AbstractView.prototype = Object.create(AbstractApplicationComponent.prototype);
AbstractView.prototype.constructor = AbstractView;
/**
- Abstract class to define structure for arbitrary UI elements. Inherits from AbstractApplicationComponent.
*/
function AbstractView(containerSelector, componentSelectors) {
// Inheritance.
AbstractApplicationComponent.call(this);
// Members.
this._containerSelector = containerSelector ? containerSelector : document.createElement("div");
this._selectors = componentSelectors ? componentSelectors : {};
this._verifySelectors(); // Verify the provided selectors.
}
AbstractView.prototype._verifySelectors = function() {
if ($(this._containerSelector).length == 0) {
this._logWarning("Parent container '" + this._containerSelector + "' could not be found on the page.");
}
for (var name in this._selectors) {
if ($(this._selectors[name]).length == 0) {
this._logWarning("Selector '" + name + "' was provided as '" + this._selectors[name] + "' but could not be found on the page.");
}
}
};
AbstractView.prototype.getContainerSelector = function() {
return this._containerSelector;
};
////////////////////////////////////////////
In my app.js
I am doing many imports to bring in all the existing code, like this:
import './js/dragonfly/Core/ApplicationEvents.js';
import './js/dragonfly/Core/AbstractApplicationProperties.js';
import './js/dragonfly/Core/AbstractApplication.js';
...
But I find once I start kibana, and click on my new plugin "app" I get these kind of errors:
Uncaught ReferenceError: AbstractPubSub
My question(s) are.
. how do I import this existing code so I don't get the ReferenceErrors ?
. and am I even on the right track attempting to bring my existing non-node.js code into kibana like this ?