From abc76e0d8edf895048bec01dced9c89869a7e908 Mon Sep 17 00:00:00 2001 From: Khalah Jones Golden Date: Tue, 24 May 2016 12:33:04 -0400 Subject: [PATCH 1/6] [AppSwitcher] Removed excess colors from the appswitcher --- .../directives/app_switcher/app_switcher.less | 34 ++----------------- src/ui/public/styles/variables/for-theme.less | 6 +--- 2 files changed, 4 insertions(+), 36 deletions(-) diff --git a/src/ui/public/chrome/directives/app_switcher/app_switcher.less b/src/ui/public/chrome/directives/app_switcher/app_switcher.less index 2d4753b1320b..911c878a64f9 100644 --- a/src/ui/public/chrome/directives/app_switcher/app_switcher.less +++ b/src/ui/public/chrome/directives/app_switcher/app_switcher.less @@ -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%); - } - } - } } diff --git a/src/ui/public/styles/variables/for-theme.less b/src/ui/public/styles/variables/for-theme.less index edfe6cc176b7..9995ba06cefb 100644 --- a/src/ui/public/styles/variables/for-theme.less +++ b/src/ui/public/styles/variables/for-theme.less @@ -326,8 +326,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; From d6a80b3ef8c2b22ff26100088307b3f8e691ba69 Mon Sep 17 00:00:00 2001 From: Court Ewing Date: Tue, 24 May 2016 18:51:33 -0400 Subject: [PATCH 2/6] Only include zip snapshot link for windows tar.gz is sufficient for all operating systems except for windows, which by default only includes zip. There's no reason to provide both links, and we intend to stop publishing the alternative links altogether at some point. --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5a3fb904fc0d..113d563f5859 100644 --- a/README.md +++ b/README.md @@ -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) | From 6fa412eb84baa924fbeae84a15f0d3091f5d534d Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Wed, 25 May 2016 09:22:01 -0700 Subject: [PATCH 3/6] Checking for ES plugin readiness before trying to use it If the ES plugin is not ready (i.e. in red state), we won't try to use it and end up blocking the reply. --- src/ui/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ui/index.js b/src/ui/index.js index 94e6274521d6..c8963ddc65c1 100644 --- a/src/ui/index.js +++ b/src/ui/index.js @@ -71,12 +71,15 @@ export default async (kbnServer, server, config) => { basePath: config.get('server.basePath'), serverName: config.get('server.name'), uiSettings: { - defaults: await uiSettings.getDefaults(), - user: await uiSettings.getUserProvided() + defaults: await uiSettings.getDefaults() }, vars: defaults(app.getInjectedVars() || {}, uiExports.defaultInjectedVars), }; + if (server.plugins.elasticsearch.status.state !== 'red') { + payload.uiSettings.user = await uiSettings.getUserProvided(); + } + return this.view(app.templateName, { app: app, loadingGif: loadingGif, From 9b21b176752dcd2dcc6fa770a2e4e3d5440d67d4 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Wed, 25 May 2016 11:45:45 -0700 Subject: [PATCH 4/6] Set user settings to empty object if ES plugin is red --- src/ui/index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ui/index.js b/src/ui/index.js index c8963ddc65c1..ada8fa2a0f06 100644 --- a/src/ui/index.js +++ b/src/ui/index.js @@ -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, @@ -71,15 +72,12 @@ export default async (kbnServer, server, config) => { basePath: config.get('server.basePath'), serverName: config.get('server.name'), uiSettings: { - defaults: await uiSettings.getDefaults() + defaults: await uiSettings.getDefaults(), + user: isElasticsearchPluginRed ? {} : await uiSettings.getUserProvided() }, vars: defaults(app.getInjectedVars() || {}, uiExports.defaultInjectedVars), }; - if (server.plugins.elasticsearch.status.state !== 'red') { - payload.uiSettings.user = await uiSettings.getUserProvided(); - } - return this.view(app.templateName, { app: app, loadingGif: loadingGif, From df0cad1874c2560d5f3b18f2600ac251fdac0769 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 26 May 2016 08:18:59 -0700 Subject: [PATCH 5/6] Updating instructions for building OS packages --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 59c1f9542ebd..1305577cff46 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 ``` From d4819ac9b1f388f4d889ea67c6230a7c7159ac52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Bevacqua?= Date: Thu, 26 May 2016 12:55:17 -0300 Subject: [PATCH 6/6] [config] Added config.get(key, defaultValue) overload. Updated test suite. --- src/ui/public/config/__tests__/config.js | 20 +++++++++++-- src/ui/public/config/config.js | 36 ++++++++++++++---------- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/src/ui/public/config/__tests__/config.js b/src/ui/public/config/__tests__/config.js index 299c3fdde230..929693d926f4 100644 --- a/src/ui/public/config/__tests__/config.js +++ b/src/ui/public/config/__tests__/config.js @@ -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 () { diff --git a/src/ui/public/config/config.js b/src/ui/public/config/config.js index 4710ce47e5b2..265e0b5dd6af 100644 --- a/src/ui/public/config/config.js +++ b/src/ui/public/config/config.js @@ -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;