Skip to content

Commit

Permalink
Merge branch 'master' into fix/elastic#1962
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Thomassie committed Jan 29, 2015
2 parents 2fb7e1d + bedc9cd commit 83f1bb8
Show file tree
Hide file tree
Showing 38 changed files with 459 additions and 272 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ target
*.iml
*.log
esvm
.htpasswd
21 changes: 3 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,16 @@ Please make sure you have signed the [Contributor License Agreement](http://www.
nvm install 0.10
```

- 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)
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 `bundle`

- Install grunt and bower globally
- Install grunt and bower globally (as root if not using nvm)

```sh
npm install -g grunt-cli bower
```

- Install node, bower, and ruby dependencies
- Install node and bower dependencies

```sh
npm install && bower install && bundle
npm install && bower install
```

- Start the development server.
Expand Down
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
"version": "4.0.0-beta3",
"main": "src/server/app.js",
"homepage": "http://www.elasticsearch.org/overview/kibana/",
"bugs": "https://github.com/elasticsearch/kibana/issues",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/elasticsearch/kibana/issues"
},
"license": "Apache 2.0",
"author": "Rashid Khan <rashid.khan@elasticsearch.com>",
"contributors": [
"Spencer Alger <spencer.alger@elasticsearch.com>",
Expand Down Expand Up @@ -43,13 +45,15 @@
"debug": "~2.1.1",
"express": "~4.10.6",
"glob": "^4.3.2",
"http-proxy": "^1.8.1",
"http-auth": "^2.2.5",
"jade": "~1.8.2",
"js-yaml": "^3.2.5",
"less-middleware": "1.0.x",
"lodash": "^2.4.1",
"morgan": "~1.5.1",
"serve-favicon": "~2.2.0"
"request": "^2.40.0",
"serve-favicon": "~2.2.0",
"ssl-root-cas": "^1.1.7"
},
"devDependencies": {
"bluebird": "~2.0.7",
Expand Down Expand Up @@ -86,14 +90,9 @@
"opn": "~1.0.0",
"path-browserify": "0.0.0",
"progress": "^1.1.8",
"request": "^2.40.0",
"requirejs": "~2.1.14",
"rjs-build-analysis": "0.0.3",
"simple-git": "^0.11.0",
"tar": "^1.0.1"
},
"license": "Apache 2.0",
"bugs": {
"url": "https://github.com/elasticsearch/kibana/issues"
}
}
5 changes: 4 additions & 1 deletion src/kibana/components/agg_types/buckets/date_histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ define(function (require) {
params: [
{
name: 'field',
filterFieldTypes: 'date'
filterFieldTypes: 'date',
default: function (aggConfig) {
return aggConfig.vis.indexPattern.timeFieldName;
}
},

{
Expand Down
1 change: 1 addition & 0 deletions src/kibana/components/agg_types/controls/interval.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
class="form-control"
name="interval"
min="0"
input-whole-number
>
</div>
6 changes: 4 additions & 2 deletions src/kibana/components/config/_delayed_updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ define(function (require) {
if (updater.fired) return;
updater.fired = true;


var method;
var body;
var updated = [];
Expand All @@ -44,6 +43,9 @@ define(function (require) {
queue.forEach(function (q) { q.resolve(resp); });
}, function (err) {
queue.forEach(function (q) { q.reject(err); });
})
.finally(function () {
$rootScope.$emit('change:config', updated.concat(deleted));
});
};

Expand All @@ -68,7 +70,7 @@ define(function (require) {
var defer = Promise.defer();
queue.push(defer);
notify.log('config change: ' + key + ': ' + oldVal + ' -> ' + newVal);
$rootScope.$broadcast('change:config.' + key, newVal, oldVal);
$rootScope.$emit('change:config.' + key, newVal, oldVal);

// reset the fire timer
clearTimeout(timer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<span ng-click="sort(indexPattern.timeFieldName)" tooltip="Sort by time">Time <i ng-class="headerClass(indexPattern.timeFieldName)"></i></span>
</th>
<th ng-repeat="name in columns">
<span ng-click="sort(name)" class="table-header-name" tooltip="Sort by {{name | shortDots}}">
<span ng-click="sort(name)" class="table-header-name" tooltip="{{tooltip(name)}}">
{{name | shortDots}} <i ng-class="headerClass(name)"></i>
</span>
<span class="table-header-move">
Expand Down
6 changes: 5 additions & 1 deletion src/kibana/components/doc_table/components/table_header.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ define(function (require) {

require('filters/short_dots');

module.directive('kbnTableHeader', function () {
module.directive('kbnTableHeader', function (shortDotsFilter) {
var headerHtml = require('text!components/doc_table/components/table_header.html');
return {
restrict: 'A',
Expand All @@ -21,6 +21,10 @@ define(function (require) {
return $scope.indexPattern.fields.byName[field].sortable;
};

$scope.tooltip = function (column) {
if (!sortableField(column)) return ''; else return 'Sort by ' + shortDotsFilter(column);
};

$scope.headerClass = function (column) {
if (!sortableField(column)) return;

Expand Down
8 changes: 4 additions & 4 deletions src/kibana/components/doc_table/doc_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</table>
<kbn-infinite-scroll ng-if="infiniteScroll" more="addRows"></kbn-infinite-scroll>
</div>
<div ng-if="!hits.length" class="table-vis-error">
<h2><i class="fa fa-meh-o"></i></h2>
<h4>No results found</h4>
</div>
<div ng-if="hits != null && !hits.length" class="table-vis-error">
<h2><i class="fa fa-meh-o"></i></h2>
<h4>No results found</h4>
</div>
12 changes: 9 additions & 3 deletions src/kibana/components/vis/_agg_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ define(function (require) {

if (val == null) {
if (aggParam.default == null) return;
else val = aggParam.default;

if (!_.isFunction(aggParam.default)) {
val = aggParam.default;
} else {
val = aggParam.default(self);
if (val == null) return;
}
}

if (aggParam.deserialize) {
Expand Down Expand Up @@ -104,8 +110,8 @@ define(function (require) {
* @return {object} the new params object
*/
AggConfig.prototype.resetParams = function () {
// We need to ensure that row doesn't get overriden.
return this.fillDefaults(_.pick(this.params, 'row'));
// We need to ensure that row and field don't get overriden.
return this.fillDefaults(_.pick(this.params, 'row', 'field'));
};

AggConfig.prototype.write = function () {
Expand Down
4 changes: 2 additions & 2 deletions src/kibana/components/vislib/lib/resize_checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ define(function (require) {
var sequencer = require('utils/sequencer');

var SCHEDULE = ResizeChecker.SCHEDULE = sequencer.createEaseIn(
5, // shortest delay
100, // shortest delay
10000, // longest delay
125 // tick count
50 // tick count
);

// maximum ms that we can delay emitting 'resize'. This is only used
Expand Down
6 changes: 4 additions & 2 deletions src/kibana/components/vislib/visualizations/area_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ define(function (require) {
// Append the bars
circles = layer
.selectAll('rect')
.data(function appendData(d) {
return d;
.data(function appendData(data) {
return data.filter(function isNotZero(d) {
return d.y !== 0;
});
});

// exit
Expand Down
19 changes: 19 additions & 0 deletions src/kibana/directives/input_whole_number.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
define(function (require) {
var module = require('modules').get('kibana');

module.directive('inputWholeNumber', function () {
return {
restrict: 'A',
require: 'ngModel',
link: function ($scope, $elem, attrs, ngModel) {
ngModel.$parsers.push(checkWholeNumber);
ngModel.$formatters.push(checkWholeNumber);

function checkWholeNumber(value) {
ngModel.$setValidity('whole', value % 1 === 0);
return value;
}
}
};
});
});
Binary file added src/kibana/images/initial_load.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 18 additions & 3 deletions src/kibana/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,29 @@
<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="row">
<div class="col-md-offset-4 col-md-4 page-header initial-load">
<center>
<img width="128" src="images/initial_load.gif">
<h1>
<strong>Kibana</strong>
<small>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>
</div>

<script>
window.KIBANA_VERSION='@@version';
window.KIBANA_BUILD_NUM='@@buildNum';
window.KIBANA_COMMIT_SHA='@@commitSha';
</script>

<link rel="stylesheet" href="styles/main.css?_b=@@buildNum">
<script src="bower_components/requirejs/require.js?_b=@@buildNum"></script>
<script src="require.config.js?_b=@@buildNum"></script>
<script>
Expand All @@ -25,6 +40,6 @@

require(['kibana'], function (kibana) { kibana.init(); });
</script>
</head>
<body kibana ng-class="'application-' + activeApp.id"></body>

</body>
</html>
6 changes: 4 additions & 2 deletions src/kibana/plugins/metric_vis/metric_vis.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<div ng-controller="KbnMetricVisController" class="metric-vis">
<div class="metric-value" ng-style="{'font-size': vis.params.fontSize+'pt'}">{{metric.value}}</div>
<div>{{metric.label}}</div>
<div class="metric-container" ng-repeat="metric in metrics">
<div class="metric-value" ng-style="{'font-size': vis.params.fontSize+'pt'}">{{metric.value}}</div>
<div>{{metric.label}}</div>
</div>
</div>
16 changes: 13 additions & 3 deletions src/kibana/plugins/metric_vis/metric_vis.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@
@import (reference) "lesshat.less";

.metric-vis {
text-align: center;
.flex-parent();
.justify-content(center);
width: 100%;
.display(flex);
.flex-direction(row);
.flex-wrap(wrap);
.justify-content(space-around);
.align-items(center);
.align-content(space-around);

.metric-value {
font-weight: bold;
.ellipsis();
}

.metric-container {
text-align: center;
padding: 1em;
.flex();
}
}
29 changes: 18 additions & 11 deletions src/kibana/plugins/metric_vis/metric_vis_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,27 @@ define(function (require) {
// didn't already
var module = require('modules').get('kibana/metric_vis', ['kibana']);

module.controller('KbnMetricVisController', function ($scope) {
var metric = $scope.metric = {
label: null,
value: null
module.controller('KbnMetricVisController', function ($scope, Private) {
var tabifyAggResponse = Private(require('components/agg_response/tabify/tabify'));

var metrics = $scope.metrics = [];

$scope.processTableGroups = function (tableGroups) {
tableGroups.tables.forEach(function (table) {
table.columns.forEach(function (column, i) {
var fieldFormatter = table.aggConfig(column).fieldFormatter();
metrics.push({
label: column.title,
value: fieldFormatter(table.rows[0][i])
});
});
});
};

$scope.$watch('esResponse', function (resp) {
if (!resp) {
metric.label = metric.value = null;
} else {
var agg = $scope.vis.aggs[0];
metric.label = agg.makeLabel();
if (agg.type.name === 'count') metric.value = resp.hits.total;
else metric.value = agg.fieldFormatter()(resp.aggregations[agg.id].value);
if (resp) {
metrics.length = 0;
$scope.processTableGroups(tabifyAggResponse($scope.vis, resp));
}
});
});
Expand Down
Loading

0 comments on commit 83f1bb8

Please sign in to comment.