diff --git a/src/plugins/statusPage/public/lib/formatNumber.js b/src/plugins/statusPage/public/lib/formatNumber.js index 291ea77ae7d4b..291e4c5a3406f 100644 --- a/src/plugins/statusPage/public/lib/formatNumber.js +++ b/src/plugins/statusPage/public/lib/formatNumber.js @@ -1,10 +1,10 @@ -var moment = require('moment'); -var numeral = require('numeral'); +const moment = require('moment'); +const numeral = require('numeral'); module.exports = function formatNumber(num, which) { - var format = '0.00'; - var postfix = ''; + let format = '0.00'; + let postfix = ''; switch (which) { case 'time': return moment(num).format('HH:mm:ss'); diff --git a/src/plugins/statusPage/public/lib/makeChartOptions.js b/src/plugins/statusPage/public/lib/makeChartOptions.js index b7a8783c84396..fdcad49d96799 100644 --- a/src/plugins/statusPage/public/lib/makeChartOptions.js +++ b/src/plugins/statusPage/public/lib/makeChartOptions.js @@ -1,5 +1,5 @@ -var formatNumber = require('./formatNumber'); +const formatNumber = require('./formatNumber'); module.exports = function makeChartOptions(type) { return { diff --git a/src/plugins/statusPage/public/lib/readStatData.js b/src/plugins/statusPage/public/lib/readStatData.js index 1bfe56392fe29..7a21a045cd6b4 100644 --- a/src/plugins/statusPage/public/lib/readStatData.js +++ b/src/plugins/statusPage/public/lib/readStatData.js @@ -1,4 +1,4 @@ -var _ = require('lodash'); +const _ = require('lodash'); module.exports = function readStatData(data, seriesNames) { // Metric Values format @@ -13,13 +13,13 @@ module.exports = function readStatData(data, seriesNames) { // Go through all of the metric values and split the values out. // returns an array of all of the averages - var metricList = []; + const metricList = []; seriesNames = seriesNames || []; data.forEach(function (vector) { vector = _.flatten(vector); - var x = vector.shift(); + const x = vector.shift(); vector.forEach(function (yValue, i) { - var series = seriesNames[i] || ''; + const series = seriesNames[i] || ''; if (!metricList[i]) { metricList[i] = { diff --git a/src/plugins/statusPage/public/lib/toTitleCase.js b/src/plugins/statusPage/public/lib/toTitleCase.js index e7f4a1d33a4fa..798039898817a 100644 --- a/src/plugins/statusPage/public/lib/toTitleCase.js +++ b/src/plugins/statusPage/public/lib/toTitleCase.js @@ -1,4 +1,4 @@ -var _ = require('lodash'); +const _ = require('lodash'); // Turns thisIsASentence to // This Is A Sentence diff --git a/src/plugins/statusPage/public/statusPage.js b/src/plugins/statusPage/public/statusPage.js index 6189ec0832581..ecadba6467607 100644 --- a/src/plugins/statusPage/public/statusPage.js +++ b/src/plugins/statusPage/public/statusPage.js @@ -1,11 +1,11 @@ -var $ = require('jquery'); -var _ = require('lodash'); -var notify = require('ui/notify'); +const $ = require('jquery'); +const _ = require('lodash'); +const notify = require('ui/notify'); require('plugins/statusPage/statusPageMetric'); require('plugins/statusPage/statusPage.less'); -var chrome = require('ui/chrome') +const chrome = require('ui/chrome') .setTabs([ { id: '', @@ -15,7 +15,7 @@ var chrome = require('ui/chrome') ]) .setRootTemplate(require('plugins/statusPage/statusPage.html')) .setRootController('ui', function ($http, $scope) { - var ui = this; + const ui = this; ui.loading = false; ui.refresh = function () { @@ -31,11 +31,11 @@ var chrome = require('ui/chrome') ui.fetchError = null; } - var data = resp.data; + const data = resp.data; ui.metrics = data.metrics; ui.statuses = data.status.statuses; - var overall = data.status.overall; + const overall = data.status.overall; if (!ui.serverState || (ui.serverState !== overall.state)) { ui.serverState = overall.state; ui.serverStateMessage = overall.title; diff --git a/src/plugins/statusPage/public/statusPageMetric.js b/src/plugins/statusPage/public/statusPageMetric.js index 99de1c3670240..180fb2826a492 100644 --- a/src/plugins/statusPage/public/statusPageMetric.js +++ b/src/plugins/statusPage/public/statusPageMetric.js @@ -1,14 +1,14 @@ -var _ = require('lodash'); -var moment = require('moment'); -var numeral = require('numeral'); +const _ = require('lodash'); +const moment = require('moment'); +const numeral = require('numeral'); -var toTitleCase = require('./lib/toTitleCase'); -var formatNumber = require('./lib/formatNumber'); -var readStatData = require('./lib/readStatData'); +const toTitleCase = require('./lib/toTitleCase'); +const formatNumber = require('./lib/formatNumber'); +const readStatData = require('./lib/readStatData'); function calcAvg(metricList, metricNumberType) { return metricList.map(function (data) { - var uglySum = data.values.reduce(function (sumSoFar, vector) { + const uglySum = data.values.reduce(function (sumSoFar, vector) { return sumSoFar + vector.y; }, 0); return formatNumber(uglySum / data.values.length, metricNumberType); @@ -27,7 +27,7 @@ require('ui/modules') }, controllerAs: 'metric', controller: function ($scope) { - var self = this; + const self = this; self.name = $scope.name; self.title = toTitleCase(self.name); @@ -56,10 +56,10 @@ require('ui/modules') self.chartData = readStatData(self.rawData, self.seriesNames); self.averages = calcAvg(self.chartData, self.numberType); - var unit = ''; + let unit = ''; self.averages = self.averages.map(function (average) { - var parts = average.split(' '); - var value = parts.shift(); + const parts = average.split(' '); + const value = parts.shift(); unit = parts.join(' '); return value; });