-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move
showcoveragegraph.php
AJAX endpoint to controller (#1521)
This PR is part of an ongoing series of refactor PRs with the goal of migrating all of the `/ajax/*` routes to Laravel's routing/controller scheme.
- Loading branch information
1 parent
ae056e2
commit 8e39fe0
Showing
5 changed files
with
90 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<script type="text/javascript"> | ||
$(function () { | ||
const percent_array = []; | ||
const loctested_array = []; | ||
const locuntested_array = []; | ||
const buildids = []; | ||
@php($i = 0) | ||
@foreach($previousbuilds as $build_array) | ||
@php($t = strtotime($build_array->starttime) * 1000) {{-- flot expects milliseconds --}} | ||
@php(@$percent = round(intval($build_array->loctested) / (intval($build_array->loctested) + intval($build_array->locuntested)) * 100, 2)) | ||
percent_array.push([{{ $t }}, {{ $percent }}]); | ||
loctested_array.push([{{ $t }}, {{ $build_array->loctested }}]); | ||
locuntested_array.push([{{ $t }}, {{ $build_array->locuntested }}]); | ||
buildids[{{ $t }}] = {{ $build_array->id }}; | ||
@php($i++) | ||
@endforeach | ||
const options = { | ||
lines: {show: true}, | ||
points: {show: true}, | ||
xaxis: {mode: "time"}, | ||
yaxis: {min: 0, max: 100}, | ||
legend: {position: "nw"}, | ||
grid: { | ||
backgroundColor: "#fffaff", | ||
clickable: true, | ||
hoverable: true, | ||
hoverFill: '#444', | ||
hoverRadius: 4 | ||
}, | ||
selection: {mode: "x"}, | ||
colors: ["#0000FF", "#dba255", "#919733"] | ||
}; | ||
$("#grapholder").bind("selected", function (event, area) { | ||
plot = $.plot($("#grapholder"), | ||
[{label: "% coverage", data: percent_array}, | ||
{label: "loc tested", data: loctested_array, yaxis: 2}, | ||
{label: "loc untested", data: locuntested_array, yaxis: 2}], | ||
$.extend(true, {}, options, {xaxis: {min: area.x1, max: area.x2}})); | ||
}); | ||
$("#grapholder").bind("plotclick", function (e, pos, item) { | ||
if (item) { | ||
plot.highlight(item.series, item.datapoint); | ||
buildid = buildids[item.datapoint[0]]; | ||
window.location = "build/" + buildid; | ||
} | ||
}); | ||
plot = $.plot($("#grapholder"), [{label: "% coverage", data: percent_array}, | ||
{label: "loc tested", data: loctested_array, yaxis: 2}, | ||
{label: "loc untested", data: locuntested_array, yaxis: 2}], options); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters