Skip to content

Commit

Permalink
fix some straggling exports
Browse files Browse the repository at this point in the history
  • Loading branch information
w33ble committed Jun 5, 2017
1 parent 823f984 commit 729a456
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 26 deletions.
7 changes: 3 additions & 4 deletions src/cli/color.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

import _ from 'lodash';
import ansicolors from 'ansicolors';

exports.green = _.flow(ansicolors.black, ansicolors.bgGreen);
exports.red = _.flow(ansicolors.white, ansicolors.bgRed);
exports.yellow = _.flow(ansicolors.black, ansicolors.bgYellow);
export const green = _.flow(ansicolors.black, ansicolors.bgGreen);
export const red = _.flow(ansicolors.white, ansicolors.bgRed);
export const yellow = _.flow(ansicolors.black, ansicolors.bgYellow);
8 changes: 4 additions & 4 deletions src/cli/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const log = _.restParam(function (color, label, rest1) {
console.log.apply(console, [color(` ${_.trim(label)} `)].concat(rest1));
});

import color from './color';
import { green, yellow, red } from './color';

export default class Log {
constructor(quiet, silent) {
this.good = quiet || silent ? _.noop : _.partial(log, color.green);
this.warn = quiet || silent ? _.noop : _.partial(log, color.yellow);
this.bad = silent ? _.noop : _.partial(log, color.red);
this.good = quiet || silent ? _.noop : _.partial(log, green);
this.warn = quiet || silent ? _.noop : _.partial(log, yellow);
this.bad = silent ? _.noop : _.partial(log, red);
}
}
2 changes: 1 addition & 1 deletion src/core_plugins/elasticsearch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { clientLogger } from './lib/client_logger';
import { createClusters } from './lib/create_clusters';
import filterHeaders from './lib/filter_headers';

import createProxy, { createPath } from './lib/create_proxy';
import { createProxy, createPath } from './lib/create_proxy';

const DEFAULT_REQUEST_HEADERS = [ 'authorization' ];

Expand Down
8 changes: 4 additions & 4 deletions src/core_plugins/elasticsearch/lib/__tests__/create_proxy.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import expect from 'expect.js';
import createProxy from '../create_proxy';
import { createPath } from '../create_proxy';

describe('plugins/elasticsearch', function () {
describe('lib/create_proxy', function () {
describe('#createPath', function () {
it('prepends /elasticsearch to route', function () {
const path = createProxy.createPath('/foobar', '/wat');
const path = createPath('/foobar', '/wat');
expect(path).to.equal('/foobar/wat');
});

it('ensures leading slash for prefix', function () {
const path = createProxy.createPath('foobar', '/wat');
const path = createPath('foobar', '/wat');
expect(path).to.equal('/foobar/wat');
});

it('ensures leading slash for path', function () {
const path = createProxy.createPath('/foobar', 'wat');
const path = createPath('/foobar', 'wat');
expect(path).to.equal('/foobar/wat');
});
});
Expand Down
20 changes: 9 additions & 11 deletions src/core_plugins/elasticsearch/lib/create_proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ import createAgent from './create_agent';
import mapUri from './map_uri';
import { assign } from 'lodash';

function createProxy(server, method, path, config) {
export function createPath(prefix, path) {
path = path[0] === '/' ? path : `/${path}`;
prefix = prefix[0] === '/' ? prefix : `/${prefix}`;

return `${prefix}${path}`;
}

export function createProxy(server, method, path, config) {
const proxies = new Map([
['/elasticsearch', server.plugins.elasticsearch.getCluster('data')],
['/es_admin', server.plugins.elasticsearch.getCluster('admin')]
Expand All @@ -25,7 +32,7 @@ function createProxy(server, method, path, config) {
for (const [proxyPrefix, cluster] of proxies) {
const options = {
method,
path: createProxy.createPath(proxyPrefix, path),
path: createPath(proxyPrefix, path),
config: {
timeout: {
socket: cluster.getRequestTimeout()
Expand All @@ -50,12 +57,3 @@ function createProxy(server, method, path, config) {
server.route(options);
}
}

createProxy.createPath = function createPath(prefix, path) {
path = path[0] === '/' ? path : `/${path}`;
prefix = prefix[0] === '/' ? prefix : `/${prefix}`;

return `${prefix}${path}`;
};

module.exports = createProxy;
5 changes: 3 additions & 2 deletions src/ui/public/routes/routes.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import RouteManager from './route_manager';
import 'angular-route/angular-route';
import { uiModules } from 'ui/modules';
const defaultRouteManager = new RouteManager();
import { WAIT_FOR_URL_CHANGE_TOKEN } from './route_setup_manager';
const defaultRouteManager = new RouteManager();

module.exports = {
// eslint-disable-next-line kibana-custom/no-default-export
export default {
...defaultRouteManager,
WAIT_FOR_URL_CHANGE_TOKEN,
enable() {
Expand Down

0 comments on commit 729a456

Please sign in to comment.