Skip to content

Commit 8889ec9

Browse files
rafaveira3joserenatosilva
authored andcommitted
fe|FEAT: Add error metric into line graph (#58)
1 parent 5236f34 commit 8889ec9

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

src/components/Dashboard.js

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ class Dashboard extends Component {
183183
let infoHistoryAnalysisLabelsTmp = [];
184184
const failingListTmp = [];
185185
const passingListTmp = [];
186+
const erroringListTmp = [];
186187
response.json().then(historyResultJSON => {
187188
let infoHistoryAnalysisKey = "";
188189
Object.keys(historyResultJSON).forEach(key => {
@@ -203,6 +204,7 @@ class Dashboard extends Component {
203204
infoHistoryAnalysisTmp[infoHistoryAnalysisKey] = {
204205
passed: 0,
205206
failed: 0,
207+
error: 0,
206208
};
207209
}
208210
historyResultJSON[key].results.forEach(currentResult => {
@@ -221,10 +223,12 @@ class Dashboard extends Component {
221223
.forEach(key => {
222224
failingListTmp.push(infoHistoryAnalysisTmp[key].failed);
223225
passingListTmp.push(infoHistoryAnalysisTmp[key].passed);
226+
erroringListTmp.push(infoHistoryAnalysisTmp[key].error);
224227
});
225228
const { infoHistoryAnalysis } = this.state;
226229
const { passingList } = this.state;
227230
const { failingList } = this.state;
231+
const { erroringList } = this.state;
228232
const { infoHistoryAnalysisLabels } = this.state;
229233

230234
if (timeFilter === "time_range=today") {
@@ -244,13 +248,15 @@ class Dashboard extends Component {
244248
infoHistoryAnalysisLabelsTmp
245249
) ||
246250
!isEqual(passingList, passingListTmp) ||
247-
!isEqual(failingList, failingListTmp)
251+
!isEqual(failingList, failingListTmp) ||
252+
!isEqual(erroringList, erroringListTmp)
248253
) {
249254
this.setState({
250255
infoHistoryAnalysis: infoHistoryAnalysisTmp,
251256
infoHistoryAnalysisLabels: infoHistoryAnalysisLabelsTmp,
252257
passingList: passingListTmp,
253258
failingList: failingListTmp,
259+
erroringList: erroringListTmp,
254260
});
255261
}
256262
});
@@ -435,7 +441,7 @@ class Dashboard extends Component {
435441
for (let counter = 0; counter < 24; counter += 1) {
436442
const current = String(Number(first) + increment * counter);
437443
if (!keys.includes(current)) {
438-
final[current] = { passed: 0, failed: 0 };
444+
final[current] = { passed: 0, failed: 0, error: 0 };
439445
}
440446
}
441447
} else {
@@ -444,7 +450,7 @@ class Dashboard extends Component {
444450
for (let counter = 0; counter < numDays; counter += 1) {
445451
const current = String(Number(first) + increment * counter);
446452
if (!keys.includes(current)) {
447-
final[current] = { passed: 0, failed: 0 };
453+
final[current] = { passed: 0, failed: 0, error: 0 };
448454
}
449455
}
450456
}
@@ -530,6 +536,7 @@ class Dashboard extends Component {
530536
const { infoHistoryAnalysisLabels } = this.state;
531537
const { failingList } = this.state;
532538
const { passingList } = this.state;
539+
const { erroringList } = this.state;
533540
const infoHistoryAnalysisData = {
534541
labels: infoHistoryAnalysisLabels,
535542
datasets: [
@@ -545,7 +552,7 @@ class Dashboard extends Component {
545552
borderDashOffset: 0.0,
546553
borderJoinStyle: "miter",
547554
pointBorderColor: colorGreenHover,
548-
pointBackgroundColor: "#fff",
555+
pointBackgroundColor: colorGreen,
549556
pointBorderWidth: 4,
550557
pointHoverRadius: 5,
551558
pointHoverBackgroundColor: colorGreen,
@@ -567,7 +574,7 @@ class Dashboard extends Component {
567574
borderDashOffset: 0.0,
568575
borderJoinStyle: "miter",
569576
pointBorderColor: colorRedHover,
570-
pointBackgroundColor: "#fff",
577+
pointBackgroundColor: colorRed,
571578
pointBorderWidth: 4,
572579
pointHoverRadius: 5,
573580
pointHoverBackgroundColor: colorRed,
@@ -577,6 +584,28 @@ class Dashboard extends Component {
577584
pointHitRadius: 10,
578585
data: failingList,
579586
},
587+
{
588+
label: "Error Analyses",
589+
fill: false,
590+
lineTension: 0.1,
591+
borderWidth: 5,
592+
backgroundColor: colorGray,
593+
borderColor: colorGrayHover,
594+
borderCapStyle: "butt",
595+
borderDash: [],
596+
borderDashOffset: 0.0,
597+
borderJoinStyle: "miter",
598+
pointBorderColor: colorGrayHover,
599+
pointBackgroundColor: colorGray,
600+
pointBorderWidth: 4,
601+
pointHoverRadius: 5,
602+
pointHoverBackgroundColor: colorGray,
603+
pointHoverBorderColor: colorGrayHover,
604+
pointHoverBorderWidth: 4,
605+
pointRadius: 3,
606+
pointHitRadius: 10,
607+
data: erroringList,
608+
},
580609
],
581610
};
582611

0 commit comments

Comments
 (0)