1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00

Provide some more context hints for repository URIs

Summary: Ref T10923. This provides a little guidance about hosted vs observed, and points at the `diffusion.ssh-*` options.

Test Plan: Poked around in the web UI, saw useful guidance.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10923

Differential Revision: https://secure.phabricator.com/D15872
This commit is contained in:
epriestley 2016-05-09 15:36:13 -07:00
parent 3328e78a7b
commit 98b202042e
4 changed files with 54 additions and 2 deletions

View file

@ -83,9 +83,25 @@ final class DiffusionURIEditEngine
protected function buildCustomEditFields($object) {
$viewer = $this->getViewer();
$uri_instructions = null;
if ($object->isBuiltin()) {
$is_builtin = true;
$uri_value = (string)$object->getDisplayURI();
switch ($object->getBuiltinProtocol()) {
case PhabricatorRepositoryURI::BUILTIN_PROTOCOL_SSH:
$uri_instructions = pht(
" - Configure [[ %s | %s ]] to change the SSH username.\n".
" - Configure [[ %s | %s ]] to change the SSH host.\n".
" - Configure [[ %s | %s ]] to change the SSH port.",
'/config/edit/diffusion.ssh-user/',
'diffusion.ssh-user',
'/config/edit/diffusion.ssh-host/',
'diffusion.ssh-host',
'/config/edit/diffusion.ssh-port/',
'diffusion.ssh-port');
break;
}
} else {
$is_builtin = false;
$uri_value = $object->getURI();
@ -118,7 +134,8 @@ final class DiffusionURIEditEngine
->setConduitTypeDescription(pht('New repository URI.'))
->setIsRequired(!$is_builtin)
->setIsLocked($is_builtin)
->setValue($uri_value),
->setValue($uri_value)
->setControlInstructions($uri_instructions),
id(new PhabricatorSelectEditField())
->setKey('io')
->setLabel(pht('I/O Type'))

View file

@ -14,7 +14,7 @@ final class DiffusionRepositoryDocumentationManagementPanel
}
public function getManagementPanelIcon() {
return 'fa-book bluegrey';
return 'fa-book';
}
public function buildManagementPanelContent() {

View file

@ -113,8 +113,28 @@ final class DiffusionRepositoryURIsManagementPanel
->setTag('a')
->setText(pht('Documentation')));
$messages = array();
if ($repository->isHosted()) {
$messages[] = array(
id(new PHUIIconView())->setIcon('fa-folder'),
' ',
pht('Phabricator is hosting this repository.'),
);
} else {
$messages[] = array(
id(new PHUIIconView())->setIcon('fa-download'),
' ',
pht('This repository is hosted remotely. Phabricator is observing it.'),
);
}
$info_view = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->setErrors($messages);
return id(new PHUIObjectBoxView())
->setHeader($header)
->setInfoView($info_view)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->setTable($table);
}

View file

@ -16,6 +16,7 @@ abstract class PhabricatorEditField extends Phobject {
private $isRequired;
private $previewPanel;
private $controlID;
private $controlInstructions;
private $description;
private $conduitDescription;
@ -272,6 +273,15 @@ abstract class PhabricatorEditField extends Phobject {
return $this->previewPanel;
}
public function setControlInstructions($control_instructions) {
$this->controlInstructions = $control_instructions;
return $this;
}
public function getControlInstructions() {
return $this->controlInstructions;
}
protected function newControl() {
throw new PhutilMethodNotImplementedException();
}
@ -358,6 +368,11 @@ abstract class PhabricatorEditField extends Phobject {
}
}
$instructions = $this->getControlInstructions();
if (strlen($instructions)) {
$form->appendRemarkupInstructions($instructions);
}
$form->appendControl($control);
}
return $this;