kritbit

kritbit Commit Details


Date:2015-12-18 23:10:28 (9 years 3 days ago)
Author:Natalie Adams
Branch:master
Commit:2ee3e7cee5236f95155d426fa567f3922de34b03
Parents: 279452a992133e80a80329d34961d7c6b34a3ca1
Message:Adding dygraph support

Changes:

File differences

web/application/controllers/history.php
3939
4040
4141
42
4342
4443
4544
4645
47
46
47
48
49
50
51
4852
4953
5054
try {
if (count($idArr) == 2) {
/** @var \application\models\Histories $historyArr */
//$historyArr = \application\models\Histories::getByField("jobs_id", $idArr[1]);
$historyArr = DB::fetchObject("SELECT * FROM histories WHERE jobs_id = ? ORDER BY run_date DESC", '\application\models\Histories', [$idArr[1]]);
/** @var \application\models\Jobs[] $jobObject */
$jobObject = \application\models\Jobs::getByField("id", $idArr[1]);
if ($this->checkAccess($jobObject[0])) {
echo $this->loadRender("history.html", ["job" => $jobObject[0], "histories" => $historyArr]);
$csv = [];
/** @var \application\models\histories $history */
foreach($historyArr as $history) {
$csv[] = "\"" . str_replace("-", "/", $history->run_date) . "," . $history->time_taken . "," . $history->getRawSize() . "," . $history->result . "\\n\"";
}
echo $this->loadRender("history.html", ["csv" => implode("+", $csv), "job" => $jobObject[0], "histories" => $historyArr]);
}
}
} catch (\Exception $e) {
web/application/models/histories.php
3636
3737
3838
39
39
4040
4141
42
43
44
45
4246
return round($bytes, $precision) . ' ' . $units[$pow];
}
public function getSize() {
public function getSize() {
return $this->formatBytes(strlen($this->output));
}
public function getRawSize() {
return strlen($this->output);
}
}
web/application/views/history.html
1313
1414
1515
16
17
18
19
20
21
22
1623
1724
1825
......
7178
7279
7380
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
74105
75106
76107
<hr>
<div style="margin: 0 auto; width: 80%" id="label">&nbsp;</div>
<div style="margin: 0 auto; width:80%;" id="stats">
</div>
<hr>
<table align="center" style="width: 30%;" class="table table-hover">
<thead>
<tr>
}
});
$(".results").dynatable();
var graph = new Dygraph(document.getElementById("stats"),
{{csv|safe}},
{
series: {
'Result': {
axis: 'y2'
},
},
axes: {
y2: {
independentTicks: true
}
},
legend: "always",
hideOverlayOnMouseOut: false,
labelsDiv: "label",
showRangeSelector: true,
animatedZooms: true,
labels: ["Date", "Time Taken", "Log Size", "Result"]
}
);
});
</script>

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.06018s using 14 queries.