initial commit

This commit is contained in:
Spencer Alger 2014-02-06 16:29:19 -07:00
commit a6742be90a
13 changed files with 171 additions and 0 deletions

3
.bowerrc Normal file
View file

@ -0,0 +1,3 @@
{
"directory": "./src/bower_components"
}

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
node_modules/
bower_components

16
Gulpfile.js Normal file
View file

@ -0,0 +1,16 @@
var gulp = require('gulp');
var connect = require('connect');
var paths = {
webroot: 'src/'
};
gulp.task('server', function() {
var app = connect()
// .use(connect.logger('dev'))
.use(connect.static(paths.webroot));
var server = require('http').createServer(app).listen(0, function () {
console.log('server listeing at http://localhost:%d', server.address().port);
});
});

1
README.md Normal file
View file

@ -0,0 +1 @@
# Kibana 4

28
bower.json Normal file
View file

@ -0,0 +1,28 @@
{
"name": "kibana",
"version": "0.0.0",
"authors": [
"Spencer Alger <spencer@spenceralger.com>"
],
"description": "Browser based analytics and search interface to Logstash and other timestamped data sets stored in ElasticSearch",
"main": "src/index.html",
"keywords": [
"kibana",
"elasticsearch"
],
"license": "Apache 2.0",
"homepage": "http://www.elasticsearch.org/overview/kibana/",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"requirejs": "~2.1.10",
"elasticsearch": "~1.4.0",
"angular": "~1.2.10",
"lodash": "~2.4.1"
}
}

25
package.json Normal file
View file

@ -0,0 +1,25 @@
{
"name": "kibana4",
"private": true,
"version": "0.0.0",
"description": "Kibana TNG",
"main": "Gulpfile.js",
"dependencies": {
"connect": "~2.12.0",
"gulp": "~3.5.2"
},
"devDependencies": {},
"scripts": {
"test": "gulp test"
},
"repository": {
"type": "git",
"url": "git@github.com:elasticsearch/kibana4.git"
},
"author": "",
"license": "Apache 2.0",
"bugs": {
"url": "https://github.com/elasticsearch/kibana4/issues"
},
"homepage": "https://github.com/elasticsearch/kibana4"
}

60
src/app/app.js Normal file
View file

@ -0,0 +1,60 @@
define(function (require) {
var Treemap = require('visualize/treemap/index');
var d3 = require('d3');
var margin = {
top: 40,
right: 10,
bottom: 10,
left: 10
},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var color = d3.scale.category20c();
var treemap = d3.layout.treemap()
.size([width, height])
.sticky(true)
.value(function(d) { return d.size; });
var div = d3.select("body").append("div")
.style("position", "relative")
.style("width", (width + margin.left + margin.right) + "px")
.style("height", (height + margin.top + margin.bottom) + "px")
.style("left", margin.left + "px")
.style("top", margin.top + "px");
d3.json("flare.json", function(error, root) {
var node = div.datum(root).selectAll(".node")
.data(treemap.nodes)
.enter().append("div")
.attr("class", "node")
.call(position)
.style("background", function(d) { return d.children ? color(d.name) : null; })
.text(function(d) { return d.children ? null : d.name; });
d3.selectAll("input").on("change", function change() {
var value;
if (this.value === "count") {
value = function() { return 1; };
} else {
value = function(d) { return d.size; };
}
node
.data(treemap.value(value).nodes)
.transition()
.duration(1500)
.call(position);
});
});
function position() {
this.style("left", function(d) { return d.x + "px"; })
.style("top", function(d) { return d.y + "px"; })
.style("width", function(d) { return Math.max(0, d.dx - 1) + "px"; })
.style("height", function(d) { return Math.max(0, d.dy - 1) + "px"; });
}
});

View file

View file

19
src/app/require.config.js Normal file
View file

@ -0,0 +1,19 @@
/**
* Bootstrap require with the needed config, then load the app.js module.
*/
require.config({
baseUrl: 'app',
paths: {
angular: '../bower_components/angular/angular',
lodash: '../bower_components/lodash/lodash',
jquery: '../bower_components/jquery/jquery',
d3: '../bower_components/d3/d3'
},
shim: {
angular: {
deps: ['jquery'],
exports: 'angular'
}
},
waitSeconds: 60
});

View file

View file

17
src/index.html Normal file
View file

@ -0,0 +1,17 @@
<!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">
<title>Kibana 4</title>
<!-- load the root require context -->
<script src="bower_components/requirejs/require.js"></script>
<script src="app/require.config.js"></script>
<script>require(['app'], function () {})</script>
</head>
<body>
</body>
</html>