renaming the dimensions to lowercase.
BrainDoctor committed
Aug 1, 2017 at 13:12 UTC
c1db1fd8df0baec78b383dd3388167c4c6812b4a
2 files changed
+19
-19
node.d/fronius.node.js
+9
-9
@@ -45,9 +45,9 @@ var fronius = {
45
if (fronius.isDefined(chart)) return chart;
46
47
var dim = {};
48
- dim[fronius.powerGridId] = this.createBasicDimension(fronius.powerGridId, "Grid", 1);
49
- dim[fronius.powerPvId] = this.createBasicDimension(fronius.powerPvId, "Photovoltaics", 1);
50
- dim[fronius.powerAccuId] = this.createBasicDimension(fronius.powerAccuId, "Accumulator", 1);
48
+ dim[fronius.powerGridId] = this.createBasicDimension(fronius.powerGridId, "grid", 1);
49
+ dim[fronius.powerPvId] = this.createBasicDimension(fronius.powerPvId, "photovoltaics", 1);
50
+ dim[fronius.powerAccuId] = this.createBasicDimension(fronius.powerAccuId, "accumulator", 1);
51
52
chart = {
53
id: id, // the unique id of the chart
@@ -73,7 +73,7 @@ var fronius = {
73
var chart = fronius.charts[id];
74
if (fronius.isDefined(chart)) return chart;
75
var dim = {};
76
- dim[fronius.consumptionLoadId] = this.createBasicDimension(fronius.consumptionLoadId, "Load", 1);
76
+ dim[fronius.consumptionLoadId] = this.createBasicDimension(fronius.consumptionLoadId, "load", 1);
77
78
chart = {
79
id: id, // the unique id of the chart
@@ -99,8 +99,8 @@ var fronius = {
99
var chart = fronius.charts[id];
100
if (fronius.isDefined(chart)) return chart;
101
var dim = {};
102
- dim[fronius.autonomyId] = this.createBasicDimension(fronius.autonomyId, "Autonomy", 1);
103
- dim[fronius.consumptionSelfId] = this.createBasicDimension(fronius.consumptionSelfId, "Self Consumption", 1);
102
+ dim[fronius.autonomyId] = this.createBasicDimension(fronius.autonomyId, "autonomy", 1);
103
+ dim[fronius.consumptionSelfId] = this.createBasicDimension(fronius.consumptionSelfId, "self_consumption", 1);
104
105
chart = {
106
id: id, // the unique id of the chart
@@ -126,7 +126,7 @@ var fronius = {
126
var chart = fronius.charts[chartId];
127
if (fronius.isDefined(chart)) return chart;
128
var dim = {};
129
- dim[fronius.energyTodayId] = this.createBasicDimension(fronius.energyTodayId, "Today", 1000);
129
+ dim[fronius.energyTodayId] = this.createBasicDimension(fronius.energyTodayId, "today", 1000);
130
chart = {
131
id: chartId, // the unique id of the chart
132
name: "", // the unique name of the chart
@@ -151,7 +151,7 @@ var fronius = {
151
var chart = fronius.charts[chartId];
152
if (fronius.isDefined(chart)) return chart;
153
var dim = {};
154
- dim[fronius.energyYearId] = this.createBasicDimension(fronius.energyYearId, "Year", 1000);
154
+ dim[fronius.energyYearId] = this.createBasicDimension(fronius.energyYearId, "year", 1000);
155
chart = {
156
id: chartId, // the unique id of the chart
157
name: "", // the unique name of the chart
@@ -181,7 +181,7 @@ var fronius = {
181
for (var key in inverters) {
182
if (inverters.hasOwnProperty(key)) {
183
var name = key;
184
- if (!isNaN(key)) name = "Inverter " + key;
184
+ if (!isNaN(key)) name = "inverter_" + key;
185
dim[key] = this.createBasicDimension("inverter_" + key, name, 1);
186
}
187
}
tests/node.d/fronius.chart.spec.js
+10
-10
@@ -40,9 +40,9 @@ describe("fronius chart creation", function () {
40
expect(result.type).toBe(netdata.chartTypes.area);
41
expect(result.family).toBe("power");
42
expect(result.context).toBe("fronius.power");
43
- expect(result.dimensions[subject.powerGridId].name).toBe("Grid");
44
- expect(result.dimensions[subject.powerPvId].name).toBe("Photovoltaics");
45
- expect(result.dimensions[subject.powerAccuId].name).toBe("Accumulator");
43
+ expect(result.dimensions[subject.powerGridId].name).toBe("grid");
44
+ expect(result.dimensions[subject.powerPvId].name).toBe("photovoltaics");
45
+ expect(result.dimensions[subject.powerAccuId].name).toBe("accumulator");
46
expect(Object.keys(result.dimensions).length).toBe(3);
47
});
48
@@ -56,7 +56,7 @@ describe("fronius chart creation", function () {
56
expect(result.family).toBe("consumption");
57
expect(result.context).toBe("fronius.consumption");
58
expect(Object.keys(result.dimensions).length).toBe(1);
59
- expect(result.dimensions[subject.consumptionLoadId].name).toBe("Load");
59
+ expect(result.dimensions[subject.consumptionLoadId].name).toBe("load");
60
});
61
62
it("should return the autonomy chart definition", function () {
@@ -69,8 +69,8 @@ describe("fronius chart creation", function () {
69
expect(result.family).toBe("autonomy");
70
expect(result.context).toBe("fronius.autonomy");
71
expect(Object.keys(result.dimensions).length).toBe(2);
72
- expect(result.dimensions[subject.autonomyId].name).toBe("Autonomy");
73
- expect(result.dimensions[subject.consumptionSelfId].name).toBe("Self Consumption");
72
+ expect(result.dimensions[subject.autonomyId].name).toBe("autonomy");
73
+ expect(result.dimensions[subject.consumptionSelfId].name).toBe("self_consumption");
74
});
75
76
it("should return the energy today chart definition", function () {
@@ -83,7 +83,7 @@ describe("fronius chart creation", function () {
83
expect(result.family).toBe("energy");
84
expect(result.context).toBe("fronius.energy.today");
85
expect(Object.keys(result.dimensions).length).toBe(1);
86
- expect(result.dimensions[subject.energyTodayId].name).toBe("Today");
86
+ expect(result.dimensions[subject.energyTodayId].name).toBe("today");
87
});
88
89
it("should return the energy year chart definition", function () {
@@ -96,7 +96,7 @@ describe("fronius chart creation", function () {
96
expect(result.family).toBe("energy");
97
expect(result.context).toBe("fronius.energy.year");
98
expect(Object.keys(result.dimensions).length).toBe(1);
99
- expect(result.dimensions[subject.energyYearId].name).toBe("Year");
99
+ expect(result.dimensions[subject.energyYearId].name).toBe("year");
100
});
101
102
it("should return the inverter chart definition with a single numerical inverter", function () {
@@ -112,7 +112,7 @@ describe("fronius chart creation", function () {
112
expect(result.family).toBe("inverters");
113
expect(result.context).toBe("fronius.inverter.output");
114
expect(Object.keys(result.dimensions).length).toBe(1);
115
- expect(result.dimensions["1"].name).toBe("Inverter 1");
115
+ expect(result.dimensions["1"].name).toBe("inverter_1");
116
});
117
118
it("should return the inverter chart definition with a single alphabetical inverter", function () {
@@ -149,7 +149,7 @@ describe("fronius chart creation", function () {
149
expect(result.context).toBe("fronius.inverter.output");
150
expect(Object.keys(result.dimensions).length).toBe(2);
151
expect(result.dimensions[alpha].name).toBe(alpha);
152
- expect(result.dimensions[numerical].name).toBe("Inverter " + numerical);
152
+ expect(result.dimensions[numerical].name).toBe("inverter_" + numerical);
153
});
154
155
it("should return the same chart definition on second call for lazy loading", function () {