Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #69 from bobey/master

Fatal error on index when having no jenkinsgrouprun at all
  • Loading branch information...
commit 15594b2f932e5f10dbfa98eb9e12923626f64cdc 2 parents 262d45b + 9baf309
@srogier srogier authored
View
42 apps/front/modules/jenkins/actions/indexAction.class.php
@@ -76,29 +76,35 @@ function execute($request)
}
$currentGroupRun = JenkinsGroupRunPeer::retrieveByPK($currentGroupId);
-
- $sortMenu = array(
- 'label' => array(
- 'label' => 'Name',
- 'url' => $this->generateUrl('branch_view', $currentGroupRun) . '/sort/label_' . $sortDirection,
- ),
- 'date' => array(
- 'label' => 'Creation date',
- 'url' => $this->generateUrl('branch_view', $currentGroupRun) . '/sort/date_' . $sortDirection,
- ),
- 'result' => array(
- 'label' => 'Status',
- 'url' => $this->generateUrl('branch_view', $currentGroupRun) . '/sort/result_' . $sortDirection,
- ),
- );
-
+
+ $sortMenu = $partial_url_for_sort_direction = $branch_view_url = null;
+ if (null !== $currentGroupRun)
+ {
+ $sortMenu = array(
+ 'label' => array(
+ 'label' => 'Name',
+ 'url' => $this->generateUrl('branch_view', $currentGroupRun) . '/sort/label_' . $sortDirection,
+ ),
+ 'date' => array(
+ 'label' => 'Creation date',
+ 'url' => $this->generateUrl('branch_view', $currentGroupRun) . '/sort/date_' . $sortDirection,
+ ),
+ 'result' => array(
+ 'label' => 'Status',
+ 'url' => $this->generateUrl('branch_view', $currentGroupRun) . '/sort/result_' . $sortDirection,
+ ),
+ );
+ $branch_view_url = $this->generateUrl('branch_view', $currentGroupRun);
+ $partial_url_for_sort_direction = sprintf('%s/sort/%s_', $this->generateUrl('branch_view', $currentGroupRun), $sortType);
+ }
+
$this->setVar('group_runs', $dataGroupRuns);
$this->setVar('current_group_run_id', $currentGroupId);
$this->setVar('sort_type', $sortType);
$this->setVar('sort_direction', $sortDirection);
$this->setVar('sort_menu', $sortMenu);
- $this->setVar('branch_view_url', $this->generateUrl('branch_view', $currentGroupRun));
- $this->setVar('partial_url_for_sort_direction', sprintf('%s/sort/%s_', $this->generateUrl('branch_view', $currentGroupRun), $sortType));
+ $this->setVar('branch_view_url', $branch_view_url);
+ $this->setVar('partial_url_for_sort_direction', $partial_url_for_sort_direction);
}
/**
View
2  apps/front/modules/jenkins/templates/indexSuccess.php
@@ -18,6 +18,7 @@
<?php endif; ?>
<div class="sidebar">
<ul>
+ <?php if (null !== $sort_menu): ?>
<li class="sidebar-actions">
<div class="btn-group">
<a class="btn dropdown-toggle btn-primary" data-toggle="dropdown" href="#">
@@ -36,6 +37,7 @@
</div>
</div>
</li>
+ <?php endif ?>
<li>
<?php if ($jenkins->isAvailable()): ?>
<?php echo link_to('Create a build branch', 'jenkins/createGroupRun', array('class' => 'add-run')); ?>
Please sign in to comment.
Something went wrong with that request. Please try again.