NEW FEATURE: multiple wrong exit statuses
This commit is contained in:
parent
1210c0193f
commit
4987f818c5
|
@ -32,7 +32,7 @@ class JobController extends Controller
|
||||||
|
|
||||||
if($this->getRequest()->getMethod() == 'GET') {
|
if($this->getRequest()->getMethod() == 'GET') {
|
||||||
$job = $jobRepo->getJob($id);
|
$job = $jobRepo->getJob($id);
|
||||||
$runs = $runRepo->getRunsForJob($id, $all != 'all' ? [$job['data']['response']] : []);
|
$runs = $runRepo->getRunsForJob($id, $all != 'all' ? array_merge($job['data']['response'] ?? [], $job['data']['http-status'] ?? []) : []);
|
||||||
return $this->render('job/view.html.twig', ['job' => $job, 'runs' => $runs, 'allruns' => $all == 'all']);
|
return $this->render('job/view.html.twig', ['job' => $job, 'runs' => $runs, 'allruns' => $all == 'all']);
|
||||||
} elseif($this->getRequest()->getMethod() == 'DELETE') {
|
} elseif($this->getRequest()->getMethod() == 'DELETE') {
|
||||||
$success = $jobRepo->deleteJob($id);
|
$success = $jobRepo->deleteJob($id);
|
||||||
|
|
|
@ -266,7 +266,7 @@ class Job extends Repository
|
||||||
{
|
{
|
||||||
case 'command':
|
case 'command':
|
||||||
$values['data']['command'] = $values['command'];
|
$values['data']['command'] = $values['command'];
|
||||||
$values['data']['response'] = $values['response'];
|
$values['data']['response'] = explode(',', $values['response']);
|
||||||
break;
|
break;
|
||||||
case 'reboot':
|
case 'reboot':
|
||||||
$values['data']['reboot-command'] = $values['reboot-command'];
|
$values['data']['reboot-command'] = $values['reboot-command'];
|
||||||
|
@ -287,7 +287,7 @@ class Job extends Repository
|
||||||
case 'http':
|
case 'http':
|
||||||
$parsedUrl = parse_url($values['url']);
|
$parsedUrl = parse_url($values['url']);
|
||||||
$values['data']['url'] = $values['url'];
|
$values['data']['url'] = $values['url'];
|
||||||
$values['data']['response'] = $values['response'];
|
$values['data']['http-status'] = explode(',', $values['http-status']);
|
||||||
$values['data']['basicauth-username'] = $values['basicauth-username'];
|
$values['data']['basicauth-username'] = $values['basicauth-username'];
|
||||||
if(empty($parsedUrl['host'])) {
|
if(empty($parsedUrl['host'])) {
|
||||||
throw new \InvalidArgumentException('Some data was invalid');
|
throw new \InvalidArgumentException('Some data was invalid');
|
||||||
|
|
|
@ -13,12 +13,13 @@ class Run extends Repository
|
||||||
$runsSql = "SELECT * FROM run WHERE job_id = :job";
|
$runsSql = "SELECT * FROM run WHERE job_id = :job";
|
||||||
$params = [':job' => $id];
|
$params = [':job' => $id];
|
||||||
if (!empty($excludedexitcodes)) {
|
if (!empty($excludedexitcodes)) {
|
||||||
$runsSql .= ' AND exitcode NOT in (';
|
$runsSql .= ' AND exitcode NOT in ';
|
||||||
|
$exitcodes = [];
|
||||||
foreach($excludedexitcodes as $key => $exitcode) {
|
foreach($excludedexitcodes as $key => $exitcode) {
|
||||||
$runsSql .= ':code' . $key;
|
$exitcodes[] = ':code' . $key;
|
||||||
$params[':code' . $key] = $exitcode;
|
$params[':code' . $key] = $exitcode;
|
||||||
}
|
}
|
||||||
$runsSql .= ')';
|
$runsSql .= '(' . implode(',', $exitcodes) . ')';
|
||||||
}
|
}
|
||||||
if ($ordered) $runsSql .= ' ORDER by timestamp DESC';
|
if ($ordered) $runsSql .= ' ORDER by timestamp DESC';
|
||||||
$runsStmt = $this->dbcon->prepare($runsSql);
|
$runsStmt = $this->dbcon->prepare($runsSql);
|
||||||
|
|
|
@ -152,8 +152,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="response">Expected response status code</label>
|
<label for="http-status">Expected http status code</label>
|
||||||
<input type="text" name="response" class="form-control" id="response" placeholder="200" value="{% if attribute(data, 'response') is not empty %}{{ attribute(data, 'response') }}{% endif %}">
|
<input type="text" name="http-status" class="form-control" id="http-status" placeholder="200" value="{% if attribute(data, 'http-status') is not empty %}{{ attribute(data, 'http-status') }}{% endif %}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user