mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 15:22:41 +01:00
Update redirect/cancel URIs for repository dialogs
Summary: Ref T10923. Some of the dialogs ("Deactivate Repository", "Test Automation", etc.) had cancel or redirect URIs which I missed originally. Go through them and make sure they all point to the right places. Also removed one unused controller which I missed the first time around. Test Plan: - Opened all these dialogs in a new tab with Command-Click. - Clicked every "cancel" and "submit" button on all of these dialogs. - Got consistently sent to the place I came from. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10923 Differential Revision: https://secure.phabricator.com/D15867
This commit is contained in:
parent
846eec7563
commit
8512f9358e
7 changed files with 55 additions and 167 deletions
|
@ -774,7 +774,6 @@ phutil_register_library_map(array(
|
|||
'DiffusionRepositoryStagingManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php',
|
||||
'DiffusionRepositoryStatusManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStatusManagementPanel.php',
|
||||
'DiffusionRepositoryStorageManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php',
|
||||
'DiffusionRepositorySymbolsController' => 'applications/diffusion/controller/DiffusionRepositorySymbolsController.php',
|
||||
'DiffusionRepositorySymbolsManagementPanel' => 'applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php',
|
||||
'DiffusionRepositoryTag' => 'applications/diffusion/data/DiffusionRepositoryTag.php',
|
||||
'DiffusionRepositoryTestAutomationController' => 'applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php',
|
||||
|
@ -4994,7 +4993,6 @@ phutil_register_library_map(array(
|
|||
'DiffusionRepositoryStagingManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositoryStatusManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositoryStorageManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositorySymbolsController' => 'DiffusionRepositoryEditController',
|
||||
'DiffusionRepositorySymbolsManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositoryTag' => 'Phobject',
|
||||
'DiffusionRepositoryTestAutomationController' => 'DiffusionRepositoryEditController',
|
||||
|
|
|
@ -13,7 +13,9 @@ final class DiffusionRepositoryEditActivateController
|
|||
$drequest = $this->getDiffusionRequest();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
|
||||
$panel_uri = id(new DiffusionRepositoryBasicsManagementPanel())
|
||||
->setRepository($repository)
|
||||
->getPanelURI();
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
if (!$repository->isTracked()) {
|
||||
|
@ -33,24 +35,24 @@ final class DiffusionRepositoryEditActivateController
|
|||
->setActor($viewer)
|
||||
->applyTransactions($repository, array($xaction));
|
||||
|
||||
return id(new AphrontReloadResponse())->setURI($edit_uri);
|
||||
return id(new AphrontReloadResponse())->setURI($panel_uri);
|
||||
}
|
||||
|
||||
if ($repository->isTracked()) {
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('Deactivate Repository?'))
|
||||
->appendChild(
|
||||
pht('Deactivate this repository?'))
|
||||
->addSubmitButton(pht('Deactivate Repository'))
|
||||
->addCancelButton($edit_uri);
|
||||
$title = pht('Deactivate Repository');
|
||||
$body = pht('Deactivate this repository?');
|
||||
$submit = pht('Deactivate Repository');
|
||||
} else {
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('Activate Repository?'))
|
||||
->appendChild(
|
||||
pht('Activate this repository?'))
|
||||
->addSubmitButton(pht('Activate Repository'))
|
||||
->addCancelButton($edit_uri);
|
||||
$title = pht('Activate Repository');
|
||||
$body = pht('Activate this repository?');
|
||||
$submit = pht('Activate Repository');
|
||||
}
|
||||
|
||||
return $this->newDialog()
|
||||
->setTitle($title)
|
||||
->appendChild($body)
|
||||
->addSubmitButton($submit)
|
||||
->addCancelButton($panel_uri);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,9 @@ final class DiffusionRepositoryEditDangerousController
|
|||
$drequest = $this->getDiffusionRequest();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
|
||||
$panel_uri = id(new DiffusionRepositoryBasicsManagementPanel())
|
||||
->setRepository($repository)
|
||||
->getPanelURI();
|
||||
|
||||
if (!$repository->canAllowDangerousChanges()) {
|
||||
if ($repository->isSVN()) {
|
||||
|
@ -24,7 +26,7 @@ final class DiffusionRepositoryEditDangerousController
|
|||
'It is not possible for users to push any dangerous changes '.
|
||||
'to a Subversion repository. Pushes to a Subversion repository '.
|
||||
'can always be reverted and never destroy data.'))
|
||||
->addCancelButton($edit_uri);
|
||||
->addCancelButton($panel_uri);
|
||||
} else {
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('Unprotectable Repository'))
|
||||
|
@ -33,7 +35,7 @@ final class DiffusionRepositoryEditDangerousController
|
|||
'This repository can not be protected from dangerous changes '.
|
||||
'because Phabricator does not control what users are allowed '.
|
||||
'to push to it.'))
|
||||
->addCancelButton($edit_uri);
|
||||
->addCancelButton($panel_uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,33 +50,33 @@ final class DiffusionRepositoryEditDangerousController
|
|||
->setActor($viewer)
|
||||
->applyTransactions($repository, array($xaction));
|
||||
|
||||
return id(new AphrontReloadResponse())->setURI($edit_uri);
|
||||
return id(new AphrontReloadResponse())->setURI($panel_uri);
|
||||
}
|
||||
|
||||
$force = phutil_tag('tt', array(), '--force');
|
||||
|
||||
if ($repository->shouldAllowDangerousChanges()) {
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('Prevent Dangerous changes?'))
|
||||
->appendChild(
|
||||
pht(
|
||||
'It will no longer be possible to delete branches from this '.
|
||||
'repository, or %s push to this repository.',
|
||||
$force))
|
||||
->addSubmitButton(pht('Prevent Dangerous Changes'))
|
||||
->addCancelButton($edit_uri);
|
||||
$title = pht('Prevent Dangerous Changes');
|
||||
$body = pht(
|
||||
'It will no longer be possible to delete branches from this '.
|
||||
'repository, or %s push to this repository.',
|
||||
$force);
|
||||
$submit = pht('Prevent Dangerous Changes');
|
||||
} else {
|
||||
return $this->newDialog()
|
||||
->setTitle(pht('Allow Dangerous Changes?'))
|
||||
->appendChild(
|
||||
pht(
|
||||
'If you allow dangerous changes, it will be possible to delete '.
|
||||
'branches and %s push this repository. These operations can '.
|
||||
'alter a repository in a way that is difficult to recover from.',
|
||||
$force))
|
||||
->addSubmitButton(pht('Allow Dangerous Changes'))
|
||||
->addCancelButton($edit_uri);
|
||||
$title = pht('Allow Dangerous Changes');
|
||||
$body = pht(
|
||||
'If you allow dangerous changes, it will be possible to delete '.
|
||||
'branches and %s push this repository. These operations can '.
|
||||
'alter a repository in a way that is difficult to recover from.',
|
||||
$force);
|
||||
$submit = pht('Allow Dangerous Changes');
|
||||
}
|
||||
|
||||
return $this->newDialog()
|
||||
->setTitle($title)
|
||||
->appendParagraph($body)
|
||||
->addSubmitButton($submit)
|
||||
->addCancelButton($panel_uri);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,9 @@ final class DiffusionRepositoryEditDeleteController
|
|||
$drequest = $this->getDiffusionRequest();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
|
||||
$panel_uri = id(new DiffusionRepositoryBasicsManagementPanel())
|
||||
->setRepository($repository)
|
||||
->getPanelURI();
|
||||
|
||||
$dialog = new AphrontDialogView();
|
||||
$text_1 = pht(
|
||||
|
@ -40,7 +42,7 @@ final class DiffusionRepositoryEditDeleteController
|
|||
return $this->newDialog()
|
||||
->setTitle(pht('Really want to delete the repository?'))
|
||||
->appendChild($body)
|
||||
->addCancelButton($edit_uri, pht('Okay'));
|
||||
->addCancelButton($panel_uri, pht('Okay'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,9 @@ final class DiffusionRepositoryEditUpdateController
|
|||
$drequest = $this->getDiffusionRequest();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
|
||||
$panel_uri = id(new DiffusionRepositoryStatusManagementPanel())
|
||||
->setRepository($repository)
|
||||
->getPanelURI();
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
$params = array(
|
||||
|
@ -26,7 +28,7 @@ final class DiffusionRepositoryEditUpdateController
|
|||
->setUser($viewer)
|
||||
->execute();
|
||||
|
||||
return id(new AphrontRedirectResponse())->setURI($edit_uri);
|
||||
return id(new AphrontRedirectResponse())->setURI($panel_uri);
|
||||
}
|
||||
|
||||
$doc_name = 'Diffusion User Guide: Repository Updates';
|
||||
|
@ -58,7 +60,7 @@ final class DiffusionRepositoryEditUpdateController
|
|||
'To learn more about how Phabricator updates repositories, '.
|
||||
'read %s in the documentation.',
|
||||
$doc_link))
|
||||
->addCancelButton($edit_uri)
|
||||
->addCancelButton($panel_uri)
|
||||
->addSubmitButton(pht('Schedule Update'));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,120 +0,0 @@
|
|||
<?php
|
||||
|
||||
final class DiffusionRepositorySymbolsController
|
||||
extends DiffusionRepositoryEditController {
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$response = $this->loadDiffusionContextForEdit();
|
||||
if ($response) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$viewer = $this->getViewer();
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
|
||||
|
||||
$v_sources = $repository->getSymbolSources();
|
||||
$v_languages = $repository->getSymbolLanguages();
|
||||
if ($v_languages) {
|
||||
$v_languages = implode(', ', $v_languages);
|
||||
}
|
||||
$errors = array();
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
$v_sources = $request->getArr('sources');
|
||||
$v_languages = $request->getStrList('languages');
|
||||
$v_languages = array_map('phutil_utf8_strtolower', $v_languages);
|
||||
|
||||
if (!$errors) {
|
||||
$xactions = array();
|
||||
$template = id(new PhabricatorRepositoryTransaction());
|
||||
|
||||
$type_sources = PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES;
|
||||
$type_lang = PhabricatorRepositoryTransaction::TYPE_SYMBOLS_LANGUAGE;
|
||||
|
||||
$xactions[] = id(clone $template)
|
||||
->setTransactionType($type_sources)
|
||||
->setNewValue($v_sources);
|
||||
|
||||
$xactions[] = id(clone $template)
|
||||
->setTransactionType($type_lang)
|
||||
->setNewValue($v_languages);
|
||||
|
||||
try {
|
||||
id(new PhabricatorRepositoryEditor())
|
||||
->setContinueOnNoEffect(true)
|
||||
->setContentSourceFromRequest($request)
|
||||
->setActor($viewer)
|
||||
->applyTransactions($repository, $xactions);
|
||||
|
||||
return id(new AphrontRedirectResponse())->setURI($edit_uri);
|
||||
} catch (Exception $ex) {
|
||||
$errors[] = $ex->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb(pht('Edit Symbols'));
|
||||
|
||||
$title = pht('Edit Symbols (%s)', $repository->getName());
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader($title)
|
||||
->setHeaderIcon('fa-pencil');
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($viewer)
|
||||
->appendRemarkupInstructions($this->getInstructions())
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('languages')
|
||||
->setLabel(pht('Indexed Languages'))
|
||||
->setCaption(pht(
|
||||
'File extensions, separate with commas, for example: php, py. '.
|
||||
'Leave blank for "any".'))
|
||||
->setValue($v_languages))
|
||||
|
||||
->appendControl(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setName('sources')
|
||||
->setLabel(pht('Uses Symbols From'))
|
||||
->setDatasource(new DiffusionRepositoryDatasource())
|
||||
->setValue($v_sources))
|
||||
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue(pht('Save'))
|
||||
->addCancelButton($edit_uri));
|
||||
|
||||
$form_box = id(new PHUIObjectBoxView())
|
||||
->setHeaderText(pht('Symbols'))
|
||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||
->setForm($form)
|
||||
->setFormErrors($errors);
|
||||
|
||||
$view = id(new PHUITwoColumnView())
|
||||
->setHeader($header)
|
||||
->setFooter(array(
|
||||
$form_box,
|
||||
));
|
||||
|
||||
return $this->newPage()
|
||||
->setTitle($title)
|
||||
->setCrumbs($crumbs)
|
||||
->appendChild($view);
|
||||
}
|
||||
|
||||
private function getInstructions() {
|
||||
return pht(<<<EOT
|
||||
Configure Symbols for this repository.
|
||||
|
||||
See [[%s | Symbol Indexes]] for more information on using symbols.
|
||||
EOT
|
||||
,
|
||||
PhabricatorEnv::getDoclink(
|
||||
'Diffusion User Guide: Symbol Indexes'));
|
||||
}
|
||||
|
||||
}
|
|
@ -13,7 +13,9 @@ final class DiffusionRepositoryTestAutomationController
|
|||
$drequest = $this->getDiffusionRequest();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
|
||||
$panel_uri = id(new DiffusionRepositoryAutomationManagementPanel())
|
||||
->setRepository($repository)
|
||||
->getPanelURI();
|
||||
|
||||
if (!$repository->canPerformAutomation()) {
|
||||
return $this->newDialog()
|
||||
|
@ -23,7 +25,7 @@ final class DiffusionRepositoryTestAutomationController
|
|||
'You can not run a configuration test for this repository '.
|
||||
'because you have not configured repository automation yet. '.
|
||||
'Configure it first, then test the configuration.'))
|
||||
->addCancelButton($edit_uri);
|
||||
->addCancelButton($panel_uri);
|
||||
}
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
|
@ -63,7 +65,7 @@ final class DiffusionRepositoryTestAutomationController
|
|||
'If you run into write failures despite passing this test, '.
|
||||
'it suggests that your setup is nearly correct but authentication '.
|
||||
'is probably not fully configured.'))
|
||||
->addCancelButton($edit_uri)
|
||||
->addCancelButton($panel_uri)
|
||||
->addSubmitButton(pht('Start Test'));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue