mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[server] work out plugin organization, and app declaration
This commit is contained in:
parent
f47d3ca494
commit
8d2e8816dc
800 changed files with 1406 additions and 1255 deletions
3
.bowerrc
3
.bowerrc
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"directory": "./src/kibana/bower_components"
|
||||
}
|
|
@ -1 +1 @@
|
|||
0.10.x
|
||||
iojs-2
|
||||
|
|
|
@ -7,7 +7,6 @@ cache:
|
|||
directories:
|
||||
- esvm
|
||||
- node_modules
|
||||
- src/kibana/bower_components
|
||||
before_cache:
|
||||
- rm -rf esvm/*/logs esvm/data_dir
|
||||
notifications:
|
||||
|
|
|
@ -11,13 +11,6 @@
|
|||
],
|
||||
"license": "Apache 2.0",
|
||||
"homepage": "http://www.elastic.co/products/kibana",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"angular": "1.2.28",
|
||||
"angular-bindonce": "0.3.3",
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
"ansicolors": "^0.3.2",
|
||||
"bluebird": "^2.9.27",
|
||||
"body-parser": "^1.10.1",
|
||||
"boom": "^2.8.0",
|
||||
"bunyan": "^1.2.3",
|
||||
"commander": "^2.6.0",
|
||||
"compression": "^1.3.0",
|
||||
|
@ -60,6 +61,7 @@
|
|||
"js-yaml": "^3.2.5",
|
||||
"lodash": "^3.9.3",
|
||||
"json-stringify-safe": "^5.0.1",
|
||||
"minimatch": "^2.0.8",
|
||||
"moment": "^2.10.3",
|
||||
"numeral": "^1.5.3",
|
||||
"request": "^2.40.0",
|
||||
|
|
3
src/.jshintrc
Normal file
3
src/.jshintrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../.jshintrc.node"
|
||||
}
|
|
@ -6,7 +6,7 @@ set SCRIPT_DIR=%~dp0
|
|||
for %%I in ("%SCRIPT_DIR%..") do set DIR=%%~dpfI
|
||||
|
||||
set NODE=%DIR%\node\node.exe
|
||||
set SERVER=%DIR%\src\bin\kibana.js
|
||||
set SERVER=%DIR%\src\server\cli
|
||||
set NODE_ENV="production"
|
||||
set CONFIG_PATH=%DIR%\config\kibana.yml
|
||||
|
|
@ -15,7 +15,7 @@ done
|
|||
|
||||
DIR=$(dirname "${SCRIPT}")/..
|
||||
NODE=${DIR}/node/bin/node
|
||||
SERVER=${DIR}/src/bin/kibana.js
|
||||
SERVER=${DIR}/src/server/cli
|
||||
|
||||
CONFIG_PATH="${DIR}/config/kibana.yml" NODE_ENV="production" exec "${NODE}" ${SERVER} ${@}
|
||||
|
79
src/dev_server/dev_statics_plugin/index.js
Normal file
79
src/dev_server/dev_statics_plugin/index.js
Normal file
|
@ -0,0 +1,79 @@
|
|||
module.exports = function (kibana) {
|
||||
var path = require('path');
|
||||
var glob = require('glob');
|
||||
var join = path.join;
|
||||
var rel = join.bind(null, __dirname);
|
||||
|
||||
var ROOT = rel('../../../');
|
||||
var SRC = join(ROOT, 'src');
|
||||
var NODE_MODULES = join(ROOT, 'node_modules');
|
||||
var APP = join(SRC, 'kibana');
|
||||
var TEST = join(ROOT, 'test');
|
||||
var istanbul = require('./lib/istanbul');
|
||||
var amdWrapper = require('./lib/amd_wrapper');
|
||||
var kibanaSrcFilter = require('./lib/kibana_src_filter');
|
||||
|
||||
return new kibana.Plugin({
|
||||
require: ['marvel'],
|
||||
init: function (server, options) {
|
||||
server.ext('onPreHandler', istanbul({ root: SRC, displayRoot: SRC, filter: kibanaSrcFilter }));
|
||||
server.ext('onPreHandler', istanbul({ root: APP, displayRoot: SRC, filter: kibanaSrcFilter }));
|
||||
|
||||
server.route({
|
||||
path: '/test/{paths*}',
|
||||
method: 'GET',
|
||||
handler: {
|
||||
directory: {
|
||||
path: TEST
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
server.route({
|
||||
path: '/amd-wrap/{paths*}',
|
||||
method: 'GET',
|
||||
handler: amdWrapper({ root: ROOT })
|
||||
});
|
||||
|
||||
server.route({
|
||||
path: '/src/{paths*}',
|
||||
method: 'GET',
|
||||
handler: {
|
||||
directory: {
|
||||
path: SRC
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
server.route({
|
||||
path: '/node_modules/{paths*}',
|
||||
method: 'GET',
|
||||
handler: {
|
||||
directory: {
|
||||
path: NODE_MODULES
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
server.route({
|
||||
path: '/specs',
|
||||
method: 'GET',
|
||||
handler: function (request, reply) {
|
||||
var unit = join(ROOT, '/test/unit/');
|
||||
glob(join(unit, 'specs/**/*.js'), function (er, files) {
|
||||
var moduleIds = files
|
||||
.filter(function (filename) {
|
||||
return path.basename(filename).charAt(0) !== '_';
|
||||
})
|
||||
.map(function (filename) {
|
||||
return path.relative(unit, filename).replace(/\\/g, '/').replace(/\.js$/, '');
|
||||
});
|
||||
|
||||
return reply(moduleIds);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
};
|
4
src/dev_server/dev_statics_plugin/package.json
Normal file
4
src/dev_server/dev_statics_plugin/package.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "dev_statics",
|
||||
"version": "1.0.0"
|
||||
}
|
26
src/dev_server/index.js
Normal file
26
src/dev_server/index.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
var _ = require('lodash');
|
||||
var join = require('path').join;
|
||||
|
||||
var KbnServer = require('../server');
|
||||
|
||||
function run(grunt) {
|
||||
var opt = grunt ? _.bindKey(grunt, 'option') : _.noop;
|
||||
|
||||
return (new KbnServer({
|
||||
'logging.quiet': opt('debug') && opt('verbose'),
|
||||
'kibana.server.port': opt('port') || 5601,
|
||||
'kibana.pluginPaths': [
|
||||
join(__dirname, 'dev_statics_plugin')
|
||||
],
|
||||
'kibana.pluginScanDirs': [
|
||||
join(__dirname, '..', 'plugins')
|
||||
]
|
||||
}))
|
||||
.listen();
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
run().done();
|
||||
} else {
|
||||
module.exports = run;
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
define(function (require) {
|
||||
return function SetupErrorFactory(configFile) {
|
||||
var _ = require('lodash');
|
||||
|
||||
function SetupError(template, err) {
|
||||
// don't override other setup errors
|
||||
if (err && err instanceof SetupError) return err;
|
||||
|
||||
var err2 = new Error(_.template(template)({ configFile: configFile }));
|
||||
if (err) {
|
||||
err2.origError = err;
|
||||
if (err.stack) err2.stack = err.stack;
|
||||
}
|
||||
return err2;
|
||||
}
|
||||
return SetupError;
|
||||
};
|
||||
});
|
|
@ -1,29 +0,0 @@
|
|||
define(function (require) {
|
||||
var _ = require('lodash');
|
||||
var $ = require('jquery');
|
||||
|
||||
require('components/notify/notify');
|
||||
|
||||
require('modules').get('components/setup', ['kibana', 'kibana/notify', 'kibana/config'])
|
||||
.service('kbnSetup', function (Private, Promise, Notifier, es, configFile) {
|
||||
// setup steps
|
||||
var checkForEs = Private(require('components/setup/steps/check_for_es'));
|
||||
var checkEsVersion = Private(require('components/setup/steps/check_es_version'));
|
||||
var checkForKibanaIndex = Private(require('components/setup/steps/check_for_kibana_index'));
|
||||
var createKibanaIndex = Private(require('components/setup/steps/create_kibana_index'));
|
||||
|
||||
var notify = new Notifier({ location: 'Setup' });
|
||||
|
||||
return _.once(function () {
|
||||
var complete = notify.lifecycle('bootstrap');
|
||||
|
||||
return checkForEs()
|
||||
.then(checkEsVersion)
|
||||
.then(checkForKibanaIndex)
|
||||
.then(function (exists) {
|
||||
if (!exists) return createKibanaIndex();
|
||||
})
|
||||
.then(complete, complete.failure);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,43 +0,0 @@
|
|||
define(function (require) {
|
||||
return function CheckEsVersionFn(Private, es, configFile, Notifier, minimumElasticsearchVersion) {
|
||||
|
||||
var _ = require('lodash');
|
||||
var versionmath = require('utils/versionmath');
|
||||
var esBool = require('utils/esBool');
|
||||
var notify = new Notifier({
|
||||
location: 'Setup: Elasticsearch version check'
|
||||
});
|
||||
|
||||
return notify.timed(function checkEsVersion() {
|
||||
var SetupError = Private(require('components/setup/_setup_error'));
|
||||
|
||||
return es.nodes.info()
|
||||
.then(function (info) {
|
||||
var badNodes = _.filter(info.nodes, function (node) {
|
||||
// remove client nodes (Logstash)
|
||||
var isClient = _.get(node, 'attributes.client');
|
||||
if (isClient != null && esBool(isClient) === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// remove nodes that are gte the min version
|
||||
var v = node.version.split('-')[0];
|
||||
return !versionmath.gte(minimumElasticsearchVersion, v);
|
||||
});
|
||||
|
||||
if (!badNodes.length) return true;
|
||||
|
||||
var badNodeNames = badNodes.map(function (node) {
|
||||
return 'Elasticsearch v' + node.version + ' @ ' + node.http_address + ' (' + node.ip + ')';
|
||||
});
|
||||
|
||||
throw SetupError(
|
||||
'This version of Kibana requires Elasticsearch ' +
|
||||
minimumElasticsearchVersion + ' or higher on all nodes. ' +
|
||||
'I found the following incompatible nodes in your cluster: \n\n' +
|
||||
badNodeNames.join('\n')
|
||||
);
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
|
@ -1,21 +0,0 @@
|
|||
define(function (require) {
|
||||
return function checkForEsFunction(Private, Notifier, es, configFile) {
|
||||
var SetupError = Private(require('components/setup/_setup_error'));
|
||||
var notify = new Notifier({ location: 'Setup: Elasticsearch check' });
|
||||
|
||||
return function checkForES() {
|
||||
var complete = notify.lifecycle('es check');
|
||||
return es.info({
|
||||
method: 'GET'
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (err.body && err.body.message) {
|
||||
throw new SetupError(err.body.message, err);
|
||||
} else {
|
||||
throw new SetupError('Unknown error while connecting to Elasticsearch', err);
|
||||
}
|
||||
})
|
||||
.then(complete, complete.failure);
|
||||
};
|
||||
};
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
define(function (require) {
|
||||
return function CheckForKibanaIndexFn(Private, es, Notifier, configFile) {
|
||||
var SetupError = Private(require('components/setup/_setup_error'));
|
||||
var notify = new Notifier({ location: 'Setup: Kibana index check' });
|
||||
|
||||
return function checkForKibana() {
|
||||
var complete = notify.lifecycle('kibana index check');
|
||||
return es.indices.exists({
|
||||
index: configFile.kibana_index
|
||||
})
|
||||
.catch(function (err) {
|
||||
throw new SetupError('Unable to check for Kibana index "<%= configFile.kibana_index %>"', err);
|
||||
})
|
||||
.then(complete, complete.failure);
|
||||
};
|
||||
};
|
||||
});
|
|
@ -1,31 +0,0 @@
|
|||
define(function (require) {
|
||||
return function CreateKibanaIndexFn(Private, es, configFile, Notifier) {
|
||||
return function createKibanaIndex() {
|
||||
var notify = new Notifier({ location: 'Setup: Kibana Index Creation' });
|
||||
var complete = notify.lifecycle('kibana index creation');
|
||||
var SetupError = Private(require('components/setup/_setup_error'));
|
||||
|
||||
return es.indices.create({
|
||||
index: configFile.kibana_index,
|
||||
body: {
|
||||
settings: {
|
||||
number_of_shards : 1
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
throw new SetupError('Unable to create Kibana index "<%= configFile.kibana_index %>"', err);
|
||||
})
|
||||
.then(function () {
|
||||
return es.cluster.health({
|
||||
waitForStatus: 'yellow',
|
||||
index: configFile.kibana_index
|
||||
})
|
||||
.catch(function (err) {
|
||||
throw new SetupError('Waiting for Kibana index "<%= configFile.kibana_index %>" to come online failed', err);
|
||||
});
|
||||
})
|
||||
.then(complete, complete.failure);
|
||||
};
|
||||
};
|
||||
});
|
|
@ -1,46 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
|
||||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="shortcut icon" href="styles/theme/elk.ico">
|
||||
<title>Kibana 4</title>
|
||||
<link rel="stylesheet" href="styles/main.css?_b=@@buildNum">
|
||||
|
||||
</head>
|
||||
<body kibana ng-class="'application-' + activeApp.id">
|
||||
|
||||
<div class="col-md-offset-4 col-md-4 page-header initial-load">
|
||||
<center>
|
||||
<img width="128" alt="Loading Kibana" src="images/initial_load.gif">
|
||||
<h1>
|
||||
<strong>Kibana</strong>
|
||||
<small id="cache-message">is loading. Give me a moment here. I'm loading a whole bunch of code. Don't worry, all this good stuff will be cached up for next time!</small>
|
||||
</h1>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.KIBANA_VERSION='@@version';
|
||||
window.KIBANA_BUILD_NUM='@@buildNum';
|
||||
window.KIBANA_COMMIT_SHA='@@commitSha';
|
||||
</script>
|
||||
|
||||
<script src="bower_components/requirejs/require.js?_b=@@buildNum"></script>
|
||||
<script src="require.config.js?_b=@@buildNum"></script>
|
||||
<script>
|
||||
var showCacheMessage = location.href.indexOf('?embed') < 0 && location.href.indexOf('&embed') < 0;
|
||||
if (!showCacheMessage) document.getElementById('cache-message').style.display = 'none';
|
||||
|
||||
if (window.KIBANA_BUILD_NUM.substr(0, 2) !== '@@') {
|
||||
// only cache bust if this is really the build number
|
||||
require.config({ urlArgs: '_b=' + window.KIBANA_BUILD_NUM });
|
||||
}
|
||||
|
||||
require(['kibana'], function (kibana) { kibana.init(); });
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -81,17 +81,19 @@ module.exports = function (kibana) {
|
|||
icon: 'plugins/my-kibana-plugins/scratchpad/logo.png',
|
||||
|
||||
// when you want to run your app, which module should we load?
|
||||
main: 'plugins/my-kibana-plugins/scratchpad/controller.js',
|
||||
main: 'plugins/my-kibana-plugins/scratchpad/controller',
|
||||
|
||||
// what modules from other plugins does your app use?
|
||||
uses: [
|
||||
'plugins/*/favorites'
|
||||
'visTypes',
|
||||
'spyModes',
|
||||
'fieldFormats'
|
||||
]
|
||||
},
|
||||
|
||||
// visualizations, fieldForamtters, and other module types are exposed
|
||||
// visTypes, fieldForamtters, and other module types are exposed
|
||||
// by simply listing their module ids
|
||||
visualizations: [
|
||||
visTypes: [
|
||||
'plugins/my-kibana-plugins/pie/PieChart',
|
||||
'plugins/my-kibana-plugins/table/table'
|
||||
]
|
43
src/plugins/elasticsearch/index.js
Normal file
43
src/plugins/elasticsearch/index.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
module.exports = function (kibana) {
|
||||
var healthCheck = require('./lib/health_check');
|
||||
var exposeClient = require('./lib/expose_client');
|
||||
var createProxy = require('./lib/create_proxy');
|
||||
|
||||
return new kibana.Plugin({
|
||||
init: function (server, options) {
|
||||
var config = server.config();
|
||||
|
||||
// Expose the client to the server
|
||||
exposeClient(server);
|
||||
|
||||
|
||||
createProxy(server, 'GET', '/elasticsearch/{paths*}');
|
||||
createProxy(server, 'POST', '/elasticsearch/_mget');
|
||||
createProxy(server, 'POST', '/elasticsearch/_msearch');
|
||||
|
||||
function noBulkCheck(request, reply) {
|
||||
if (/\/_bulk/.test(request.path)) {
|
||||
return reply({
|
||||
error: 'You can not send _bulk requests to this interface.'
|
||||
}).code(400).takeover();
|
||||
}
|
||||
return reply.continue();
|
||||
}
|
||||
|
||||
createProxy(
|
||||
server,
|
||||
['PUT', 'POST', 'DELETE'],
|
||||
'/elasticsearch/' + config.get('kibana.index') + '/{paths*}',
|
||||
{
|
||||
prefix: '/' + config.get('kibana.index'),
|
||||
config: { pre: [ noBulkCheck ] }
|
||||
}
|
||||
);
|
||||
|
||||
// Set up the health check service and start it.
|
||||
healthCheck(this, server).start();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
};
|
4
src/plugins/elasticsearch/package.json
Normal file
4
src/plugins/elasticsearch/package.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "elasticsearch",
|
||||
"version": "1.0.0"
|
||||
}
|
13
src/plugins/kbn-vislib-vis-types/index.js
Normal file
13
src/plugins/kbn-vislib-vis-types/index.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
module.exports = function (kibana) {
|
||||
|
||||
return new kibana.Plugin({
|
||||
|
||||
exports: {
|
||||
visTypes: [
|
||||
'plugins/kbn-vislib-vis-types/index'
|
||||
]
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
};
|
4
src/plugins/kbn-vislib-vis-types/package.json
Normal file
4
src/plugins/kbn-vislib-vis-types/package.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "kbn-vislib-vis-types",
|
||||
"version": "1.0.0"
|
||||
}
|
|
@ -2,7 +2,7 @@ define(function (require) {
|
|||
var _ = require('lodash');
|
||||
var $ = require('jquery');
|
||||
var module = require('modules').get('kibana');
|
||||
require('directives/inequality');
|
||||
require('ui/directives/inequality');
|
||||
|
||||
module.directive('pointSeriesOptions', function ($parse, $compile) {
|
||||
return {
|
20
src/plugins/kibana/index.js
Normal file
20
src/plugins/kibana/index.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
module.exports = function (kibana) {
|
||||
|
||||
return new kibana.Plugin({
|
||||
|
||||
exports: {
|
||||
app: {
|
||||
title: 'Kibana',
|
||||
description: 'the kibana you know and love',
|
||||
icon: 'images/logo.png',
|
||||
main: 'plugins/kibana/index',
|
||||
uses: [
|
||||
'visualizations',
|
||||
'spyModes'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
};
|
4
src/plugins/kibana/package.json
Normal file
4
src/plugins/kibana/package.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "kibana",
|
||||
"version": "1.0.0"
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"extends": "../../.jshintrc.browser"
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ define(function (require) {
|
|||
var angular = require('angular');
|
||||
var ConfigTemplate = require('utils/config_template');
|
||||
|
||||
require('directives/config');
|
||||
require('ui/directives/config');
|
||||
require('components/courier/courier');
|
||||
require('components/config/config');
|
||||
require('components/notify/notify');
|
|
@ -4,8 +4,8 @@ define(function (require) {
|
|||
var html = require('text!plugins/discover/components/field_chooser/discover_field.html');
|
||||
var _ = require('lodash');
|
||||
|
||||
require('directives/css_truncate');
|
||||
require('directives/field_name');
|
||||
require('ui/directives/css_truncate');
|
||||
require('ui/directives/field_name');
|
||||
|
||||
|
||||
app.directive('discoverField', function ($compile) {
|
|
@ -1,9 +1,9 @@
|
|||
define(function (require) {
|
||||
var app = require('modules').get('apps/discover');
|
||||
|
||||
require('directives/css_truncate');
|
||||
require('directives/field_name');
|
||||
require('filters/unique');
|
||||
require('ui/directives/css_truncate');
|
||||
require('ui/directives/field_name');
|
||||
require('ui/filters/unique');
|
||||
require('plugins/discover/components/field_chooser/discover_field');
|
||||
|
||||
app.directive('discFieldChooser', function ($location, globalState, config, $route, Private) {
|
|
@ -11,9 +11,9 @@ define(function (require) {
|
|||
require('components/notify/notify');
|
||||
require('components/timepicker/timepicker');
|
||||
require('components/fixedScroll');
|
||||
require('directives/validate_json');
|
||||
require('ui/directives/validate_json');
|
||||
require('components/validate_query/validate_query');
|
||||
require('filters/moment');
|
||||
require('ui/filters/moment');
|
||||
require('components/courier/courier');
|
||||
require('components/index_patterns/index_patterns');
|
||||
require('components/state_management/app_state');
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue