Skip to content

Commit

Permalink
Merge branch 'master' into fix/elastic#2297
Browse files Browse the repository at this point in the history
  • Loading branch information
stormpython committed Dec 30, 2014
2 parents 2d52936 + a801c00 commit c16b027
Show file tree
Hide file tree
Showing 155 changed files with 3,311 additions and 2,255 deletions.
15 changes: 8 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ Please make sure you have signed the [Contributor License Agreement](http://www.

- Install ruby *1.9.3* (we recommend using [rbenv](https://github.com/sstephenson/rbenv))
- See [rbenv docs](https://github.com/sstephenson/rbenv#installation) for installation assistance

```sh
## install ruby and ruby-build using your local package manager (apt, brew, etc)
## ex. brew install rbenv ruby-build

```sh
## install ruby and ruby-build using your local package manager (apt, brew, etc)
brew install rbenv ruby-build
```

- Run `rbenv init` and add `eval "$(rbenv init -)"` to your shell (ex. .bashrc/.bash_profile)
- Run `rbenv install` to install the required version
- Run `ruby -v` and make sure you are using 1.9.3
- Check the installation docs if you have issues getting the correct version
- Install bundler by running `gem install bundler`
- Install local gems by running `cd src/server; bundle; cd ../..`
```
- Install local gems by running `bundle`

- Install grunt and bower globally

Expand All @@ -40,7 +41,7 @@ Please make sure you have signed the [Contributor License Agreement](http://www.
- Install node, bower, and ruby dependencies

```sh
npm install && bower install && cd src/server && bundle && cd ../..
npm install && bower install && bundle
```

- Start the development server.
Expand Down
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = function (grunt) {
return 'plugins/' + dirname(fileName) + '/index';
});

config.bundledPluginModuleIds = grunt.bundledPluginModuleIds = moduleIds;
config.bundled_plugin_module_ids = grunt.bundled_plugin_module_ids = moduleIds;

// load plugins
require('load-grunt-config')(grunt, {
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- render {"template":"# Kibana <%= pkg.version %>"} -->
# Kibana 4.0.0-BETA2
# Kibana 4.0.0-beta3
<!-- /render -->

[![Build Status](https://travis-ci.org/elasticsearch/kibana.svg?branch=master)](https://travis-ci.org/elasticsearch/kibana?branch=master)
Expand All @@ -22,14 +22,15 @@ Kibana is an open source (Apache Licensed), browser based analytics and search d
- Elasticsearch version 1.4.0 or later
- ...and nothing else

*Note:* Groovy scripting must be enabled in Elasticsearch

## Installation

* Download: [http://www.elasticsearch.org/overview/kibana/installation/](http://www.elasticsearch.org/overview/kibana/installation/)
* Run `bin/kibana` on unix, or `bin/kibana.bat` on Windows.
* Visit [http://localhost:5601](http://localhost:5601)

<!-- include {"path":"docs/quick_start.md"} -->

## Quick Start

You're up and running! Fantastic! Kibana is now running on port 5601, so point your browser at http://YOURDOMAIN.com:5601.
Expand Down Expand Up @@ -325,7 +326,4 @@ Clicking on the *View* action loads that item in the associated applications. Re
Clicking *Edit* will allow you to change the title, description and other settings of the saved object. You can also edit the schema of the stored object.

*Note:* this operation is for advanced users only - making changes here can break large portions of the application.
<!-- /include -->

## Building from Source
If you want the latest code or need something that's not in a release package, you'll need to build from source. See [CONTRIBUTING.md](CONTRIBUTING.md) for instructions.
<!-- /include -->
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"angular-ui-select": "~0.9.3",
"async": "~0.2.10",
"bluebird": "~2.1.3",
"bootstrap": "~3.1.1",
"bootstrap": "~3.3.1",
"d3": "~3.4.8",
"elasticsearch": "elasticsearch/bower-elasticsearch-js#prerelease",
"Faker": "~1.1.0",
Expand All @@ -48,7 +48,7 @@
"require-css": "~0.1.2",
"requirejs": "~2.1.10",
"requirejs-text": "~2.0.10",
"lodash-deep": "spenceralger/lodash-deep#k4"
"lodash-deep": "spenceralger/lodash-deep#a2768a72d7"
},
"devDependencies": {}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kibana",
"private": true,
"version": "4.0.0-BETA2",
"version": "4.0.0-beta3",
"description": "Kibana 4",
"main": "Gulpfile.js",
"dependencies": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ define(function (require) {
var agg = firstAgg._next;
var split = buildSplit(agg, metric, bucket[agg.id]);
// Since splits display labels we need to set it.
split.label = firstAgg.fieldFormatter()(bucket.key) + ': ' + firstAgg.field().displayName;
split.label = firstAgg.fieldFormatter()(bucket.key);

var displayName = firstAgg.fieldDisplayName();
if (!_.isEmpty(displayName)) split.label += ': ' + displayName;

split.tooltipFormatter = tooltipFormatter(raw.columns);
var aggConfigResult = new AggConfigResult(firstAgg, null, null, bucket.key);
split.split = { aggConfig: firstAgg, aggConfigResult: aggConfigResult, key: bucket.key };
Expand Down
30 changes: 18 additions & 12 deletions src/kibana/components/agg_response/tabify/_response_writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ define(function (require) {
this.aggStack = _.pluck(this.columns, 'aggConfig');

this.root = new TableGroup();
this.acrStack = [];
this.splitStack = [this.root];
}

Expand All @@ -66,9 +67,6 @@ define(function (require) {
table.aggConfig = agg;
table.key = key;
table.title = agg.makeLabel() + ': ' + (table.fieldFormatter()(key));
if (this.asAggConfigResults) {
table.aggConfigResult = new AggConfigResult(agg, parent.aggConfigResult, key, key);
}
}

// link the parent and child
Expand Down Expand Up @@ -99,16 +97,23 @@ define(function (require) {

buckets.forEach(function (bucket, key) {
// find the existing split that we should extend
var TableGroup = _.find(self.splitStack[0].tables, { aggConfig: agg, key: key });
var tableGroup = _.find(self.splitStack[0].tables, { aggConfig: agg, key: key });
// create the split if it doesn't exist yet
if (!TableGroup) TableGroup = self._table(true, agg, key);
if (!tableGroup) tableGroup = self._table(true, agg, key);

var splitAcr = false;
if (self.asAggConfigResults) splitAcr = new AggConfigResult(agg, self.acrStack[0], key, key);

// push the split onto the stack so that it will receive written tables
self.splitStack.unshift(TableGroup);
self.splitStack.unshift(tableGroup);
splitAcr && self.acrStack.unshift(splitAcr);

// call the block
if (_.isFunction(block)) block.call(self, bucket, key);

// remove the split from the stack
self.splitStack.shift();
splitAcr && self.acrStack.shift();
});
};

Expand Down Expand Up @@ -144,17 +149,18 @@ define(function (require) {
*/
TabbedAggResponseWriter.prototype.cell = function (agg, value, block) {
if (this.asAggConfigResults) {
var parent = _.findLast(this.rowBuffer, function (result) {
return result.aggConfig.schema.group === 'buckets';
});
if (!parent) parent = this.splitStack[0].aggConfigResult;

value = new AggConfigResult(agg, parent, value, value);
value = new AggConfigResult(agg, this.acrStack[0], value, value);
}

var staskResult = this.asAggConfigResults && value.type === 'bucket';

this.rowBuffer.push(value);
if (staskResult) this.acrStack.unshift(value);

if (_.isFunction(block)) block.call(this);

this.rowBuffer.pop(value);
if (staskResult) this.acrStack.shift();

return value;
};
Expand Down
8 changes: 6 additions & 2 deletions src/kibana/components/agg_table/agg_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
per-page="perPage">

<div class="agg-table-controls">
<a class="small" ng-click="aggTable.exportAsCsv()">
Export <i class="fa fa-download"></i>
<small>Export:</small>&nbsp;&nbsp;
<a class="small" ng-click="aggTable.exportAsCsv(false)">
Raw <i class="fa fa-download"></i>
</a>&nbsp;&nbsp;&nbsp;
<a class="small" ng-click="aggTable.exportAsCsv(true)">
Formatted <i class="fa fa-download"></i>
</a>
<paginate-controls></paginate-controls>
</div>
Expand Down
11 changes: 5 additions & 6 deletions src/kibana/components/agg_table/agg_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ define(function (require) {
quoteValues: config.get('csv:quoteValues')
};

self.exportAsCsv = function () {
var csv = new Blob([self.toCsv()], { type: 'text/plain' });
self.exportAsCsv = function (formatted) {
var csv = new Blob([self.toCsv(formatted)], { type: 'text/plain' });
self._saveAs(csv, self.csv.filename);
};


self.toCsv = function () {
var rows = $scope.table.rows;
var columns = $scope.table.columns;
self.toCsv = function (formatted) {
var rows = formatted ? $scope.formattedRows : $scope.table.rows;
var columns = formatted ? $scope.formattedColumns : $scope.table.columns;
var nonAlphaNumRE = /[^a-zA-Z0-9]/;
var allDoubleQuoteRE = /"/g;

Expand Down
16 changes: 12 additions & 4 deletions src/kibana/components/agg_types/buckets/create_filter/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ define(function (require) {
var _ = require('lodash');
return function CreateFilterFiltersProvider(Private) {
return function (aggConfig, key) {
return _.find(aggConfig.params.filters, function (filter) {
filter.meta = { index: aggConfig.vis.indexPattern.id };
return filter.query.query_string.query === key;
});
// have the aggConfig write agg dsl params
var dslFilters = _.deepGet(aggConfig.toDsl(), 'filters.filters');
var filter = dslFilters[key];

if (filter) {
return {
query: filter.query,
meta: {
index: aggConfig.vis.indexPattern.id
}
};
}
};
};
});
35 changes: 20 additions & 15 deletions src/kibana/components/agg_types/buckets/filters.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
define(function (require) {
return function FiltersAggDefinition(Private) {
return function FiltersAggDefinition(Private, Notifier) {
var _ = require('lodash');
var AggType = Private(require('components/agg_types/_agg_type'));
var createFilter = Private(require('components/agg_types/buckets/create_filter/filters'));

function getTickLabel(query) {

if (query.query_string && query.query_string.query) {
return query.query_string.query;
}
return JSON.stringify(query);
}
var notif = new Notifier({ location: 'Filters Agg' });

return new AggType({
name: 'filters',
Expand All @@ -22,12 +15,24 @@ define(function (require) {
editor: require('text!components/agg_types/controls/filters.html'),
default: [ {input: {}} ],
write: function (aggConfig, output) {
output.params = {
filters: _.transform(aggConfig.params.filters, function (filters, filter, iterator) {
// We need to check here
filters[getTickLabel(filter.input.query)] = filter.input || {query: {query_string: {query: '*'}}};
}, {})
};
var inFilters = aggConfig.params.filters;
if (!_.size(inFilters)) return;

var outFilters = _.transform(inFilters, function (filters, filter) {
var input = filter.input;
if (!input) return notif.log('malformed filter agg params, missing "input" query');

var query = input.query;
if (!query) return notif.log('malformed filter agg params, missing "query" on input');

var label = _.deepGet(query, 'query_string.query') || JSON.stringify(query);
filters[label] = input;
}, {});

if (!_.size(outFilters)) return;

var params = output.params || (output.params = {});
params.filters = outFilters;
}
}
]
Expand Down
28 changes: 21 additions & 7 deletions src/kibana/components/agg_types/buckets/geo_hash.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
define(function (require) {
return function GeoHashAggDefinition(Private) {
return function GeoHashAggDefinition(Private, config) {
var _ = require('lodash');
var moment = require('moment');
var AggType = Private(require('components/agg_types/_agg_type'));
var defaultPrecision = 3;

function getPrecision(precision) {
var maxPrecision = _.parseInt(config.get('visualization:tileMap:maxPrecision'));

precision = parseInt(precision, 10);

if (isNaN(precision)) {
precision = defaultPrecision;
}

if (precision > maxPrecision) {
return maxPrecision;
}

return precision;
}

return new AggType({
name: 'geohash_grid',
Expand All @@ -15,14 +32,11 @@ define(function (require) {
},
{
name: 'precision',
default: 3,
default: defaultPrecision,
editor: require('text!components/agg_types/controls/precision.html'),
deserialize: getPrecision,
write: function (aggConfig, output) {
var precision = parseInt(aggConfig.params.precision, 10);
if (isNaN(precision)) {
precision = 3;
}
output.params.precision = precision;
output.params.precision = getPrecision(aggConfig.params.precision);
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion src/kibana/components/agg_types/controls/precision.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class="form-control"
type="range"
min="1"
max="9"
max="{{config.get('visualization:tileMap:maxPrecision')}}"
>
<div class="form-group vis-editor-agg-form-value">
{{params.precision}}
Expand Down
19 changes: 11 additions & 8 deletions src/kibana/components/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ define(function (require) {
]);

var configFile = JSON.parse(require('text!config'));
configFile.elasticsearch = (
window.location.protocol + '//' +
window.location.hostname +
(window.location.port ? ':' + window.location.port : '') +
'/elasticsearch');
configFile.elasticsearch = (function () {
var a = document.createElement('a');
a.href = 'elasticsearch';
return a.href;
}());

// allow the rest of the app to get the configFile easily
module.constant('configFile', configFile);

// service for delivering config variables to everywhere else
module.service('config', function (Private, Notifier, kbnVersion, kbnSetup, $rootScope) {
module.service('config', function (Private, Notifier, kbnVersion, kbnSetup, $rootScope, buildNum) {
var config = this;

var angular = require('angular');
Expand Down Expand Up @@ -63,8 +63,11 @@ define(function (require) {
};

return doc.fetch().then(function initDoc(resp) {
if (!resp.found) return doc.doIndex({}).then(getDoc);
else {
if (!resp.found) {
return doc.doIndex({
buildNum: buildNum
}).then(getDoc);
} else {
// apply update, and keep it quiet the first time
applyMassUpdate(resp, true);

Expand Down
4 changes: 4 additions & 0 deletions src/kibana/components/config/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ define(function (require) {
value: 100,
description: 'Never show more than this many bar in date histograms, scale values if needed',
},
'visualization:tileMap:maxPrecision': {
value: 6,
description: 'The maximum geoHash size allowed in a tile map',
},
'csv:separator': {
value: ',',
description: 'Separate exported values with this string',
Expand Down
Loading

0 comments on commit c16b027

Please sign in to comment.