From 774a3145b8a8cc452111235c6935b159da4645bd Mon Sep 17 00:00:00 2001 From: ppisljar Date: Wed, 14 Dec 2016 10:51:18 +0100 Subject: [PATCH] rebasing on master and fixing linting --- src/ui/public/vis_maps/lib/data.js | 21 +++++++++--------- src/ui/public/vis_maps/lib/dispatch.js | 22 +++++++++---------- src/ui/public/vis_maps/lib/layout.js | 10 ++++----- src/ui/public/vis_maps/lib/maps_config.js | 6 ++--- src/ui/public/vis_maps/maps.js | 10 ++++----- src/ui/public/vis_maps/maps_renderbot.js | 16 +++++++------- src/ui/public/vis_maps/maps_vis_type.js | 6 ++--- .../public/vis_maps/visualizations/_chart.js | 6 ++--- 8 files changed, 48 insertions(+), 49 deletions(-) diff --git a/src/ui/public/vis_maps/lib/data.js b/src/ui/public/vis_maps/lib/data.js index 2c84b801355a498..341a99237b2b124 100644 --- a/src/ui/public/vis_maps/lib/data.js +++ b/src/ui/public/vis_maps/lib/data.js @@ -71,7 +71,7 @@ export default function DataFactory(Private) { return _.toArray(arr); } return [this.data]; - }; + } /** * Returns an array of chart data objects @@ -91,7 +91,7 @@ export default function DataFactory(Private) { } return visData; - }; + } /** * get min and max for all cols, rows of data @@ -108,7 +108,7 @@ export default function DataFactory(Private) { max: Math.max(props.max, minMax.max) }; }, {min: Infinity, max: -Infinity}); - }; + } /** * Get attributes off the data, e.g. `tooltipFormatter` or `xAxisFormatter` @@ -123,7 +123,7 @@ export default function DataFactory(Private) { get(thing, def) { const source = (this.data.rows || this.data.columns || [this.data])[0]; return _.get(source, thing, def); - }; + } /** * Return an array of all value objects @@ -140,7 +140,7 @@ export default function DataFactory(Private) { .pluck('values') .flattenDeep() .value(); - }; + } /** * ensure that the datas ordered property has a min and max @@ -164,7 +164,7 @@ export default function DataFactory(Private) { if (missingMax) d.ordered.max = extent[1]; } }); - }; + } /** * Calculates min and max values for all map data @@ -177,12 +177,11 @@ export default function DataFactory(Private) { * @returns {Array} min and max values */ mapDataExtents(series) { - let values; - values = _.map(series.rows, function (row) { + const values = _.map(series.rows, function (row) { return row[row.length - 1]; }); return [_.min(values), _.max(values)]; - }; + } /** * Get the maximum number of series, considering each chart @@ -194,8 +193,8 @@ export default function DataFactory(Private) { return this.chartData().reduce(function (max, chart) { return Math.max(max, chart.series.length); }, 0); - }; + } } return Data; -}; +} diff --git a/src/ui/public/vis_maps/lib/dispatch.js b/src/ui/public/vis_maps/lib/dispatch.js index 114b7e2a6a2afb7..5358eb2ee19c8b8 100644 --- a/src/ui/public/vis_maps/lib/dispatch.js +++ b/src/ui/public/vis_maps/lib/dispatch.js @@ -71,7 +71,7 @@ export default function DispatchClass(Private, config) { } return eventData; - }; + } /** * Returns a function that adds events and listeners to a D3 selection @@ -91,7 +91,7 @@ export default function DispatchClass(Private, config) { } }); }; - }; + } /** * @@ -118,7 +118,7 @@ export default function DispatchClass(Private, config) { } return addEvent('mouseover', hover); - }; + } /** * @@ -138,7 +138,7 @@ export default function DispatchClass(Private, config) { } return addEvent('mouseout', mouseout); - }; + } /** * @@ -154,7 +154,7 @@ export default function DispatchClass(Private, config) { } return addEvent('click', click); - }; + } /** * Determine if we will allow brushing @@ -167,7 +167,7 @@ export default function DispatchClass(Private, config) { //Allow brushing for ordered axis - date histogram and histogram return Boolean(xAxis.ordered); - }; + } /** * Determine if brushing is currently enabled @@ -177,7 +177,7 @@ export default function DispatchClass(Private, config) { */ isBrushable() { return this.allowBrushing() && this.listenerCount('brush') > 0; - }; + } /** * Mouseover Behavior @@ -187,7 +187,7 @@ export default function DispatchClass(Private, config) { */ addMousePointer() { return d3.select(this).style('cursor', 'pointer'); - }; + } /** * Highlight the element that is under the cursor @@ -214,7 +214,7 @@ export default function DispatchClass(Private, config) { */ unHighlight(element) { $('[data-label]', element.parentNode).css('opacity', 1); - }; + } /** * Adds D3 brush to SVG and returns the brush function @@ -281,7 +281,7 @@ export default function DispatchClass(Private, config) { return brush; } - }; + } } /** @@ -312,4 +312,4 @@ export default function DispatchClass(Private, config) { } return Dispatch; -}; +} diff --git a/src/ui/public/vis_maps/lib/layout.js b/src/ui/public/vis_maps/lib/layout.js index a33d182b624f216..24402f960c136e7 100644 --- a/src/ui/public/vis_maps/lib/layout.js +++ b/src/ui/public/vis_maps/lib/layout.js @@ -13,7 +13,7 @@ export default function LayoutFactory(Private) { render() { this.removeAll(); this.createLayout(); - }; + } createLayout() { const wrapper = this.appendElem(this.el, 'div', 'vis-wrapper'); @@ -21,7 +21,7 @@ export default function LayoutFactory(Private) { const colWrapper = this.appendElem(wrapper.node(), 'div', 'vis-col-wrapper'); const chartWrapper = this.appendElem(colWrapper.node(), 'div', 'chart-wrapper'); chartWrapper.call(mapSplit, colWrapper.node(), this.config); - }; + } appendElem(el, type, className) { if (!el || !type || !className) { @@ -39,12 +39,12 @@ export default function LayoutFactory(Private) { return d3.select(el) .append(type) .attr('class', className); - }; + } removeAll() { return d3.select(this.el).selectAll('*').remove(); - }; + } } return Layout; -}; +} diff --git a/src/ui/public/vis_maps/lib/maps_config.js b/src/ui/public/vis_maps/lib/maps_config.js index 57c67a0c0480853..2032f25c28e6ef2 100644 --- a/src/ui/public/vis_maps/lib/maps_config.js +++ b/src/ui/public/vis_maps/lib/maps_config.js @@ -18,7 +18,7 @@ export default function MapsConfigFactory(Private) { class MapsConfig { constructor(mapsConfigArgs) { this._values = _.defaultsDeep({}, mapsConfigArgs, DEFAULT_VIS_CONFIG); - }; + } get(property, defaults) { if (_.has(this._values, property) || typeof defaults !== 'undefined') { @@ -27,11 +27,11 @@ export default function MapsConfigFactory(Private) { throw new Error(`Accessing invalid config property: ${property}`); return defaults; } - }; + } set(property, value) { return _.set(this._values, property, value); - }; + } } return MapsConfig; diff --git a/src/ui/public/vis_maps/maps.js b/src/ui/public/vis_maps/maps.js index f3a8c12841b19be..a508eecc6855c30 100644 --- a/src/ui/public/vis_maps/maps.js +++ b/src/ui/public/vis_maps/maps.js @@ -54,7 +54,7 @@ export default function MapsFactory(Private) { if (first && added && this.handler) this.handler.enable(event); return ret; - }; + } off(event, listener) { const last = this.listenerCount(event) === 1; @@ -64,7 +64,7 @@ export default function MapsFactory(Private) { // Once all listeners are removed, disable the events in the handler if (last && removed && this.handler) this.handler.disable(event); return ret; - }; + } render(data, uiState) { if (!data) { @@ -76,12 +76,12 @@ export default function MapsFactory(Private) { this.visConfig = new MapsConfig(this.mapsConfigArgs, this.data, this.uiState); this.layout = new Layout(this.el, this.visConfig, this.data); this.draw(); - }; + } destroy() { this.charts.forEach(chart => chart.destroy()); d3.select(this.el).selectAll('*').remove(); - }; + } draw() { this.layout.render(); @@ -103,4 +103,4 @@ export default function MapsFactory(Private) { } return Maps; -}; +} diff --git a/src/ui/public/vis_maps/maps_renderbot.js b/src/ui/public/vis_maps/maps_renderbot.js index 94aae9f230b6d5c..119b2389c5c5aab 100644 --- a/src/ui/public/vis_maps/maps_renderbot.js +++ b/src/ui/public/vis_maps/maps_renderbot.js @@ -4,9 +4,9 @@ import VisRenderbotProvider from 'ui/vis/renderbot'; import MapsVisTypeBuildChartDataProvider from 'ui/vislib_vis_type/build_chart_data'; module.exports = function MapsRenderbotFactory(Private, $injector) { const AngularPromise = $injector.get('Promise'); - let Maps = Private(MapsProvider); - let Renderbot = Private(VisRenderbotProvider); - let buildChartData = Private(MapsVisTypeBuildChartDataProvider); + const Maps = Private(MapsProvider); + const Renderbot = Private(VisRenderbotProvider); + const buildChartData = Private(MapsVisTypeBuildChartDataProvider); _.class(MapsRenderbot).inherits(Renderbot); function MapsRenderbot(vis, $el, uiState) { @@ -29,7 +29,7 @@ module.exports = function MapsRenderbotFactory(Private, $injector) { }; MapsRenderbot.prototype._getMapsParams = function () { - let self = this; + const self = this; return _.assign( {}, @@ -52,9 +52,9 @@ module.exports = function MapsRenderbotFactory(Private, $injector) { }; MapsRenderbot.prototype.destroy = function () { - let self = this; + const self = this; - let mapsVis = self.mapsVis; + const mapsVis = self.mapsVis; _.forOwn(self.vis.listeners, function (listener, event) { mapsVis.off(event, listener); @@ -64,10 +64,10 @@ module.exports = function MapsRenderbotFactory(Private, $injector) { }; MapsRenderbot.prototype.updateParams = function () { - let self = this; + const self = this; // get full maps params object - let newParams = self._getMapsParams(); + const newParams = self._getMapsParams(); // if there's been a change, replace the vis if (!_.isEqual(newParams, self.mapsParams)) self._createVis(); diff --git a/src/ui/public/vis_maps/maps_vis_type.js b/src/ui/public/vis_maps/maps_vis_type.js index 1f730bdcf45a7da..999397dc2d92e64 100644 --- a/src/ui/public/vis_maps/maps_vis_type.js +++ b/src/ui/public/vis_maps/maps_vis_type.js @@ -4,8 +4,8 @@ import 'plugins/kbn_vislib_vis_types/controls/vislib_basic_options'; import VisVisTypeProvider from 'ui/vis/vis_type'; import MapsVisTypeMapsRenderbotProvider from 'ui/vis_maps/maps_renderbot'; export default function MapsVisTypeFactory(Private) { - let VisType = Private(VisVisTypeProvider); - let MapsRenderbot = Private(MapsVisTypeMapsRenderbotProvider); + const VisType = Private(VisVisTypeProvider); + const MapsRenderbot = Private(MapsVisTypeMapsRenderbotProvider); _.class(MapsVisType).inherits(VisType); @@ -19,4 +19,4 @@ export default function MapsVisTypeFactory(Private) { }; return MapsVisType; -}; +} diff --git a/src/ui/public/vis_maps/visualizations/_chart.js b/src/ui/public/vis_maps/visualizations/_chart.js index 23f890dd50880e1..a18682e36e81e32 100644 --- a/src/ui/public/vis_maps/visualizations/_chart.js +++ b/src/ui/public/vis_maps/visualizations/_chart.js @@ -38,7 +38,7 @@ export default function ChartBaseClass(Private) { const selection = d3.select(this.chartEl); selection.selectAll('*').remove(); selection.call(this.draw()); - }; + } /** @@ -53,8 +53,8 @@ export default function ChartBaseClass(Private) { tooltip.destroy(); }); selection.remove(); - }; + } } return Chart; -}; +}