mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 19:32:40 +01:00
247cb94d5a
Summary: Ref T5833. The "uninteresting" part of this object is virtually identical to AlmanacService. Test Plan: See screenshots. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5833 Differential Revision: https://secure.phabricator.com/D10714
52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php
|
|
|
|
final class AlmanacDeviceListController
|
|
extends AlmanacDeviceController {
|
|
|
|
public function shouldAllowPublic() {
|
|
return true;
|
|
}
|
|
|
|
public function handleRequest(AphrontRequest $request) {
|
|
$controller = id(new PhabricatorApplicationSearchController())
|
|
->setQueryKey($request->getURIData('queryKey'))
|
|
->setSearchEngine(new AlmanacDeviceSearchEngine())
|
|
->setNavigation($this->buildSideNavView());
|
|
|
|
return $this->delegateToController($controller);
|
|
}
|
|
|
|
public function buildApplicationCrumbs() {
|
|
$crumbs = parent::buildApplicationCrumbs();
|
|
|
|
$can_create = $this->hasApplicationCapability(
|
|
AlmanacCreateDevicesCapability::CAPABILITY);
|
|
|
|
$crumbs->addAction(
|
|
id(new PHUIListItemView())
|
|
->setName(pht('Create Device'))
|
|
->setHref($this->getApplicationURI('device/edit/'))
|
|
->setIcon('fa-plus-square')
|
|
->setDisabled(!$can_create)
|
|
->setWorkflow(!$can_create));
|
|
|
|
return $crumbs;
|
|
}
|
|
|
|
public function buildSideNavView() {
|
|
$viewer = $this->getViewer();
|
|
|
|
$nav = new AphrontSideNavFilterView();
|
|
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
|
|
|
id(new AlmanacDeviceSearchEngine())
|
|
->setViewer($viewer)
|
|
->addNavigationItems($nav->getMenu());
|
|
|
|
$nav->selectFilter(null);
|
|
|
|
return $nav;
|
|
}
|
|
|
|
|
|
}
|