1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 09:20:58 +01:00

Make conduit-uri info easier to be copied into arcrc

Summary:
add the conduit URI and the username together with the arc
certificate to the setting page.

Test Plan:
run arc diff to make sure it still works after copying the
generated test into the .arcrc file.

Reviewed By: epriestley
Reviewers: epriestley
CC: epriestley
Differential Revision: 73
This commit is contained in:
jungejason 2011-03-11 15:34:55 -08:00
parent ab2b83ce14
commit 6aa006b903
4 changed files with 32 additions and 8 deletions

View file

@ -171,18 +171,43 @@ class PhabricatorUserSettingsController extends PhabricatorPeopleController {
$notice = null;
}
$host = PhabricatorEnv::getEnvConfig('phabricator.base-uri') . 'api/';
$conduit_setting = sprintf(
' %s: {'."\n".
' "user" : %s,'."\n".
' "cert" : %s'."\n".
' }'."\n",
json_encode($host),
json_encode($user->getUserName()),
json_encode($user->getConduitCertificate()));
$cert_form = new AphrontFormView();
$cert_form
->setUser($user)
->appendChild(
'<p class="aphront-form-instructions">Copy and paste this certificate '.
'into your <tt>~/.arcrc</tt> in the "hosts" section to enable '.
'Arcanist to authenticate against this host.</p>')
'<p class="aphront-form-instructions">Copy and paste the host info '.
'including the certificate into your <tt>~/.arcrc</tt> in the "hosts" '.
'session to enable Arcanist to authenticate against this host.</p>')
->appendChild(
id(new AphrontFormMarkupControl())
->setControlStyle('white-space: pre; font-family: monospace')
->setValue(
'{'."\n".
' ...'."\n".
' "hosts" : {'."\n"))
->appendChild(
id(new AphrontFormTextAreaControl())
->setLabel('Certificate')
->setLabel('Credentials')
->setHeight(AphrontFormTextAreaControl::HEIGHT_SHORT)
->setValue($user->getConduitCertificate()));
->setControlStyle('font-family: monospace')
->setValue($conduit_setting))
->appendChild(
id(new AphrontFormStaticControl())
->setControlStyle('white-space: pre; font-family: monospace')
->setValue(
' }'."\n".
' ...'."\n".
'}'));
$cert = new AphrontPanelView();
$cert->setHeader('Arcanist Certificate');

View file

@ -24,7 +24,6 @@ phutil_require_module('phabricator', 'view/form/control/markup');
phutil_require_module('phabricator', 'view/form/control/static');
phutil_require_module('phabricator', 'view/form/control/submit');
phutil_require_module('phabricator', 'view/form/control/text');
phutil_require_module('phabricator', 'view/form/control/textarea');
phutil_require_module('phabricator', 'view/form/error');
phutil_require_module('phabricator', 'view/layout/panel');
phutil_require_module('phabricator', 'view/layout/sidenav');

View file

@ -22,5 +22,4 @@ To retrieve the certificate for a Phabricator host:
- Login to Phabricator.
- Go to Settings > Arcanist Certificate.
Copy the certificate into the "cert" field, and specify your username in the
"user" field.
Copy the host info including the certificate into the "hosts" section.

View file

@ -50,6 +50,7 @@ class AphrontFormTextAreaControl extends AphrontFormControl {
'name' => $this->getName(),
'disabled' => $this->getDisabled() ? 'disabled' : null,
'class' => $height_class,
'style' => $this->getControlStyle(),
'id' => $this->getID(),
),
phutil_escape_html($this->getValue()));