mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-02 09:58:24 +01:00
Index "Call Webhook" in Herald, and show calling rules on the Webhook page
Summary: Depends on D20259. Now that we can index Herald rules to affected objects, show callers on the "Webhooks" UI. A few other rule types could get indexes too ("Sign Legalpad Documents", "Add Reviewers", "Add Subscribers"), but I think they're less likely to be useful since those triggers are usually more obvious (the transaction timeline makes it clearer what happened/why). We could revisit this in the future now that it's a possibility. Test Plan: {F6260106} Reviewers: amckinley Reviewed By: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Differential Revision: https://secure.phabricator.com/D20260
This commit is contained in:
parent
9913754a2a
commit
1d4f6bd444
3 changed files with 46 additions and 0 deletions
|
@ -496,6 +496,7 @@ final class HarbormasterPlanViewController extends HarbormasterPlanController {
|
|||
->withDisabled(false)
|
||||
->withAffectedObjectPHIDs(array($plan->getPHID()))
|
||||
->needValidateAuthors(true)
|
||||
->setLimit(10)
|
||||
->execute();
|
||||
|
||||
$list = id(new HeraldRuleListView())
|
||||
|
|
|
@ -63,4 +63,8 @@ final class HeraldCallWebhookAction extends HeraldAction {
|
|||
return new HeraldWebhookDatasource();
|
||||
}
|
||||
|
||||
public function getPHIDsAffectedByAction(HeraldActionRecord $record) {
|
||||
return $record->getTarget();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,12 +73,15 @@ final class HeraldWebhookViewController
|
|||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->setTable($requests_table);
|
||||
|
||||
$rules_view = $this->newRulesView($hook);
|
||||
|
||||
$hook_view = id(new PHUITwoColumnView())
|
||||
->setHeader($header)
|
||||
->setMainColumn(
|
||||
array(
|
||||
$warnings,
|
||||
$properties_view,
|
||||
$rules_view,
|
||||
$requests_view,
|
||||
$timeline,
|
||||
))
|
||||
|
@ -194,4 +197,42 @@ final class HeraldWebhookViewController
|
|||
->appendChild($properties);
|
||||
}
|
||||
|
||||
private function newRulesView(HeraldWebhook $hook) {
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$rules = id(new HeraldRuleQuery())
|
||||
->setViewer($viewer)
|
||||
->withDisabled(false)
|
||||
->withAffectedObjectPHIDs(array($hook->getPHID()))
|
||||
->needValidateAuthors(true)
|
||||
->setLimit(10)
|
||||
->execute();
|
||||
|
||||
$list = id(new HeraldRuleListView())
|
||||
->setViewer($viewer)
|
||||
->setRules($rules)
|
||||
->newObjectList();
|
||||
|
||||
$list->setNoDataString(pht('No active Herald rules call this webhook.'));
|
||||
|
||||
$more_href = new PhutilURI(
|
||||
'/herald/',
|
||||
array('affectedPHID' => $hook->getPHID()));
|
||||
|
||||
$more_link = id(new PHUIButtonView())
|
||||
->setTag('a')
|
||||
->setIcon('fa-list-ul')
|
||||
->setText(pht('View All Rules'))
|
||||
->setHref($more_href);
|
||||
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader(pht('Called By Herald Rules'))
|
||||
->addActionLink($more_link);
|
||||
|
||||
return id(new PHUIObjectBoxView())
|
||||
->setHeader($header)
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->appendChild($list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue