Differential D19826 Diff 47381 src/applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php
<?php | <?php | ||||
final class DiffusionRepositoryStorageManagementPanel | final class DiffusionRepositoryStorageManagementPanel | ||||
extends DiffusionRepositoryManagementPanel { | extends DiffusionRepositoryManagementPanel { | ||||
const PANELKEY = 'storage'; | const PANELKEY = 'storage'; | ||||
public function getManagementPanelLabel() { | public function getManagementPanelLabel() { | ||||
return pht('Storage'); | return pht('Storage'); | ||||
} | } | ||||
public function getManagementPanelOrder() { | public function getManagementPanelOrder() { | ||||
return 600; | return 600; | ||||
} | } | ||||
public function getManagementPanelIcon() { | public function getManagementPanelIcon() { | ||||
$repository = $this->getRepository(); | |||||
if ($repository->getAlmanacServicePHID()) { | |||||
return 'fa-sitemap'; | |||||
} else if ($repository->isHosted()) { | |||||
return 'fa-database'; | return 'fa-database'; | ||||
} else { | |||||
return 'fa-download'; | |||||
} | |||||
} | |||||
public function buildManagementPanelCurtain() { | |||||
$repository = $this->getRepository(); | |||||
$viewer = $this->getViewer(); | |||||
$action_list = $this->newActionList(); | |||||
$doc_href = PhabricatorEnv::getDoclink('Cluster: Repositories'); | |||||
$action_list->addAction( | |||||
id(new PhabricatorActionView()) | |||||
->setIcon('fa-book') | |||||
->setHref($doc_href) | |||||
->setName(pht('Cluster Documentation'))); | |||||
return $this->newCurtainView() | |||||
->setActionList($action_list); | |||||
} | } | ||||
public function buildManagementPanelContent() { | public function buildManagementPanelContent() { | ||||
return array( | return array( | ||||
$this->buildStorageStatusPanel(), | $this->buildStorageStatusPanel(), | ||||
$this->buildClusterStatusPanel(), | $this->buildClusterStatusPanel(), | ||||
); | ); | ||||
} | } | ||||
Show All 16 Lines | if ($service_phid) { | ||||
$storage_service = $viewer->renderHandle($service_phid); | $storage_service = $viewer->renderHandle($service_phid); | ||||
} else { | } else { | ||||
$storage_service = phutil_tag('em', array(), pht('Local')); | $storage_service = phutil_tag('em', array(), pht('Local')); | ||||
} | } | ||||
$view->addProperty(pht('Storage Path'), $storage_path); | $view->addProperty(pht('Storage Path'), $storage_path); | ||||
$view->addProperty(pht('Storage Cluster'), $storage_service); | $view->addProperty(pht('Storage Cluster'), $storage_service); | ||||
$doc_href = PhabricatorEnv::getDoclink('Cluster: Repositories'); | return $this->newBox(pht('Storage'), $view); | ||||
$button = id(new PHUIButtonView()) | |||||
->setTag('a') | |||||
->setIcon('fa-book') | |||||
->setHref($doc_href) | |||||
->setText(pht('Help')); | |||||
return $this->newBox(pht('Storage'), $view, array($button)); | |||||
} | } | ||||
private function buildClusterStatusPanel() { | private function buildClusterStatusPanel() { | ||||
$repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$service_phid = $repository->getAlmanacServicePHID(); | $service_phid = $repository->getAlmanacServicePHID(); | ||||
if ($service_phid) { | if ($service_phid) { | ||||
▲ Show 20 Lines • Show All 182 Lines • Show Last 20 Lines |