1
0
Fork 0
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:
epriestley 2016-05-09 07:01:37 -07:00
parent 846eec7563
commit 8512f9358e
7 changed files with 55 additions and 167 deletions

View file

@ -774,7 +774,6 @@ phutil_register_library_map(array(
'DiffusionRepositoryStagingManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php', 'DiffusionRepositoryStagingManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php',
'DiffusionRepositoryStatusManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStatusManagementPanel.php', 'DiffusionRepositoryStatusManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStatusManagementPanel.php',
'DiffusionRepositoryStorageManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php', 'DiffusionRepositoryStorageManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php',
'DiffusionRepositorySymbolsController' => 'applications/diffusion/controller/DiffusionRepositorySymbolsController.php',
'DiffusionRepositorySymbolsManagementPanel' => 'applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php', 'DiffusionRepositorySymbolsManagementPanel' => 'applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php',
'DiffusionRepositoryTag' => 'applications/diffusion/data/DiffusionRepositoryTag.php', 'DiffusionRepositoryTag' => 'applications/diffusion/data/DiffusionRepositoryTag.php',
'DiffusionRepositoryTestAutomationController' => 'applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php', 'DiffusionRepositoryTestAutomationController' => 'applications/diffusion/controller/DiffusionRepositoryTestAutomationController.php',
@ -4994,7 +4993,6 @@ phutil_register_library_map(array(
'DiffusionRepositoryStagingManagementPanel' => 'DiffusionRepositoryManagementPanel', 'DiffusionRepositoryStagingManagementPanel' => 'DiffusionRepositoryManagementPanel',
'DiffusionRepositoryStatusManagementPanel' => 'DiffusionRepositoryManagementPanel', 'DiffusionRepositoryStatusManagementPanel' => 'DiffusionRepositoryManagementPanel',
'DiffusionRepositoryStorageManagementPanel' => 'DiffusionRepositoryManagementPanel', 'DiffusionRepositoryStorageManagementPanel' => 'DiffusionRepositoryManagementPanel',
'DiffusionRepositorySymbolsController' => 'DiffusionRepositoryEditController',
'DiffusionRepositorySymbolsManagementPanel' => 'DiffusionRepositoryManagementPanel', 'DiffusionRepositorySymbolsManagementPanel' => 'DiffusionRepositoryManagementPanel',
'DiffusionRepositoryTag' => 'Phobject', 'DiffusionRepositoryTag' => 'Phobject',
'DiffusionRepositoryTestAutomationController' => 'DiffusionRepositoryEditController', 'DiffusionRepositoryTestAutomationController' => 'DiffusionRepositoryEditController',

View file

@ -13,7 +13,9 @@ final class DiffusionRepositoryEditActivateController
$drequest = $this->getDiffusionRequest(); $drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository(); $repository = $drequest->getRepository();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); $panel_uri = id(new DiffusionRepositoryBasicsManagementPanel())
->setRepository($repository)
->getPanelURI();
if ($request->isFormPost()) { if ($request->isFormPost()) {
if (!$repository->isTracked()) { if (!$repository->isTracked()) {
@ -33,24 +35,24 @@ final class DiffusionRepositoryEditActivateController
->setActor($viewer) ->setActor($viewer)
->applyTransactions($repository, array($xaction)); ->applyTransactions($repository, array($xaction));
return id(new AphrontReloadResponse())->setURI($edit_uri); return id(new AphrontReloadResponse())->setURI($panel_uri);
} }
if ($repository->isTracked()) { if ($repository->isTracked()) {
return $this->newDialog() $title = pht('Deactivate Repository');
->setTitle(pht('Deactivate Repository?')) $body = pht('Deactivate this repository?');
->appendChild( $submit = pht('Deactivate Repository');
pht('Deactivate this repository?'))
->addSubmitButton(pht('Deactivate Repository'))
->addCancelButton($edit_uri);
} else { } else {
return $this->newDialog() $title = pht('Activate Repository');
->setTitle(pht('Activate Repository?')) $body = pht('Activate this repository?');
->appendChild( $submit = pht('Activate Repository');
pht('Activate this repository?'))
->addSubmitButton(pht('Activate Repository'))
->addCancelButton($edit_uri);
} }
return $this->newDialog()
->setTitle($title)
->appendChild($body)
->addSubmitButton($submit)
->addCancelButton($panel_uri);
} }
} }

View file

@ -13,7 +13,9 @@ final class DiffusionRepositoryEditDangerousController
$drequest = $this->getDiffusionRequest(); $drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository(); $repository = $drequest->getRepository();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); $panel_uri = id(new DiffusionRepositoryBasicsManagementPanel())
->setRepository($repository)
->getPanelURI();
if (!$repository->canAllowDangerousChanges()) { if (!$repository->canAllowDangerousChanges()) {
if ($repository->isSVN()) { if ($repository->isSVN()) {
@ -24,7 +26,7 @@ final class DiffusionRepositoryEditDangerousController
'It is not possible for users to push any dangerous changes '. 'It is not possible for users to push any dangerous changes '.
'to a Subversion repository. Pushes to a Subversion repository '. 'to a Subversion repository. Pushes to a Subversion repository '.
'can always be reverted and never destroy data.')) 'can always be reverted and never destroy data.'))
->addCancelButton($edit_uri); ->addCancelButton($panel_uri);
} else { } else {
return $this->newDialog() return $this->newDialog()
->setTitle(pht('Unprotectable Repository')) ->setTitle(pht('Unprotectable Repository'))
@ -33,7 +35,7 @@ final class DiffusionRepositoryEditDangerousController
'This repository can not be protected from dangerous changes '. 'This repository can not be protected from dangerous changes '.
'because Phabricator does not control what users are allowed '. 'because Phabricator does not control what users are allowed '.
'to push to it.')) 'to push to it.'))
->addCancelButton($edit_uri); ->addCancelButton($panel_uri);
} }
} }
@ -48,33 +50,33 @@ final class DiffusionRepositoryEditDangerousController
->setActor($viewer) ->setActor($viewer)
->applyTransactions($repository, array($xaction)); ->applyTransactions($repository, array($xaction));
return id(new AphrontReloadResponse())->setURI($edit_uri); return id(new AphrontReloadResponse())->setURI($panel_uri);
} }
$force = phutil_tag('tt', array(), '--force'); $force = phutil_tag('tt', array(), '--force');
if ($repository->shouldAllowDangerousChanges()) { if ($repository->shouldAllowDangerousChanges()) {
return $this->newDialog() $title = pht('Prevent Dangerous Changes');
->setTitle(pht('Prevent Dangerous changes?')) $body = pht(
->appendChild(
pht(
'It will no longer be possible to delete branches from this '. 'It will no longer be possible to delete branches from this '.
'repository, or %s push to this repository.', 'repository, or %s push to this repository.',
$force)) $force);
->addSubmitButton(pht('Prevent Dangerous Changes')) $submit = pht('Prevent Dangerous Changes');
->addCancelButton($edit_uri);
} else { } else {
return $this->newDialog() $title = pht('Allow Dangerous Changes');
->setTitle(pht('Allow Dangerous Changes?')) $body = pht(
->appendChild(
pht(
'If you allow dangerous changes, it will be possible to delete '. 'If you allow dangerous changes, it will be possible to delete '.
'branches and %s push this repository. These operations can '. 'branches and %s push this repository. These operations can '.
'alter a repository in a way that is difficult to recover from.', 'alter a repository in a way that is difficult to recover from.',
$force)) $force);
->addSubmitButton(pht('Allow Dangerous Changes')) $submit = pht('Allow Dangerous Changes');
->addCancelButton($edit_uri);
} }
return $this->newDialog()
->setTitle($title)
->appendParagraph($body)
->addSubmitButton($submit)
->addCancelButton($panel_uri);
} }
} }

View file

@ -13,7 +13,9 @@ final class DiffusionRepositoryEditDeleteController
$drequest = $this->getDiffusionRequest(); $drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository(); $repository = $drequest->getRepository();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); $panel_uri = id(new DiffusionRepositoryBasicsManagementPanel())
->setRepository($repository)
->getPanelURI();
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$text_1 = pht( $text_1 = pht(
@ -40,7 +42,7 @@ final class DiffusionRepositoryEditDeleteController
return $this->newDialog() return $this->newDialog()
->setTitle(pht('Really want to delete the repository?')) ->setTitle(pht('Really want to delete the repository?'))
->appendChild($body) ->appendChild($body)
->addCancelButton($edit_uri, pht('Okay')); ->addCancelButton($panel_uri, pht('Okay'));
} }
} }

View file

@ -13,7 +13,9 @@ final class DiffusionRepositoryEditUpdateController
$drequest = $this->getDiffusionRequest(); $drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository(); $repository = $drequest->getRepository();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); $panel_uri = id(new DiffusionRepositoryStatusManagementPanel())
->setRepository($repository)
->getPanelURI();
if ($request->isFormPost()) { if ($request->isFormPost()) {
$params = array( $params = array(
@ -26,7 +28,7 @@ final class DiffusionRepositoryEditUpdateController
->setUser($viewer) ->setUser($viewer)
->execute(); ->execute();
return id(new AphrontRedirectResponse())->setURI($edit_uri); return id(new AphrontRedirectResponse())->setURI($panel_uri);
} }
$doc_name = 'Diffusion User Guide: Repository Updates'; $doc_name = 'Diffusion User Guide: Repository Updates';
@ -58,7 +60,7 @@ final class DiffusionRepositoryEditUpdateController
'To learn more about how Phabricator updates repositories, '. 'To learn more about how Phabricator updates repositories, '.
'read %s in the documentation.', 'read %s in the documentation.',
$doc_link)) $doc_link))
->addCancelButton($edit_uri) ->addCancelButton($panel_uri)
->addSubmitButton(pht('Schedule Update')); ->addSubmitButton(pht('Schedule Update'));
} }

View file

@ -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'));
}
}

View file

@ -13,7 +13,9 @@ final class DiffusionRepositoryTestAutomationController
$drequest = $this->getDiffusionRequest(); $drequest = $this->getDiffusionRequest();
$repository = $drequest->getRepository(); $repository = $drequest->getRepository();
$edit_uri = $this->getRepositoryControllerURI($repository, 'edit/'); $panel_uri = id(new DiffusionRepositoryAutomationManagementPanel())
->setRepository($repository)
->getPanelURI();
if (!$repository->canPerformAutomation()) { if (!$repository->canPerformAutomation()) {
return $this->newDialog() return $this->newDialog()
@ -23,7 +25,7 @@ final class DiffusionRepositoryTestAutomationController
'You can not run a configuration test for this repository '. 'You can not run a configuration test for this repository '.
'because you have not configured repository automation yet. '. 'because you have not configured repository automation yet. '.
'Configure it first, then test the configuration.')) 'Configure it first, then test the configuration.'))
->addCancelButton($edit_uri); ->addCancelButton($panel_uri);
} }
if ($request->isFormPost()) { if ($request->isFormPost()) {
@ -63,7 +65,7 @@ final class DiffusionRepositoryTestAutomationController
'If you run into write failures despite passing this test, '. 'If you run into write failures despite passing this test, '.
'it suggests that your setup is nearly correct but authentication '. 'it suggests that your setup is nearly correct but authentication '.
'is probably not fully configured.')) 'is probably not fully configured.'))
->addCancelButton($edit_uri) ->addCancelButton($panel_uri)
->addSubmitButton(pht('Start Test')); ->addSubmitButton(pht('Start Test'));
} }