-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathOutputHighstateSummaryOriginal.js
More file actions
69 lines (56 loc) · 2.24 KB
/
OutputHighstateSummaryOriginal.js
File metadata and controls
69 lines (56 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import {Output} from "./Output.js";
import {Utils} from "../Utils.js";
export class OutputHighstateSummaryOriginal {
static addPercentage (pCount, pTotal) {
return (100 * pCount / pTotal).toLocaleString(undefined, {"maximumFractionDigits": 1, "minimumFractionDigits": 1}) + "%";
}
static addSummarySpan (pDiv, pMinionId, pSucceeded, pFailed, pSkipped, pTotalMilliSeconds, pChangesSummary) {
let txt = "\nSummary for " + pMinionId;
txt += "\n------------";
const summarySpan = Utils.createSpan("text-info", txt);
pDiv.append(summarySpan);
const total = pSucceeded + pSkipped + pFailed;
txt = "\nSucceeded: " + pSucceeded;
const succeededSpan = Utils.createSpan("task-success", txt);
pDiv.append(succeededSpan);
if (pChangesSummary > 0) {
txt = " (";
const oSpan = Utils.createSpan("", txt);
pDiv.append(oSpan);
txt = "changed=" + pChangesSummary;
const changedSpan = Utils.createSpan("task-success-changes", txt);
pDiv.append(changedSpan);
txt = ")";
const cSpan = Utils.createSpan("", txt);
pDiv.append(cSpan);
}
txt = "\nFailed: " + pFailed;
const failedSpan = Utils.createSpan("", txt);
if (pFailed > 0) {
failedSpan.classList.add("task-failure");
} else {
failedSpan.classList.add("text-info");
}
pDiv.append(failedSpan);
const stateOutputPct = Utils.getStorageItemBoolean("session", "state_output_pct");
if (stateOutputPct) {
txt = "\nSuccess %: " + OutputHighstateSummaryOriginal.addPercentage(pSucceeded, total);
const successSpan = Utils.createSpan("task-success", txt);
pDiv.append(successSpan);
txt = "\nFailure %: " + OutputHighstateSummaryOriginal.addPercentage(pFailed, total);
const failureSpan = Utils.createSpan("", txt);
if (pFailed > 0) {
failureSpan.classList.add("task-failure");
} else {
failureSpan.classList.add("text-info");
}
pDiv.append(failureSpan);
}
txt = "\n------------";
txt += "\nTotal states run: " + total;
txt += "\nTotal run time: " + Output.getDuration(pTotalMilliSeconds);
const totalsSpan = Utils.createSpan("text-info", txt);
pDiv.append(totalsSpan);
pDiv.style.cursor = "pointer";
}
}