2013-12-03 11:09:07 +11:00
|
|
|
<?php
|
|
|
|
|
2014-05-08 10:08:37 -07:00
|
|
|
final class DrydockBlueprintListController extends DrydockBlueprintController {
|
2013-12-03 11:09:07 +11:00
|
|
|
|
2013-12-26 12:30:04 -08:00
|
|
|
private $queryKey;
|
2013-12-03 11:09:07 +11:00
|
|
|
|
2013-12-26 12:30:04 -08:00
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
2013-12-03 11:09:07 +11:00
|
|
|
|
2013-12-26 12:30:04 -08:00
|
|
|
public function willProcessRequest(array $data) {
|
|
|
|
$this->queryKey = idx($data, 'queryKey');
|
|
|
|
}
|
2013-12-03 11:09:07 +11:00
|
|
|
|
2013-12-26 12:30:04 -08:00
|
|
|
public function processRequest() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$controller = id(new PhabricatorApplicationSearchController($request))
|
|
|
|
->setQueryKey($this->queryKey)
|
|
|
|
->setSearchEngine(new DrydockBlueprintSearchEngine())
|
2013-12-26 12:30:36 -08:00
|
|
|
->setNavigation($this->buildSideNavView());
|
2013-12-03 11:09:07 +11:00
|
|
|
|
2013-12-26 12:30:04 -08:00
|
|
|
return $this->delegateToController($controller);
|
2013-12-03 11:09:07 +11:00
|
|
|
}
|
|
|
|
|
2013-12-27 13:15:12 -08:00
|
|
|
public function buildApplicationCrumbs() {
|
2014-01-09 12:19:45 -08:00
|
|
|
$can_create = $this->hasApplicationCapability(
|
2014-07-25 08:20:39 +10:00
|
|
|
DrydockCreateBlueprintsCapability::CAPABILITY);
|
2014-01-09 12:19:45 -08:00
|
|
|
|
2013-12-27 13:15:12 -08:00
|
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
$crumbs->addAction(
|
|
|
|
id(new PHUIListItemView())
|
|
|
|
->setName(pht('New Blueprint'))
|
|
|
|
->setHref($this->getApplicationURI('/blueprint/create/'))
|
2014-01-09 12:19:45 -08:00
|
|
|
->setDisabled(!$can_create)
|
|
|
|
->setWorkflow(!$can_create)
|
2014-05-12 10:08:32 -07:00
|
|
|
->setIcon('fa-plus-square'));
|
2013-12-27 13:15:12 -08:00
|
|
|
return $crumbs;
|
|
|
|
}
|
|
|
|
|
2013-12-03 11:09:07 +11:00
|
|
|
}
|