Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/feature/design' into feature/d…
Browse files Browse the repository at this point in the history
…esign
  • Loading branch information
panda01 committed Mar 9, 2016
2 parents 291dde9 + 9502ade commit aa7f9af
Show file tree
Hide file tree
Showing 44 changed files with 645 additions and 628 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ Remember, someone is blocked by a pull awaiting review, make it count. Be thorou
1. **Understand the issue** that is being fixed, or the feature being added. Check the description on the pull, and check out the related issue. If you don't understand something, ask the person the submitter for clarification.
1. **Reproduce the bug** (or the lack of feature I guess?) in the destination branch, usually `master`. The referenced issue will help you here. If you're unable to reproduce the issue, contact the issue submitter for clarification
1. **Check out the pull** and test it. Is the issue fixed? Does it have nasty side effects? Try to create suspect inputs. If it operates on the value of a field try things like: strings (including an empty string), null, numbers, dates. Try to think of edge cases that might break the code.
1. **Merge the target branch**. It is possible that tests or the linter have been updated in the target branch since the pull was submitted. Merging the pull could cause core to start failing.
1. **Read the code**. Understanding the changes will help you find additional things to test. Contact the submitter if you don't understand something.
1. **Go line-by-line**. Are there [style guide](https://github.com/elastic/kibana/blob/master/STYLEGUIDE.md) violations? Strangely named variables? Magic numbers? Do the abstractions make sense to you? Are things arranged in a testable way?
1. **Speaking of tests** Are they there? If a new function was added does it have tests? Do the tests, well, TEST anything? Do they just run the function or do they properly check the output?
Expand Down
13 changes: 3 additions & 10 deletions src/plugins/elasticsearch/lib/create_kibana_index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import SetupError from './setup_error';
import { format } from 'util';
import { mappings } from './kibana_index_mappings';

module.exports = function (server) {
const client = server.plugins.elasticsearch.client;
const index = server.config().get('kibana.index');
Expand All @@ -16,16 +18,7 @@ module.exports = function (server) {
settings: {
number_of_shards: 1
},
mappings: {
config: {
properties: {
buildNum: {
type: 'string',
index: 'not_analyzed'
}
}
}
}
mappings
}
})
.catch(handleError('Unable to create Kibana index "<%= kibana.index %>"'))
Expand Down
27 changes: 15 additions & 12 deletions src/plugins/elasticsearch/lib/expose_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ import callWithRequest from './call_with_request';
module.exports = function (server) {
const config = server.config();

class ElasticsearchClientLogging {
error(err) {
server.log(['error', 'elasticsearch'], err);
}
warning(message) {
server.log(['warning', 'elasticsearch'], message);
}
info() {}
debug() {}
trace() {}
close() {}
}

function createClient(options) {
options = _.defaults(options || {}, {
url: config.get('elasticsearch.url'),
Expand Down Expand Up @@ -52,18 +65,7 @@ module.exports = function (server) {
defer: function () {
return Bluebird.defer();
},
log: function () {
this.error = function (err) {
server.log(['error', 'elasticsearch'], err);
};
this.warning = function (message) {
server.log(['warning', 'elasticsearch'], message);
};
this.info = _.noop;
this.debug = _.noop;
this.trace = _.noop;
this.close = _.noop;
}
log: ElasticsearchClientLogging
});
}

Expand All @@ -73,6 +75,7 @@ module.exports = function (server) {
const noAuthClient = createClient({ auth: false });
server.on('close', _.bindKey(noAuthClient, 'close'));

server.expose('ElasticsearchClientLogging', ElasticsearchClientLogging);
server.expose('client', client);
server.expose('createClient', createClient);
server.expose('callWithRequestFactory', callWithRequest);
Expand Down
10 changes: 10 additions & 0 deletions src/plugins/elasticsearch/lib/kibana_index_mappings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const mappings = {
config: {
properties: {
buildNum: {
type: 'string',
index: 'not_analyzed'
}
}
}
};
12 changes: 9 additions & 3 deletions src/plugins/elasticsearch/lib/migrate_config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import upgrade from './upgrade_config';
import { mappings } from './kibana_index_mappings';

module.exports = function (server) {
const config = server.config();
Expand All @@ -8,11 +9,16 @@ module.exports = function (server) {
type: 'config',
body: {
size: 1000,
sort: [ { buildNum: { order: 'desc', ignore_unmapped: true } } ]
sort: [
{
buildNum: {
order: 'desc',
unmapped_type: mappings.config.properties.buildNum.type
}
}
]
}
};

return client.search(options).then(upgrade(server));
};


Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<a aria-label="Edit" ng-show="chrome.getVisible() && editUrl" ng-href="{{::editUrl}}">
<i aria-hidden="true" class="fa fa-pencil"></i>
</a>
<a aria-label="Move" ng-show="chrome.getVisible()" class="panel-move">
<i aria-hidden="true" class="fa fa-arrows"></i>
</a>
<a aria-label="Remove" ng-show="chrome.getVisible()" ng-click="remove()">
<i aria-hidden="true" class="fa fa-times"></i>
</a>
Expand Down
5 changes: 2 additions & 3 deletions src/plugins/kibana/public/dashboard/directives/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ app.directive('dashboardGrid', function ($compile, Notifier) {
// number of columns to render
const COLS = 12;
// number of pixed between each column/row
const SPACER = 10;
const SPACER = 0;
// pixels used by all of the spacers (gridster puts have a spacer on the ends)
const spacerSize = SPACER * COLS;

Expand All @@ -46,7 +46,7 @@ app.directive('dashboardGrid', function ($compile, Notifier) {
stop: readGridsterChangeHandler
},
draggable: {
handle: '.panel-heading, .panel-title',
handle: '.panel-move, .fa-arrows',
stop: readGridsterChangeHandler
}
}).data('gridster');
Expand Down Expand Up @@ -232,4 +232,3 @@ app.directive('dashboardGrid', function ($compile, Notifier) {
}
};
});

14 changes: 6 additions & 8 deletions src/plugins/kibana/public/dashboard/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,8 @@ dashboard-grid {
.visualize-show-spy {
visibility: visible;
}
.panel .panel-heading {
background-color: @kibanaGray6;
&:hover {
cursor: pointer;
}
.btn-group {
display: block !important;
}
.panel .panel-heading .btn-group {
display: block !important;
}
}

Expand Down Expand Up @@ -117,6 +111,10 @@ dashboard-grid {
}
}

.panel-move:hover {
cursor: move;
}

a {
color: @dashboard-panel-heading-link-color;
border: none;
Expand Down
1 change: 0 additions & 1 deletion src/plugins/metric_vis/public/metric_vis.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@

.metric-container {
text-align: center;
padding: 1em;
}
}
2 changes: 1 addition & 1 deletion src/ui/public/config/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function configDefaultsProvider() {
type: 'json',
value:
'[\n' +
' ["", "hh:mm:ss.SSS"],\n' +
' ["", "HH:mm:ss.SSS"],\n' +
' ["PT1S", "HH:mm:ss"],\n' +
' ["PT1M", "HH:mm"],\n' +
' ["PT1H",\n' +
Expand Down
20 changes: 10 additions & 10 deletions src/ui/public/courier/fetch/__tests__/doc.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import sinon from 'auto-release-sinon';
import expect from 'expect.js';
import ngMock from 'ngMock';
import CourierDataSourceDocSourceProvider from 'ui/courier/data_source/doc_source';
import CourierFetchRequestDocProvider from 'ui/courier/fetch/request/doc';

describe('Courier DocFetchRequest class', function () {
import DocSourceProvider from '../../data_source/doc_source';
import DocRequestProvider from '../request/doc';

var storage;
var source;
var defer;
var req;
describe('Courier DocFetchRequest class', function () {
let storage;
let source;
let defer;
let req;

var setVersion;
let setVersion;

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (Private, Promise, $injector) {
var DocSource = Private(CourierDataSourceDocSourceProvider);
var DocFetchRequest = Private(CourierFetchRequestDocProvider);
const DocSource = Private(DocSourceProvider);
const DocFetchRequest = Private(DocRequestProvider);

storage =
$injector.get('localStorage').store =
Expand Down
11 changes: 6 additions & 5 deletions src/ui/public/courier/fetch/__tests__/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import ngMock from 'ngMock';
import expect from 'expect.js';
import sinon from 'auto-release-sinon';

import FetchProvider from 'ui/courier/fetch';
import IndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import searchResp from 'fixtures/search_response';
import CourierDataSourceDocSourceProvider from 'ui/courier/data_source/doc_source';
import CourierDataSourceSearchSourceProvider from 'ui/courier/data_source/search_source';

import FetchProvider from '../fetch';
import DocSourceProvider from '../../data_source/doc_source';
import SearchSourceProvider from '../../data_source/search_source';

describe('Fetch service', function () {
require('testUtils/noDigestPromises').activateForSuite();
Expand All @@ -24,8 +25,8 @@ describe('Fetch service', function () {
Promise = $injector.get('Promise');
fetch = Private(FetchProvider);
indexPattern = Private(IndexPatternProvider);
DocSource = Private(CourierDataSourceDocSourceProvider);
SearchSource = Private(CourierDataSourceSearchSourceProvider);
DocSource = Private(DocSourceProvider);
SearchSource = Private(SearchSourceProvider);
}));

describe('#doc(docSource)', function () {
Expand Down
13 changes: 7 additions & 6 deletions src/ui/public/courier/fetch/__tests__/fetch_these.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import _ from 'lodash';
import sinon from 'auto-release-sinon';
import expect from 'expect.js';
import ngMock from 'ngMock';
import CourierFetchFetchTheseProvider from 'ui/courier/fetch/_fetch_these';

import FetchTheseProvider from '../fetch_these';

describe('ui/courier/fetch/_fetch_these', () => {

let Promise;
Expand All @@ -22,15 +23,15 @@ describe('ui/courier/fetch/_fetch_these', () => {
return fakeResponses;
}

PrivateProvider.swap(require('ui/courier/fetch/_call_client'), FakeResponsesProvider);
PrivateProvider.swap(require('ui/courier/fetch/_call_response_handlers'), FakeResponsesProvider);
PrivateProvider.swap(require('ui/courier/fetch/_continue_incomplete'), FakeResponsesProvider);
PrivateProvider.swap(require('ui/courier/fetch/call_client'), FakeResponsesProvider);
PrivateProvider.swap(require('ui/courier/fetch/call_response_handlers'), FakeResponsesProvider);
PrivateProvider.swap(require('ui/courier/fetch/continue_incomplete'), FakeResponsesProvider);
}));

beforeEach(ngMock.inject((Private, $injector) => {
$rootScope = $injector.get('$rootScope');
Promise = $injector.get('Promise');
fetchThese = Private(CourierFetchFetchTheseProvider);
fetchThese = Private(FetchTheseProvider);
request = mockRequest();
requests = [ request ];
}));
Expand Down
9 changes: 0 additions & 9 deletions src/ui/public/courier/fetch/_is_request.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
import _ from 'lodash';
import CourierFetchIsRequestProvider from 'ui/courier/fetch/_is_request';
import CourierFetchMergeDuplicateRequestsProvider from 'ui/courier/fetch/_merge_duplicate_requests';
import CourierFetchReqStatusProvider from 'ui/courier/fetch/_req_status';

import IsRequestProvider from './is_request';
import MergeDuplicatesRequestProvider from './merge_duplicate_requests';
import ReqStatusProvider from './req_status';

export default function CourierFetchCallClient(Private, Promise, es, esShardTimeout, sessionId) {

var isRequest = Private(CourierFetchIsRequestProvider);
var mergeDuplicateRequests = Private(CourierFetchMergeDuplicateRequestsProvider);
const isRequest = Private(IsRequestProvider);
const mergeDuplicateRequests = Private(MergeDuplicatesRequestProvider);

var ABORTED = Private(CourierFetchReqStatusProvider).ABORTED;
var DUPLICATE = Private(CourierFetchReqStatusProvider).DUPLICATE;
const ABORTED = Private(ReqStatusProvider).ABORTED;
const DUPLICATE = Private(ReqStatusProvider).DUPLICATE;

function callClient(strategy, requests) {
// merging docs can change status to DUPLICATE, capture new statuses
var statuses = mergeDuplicateRequests(requests);
const statuses = mergeDuplicateRequests(requests);

// get the actual list of requests that we will be fetching
var executable = statuses.filter(isRequest);
var execCount = executable.length;
const executable = statuses.filter(isRequest);
let execCount = executable.length;

// resolved by respond()
var esPromise;
var defer = Promise.defer();
let esPromise;
const defer = Promise.defer();

// for each respond with either the response or ABORTED
var respond = function (responses) {
const respond = function (responses) {
responses = responses || [];
return Promise.map(requests, function (req, i) {
switch (statuses[i]) {
Expand All @@ -43,7 +45,7 @@ export default function CourierFetchCallClient(Private, Promise, es, esShardTime


// handle a request being aborted while being fetched
var requestWasAborted = Promise.method(function (req, i) {
const requestWasAborted = Promise.method(function (req, i) {
if (statuses[i] === ABORTED) {
defer.reject(new Error('Request was aborted twice?'));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { SearchTimeout } from 'ui/errors';
import { RequestFailure } from 'ui/errors';
import { ShardFailure } from 'ui/errors';
import CourierFetchReqStatusProvider from 'ui/courier/fetch/_req_status';
import CourierFetchNotifierProvider from 'ui/courier/fetch/_notifier';
import { RequestFailure, SearchTimeout, ShardFailure } from 'ui/errors';

import ReqStatusProvider from './req_status';
import NotifierProvider from './notifier';

export default function CourierFetchCallResponseHandlers(Private, Promise) {
var ABORTED = Private(CourierFetchReqStatusProvider).ABORTED;
var INCOMPLETE = Private(CourierFetchReqStatusProvider).INCOMPLETE;
var notify = Private(CourierFetchNotifierProvider);
const ABORTED = Private(ReqStatusProvider).ABORTED;
const INCOMPLETE = Private(ReqStatusProvider).INCOMPLETE;
const notify = Private(NotifierProvider);


function callResponseHandlers(requests, responses) {
Expand All @@ -15,7 +15,7 @@ export default function CourierFetchCallResponseHandlers(Private, Promise) {
return ABORTED;
}

var resp = responses[i];
let resp = responses[i];

if (resp.timed_out) {
notify.warning(new SearchTimeout());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import CourierFetchReqStatusProvider from 'ui/courier/fetch/_req_status';
import ReqStatusProvider from './req_status';

export default function CourierFetchContinueIncompleteRequests(Private) {
var INCOMPLETE = Private(CourierFetchReqStatusProvider).INCOMPLETE;
const INCOMPLETE = Private(ReqStatusProvider).INCOMPLETE;

function continueIncompleteRequests(strategy, requests, responses, fetchWithStrategy) {
var incomplete = [];
const incomplete = [];

responses.forEach(function (resp, i) {
if (resp === INCOMPLETE) {
Expand Down
Loading

0 comments on commit aa7f9af

Please sign in to comment.