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',
|
'DiffusionRepositoryEditBasicController' => 'applications/diffusion/controller/DiffusionRepositoryEditBasicController.php',
|
||||||
'DiffusionRepositoryEditBranchesController' => 'applications/diffusion/controller/DiffusionRepositoryEditBranchesController.php',
|
'DiffusionRepositoryEditBranchesController' => 'applications/diffusion/controller/DiffusionRepositoryEditBranchesController.php',
|
||||||
'DiffusionRepositoryEditController' => 'applications/diffusion/controller/DiffusionRepositoryEditController.php',
|
'DiffusionRepositoryEditController' => 'applications/diffusion/controller/DiffusionRepositoryEditController.php',
|
||||||
|
'DiffusionRepositoryEditDeleteController' => 'applications/diffusion/controller/DiffusionRepositoryEditDeleteControler.php',
|
||||||
'DiffusionRepositoryEditEncodingController' => 'applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php',
|
'DiffusionRepositoryEditEncodingController' => 'applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php',
|
||||||
'DiffusionRepositoryEditLocalController' => 'applications/diffusion/controller/DiffusionRepositoryEditLocalController.php',
|
'DiffusionRepositoryEditLocalController' => 'applications/diffusion/controller/DiffusionRepositoryEditLocalController.php',
|
||||||
'DiffusionRepositoryEditMainController' => 'applications/diffusion/controller/DiffusionRepositoryEditMainController.php',
|
'DiffusionRepositoryEditMainController' => 'applications/diffusion/controller/DiffusionRepositoryEditMainController.php',
|
||||||
|
@ -1629,9 +1630,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorRepositoryController' => 'applications/repository/controller/PhabricatorRepositoryController.php',
|
'PhabricatorRepositoryController' => 'applications/repository/controller/PhabricatorRepositoryController.php',
|
||||||
'PhabricatorRepositoryCreateController' => 'applications/repository/controller/PhabricatorRepositoryCreateController.php',
|
'PhabricatorRepositoryCreateController' => 'applications/repository/controller/PhabricatorRepositoryCreateController.php',
|
||||||
'PhabricatorRepositoryDAO' => 'applications/repository/storage/PhabricatorRepositoryDAO.php',
|
'PhabricatorRepositoryDAO' => 'applications/repository/storage/PhabricatorRepositoryDAO.php',
|
||||||
'PhabricatorRepositoryDeleteController' => 'applications/repository/controller/PhabricatorRepositoryDeleteController.php',
|
|
||||||
'PhabricatorRepositoryDiscoveryEngine' => 'applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php',
|
'PhabricatorRepositoryDiscoveryEngine' => 'applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php',
|
||||||
'PhabricatorRepositoryEditController' => 'applications/repository/controller/PhabricatorRepositoryEditController.php',
|
|
||||||
'PhabricatorRepositoryEditor' => 'applications/repository/editor/PhabricatorRepositoryEditor.php',
|
'PhabricatorRepositoryEditor' => 'applications/repository/editor/PhabricatorRepositoryEditor.php',
|
||||||
'PhabricatorRepositoryEngine' => 'applications/repository/engine/PhabricatorRepositoryEngine.php',
|
'PhabricatorRepositoryEngine' => 'applications/repository/engine/PhabricatorRepositoryEngine.php',
|
||||||
'PhabricatorRepositoryGitCommitChangeParserWorker' => 'applications/repository/worker/commitchangeparser/PhabricatorRepositoryGitCommitChangeParserWorker.php',
|
'PhabricatorRepositoryGitCommitChangeParserWorker' => 'applications/repository/worker/commitchangeparser/PhabricatorRepositoryGitCommitChangeParserWorker.php',
|
||||||
|
@ -2686,6 +2685,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionRepositoryEditBasicController' => 'DiffusionRepositoryEditController',
|
'DiffusionRepositoryEditBasicController' => 'DiffusionRepositoryEditController',
|
||||||
'DiffusionRepositoryEditBranchesController' => 'DiffusionRepositoryEditController',
|
'DiffusionRepositoryEditBranchesController' => 'DiffusionRepositoryEditController',
|
||||||
'DiffusionRepositoryEditController' => 'DiffusionController',
|
'DiffusionRepositoryEditController' => 'DiffusionController',
|
||||||
|
'DiffusionRepositoryEditDeleteController' => 'DiffusionRepositoryEditController',
|
||||||
'DiffusionRepositoryEditEncodingController' => 'DiffusionRepositoryEditController',
|
'DiffusionRepositoryEditEncodingController' => 'DiffusionRepositoryEditController',
|
||||||
'DiffusionRepositoryEditLocalController' => 'DiffusionRepositoryEditController',
|
'DiffusionRepositoryEditLocalController' => 'DiffusionRepositoryEditController',
|
||||||
'DiffusionRepositoryEditMainController' => 'DiffusionRepositoryEditController',
|
'DiffusionRepositoryEditMainController' => 'DiffusionRepositoryEditController',
|
||||||
|
@ -3956,9 +3956,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorRepositoryController' => 'PhabricatorController',
|
'PhabricatorRepositoryController' => 'PhabricatorController',
|
||||||
'PhabricatorRepositoryCreateController' => 'PhabricatorRepositoryController',
|
'PhabricatorRepositoryCreateController' => 'PhabricatorRepositoryController',
|
||||||
'PhabricatorRepositoryDAO' => 'PhabricatorLiskDAO',
|
'PhabricatorRepositoryDAO' => 'PhabricatorLiskDAO',
|
||||||
'PhabricatorRepositoryDeleteController' => 'PhabricatorRepositoryController',
|
|
||||||
'PhabricatorRepositoryDiscoveryEngine' => 'PhabricatorRepositoryEngine',
|
'PhabricatorRepositoryDiscoveryEngine' => 'PhabricatorRepositoryEngine',
|
||||||
'PhabricatorRepositoryEditController' => 'PhabricatorRepositoryController',
|
|
||||||
'PhabricatorRepositoryEditor' => 'PhabricatorApplicationTransactionEditor',
|
'PhabricatorRepositoryEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||||
'PhabricatorRepositoryGitCommitChangeParserWorker' => 'PhabricatorRepositoryCommitChangeParserWorker',
|
'PhabricatorRepositoryGitCommitChangeParserWorker' => 'PhabricatorRepositoryCommitChangeParserWorker',
|
||||||
'PhabricatorRepositoryGitCommitMessageParserWorker' => 'PhabricatorRepositoryCommitMessageParserWorker',
|
'PhabricatorRepositoryGitCommitMessageParserWorker' => 'PhabricatorRepositoryCommitMessageParserWorker',
|
||||||
|
|
|
@ -74,6 +74,7 @@ final class PhabricatorApplicationDiffusion extends PhabricatorApplication {
|
||||||
'actions/' => 'DiffusionRepositoryEditActionsController',
|
'actions/' => 'DiffusionRepositoryEditActionsController',
|
||||||
'(?P<edit>remote)/' => 'DiffusionRepositoryCreateController',
|
'(?P<edit>remote)/' => 'DiffusionRepositoryCreateController',
|
||||||
'local/' => 'DiffusionRepositoryEditLocalController',
|
'local/' => 'DiffusionRepositoryEditLocalController',
|
||||||
|
'delete/' => 'DiffusionRepositoryEditDeleteController',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'inline/' => array(
|
'inline/' => array(
|
||||||
|
|
|
@ -1,34 +1,36 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhabricatorRepositoryDeleteController
|
final class DiffusionRepositoryEditDeleteController
|
||||||
extends PhabricatorRepositoryController {
|
extends DiffusionRepositoryEditController {
|
||||||
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
$viewer = $this->getRequest()->getUser();
|
$request = $this->getRequest();
|
||||||
|
$viewer = $request->getUser();
|
||||||
|
$drequest = $this->diffusionRequest;
|
||||||
|
$repository = $drequest->getRepository();
|
||||||
|
|
||||||
$repository = id(new PhabricatorRepositoryQuery())
|
$repository = id(new PhabricatorRepositoryQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->requireCapabilities(
|
||||||
|
array(
|
||||||
|
PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
|
PhabricatorPolicyCapability::CAN_EDIT,
|
||||||
|
))
|
||||||
|
->withIDs(array($repository->getID()))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$repository) {
|
if (!$repository) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
|
||||||
|
|
||||||
if ($request->isDialogFormPost()) {
|
|
||||||
return id(new AphrontRedirectResponse())->setURI('/repository/');
|
|
||||||
}
|
|
||||||
|
|
||||||
$dialog = new AphrontDialogView();
|
$dialog = new AphrontDialogView();
|
||||||
$text_1 = pht('If you really want to delete the repository, you must run:');
|
$text_1 = pht(
|
||||||
$command = 'bin/repository delete '.$repository->getCallsign();
|
'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 '.
|
$text_2 = pht('Repositories touch many objects and as such deletes are '.
|
||||||
'prohibitively expensive to run from the web UI.');
|
'prohibitively expensive to run from the web UI.');
|
||||||
$body = phutil_tag(
|
$body = phutil_tag(
|
||||||
|
@ -43,13 +45,14 @@ final class PhabricatorRepositoryDeleteController
|
||||||
phutil_tag('p', array(), $text_2),
|
phutil_tag('p', array(), $text_2),
|
||||||
));
|
));
|
||||||
|
|
||||||
$dialog
|
$dialog = id(new AphrontDialogView())
|
||||||
->setUser($request->getUser())
|
->setUser($request->getUser())
|
||||||
->setTitle(pht('Really want to delete the repository?'))
|
->setTitle(pht('Really want to delete the repository?'))
|
||||||
->appendChild($body)
|
->appendChild($body)
|
||||||
->setSubmitURI('/repository/delete/'.$this->id.'/')
|
->addCancelButton($edit_uri, pht('Okay'));
|
||||||
->addSubmitButton(pht('Okay'));
|
|
||||||
|
|
||||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
return id(new AphrontDialogResponse())->setDialog($dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -174,6 +174,14 @@ final class DiffusionRepositoryEditMainController
|
||||||
|
|
||||||
$view->addAction($activate);
|
$view->addAction($activate);
|
||||||
|
|
||||||
|
$view->addAction(
|
||||||
|
id(new PhabricatorActionView())
|
||||||
|
->setName(pht('Delete Repository'))
|
||||||
|
->setIcon('delete')
|
||||||
|
->setHref(
|
||||||
|
$this->getRepositoryControllerURI($repository, 'edit/delete/'))
|
||||||
|
->setWorkflow(true));
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,14 +41,6 @@ final class PhabricatorRepositoryListController
|
||||||
'href' => '/repository/edit/'.$repo->getID().'/',
|
'href' => '/repository/edit/'.$repo->getID().'/',
|
||||||
),
|
),
|
||||||
'Edit'),
|
'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',
|
'Type',
|
||||||
'Diffusion',
|
'Diffusion',
|
||||||
'',
|
'',
|
||||||
''
|
|
||||||
));
|
));
|
||||||
$table->setColumnClasses(
|
$table->setColumnClasses(
|
||||||
array(
|
array(
|
||||||
|
@ -69,7 +60,6 @@ final class PhabricatorRepositoryListController
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
'action',
|
'action',
|
||||||
'action',
|
|
||||||
));
|
));
|
||||||
|
|
||||||
$table->setColumnVisibility(
|
$table->setColumnVisibility(
|
||||||
|
@ -79,7 +69,6 @@ final class PhabricatorRepositoryListController
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
$is_admin,
|
$is_admin,
|
||||||
$is_admin,
|
|
||||||
));
|
));
|
||||||
|
|
||||||
$panel = new AphrontPanelView();
|
$panel = new AphrontPanelView();
|
||||||
|
|
Loading…
Reference in a new issue