mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-20 13:52:40 +01:00
Move "Delete Repository" stuff to Diffusion
Summary: Ref T2231. This just moves the "Delete" dialog from Repositories to Diffusion. This dialog just shows instructions and isn't interesting. Test Plan: {F75093} Reviewers: btrahan, chad Reviewed By: chad CC: aran Maniphest Tasks: T2231 Differential Revision: https://secure.phabricator.com/D7412
This commit is contained in:
parent
7c23960de8
commit
d1ed816e61
5 changed files with 34 additions and 35 deletions
|
@ -509,6 +509,7 @@ phutil_register_library_map(array(
|
|||
'DiffusionRepositoryEditBasicController' => 'applications/diffusion/controller/DiffusionRepositoryEditBasicController.php',
|
||||
'DiffusionRepositoryEditBranchesController' => 'applications/diffusion/controller/DiffusionRepositoryEditBranchesController.php',
|
||||
'DiffusionRepositoryEditController' => 'applications/diffusion/controller/DiffusionRepositoryEditController.php',
|
||||
'DiffusionRepositoryEditDeleteController' => 'applications/diffusion/controller/DiffusionRepositoryEditDeleteControler.php',
|
||||
'DiffusionRepositoryEditEncodingController' => 'applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php',
|
||||
'DiffusionRepositoryEditLocalController' => 'applications/diffusion/controller/DiffusionRepositoryEditLocalController.php',
|
||||
'DiffusionRepositoryEditMainController' => 'applications/diffusion/controller/DiffusionRepositoryEditMainController.php',
|
||||
|
@ -1629,9 +1630,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorRepositoryController' => 'applications/repository/controller/PhabricatorRepositoryController.php',
|
||||
'PhabricatorRepositoryCreateController' => 'applications/repository/controller/PhabricatorRepositoryCreateController.php',
|
||||
'PhabricatorRepositoryDAO' => 'applications/repository/storage/PhabricatorRepositoryDAO.php',
|
||||
'PhabricatorRepositoryDeleteController' => 'applications/repository/controller/PhabricatorRepositoryDeleteController.php',
|
||||
'PhabricatorRepositoryDiscoveryEngine' => 'applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php',
|
||||
'PhabricatorRepositoryEditController' => 'applications/repository/controller/PhabricatorRepositoryEditController.php',
|
||||
'PhabricatorRepositoryEditor' => 'applications/repository/editor/PhabricatorRepositoryEditor.php',
|
||||
'PhabricatorRepositoryEngine' => 'applications/repository/engine/PhabricatorRepositoryEngine.php',
|
||||
'PhabricatorRepositoryGitCommitChangeParserWorker' => 'applications/repository/worker/commitchangeparser/PhabricatorRepositoryGitCommitChangeParserWorker.php',
|
||||
|
@ -2686,6 +2685,7 @@ phutil_register_library_map(array(
|
|||
'DiffusionRepositoryEditBasicController' => 'DiffusionRepositoryEditController',
|
||||
'DiffusionRepositoryEditBranchesController' => 'DiffusionRepositoryEditController',
|
||||
'DiffusionRepositoryEditController' => 'DiffusionController',
|
||||
'DiffusionRepositoryEditDeleteController' => 'DiffusionRepositoryEditController',
|
||||
'DiffusionRepositoryEditEncodingController' => 'DiffusionRepositoryEditController',
|
||||
'DiffusionRepositoryEditLocalController' => 'DiffusionRepositoryEditController',
|
||||
'DiffusionRepositoryEditMainController' => 'DiffusionRepositoryEditController',
|
||||
|
@ -3956,9 +3956,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorRepositoryController' => 'PhabricatorController',
|
||||
'PhabricatorRepositoryCreateController' => 'PhabricatorRepositoryController',
|
||||
'PhabricatorRepositoryDAO' => 'PhabricatorLiskDAO',
|
||||
'PhabricatorRepositoryDeleteController' => 'PhabricatorRepositoryController',
|
||||
'PhabricatorRepositoryDiscoveryEngine' => 'PhabricatorRepositoryEngine',
|
||||
'PhabricatorRepositoryEditController' => 'PhabricatorRepositoryController',
|
||||
'PhabricatorRepositoryEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||
'PhabricatorRepositoryGitCommitChangeParserWorker' => 'PhabricatorRepositoryCommitChangeParserWorker',
|
||||
'PhabricatorRepositoryGitCommitMessageParserWorker' => 'PhabricatorRepositoryCommitMessageParserWorker',
|
||||
|
|
|
@ -74,6 +74,7 @@ final class PhabricatorApplicationDiffusion extends PhabricatorApplication {
|
|||
'actions/' => 'DiffusionRepositoryEditActionsController',
|
||||
'(?P<edit>remote)/' => 'DiffusionRepositoryCreateController',
|
||||
'local/' => 'DiffusionRepositoryEditLocalController',
|
||||
'delete/' => 'DiffusionRepositoryEditDeleteController',
|
||||
),
|
||||
),
|
||||
'inline/' => array(
|
||||
|
|
|
@ -1,34 +1,36 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorRepositoryDeleteController
|
||||
extends PhabricatorRepositoryController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $data['id'];
|
||||
}
|
||||
final class DiffusionRepositoryEditDeleteController
|
||||
extends DiffusionRepositoryEditController {
|
||||
|
||||
public function processRequest() {
|
||||
$viewer = $this->getRequest()->getUser();
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
$drequest = $this->diffusionRequest;
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$repository = id(new PhabricatorRepositoryQuery())
|
||||
->setViewer($viewer)
|
||||
->withIDs(array($this->id))
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
PhabricatorPolicyCapability::CAN_EDIT,
|
||||
))
|
||||
->withIDs(array($repository->getID()))
|
||||
->executeOne();
|
||||
if (!$repository) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
if ($request->isDialogFormPost()) {
|
||||
return id(new AphrontRedirectResponse())->setURI('/repository/');
|
||||
}
|
||||
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
|
||||
|
||||
$dialog = new AphrontDialogView();
|
||||
$text_1 = pht('If you really want to delete the repository, you must run:');
|
||||
$command = 'bin/repository delete '.$repository->getCallsign();
|
||||
$text_1 = pht(
|
||||
'If you really want to delete the repository, run this command from '.
|
||||
'the command line:');
|
||||
$command = csprintf(
|
||||
'phabricator/ $ ./bin/repository delete %s',
|
||||
$repository->getCallsign());
|
||||
$text_2 = pht('Repositories touch many objects and as such deletes are '.
|
||||
'prohibitively expensive to run from the web UI.');
|
||||
$body = phutil_tag(
|
||||
|
@ -43,13 +45,14 @@ final class PhabricatorRepositoryDeleteController
|
|||
phutil_tag('p', array(), $text_2),
|
||||
));
|
||||
|
||||
$dialog
|
||||
$dialog = id(new AphrontDialogView())
|
||||
->setUser($request->getUser())
|
||||
->setTitle(pht('Really want to delete the repository?'))
|
||||
->appendChild($body)
|
||||
->setSubmitURI('/repository/delete/'.$this->id.'/')
|
||||
->addSubmitButton(pht('Okay'));
|
||||
->addCancelButton($edit_uri, pht('Okay'));
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -174,6 +174,14 @@ final class DiffusionRepositoryEditMainController
|
|||
|
||||
$view->addAction($activate);
|
||||
|
||||
$view->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setName(pht('Delete Repository'))
|
||||
->setIcon('delete')
|
||||
->setHref(
|
||||
$this->getRepositoryControllerURI($repository, 'edit/delete/'))
|
||||
->setWorkflow(true));
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,14 +41,6 @@ final class PhabricatorRepositoryListController
|
|||
'href' => '/repository/edit/'.$repo->getID().'/',
|
||||
),
|
||||
'Edit'),
|
||||
javelin_tag(
|
||||
'a',
|
||||
array(
|
||||
'class' => 'button small grey',
|
||||
'href' => '/repository/delete/'.$repo->getID().'/',
|
||||
'sigil' => 'workflow',
|
||||
),
|
||||
'Delete'),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -60,7 +52,6 @@ final class PhabricatorRepositoryListController
|
|||
'Type',
|
||||
'Diffusion',
|
||||
'',
|
||||
''
|
||||
));
|
||||
$table->setColumnClasses(
|
||||
array(
|
||||
|
@ -69,7 +60,6 @@ final class PhabricatorRepositoryListController
|
|||
null,
|
||||
null,
|
||||
'action',
|
||||
'action',
|
||||
));
|
||||
|
||||
$table->setColumnVisibility(
|
||||
|
@ -79,7 +69,6 @@ final class PhabricatorRepositoryListController
|
|||
true,
|
||||
true,
|
||||
$is_admin,
|
||||
$is_admin,
|
||||
));
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
|
|
Loading…
Reference in a new issue