mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Port "Automation" panel to new Repository Manage UI
Summary: Ref T10748. Ports this UI and exposes it on the EditEngine. Test Plan: - Edited via EditEngine. - Viewed new manage UI. Reviewers: chad Reviewed By: chad Subscribers: hach-que Maniphest Tasks: T10748 Differential Revision: https://secure.phabricator.com/D15804
This commit is contained in:
parent
58b55c2fa6
commit
57a76d8a70
3 changed files with 82 additions and 0 deletions
|
@ -743,6 +743,7 @@ phutil_register_library_map(array(
|
|||
'DiffusionRefTableController' => 'applications/diffusion/controller/DiffusionRefTableController.php',
|
||||
'DiffusionRefsQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php',
|
||||
'DiffusionRenameHistoryQuery' => 'applications/diffusion/query/DiffusionRenameHistoryQuery.php',
|
||||
'DiffusionRepositoryAutomationManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php',
|
||||
'DiffusionRepositoryBasicsManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php',
|
||||
'DiffusionRepositoryByIDRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryByIDRemarkupRule.php',
|
||||
'DiffusionRepositoryClusterEngine' => 'applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php',
|
||||
|
@ -4959,6 +4960,7 @@ phutil_register_library_map(array(
|
|||
'DiffusionRefTableController' => 'DiffusionController',
|
||||
'DiffusionRefsQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
|
||||
'DiffusionRenameHistoryQuery' => 'Phobject',
|
||||
'DiffusionRepositoryAutomationManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositoryBasicsManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositoryByIDRemarkupRule' => 'PhabricatorObjectRemarkupRule',
|
||||
'DiffusionRepositoryClusterEngine' => 'Phobject',
|
||||
|
|
|
@ -162,6 +162,17 @@ final class DiffusionRepositoryEditEngine
|
|||
->setConduitDescription(pht('Set the staging area URI.'))
|
||||
->setConduitTypeDescription(pht('New staging area URI.'))
|
||||
->setValue($object->getStagingURI()),
|
||||
id(new PhabricatorDatasourceEditField())
|
||||
->setKey('automationBlueprintPHIDs')
|
||||
->setLabel(pht('Use Blueprints'))
|
||||
->setTransactionType(
|
||||
PhabricatorRepositoryTransaction::TYPE_AUTOMATION_BLUEPRINTS)
|
||||
->setIsCopyable(true)
|
||||
->setDatasource(new DrydockBlueprintDatasource())
|
||||
->setDescription(pht('Automation blueprints.'))
|
||||
->setConduitDescription(pht('Change automation blueprints.'))
|
||||
->setConduitTypeDescription(pht('New blueprint PHIDs.'))
|
||||
->setValue($object->getAutomationBlueprintPHIDs()),
|
||||
id(new PhabricatorPolicyEditField())
|
||||
->setKey('policy.push')
|
||||
->setLabel(pht('Push Policy'))
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
final class DiffusionRepositoryAutomationManagementPanel
|
||||
extends DiffusionRepositoryManagementPanel {
|
||||
|
||||
const PANELKEY = 'automation';
|
||||
|
||||
public function getManagementPanelLabel() {
|
||||
return pht('Automation');
|
||||
}
|
||||
|
||||
public function getManagementPanelOrder() {
|
||||
return 800;
|
||||
}
|
||||
|
||||
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 = $repository->getPathURI('edit/automation/');
|
||||
$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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue