Skip to content

Commit

Permalink
Merge pull request jenkins-khan#69 from bobey/master
Browse files Browse the repository at this point in the history
Fatal error on index when having no jenkinsgrouprun at all
  • Loading branch information
srogier committed Apr 4, 2012
2 parents 262d45b + 9baf309 commit 15594b2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
42 changes: 24 additions & 18 deletions apps/front/modules/jenkins/actions/indexAction.class.php
Expand Up @@ -76,29 +76,35 @@ function execute($request)
} }


$currentGroupRun = JenkinsGroupRunPeer::retrieveByPK($currentGroupId); $currentGroupRun = JenkinsGroupRunPeer::retrieveByPK($currentGroupId);


$sortMenu = array( $sortMenu = $partial_url_for_sort_direction = $branch_view_url = null;
'label' => array( if (null !== $currentGroupRun)
'label' => 'Name', {
'url' => $this->generateUrl('branch_view', $currentGroupRun) . '/sort/label_' . $sortDirection, $sortMenu = array(
), 'label' => array(
'date' => array( 'label' => 'Name',
'label' => 'Creation date', 'url' => $this->generateUrl('branch_view', $currentGroupRun) . '/sort/label_' . $sortDirection,
'url' => $this->generateUrl('branch_view', $currentGroupRun) . '/sort/date_' . $sortDirection, ),
), 'date' => array(
'result' => array( 'label' => 'Creation date',
'label' => 'Status', 'url' => $this->generateUrl('branch_view', $currentGroupRun) . '/sort/date_' . $sortDirection,
'url' => $this->generateUrl('branch_view', $currentGroupRun) . '/sort/result_' . $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('group_runs', $dataGroupRuns);
$this->setVar('current_group_run_id', $currentGroupId); $this->setVar('current_group_run_id', $currentGroupId);
$this->setVar('sort_type', $sortType); $this->setVar('sort_type', $sortType);
$this->setVar('sort_direction', $sortDirection); $this->setVar('sort_direction', $sortDirection);
$this->setVar('sort_menu', $sortMenu); $this->setVar('sort_menu', $sortMenu);
$this->setVar('branch_view_url', $this->generateUrl('branch_view', $currentGroupRun)); $this->setVar('branch_view_url', $branch_view_url);
$this->setVar('partial_url_for_sort_direction', sprintf('%s/sort/%s_', $this->generateUrl('branch_view', $currentGroupRun), $sortType)); $this->setVar('partial_url_for_sort_direction', $partial_url_for_sort_direction);
} }


/** /**
Expand Down
2 changes: 2 additions & 0 deletions apps/front/modules/jenkins/templates/indexSuccess.php
Expand Up @@ -18,6 +18,7 @@
<?php endif; ?> <?php endif; ?>
<div class="sidebar"> <div class="sidebar">
<ul> <ul>
<?php if (null !== $sort_menu): ?>
<li class="sidebar-actions"> <li class="sidebar-actions">
<div class="btn-group"> <div class="btn-group">
<a class="btn dropdown-toggle btn-primary" data-toggle="dropdown" href="#"> <a class="btn dropdown-toggle btn-primary" data-toggle="dropdown" href="#">
Expand All @@ -36,6 +37,7 @@
</div> </div>
</div> </div>
</li> </li>
<?php endif ?>
<li> <li>
<?php if ($jenkins->isAvailable()): ?> <?php if ($jenkins->isAvailable()): ?>
<?php echo link_to('Create a build branch', 'jenkins/createGroupRun', array('class' => 'add-run')); ?> <?php echo link_to('Create a build branch', 'jenkins/createGroupRun', array('class' => 'add-run')); ?>
Expand Down

0 comments on commit 15594b2

Please sign in to comment.