Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into latest-value
Browse files Browse the repository at this point in the history
  • Loading branch information
scampi committed Nov 12, 2016
2 parents 82060ce + deec2eb commit 2577298
Show file tree
Hide file tree
Showing 104 changed files with 1,902 additions and 848 deletions.
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ A high level overview of our contributing guidelines.
- [Voicing the importance of an issue](#voicing-the-importance-of-an-issue)
- ["My issue isn't getting enough attention"](#my-issue-isnt-getting-enough-attention)
- ["I want to help!"](#i-want-to-help)
- [How We Use Git and GitHub](#how-we-use-git-and-github)
- [Branching](#branching)
- [Commits and Merging](#commits-and-merging)
- [What Goes Into a Pull Request](#what-goes-into-a-pull-request)
- [Contributing Code](#contributing-code)
- [Setting Up Your Development Environment](#setting-up-your-development-environment)
- [Customizing `config/kibana.dev.yml`](#customizing-configkibanadevyml)
Expand Down Expand Up @@ -65,6 +69,31 @@ Feel free to bump your issues if you think they've been neglected for a prolonge

We enjoy working with contributors to get their code accepted. There are many approaches to fixing a problem and it is important to find the best approach before writing too much code.

## How We Use Git and GitHub

### Branching

* All work on the next major release goes into master.
* Past major release branches are named `{majorVersion}.x`. They contain work that will go into the next minor release. For example, if the next minor release is `5.2.0`, work for it should go into the `5.x` branch.
* Past minor release branches are named `{majorVersion}.{minorVersion}`. They contain work that will go into the next patch release. For example, if the next patch release is `5.3.1`, work for it should go into the `5.3` branch.
* All work is done on feature branches and merged into one of these branches.
* Where appropriate, we'll backport changes into older release branches.

### Commits and Merging

* Feel free to make as many commits as you want, while working on a branch.
* When submitting a PR for review, please perform an interactive rebase to present a logical history that's easy for the reviewers to follow.
* Please use your commit messages to include helpful information on your changes, e.g. changes to APIs, UX changes, bugs fixed, and an explanation of *why* you made the changes that you did.
* Resolve merge conflicts by rebasing the target branch over your feature branch, and force-pushing.
* When merging, we'll squash your commits into a single commit.

### What Goes Into a Pull Request

* Please include an explanation of your changes in your PR description.
* Links to relevant issues, external resources, or related PRs are very important and useful.
* Please update any tests that pertain to your code, and add new tests where appropriate.
* See [Submitting a Pull Request](#submitting-a-pull-request) for more info.

## Contributing Code

These guidelines will help you get your Pull Request into shape so that a code review can start as soon as possible.
Expand Down Expand Up @@ -258,6 +287,24 @@ To execute the front-end browser tests, enter the following. This requires the s
npm run test:ui:runner
```

To run these browser tests against against some other Elasticsearch and Kibana instance you can set these environment variables and then run the test runner.
Here's an example to run against an Elastic Cloud instance (note that you should run the same branch of tests as the version of Kibana you're testing);

```bash
export TEST_KIBANA_PROTOCOL=https
export TEST_KIBANA_HOSTNAME=9249d04b1186b3e7bbe11ea60df4f963.us-east-1.aws.found.io
export TEST_KIBANA_PORT=443
export TEST_KIBANA_USER=elastic
export TEST_KIBANA_PASS=<your password here>
export TEST_ES_PROTOCOL=http
export TEST_ES_HOSTNAME=aaa5d22032d76805fcce724ed9d9f5a2.us-east-1.aws.found.io
export TEST_ES_PORT=9200
export TEST_ES_USER=elastic
export TEST_ES_PASS=<your password here>
npm run test:ui:runner
```

##### Browser Automation Notes

- Using Page Objects pattern (https://theintern.github.io/intern/#writing-functional-test)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ _Note: The version numbers below are only examples, meant to illustrate the rela
| ES patch number is newer. | 5.1.__2__ | 5.1.__5__ | ⚠️ Logged warning |
| ES minor number is newer. | 5.__1__.2 | 5.__5__.0 | ⚠️ Logged warning |
| ES major number is newer. | __5__.1.2 | __6__.0.0 | 🚫 Fatal error |
| ES patch number is older. | 5.1.__2__ | 5.1.__0__ | 🚫 Fatal error |
| ES patch number is older. | 5.1.__2__ | 5.1.__0__ | ⚠️ Logged warning |
| ES minor number is older. | 5.__1__.2 | 5.__0__.0 | 🚫 Fatal error |
| ES major number is older. | __5__.1.2 | __4__.0.0 | 🚫 Fatal error |

Expand Down
102 changes: 6 additions & 96 deletions STYLEGUIDE.md
Original file line number Diff line number Diff line change
@@ -1,110 +1,20 @@
This is a collection of style guides for Kibana projects. The include guides for the following:
# Kibana Style Guide

This guide applies to all development within the Kibana project and is
recommended for the development of all Kibana plugins.

- [JavaScript](style_guides/js_style_guide.md)
- [Angular](style_guides/angular_style_guide.md)
- [CSS](style_guides/css_style_guide.md)
- [HTML](style_guides/html_style_guide.md)
- [API](style_guides/api_style_guide.md)

# Kibana Style Guide

Things listed here are specific to Kibana and likely only apply to this project

## Share common utilities as lodash mixins

When creating a utility function, attach it as a lodash mixin.

Several already exist, and can be found in `src/kibana/utils/_mixins.js`

## Filenames

All filenames should use `snake_case` and *can* start with an underscore if the module is not intended to be used outside of its containing module.
All filenames should use `snake_case`.

*Right:*
- `src/kibana/index_patterns/index_pattern.js`
- `src/kibana/index_patterns/_field.js`

*Wrong:*
- `src/kibana/IndexPatterns/IndexPattern.js`
- `src/kibana/IndexPatterns/Field.js`

## Modules

Kibana uses WebPack, which supports many types of module definitions.

### CommonJS Syntax

Module dependencies should be written using CommonJS or ES2015 syntax:

*Right:*

```js
const _ = require('lodash');
module.exports = ...;
```

```js
import _ from 'lodash';
export default ...;
```

*Wrong:*

```js
define(['lodash'], function (_) {
...
});
```

## Angular Usage

Kibana is written in Angular, and uses several utility methods to make using Angular easier.

### Defining modules

Angular modules are defined using a custom require module named `ui/modules`. It is used as follows:

```js
var app = require('ui/modules').get('app/namespace');
```

`app` above is a reference to an Angular module, and can be used to define controllers, providers and anything else used in Angular. While you can use this module to create/get any module with ui/modules, we generally use the "kibana" module for everything.

### Private modules

A service called `Private` is available to load any function as an angular module without needing to define it as such. It is used as follows:

```js
app.controller('myController', function($scope, otherDeps, Private) {
var ExternalClass = Private(require('path/to/some/class'));
...
});
```

*Use `Private` modules for everything except directives, filters, and controllers.*

### Promises

A more robust version of Angular's `$q` service is available as `Promise`. It can be used in the same way as `$q`, but it comes packaged with several utility methods that provide many of the same useful utilities as Bluebird.

```js
app.service('CustomService', function(Promise, otherDeps) {
new Promise(function (resolve, reject) {
...
});

var promisedFunc = Promise.cast(someFunc);

return Promise.resolve('value');
});
```

### Routes

Angular routes are defined using a custom require module named `routes` that remove much of the required boilerplate.

```js
require('ui/routes')
.when('/my/object/route/:id?', {
// angular route code goes here
});
```
4 changes: 2 additions & 2 deletions docs/getting-started/tutorial-load-dataset.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
The tutorials in this section rely on the following data sets:

* The complete works of William Shakespeare, suitably parsed into fields. Download this data set by clicking here:
https://www.elastic.co/guide/en/kibana/3.0/snippets/shakespeare.json[shakespeare.json].
https://download.elastic.co/demos/kibana/gettingstarted/shakespeare.json[shakespeare.json].
* A set of fictitious accounts with randomly generated data. Download this data set by clicking here:
https://github.com/bly2k/files/blob/master/accounts.zip?raw=true[accounts.zip]
https://download.elastic.co/demos/kibana/gettingstarted/accounts.zip[accounts.zip]
* A set of randomly generated log files. Download this data set by clicking here:
https://download.elastic.co/demos/kibana/gettingstarted/logs.jsonl.gz[logs.jsonl.gz]

Expand Down
14 changes: 14 additions & 0 deletions docs/plugins.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ $ bin/kibana-plugin install file:///some/local/path/x-pack.zip -d path/to/direct

NOTE: This command creates the specified directory if it does not already exist.

[float]
=== Installing Plugins with Linux packages

The Kibana server needs to be able to write to files in the `optimize` directory. If you're installing plugins using sudo or su you'll
want to make sure these commands are ran as the user `kibana`. This user is already added for you as part of the package installation.

[source,shell]
$ sudo -u kibana bin/kibana-plugin install x-pack

If plugins were installed as a different user and the server is not starting, then you will need to change the owner of these files:

[source,shell]
$ chown -R kibana:kibana /path/to/kibana/optimize

== Updating & Removing Plugins

To update a plugin, remove the current version and reinstall the plugin.
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/upgrade/upgrade-standard.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A standard upgrade is the most straightforward way to upgrade Kibana, and it's
possible when you're upgrading from Kibana version 4.2 or higher.

If you haven't already, consult this <<upgrade,table>> to verify that standard
upgrade is supported for your version of Kinana.
upgrade is supported for your version of Kibana.

NOTE: If you've saved and/or exported objects in Kibana that rely on the
<<search,Elasticsearch Query DSL>>, make sure to check the Elasticsearch
Expand Down
1 change: 1 addition & 0 deletions docs/visualize/area.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Checkboxes are available to enable and disable the following behaviors:
values.
*Scale Y-Axis to Data Bounds*:: The default Y axis bounds are zero and the maximum value returned in the data. Check
this box to change both upper and lower bounds to match the values returned in the data.
*Order buckets by descending sum*:: Check this box to enforce sorting of buckets by descending sum in the visualization
*Show Tooltip*:: Check this box to enable the display of tooltips.

[float]
Expand Down
1 change: 1 addition & 0 deletions docs/visualize/line.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ values.
*Show Tooltip*:: Check this box to enable the display of tooltips.
*Scale Y-Axis to Data Bounds*:: The default Y-axis bounds are zero and the maximum value returned in the data. Check
this box to change both upper and lower bounds to match the values returned in the data.
*Order buckets by descending sum*:: Check this box to enforce sorting of buckets by descending sum in the visualization

After changing options, click the *Apply changes* button to update your visualization, or the grey *Discard
changes* button to keep your visualization in its current state.
Expand Down
1 change: 1 addition & 0 deletions docs/visualize/vertbar.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Checkboxes are available to enable and disable the following behaviors:
*Show Tooltip*:: Check this box to enable the display of tooltips.
*Scale Y-Axis to Data Bounds*:: The default Y axis bounds are zero and the maximum value returned in the data. Check
this box to change both upper and lower bounds to match the values returned in the data.
*Order buckets by descending sum*:: Check this box to enforce sorting of buckets by descending sum in the visualization

[float]
[[vertbar-viewing-detailed-information]]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@bigfunger/decompress-zip": "0.2.0-stripfix3",
"@bigfunger/jsondiffpatch": "0.1.38-webpack",
"@elastic/datemath": "2.3.0",
"@elastic/kibana-ui-framework": "0.0.9",
"@elastic/kibana-ui-framework": "0.0.10",
"@spalger/filesaver": "1.1.2",
"@spalger/leaflet-draw": "0.2.3",
"@spalger/leaflet-heat": "0.1.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ describe('plugins/elasticsearch', () => {
it('when majors are equal, but ES minor is less than Kibana minor', () => {
expect(isEsCompatibleWithKibana('1.0.0', '1.1.0')).to.be(false);
});

it('when majors and minors are equal, but ES patch is less than Kibana patch', () => {
expect(isEsCompatibleWithKibana('1.1.0', '1.1.1')).to.be(false);
});
});

describe('returns true', () => {
Expand All @@ -35,6 +31,10 @@ describe('plugins/elasticsearch', () => {
it('when majors and minors are equal, and ES patch is greater than Kibana patch', () => {
expect(isEsCompatibleWithKibana('1.1.1', '1.1.0')).to.be(true);
});

it('when majors and minors are equal, but ES patch is less than Kibana patch', () => {
expect(isEsCompatibleWithKibana('1.1.0', '1.1.1')).to.be(true);
});
});
});
});
14 changes: 6 additions & 8 deletions src/core_plugins/elasticsearch/lib/check_es_version.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
*/

import _ from 'lodash';
import esBool from './es_bool';
import semver from 'semver';
import isEsCompatibleWithKibana from './is_es_compatible_with_kibana';

/**
Expand Down Expand Up @@ -37,9 +35,9 @@ module.exports = function checkEsVersion(server, kibanaVersion) {
return incompatibleNodes.push(esNode);
}

// It's acceptable if ES is ahead of Kibana, but we want to prompt users to upgrade Kibana
// to match it.
if (semver.gt(esNode.version, kibanaVersion)) {
// It's acceptable if ES and Kibana versions are not the same so long as
// they are not incompatible, but we should warn about it
if (esNode.version !== kibanaVersion) {
warningNodes.push(esNode);
}
});
Expand All @@ -65,9 +63,9 @@ module.exports = function checkEsVersion(server, kibanaVersion) {
lastWarnedNodesForServer.set(server, warningNodeNames);
server.log(['warning'], {
tmpl: (
`You're running Kibana ${kibanaVersion} with some newer versions of ` +
'Elasticsearch. Update Kibana to the latest version to prevent compatibility issues: ' +
warningNodeNames
`You're running Kibana ${kibanaVersion} with some different versions of ` +
'Elasticsearch. Update Kibana or Elasticsearch to the same ' +
`version to prevent compatibility issues: ${warningNodeNames}`
),
kibanaVersion,
nodes: simplifiedNodes,
Expand Down
17 changes: 0 additions & 17 deletions src/core_plugins/elasticsearch/lib/es_bool.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,5 @@ export default function isEsCompatibleWithKibana(esVersion, kibanaVersion) {
return false;
}

// Reject older patch versions of ES.
if (esVersionNumbers.patch < kibanaVersionNumbers.patch) {
return false;
}

return true;
}
13 changes: 13 additions & 0 deletions src/core_plugins/kbn_vislib_vis_types/public/area.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ export default function HistogramVisType(Private) {
setYExtents: false,
yAxis: {}
},
legendPositions: [{
value: 'left',
text: 'left',
}, {
value: 'right',
text: 'right',
}, {
value: 'top',
text: 'top',
}, {
value: 'bottom',
text: 'bottom',
}],
scales: ['linear', 'log', 'square root'],
modes: ['stacked', 'overlap', 'percentage', 'wiggle', 'silhouette'],
editor: areaTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,11 @@
Scale Y-Axis to Data Bounds
</label>
</div>
<div class="vis-option-item">
<label>
<input type="checkbox" ng-model="vis.params.orderBucketsBySum">
Order buckets by descending sum
</label>
</div>
</div>
</div>
Loading

0 comments on commit 2577298

Please sign in to comment.