When repository services are available, use them when creating a new repository

Summary:
Ref T2783. When creating a new repository, test for cluster services. If cluster services are available, allocate on a random open service.

Show the service that repositories are allocated on.

Test Plan: Created a new repository, saw it allocate onto an available cluster service.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2783

Differential Revision: https://secure.phabricator.com/D11003
This commit is contained in:
epriestley
2014-12-18 14:31:22 -08:00
parent 10f2cfec5b
commit cd6f67ef95
5 changed files with 112 additions and 9 deletions

View File

@@ -33,8 +33,28 @@ final class DiffusionRepositoryEditStorageController
$title = pht('Edit %s', $repository->getName());
$service_phid = $repository->getAlmanacServicePHID();
if ($service_phid) {
$handles = $this->loadViewerHandles(array($service_phid));
$v_service = $handles[$service_phid]->renderLink();
} else {
$v_service = phutil_tag(
'em',
array(),
pht('Local'));
}
$form = id(new AphrontFormView())
->setUser($user)
->appendChild(
id(new AphrontFormMarkupControl())
->setLabel(pht('Storage Service'))
->setValue($v_service))
->appendChild(
id(new AphrontFormMarkupControl())
->setName('local')
->setLabel(pht('Storage Path'))
->setValue($v_local))
->appendRemarkupInstructions(
pht(
"You can not adjust the local path for this repository from the ".
@@ -42,11 +62,6 @@ final class DiffusionRepositoryEditStorageController
" phabricator/ $ ./bin/repository edit %s --as %s --local-path ...",
$repository->getCallsign(),
$user->getUsername()))
->appendChild(
id(new AphrontFormMarkupControl())
->setName('local')
->setLabel(pht('Local Path'))
->setValue($v_local))
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton($edit_uri, pht('Done')));