Merge branch 'feature/pages/all-runs'
This commit is contained in:
commit
0a664a8a76
|
@ -69,7 +69,7 @@ if (filter_var($jobnameResult[0]["url"], FILTER_VALIDATE_URL)) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($nosave !== true && $statuscode != $jobnameResult[0]["expected"]) {
|
if($nosave !== true) {
|
||||||
$stmt = $db->prepare("INSERT INTO runs(job, statuscode, result, timestamp) VALUES(?, ?, ?, ?)");
|
$stmt = $db->prepare("INSERT INTO runs(job, statuscode, result, timestamp) VALUES(?, ?, ?, ?)");
|
||||||
$stmt->execute(array($jobID, $statuscode, $body, $timestamp));
|
$stmt->execute(array($jobID, $statuscode, $body, $timestamp));
|
||||||
}
|
}
|
||||||
|
|
10
runs.php
10
runs.php
|
@ -35,7 +35,13 @@ if ($jobnameResult[0]["user"] != $_SESSION["userID"]) {
|
||||||
}
|
}
|
||||||
$jobName = $jobnameResult[0]['name'];
|
$jobName = $jobnameResult[0]['name'];
|
||||||
|
|
||||||
$runsForJob = $db->prepare("SELECT runs.*, jobs.name FROM runs, jobs WHERE runs.job = jobs.jobID AND runs.job = ?");
|
$runsForJobQry = "SELECT runs.*, jobs.name FROM runs, jobs WHERE runs.job = jobs.jobID AND runs.job = ?";
|
||||||
|
$allruns = true;
|
||||||
|
if(!(isset($_GET['allruns']) && $_GET['allruns'] == 1)) {
|
||||||
|
$runsForJobQry .= " AND runs.statuscode <> jobs.expected";
|
||||||
|
$allruns = false;
|
||||||
|
}
|
||||||
|
$runsForJob = $db->prepare($runsForJobQry);
|
||||||
$runsForJob->execute(array($_GET['jobID']));
|
$runsForJob->execute(array($_GET['jobID']));
|
||||||
$runsForJobResult = $runsForJob->fetchAll(PDO::FETCH_ASSOC);
|
$runsForJobResult = $runsForJob->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
@ -55,7 +61,7 @@ foreach($runsForJobResult as $key=>$value) {
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$twig_vars = array('runs' => $runsForJobRendered, "title" => $jobName);
|
$twig_vars = array('jobID' => $_GET['jobID'], 'runs' => $runsForJobRendered, 'allruns' => $allruns, "title" => $jobName);
|
||||||
|
|
||||||
//echo $twig->render('overview.html.twig', array('the' => 'variables', 'go' => 'here'));
|
//echo $twig->render('overview.html.twig', array('the' => 'variables', 'go' => 'here'));
|
||||||
echo $twig->render('runs.html.twig', $twig_vars);
|
echo $twig->render('runs.html.twig', $twig_vars);
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
{% block title %}Overview of run for {{ title }}{% endblock %}
|
{% block title %}Overview of run for {{ title }}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Overview of runs for {{ title }}</h2>
|
<h2>Overview of runs for {{ title }}</h2>
|
||||||
|
{% if allruns %}
|
||||||
|
<p><a href="runs.php?jobID={{ jobID }}&allruns=0">Only show failed runs</a></p>
|
||||||
|
{% elseif not allruns %}
|
||||||
|
<p><a href="runs.php?jobID={{ jobID }}&allruns=1">Show all runs</a></p>
|
||||||
|
{% endif %}
|
||||||
<div id="accordion" class="panel-group">
|
<div id="accordion" class="panel-group">
|
||||||
{% for run in runs %}
|
{% for run in runs %}
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
|
|
|
@ -92,7 +92,7 @@ foreach ($results as $result) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($nosave !== true && $statuscode != $result["expected"]) {
|
if($nosave !== true) {
|
||||||
$stmt = $db->prepare("INSERT INTO runs(job, statuscode, result, timestamp) VALUES(?, ?, ?, ?)");
|
$stmt = $db->prepare("INSERT INTO runs(job, statuscode, result, timestamp) VALUES(?, ?, ?, ?)");
|
||||||
$stmt->execute(array($result['jobID'], $statuscode, $body, time()));
|
$stmt->execute(array($result['jobID'], $statuscode, $body, time()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue