Merge branch 'master' into feature/ingest

This commit is contained in:
Matthew Bargar 2016-05-26 16:02:10 -04:00
commit dc2eeb1c3e
7 changed files with 54 additions and 63 deletions

View file

@ -184,9 +184,9 @@ npm run test:ui:runner
Packages are built using fpm, pleaserun, dpkg, and rpm. fpm and pleaserun can be installed using gem. Package building has only been tested on Linux and is not supported on any other platform.
```sh
gem install pleaserun
apt-get install ruby-dev
gem install fpm
apt-get install ruby-dev rpm
gem install fpm -v 1.5.0 # required by pleaserun 0.0.16
gem install pleaserun -v 0.0.16 # higher versions fail at the moment
npm run build:ospackages
```

View file

@ -41,9 +41,9 @@ Visit [Elastic.co](http://www.elastic.co/guide/en/kibana/current/index.html) for
For the daring, snapshot builds are available. These builds are created after each commit to the master branch, and therefore are not something you should run in production.
| platform | | | | |
| --- | --- | --- | --- | --- |
| OSX | [tar](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-snapshot-darwin-x64.tar.gz) | [zip](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-snapshot-darwin-x64.zip) | | |
| Linux x64 | [tar](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-snapshot-linux-x64.tar.gz) | [zip](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-snapshot-linux-x64.zip) | [deb](https://download.elastic.co/kibana/kibana-snapshot/kibana_5.0.0-snapshot_amd64.deb)| [rpm](https://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0_snapshot-1.x86_64.rpm) |
| Linux x86 | [tar](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-snapshot-linux-x86.tar.gz) | [zip](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-snapshot-linux-x86.zip) | [deb](https://download.elastic.co/kibana/kibana-snapshot/kibana_5.0.0-snapshot_i386.deb) | [rpm](https://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0_snapshot-1.i386.rpm) |
| Windows | [tar](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-snapshot-windows.tar.gz) | [zip](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-snapshot-windows.zip) | | |
| platform | |
| --- | --- |
| OSX | [tar](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-snapshot-darwin-x64.tar.gz) |
| Linux x64 | [tar](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-snapshot-linux-x64.tar.gz) [deb](https://download.elastic.co/kibana/kibana-snapshot/kibana_5.0.0-snapshot_amd64.deb) [rpm](https://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0_snapshot-1.x86_64.rpm) |
| Linux x86 | [tar](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-snapshot-linux-x86.tar.gz) [deb](https://download.elastic.co/kibana/kibana-snapshot/kibana_5.0.0-snapshot_i386.deb) [rpm](https://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0_snapshot-1.i386.rpm) |
| Windows | [zip](http://download.elastic.co/kibana/kibana-snapshot/kibana-5.0.0-snapshot-windows.zip) |

View file

@ -61,6 +61,7 @@ export default async (kbnServer, server, config) => {
});
server.decorate('reply', 'renderApp', async function (app) {
const isElasticsearchPluginRed = server.plugins.elasticsearch.status.state === 'red';
const uiSettings = server.uiSettings();
const payload = {
app: app,
@ -72,7 +73,7 @@ export default async (kbnServer, server, config) => {
serverName: config.get('server.name'),
uiSettings: {
defaults: await uiSettings.getDefaults(),
user: await uiSettings.getUserProvided()
user: isElasticsearchPluginRed ? {} : await uiSettings.getUserProvided()
},
vars: defaults(app.getInjectedVars() || {}, uiExports.defaultInjectedVars),
};

View file

@ -77,11 +77,7 @@ body { overflow-x: hidden; }
> a {
display: block;
height: 100%;
color: @white;
}
&:hover {
background-color: @app-links-active-background;
color: #ebf7fa;
}
.app-icon {
@ -127,38 +123,14 @@ body { overflow-x: hidden; }
line-height: @app-icon-height;
}
&:hover,
&.active {
background-color: @app-links-active-background;
> a {
color: #333;
color: @white;
text-decoration: none;
}
img {
filter: none;
}
}
&:nth-child(1) {
background-color: @firstLinkColor;
&:hover {
background-color: lighten(@firstLinkColor, 5%);
}
}
&:nth-child(2) {
background-color: @secondLinkColor;
&:hover {
background-color: lighten(@secondLinkColor, 5%);
}
}
&:nth-child(3) {
background-color: @thirdLinkColor;
&:hover {
background-color: lighten(@thirdLinkColor, 5%);
}
}
}
}

View file

@ -12,14 +12,26 @@ describe('config component', function () {
}));
describe('#get', function () {
it('gives access to config values', function () {
expect(config.get('dateFormat')).to.be.a('string');
});
it('supports the default value overload', function () {
// default values are consumed and returned atomically
expect(config.get('obscureProperty', 'default')).to.be('default');
// default values are consumed only if setting was previously unset
expect(config.get('obscureProperty', 'another')).to.be('default');
// default values are persisted
expect(config.get('obscureProperty')).to.be('default');
});
it('throws on unknown properties that don\'t have a value yet.', function () {
const msg = 'Unexpected `config.get("throwableProperty")` call on unrecognized configuration setting';
expect(config.get).withArgs('throwableProperty').to.throwException(msg);
});
});
describe('#set', function () {
it('stores a value in the config val set', function () {
const original = config.get('dateFormat');
config.set('dateFormat', 'notaformat');
@ -27,6 +39,10 @@ describe('config component', function () {
config.set('dateFormat', original);
});
it('stores a value in a previously unknown config key', function () {
expect(config.set).withArgs('unrecognizedProperty', 'somevalue').to.not.throwException();
expect(config.get('unrecognizedProperty')).to.be('somevalue');
});
});
describe('#$bind', function () {

View file

@ -15,11 +15,12 @@ module.service(`config`, function (Private, $rootScope, $http, chrome, uiSetting
let settings = mergeSettings(defaults, initialUserSettings);
config.getAll = () => cloneDeep(settings);
config.get = key => getCurrentValue(key);
config.get = (key, defaultValue) => getCurrentValue(key, defaultValue);
config.set = (key, val) => change(key, isPlainObject(val) ? angular.toJson(val) : val);
config.remove = key => change(key, null);
config.isDefault = key => !(key in settings) || nullOrEmpty(settings[key].userValue);
config.isCustom = key => key in settings && !('value' in settings[key]);
config.isDeclared = key => key in settings;
config.isDefault = key => !config.isDeclared(key) || nullOrEmpty(settings[key].userValue);
config.isCustom = key => config.isDeclared(key) && !('value' in settings[key]);
config.watchAll = (fn, scope) => watchAll(scope, fn);
config.watch = (key, fn, scope) => watch(key, scope, fn);
@ -40,7 +41,7 @@ module.service(`config`, function (Private, $rootScope, $http, chrome, uiSetting
};
function watch(key, scope = $rootScope, fn) {
if (!(key in settings)) {
if (!config.isDeclared(key)) {
throw new Error(`Unexpected \`config.watch("${key}", fn)\` call on unrecognized configuration setting "${key}".
Setting an initial value via \`config.set("${key}", value)\` before binding
any custom setting configuration watchers for "${key}" may fix this issue.`);
@ -58,33 +59,33 @@ any custom setting configuration watchers for "${key}" may fix this issue.`);
}
function change(key, value) {
const oldVal = key in settings ? settings[key].userValue : undefined;
const declared = config.isDeclared(key);
const oldVal = declared ? settings[key].userValue : undefined;
const newVal = key in defaults && defaults[key].defaultValue === value ? null : value;
const unchanged = oldVal === newVal;
if (unchanged) {
return Promise.resolve();
}
const initialVal = config.get(key);
localUpdate(key, newVal);
const initialVal = declared ? config.get(key) : undefined;
localUpdate(key, newVal, initialVal);
return delayedUpdate(key, newVal)
.then(updatedSettings => {
settings = mergeSettings(defaults, updatedSettings);
})
.catch(reason => {
localUpdate(key, initialVal);
localUpdate(key, initialVal, config.get(key));
notify.error(reason);
});
}
function localUpdate(key, newVal) {
const oldVal = config.get(key);
function localUpdate(key, newVal, oldVal) {
patch(key, newVal);
advertise(key, oldVal);
}
function patch(key, value) {
if (!(key in settings)) {
if (!config.isDeclared(key)) {
settings[key] = {};
}
if (value === null) {
@ -105,11 +106,16 @@ any custom setting configuration watchers for "${key}" may fix this issue.`);
return value === undefined || value === null;
}
function getCurrentValue(key) {
if (!(key in settings)) {
throw new Error(`Unexpected \`config.get("${key}")\` call on unrecognized configuration setting "${key}".
function getCurrentValue(key, defaultValueForGetter) {
if (!config.isDeclared(key)) {
if (defaultValueForGetter === undefined) {
throw new Error(`Unexpected \`config.get("${key}")\` call on unrecognized configuration setting "${key}".
Setting an initial value via \`config.set("${key}", value)\` before attempting to retrieve
any custom setting value for "${key}" may fix this issue.`);
any custom setting value for "${key}" may fix this issue.
You can also save an step using \`config.get("${key}", defaultValue)\`, which
will set the initial value if one is not already set.`);
}
config.set(key, defaultValueForGetter);
}
const { userValue, value: defaultValue, type } = settings[key];
const currentValue = config.isDefault(key) ? defaultValue : userValue;

View file

@ -343,8 +343,4 @@
@transition-time: .35s;
@transition-delay: .25s;
@app-links-wrapper-background: #3caed2;
@app-links-active-background: lighten(@app-links-wrapper-background, 7.5%);
@firstLinkColor: #E4BB51;
@secondLinkColor: #8AC336;
@thirdLinkColor: #59C6C5;
@app-links-active-background: #2f99c1;