Summary:
Ref T10748. This allows an EditEngine form to be broken up into pages.
This is less powerful than `PHUIPagedFormView`, because the pages are not sequential / stateful. Each form saves immediately once it's submitted, and can not take you to a new form or back/forward in a series of forms.
For example, you can't create a workflow where the user fills out 5 pages of information before we create an object, like the current repository workflow does.
However, the only place we've ever wanted to do this is repositories and it's fairly bad there, so I feel reasonably confident we aren't going to miss this in the future.
(We do "choose a type of service/repository/rule -> fill out one page of info" fairly often, but can do this without the full-power paging stuff.)
Test Plan:
- Created a repository usin the new Manage UI, filling out only a handful of fields.
- Edited a repository using the new Manage UI.
- All forms are now EditEngine forms offering paged views of the big huge underlying form:
{F1254371}
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T10748
Differential Revision: https://secure.phabricator.com/D15832
76 lines
2.0 KiB
PHP
76 lines
2.0 KiB
PHP
<?php
|
|
|
|
final class DiffusionRepositoryAutomationManagementPanel
|
|
extends DiffusionRepositoryManagementPanel {
|
|
|
|
const PANELKEY = 'automation';
|
|
|
|
public function getManagementPanelLabel() {
|
|
return pht('Automation');
|
|
}
|
|
|
|
public function getManagementPanelOrder() {
|
|
return 800;
|
|
}
|
|
|
|
protected function getEditEngineFieldKeys() {
|
|
return array(
|
|
'automationBlueprintPHIDs',
|
|
);
|
|
}
|
|
|
|
protected function buildManagementPanelActions() {
|
|
$repository = $this->getRepository();
|
|
$viewer = $this->getViewer();
|
|
|
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
|
$viewer,
|
|
$repository,
|
|
PhabricatorPolicyCapability::CAN_EDIT);
|
|
|
|
$can_test = $can_edit && $repository->canPerformAutomation();
|
|
|
|
$automation_uri = $this->getEditPageURI();
|
|
$test_uri = $repository->getPathURI('edit/testautomation/');
|
|
|
|
return array(
|
|
id(new PhabricatorActionView())
|
|
->setIcon('fa-pencil')
|
|
->setName(pht('Edit Automation'))
|
|
->setHref($automation_uri)
|
|
->setDisabled(!$can_edit)
|
|
->setWorkflow(!$can_edit),
|
|
id(new PhabricatorActionView())
|
|
->setIcon('fa-gamepad')
|
|
->setName(pht('Test Configuration'))
|
|
->setWorkflow(true)
|
|
->setDisabled(!$can_test)
|
|
->setHref($test_uri),
|
|
);
|
|
}
|
|
|
|
public function buildManagementPanelContent() {
|
|
$repository = $this->getRepository();
|
|
$viewer = $this->getViewer();
|
|
|
|
$view = id(new PHUIPropertyListView())
|
|
->setViewer($viewer)
|
|
->setActionList($this->newActions());
|
|
|
|
$blueprint_phids = $repository->getAutomationBlueprintPHIDs();
|
|
if (!$blueprint_phids) {
|
|
$blueprint_view = phutil_tag('em', array(), pht('Not Configured'));
|
|
} else {
|
|
$blueprint_view = id(new DrydockObjectAuthorizationView())
|
|
->setUser($viewer)
|
|
->setObjectPHID($repository->getPHID())
|
|
->setBlueprintPHIDs($blueprint_phids);
|
|
}
|
|
|
|
$view->addProperty(pht('Automation'), $blueprint_view);
|
|
|
|
return $this->newBox(pht('Automation'), $view);
|
|
}
|
|
|
|
}
|