Changed functions to arrow functions for only-arrow-functions rule.

This commit is contained in:
Patrick O'Carroll
2018-09-04 17:02:32 +02:00
parent 0f326f18dc
commit dc4f547a40
36 changed files with 244 additions and 242 deletions

View File

@@ -36,7 +36,7 @@ export class DashboardMigrator {
}
}
panelUpgrades.push(function(panel) {
panelUpgrades.push(panel => {
// rename panel type
if (panel.type === 'graphite') {
panel.type = 'graph';
@@ -84,7 +84,7 @@ export class DashboardMigrator {
if (oldVersion < 3) {
// ensure panel ids
let maxId = this.dashboard.getNextPanelId();
panelUpgrades.push(function(panel) {
panelUpgrades.push(panel => {
if (!panel.id) {
panel.id = maxId;
maxId += 1;
@@ -95,11 +95,11 @@ export class DashboardMigrator {
// schema version 4 changes
if (oldVersion < 4) {
// move aliasYAxis changes
panelUpgrades.push(function(panel) {
panelUpgrades.push(panel => {
if (panel.type !== 'graph') {
return;
}
_.each(panel.aliasYAxis, function(value, key) {
_.each(panel.aliasYAxis, (value, key) => {
panel.seriesOverrides = [{ alias: key, yaxis: value }];
});
delete panel.aliasYAxis;
@@ -150,15 +150,15 @@ export class DashboardMigrator {
}
if (oldVersion < 8) {
panelUpgrades.push(function(panel) {
_.each(panel.targets, function(target) {
panelUpgrades.push(panel => {
_.each(panel.targets, target => {
// update old influxdb query schema
if (target.fields && target.tags && target.groupBy) {
if (target.rawQuery) {
delete target.fields;
delete target.fill;
} else {
target.select = _.map(target.fields, function(field) {
target.select = _.map(target.fields, field => {
const parts = [];
parts.push({ type: 'field', params: [field.name] });
parts.push({ type: field.func, params: [] });
@@ -171,7 +171,7 @@ export class DashboardMigrator {
return parts;
});
delete target.fields;
_.each(target.groupBy, function(part) {
_.each(target.groupBy, part => {
if (part.type === 'time' && part.interval) {
part.params = [part.interval];
delete part.interval;
@@ -195,7 +195,7 @@ export class DashboardMigrator {
// schema version 9 changes
if (oldVersion < 9) {
// move aliasYAxis changes
panelUpgrades.push(function(panel) {
panelUpgrades.push(panel => {
if (panel.type !== 'singlestat' && panel.thresholds !== '') {
return;
}
@@ -214,12 +214,12 @@ export class DashboardMigrator {
// schema version 10 changes
if (oldVersion < 10) {
// move aliasYAxis changes
panelUpgrades.push(function(panel) {
panelUpgrades.push(panel => {
if (panel.type !== 'table') {
return;
}
_.each(panel.styles, function(style) {
_.each(panel.styles, style => {
if (style.thresholds && style.thresholds.length >= 3) {
const k = style.thresholds;
k.shift();
@@ -231,7 +231,7 @@ export class DashboardMigrator {
if (oldVersion < 12) {
// update template variables
_.each(this.dashboard.templating.list, function(templateVariable) {
_.each(this.dashboard.templating.list, templateVariable => {
if (templateVariable.refresh) {
templateVariable.refresh = 1;
}
@@ -248,7 +248,7 @@ export class DashboardMigrator {
if (oldVersion < 12) {
// update graph yaxes changes
panelUpgrades.push(function(panel) {
panelUpgrades.push(panel => {
if (panel.type !== 'graph') {
return;
}
@@ -297,7 +297,7 @@ export class DashboardMigrator {
if (oldVersion < 13) {
// update graph yaxes changes
panelUpgrades.push(function(panel) {
panelUpgrades.push(panel => {
if (panel.type !== 'graph') {
return;
}