mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 13:22:42 +01:00
Port "Staging Area" repository section to new management UI
Summary: Ref T10748. Brings this over and adds EditEngine support for it. Test Plan: Viewed and edited staging area information. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10748 Differential Revision: https://secure.phabricator.com/D15801
This commit is contained in:
parent
8e4a7742eb
commit
8606fb588f
3 changed files with 67 additions and 0 deletions
|
@ -779,6 +779,7 @@ phutil_register_library_map(array(
|
|||
'DiffusionRepositoryRef' => 'applications/diffusion/data/DiffusionRepositoryRef.php',
|
||||
'DiffusionRepositoryRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryRemarkupRule.php',
|
||||
'DiffusionRepositorySearchConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionRepositorySearchConduitAPIMethod.php',
|
||||
'DiffusionRepositoryStagingManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php',
|
||||
'DiffusionRepositoryStatusManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStatusManagementPanel.php',
|
||||
'DiffusionRepositoryStorageManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php',
|
||||
'DiffusionRepositorySymbolsController' => 'applications/diffusion/controller/DiffusionRepositorySymbolsController.php',
|
||||
|
@ -4991,6 +4992,7 @@ phutil_register_library_map(array(
|
|||
'DiffusionRepositoryRef' => 'Phobject',
|
||||
'DiffusionRepositoryRemarkupRule' => 'PhabricatorObjectRemarkupRule',
|
||||
'DiffusionRepositorySearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
|
||||
'DiffusionRepositoryStagingManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositoryStatusManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositoryStorageManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositorySymbolsController' => 'DiffusionRepositoryEditController',
|
||||
|
|
|
@ -152,6 +152,16 @@ final class DiffusionRepositoryEditEngine
|
|||
->setConduitDescription(pht('Set the default branch name.'))
|
||||
->setConduitTypeDescription(pht('New default branch name.'))
|
||||
->setValue($object->getDetail('default-branch')),
|
||||
id(new PhabricatorTextEditField())
|
||||
->setKey('stagingAreaURI')
|
||||
->setLabel(pht('Staging Area URI'))
|
||||
->setTransactionType(
|
||||
PhabricatorRepositoryTransaction::TYPE_STAGING_URI)
|
||||
->setIsCopyable(true)
|
||||
->setDescription(pht('Staging area URI.'))
|
||||
->setConduitDescription(pht('Set the staging area URI.'))
|
||||
->setConduitTypeDescription(pht('New staging area URI.'))
|
||||
->setValue($object->getStagingURI()),
|
||||
id(new PhabricatorPolicyEditField())
|
||||
->setKey('policy.push')
|
||||
->setLabel(pht('Push Policy'))
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
final class DiffusionRepositoryStagingManagementPanel
|
||||
extends DiffusionRepositoryManagementPanel {
|
||||
|
||||
const PANELKEY = 'staging';
|
||||
|
||||
public function getManagementPanelLabel() {
|
||||
return pht('Staging Area');
|
||||
}
|
||||
|
||||
public function getManagementPanelOrder() {
|
||||
return 700;
|
||||
}
|
||||
|
||||
protected function buildManagementPanelActions() {
|
||||
$repository = $this->getRepository();
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||
$viewer,
|
||||
$repository,
|
||||
PhabricatorPolicyCapability::CAN_EDIT);
|
||||
|
||||
$staging_uri = $repository->getPathURI('edit/staging/');
|
||||
|
||||
return array(
|
||||
id(new PhabricatorActionView())
|
||||
->setIcon('fa-pencil')
|
||||
->setName(pht('Edit Staging'))
|
||||
->setHref($staging_uri)
|
||||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(!$can_edit),
|
||||
);
|
||||
}
|
||||
|
||||
public function buildManagementPanelContent() {
|
||||
$repository = $this->getRepository();
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$view = id(new PHUIPropertyListView())
|
||||
->setViewer($viewer)
|
||||
->setActionList($this->newActions());
|
||||
|
||||
$staging_uri = $repository->getStagingURI();
|
||||
if (!$staging_uri) {
|
||||
$staging_uri = phutil_tag('em', array(), pht('No Staging Area'));
|
||||
}
|
||||
|
||||
$view->addProperty(pht('Staging Area URI'), $staging_uri);
|
||||
|
||||
return $this->newBox(pht('Staging Area'), $view);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue