Changeset View
Changeset View
Standalone View
Standalone View
src/applications/herald/controller/HeraldWebhookViewController.php
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | return $this->newPage() | ||||
->appendChild($hook_view); | ->appendChild($hook_view); | ||||
} | } | ||||
private function buildHeaderView(HeraldWebhook $hook) { | private function buildHeaderView(HeraldWebhook $hook) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$title = $hook->getName(); | $title = $hook->getName(); | ||||
$status_icon = $hook->getStatusIcon(); | |||||
$status_color = $hook->getStatusColor(); | |||||
$status_name = $hook->getStatusDisplayName(); | |||||
$header = id(new PHUIHeaderView()) | $header = id(new PHUIHeaderView()) | ||||
->setHeader($title) | ->setHeader($title) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->setPolicyObject($hook) | ->setPolicyObject($hook) | ||||
->setStatus($status_icon, $status_color, $status_name) | |||||
->setHeaderIcon('fa-cloud-upload'); | ->setHeaderIcon('fa-cloud-upload'); | ||||
return $header; | return $header; | ||||
} | } | ||||
private function buildCurtain(HeraldWebhook $hook) { | private function buildCurtain(HeraldWebhook $hook) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$curtain = $this->newCurtainView($hook); | $curtain = $this->newCurtainView($hook); | ||||
$can_edit = PhabricatorPolicyFilter::hasCapability( | $can_edit = PhabricatorPolicyFilter::hasCapability( | ||||
$viewer, | $viewer, | ||||
$hook, | $hook, | ||||
PhabricatorPolicyCapability::CAN_EDIT); | PhabricatorPolicyCapability::CAN_EDIT); | ||||
$id = $hook->getID(); | $id = $hook->getID(); | ||||
$edit_uri = $this->getApplicationURI("webhook/edit/{$id}/"); | $edit_uri = $this->getApplicationURI("webhook/edit/{$id}/"); | ||||
$test_uri = $this->getApplicationURI("webhook/test/{$id}/"); | $test_uri = $this->getApplicationURI("webhook/test/{$id}/"); | ||||
$key_view_uri = $this->getApplicationURI("webhook/key/view/{$id}/"); | |||||
$key_cycle_uri = $this->getApplicationURI("webhook/key/cycle/{$id}/"); | |||||
$curtain->addAction( | $curtain->addAction( | ||||
id(new PhabricatorActionView()) | id(new PhabricatorActionView()) | ||||
->setName(pht('Edit Webhook')) | ->setName(pht('Edit Webhook')) | ||||
->setIcon('fa-pencil') | ->setIcon('fa-pencil') | ||||
->setDisabled(!$can_edit) | ->setDisabled(!$can_edit) | ||||
->setWorkflow(!$can_edit) | ->setWorkflow(!$can_edit) | ||||
->setHref($edit_uri)); | ->setHref($edit_uri)); | ||||
$curtain->addAction( | $curtain->addAction( | ||||
id(new PhabricatorActionView()) | id(new PhabricatorActionView()) | ||||
->setName(pht('New Test Request')) | ->setName(pht('New Test Request')) | ||||
->setIcon('fa-cloud-upload') | ->setIcon('fa-cloud-upload') | ||||
->setDisabled(!$can_edit) | ->setDisabled(!$can_edit) | ||||
->setWorkflow(true) | ->setWorkflow(true) | ||||
->setHref($test_uri)); | ->setHref($test_uri)); | ||||
$curtain->addAction( | |||||
id(new PhabricatorActionView()) | |||||
->setName(pht('View HMAC Key')) | |||||
->setIcon('fa-key') | |||||
->setDisabled(!$can_edit) | |||||
->setWorkflow(true) | |||||
->setHref($key_view_uri)); | |||||
$curtain->addAction( | |||||
id(new PhabricatorActionView()) | |||||
->setName(pht('Regenerate HMAC Key')) | |||||
->setIcon('fa-refresh') | |||||
->setDisabled(!$can_edit) | |||||
->setWorkflow(true) | |||||
->setHref($key_cycle_uri)); | |||||
return $curtain; | return $curtain; | ||||
} | } | ||||
private function buildPropertiesView(HeraldWebhook $hook) { | private function buildPropertiesView(HeraldWebhook $hook) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$properties = id(new PHUIPropertyListView()) | $properties = id(new PHUIPropertyListView()) | ||||
Show All 17 Lines |