1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

Improve command line prompts in setup issue pages

Summary:
This is a follow-up to D25425, where these improvements to the CLI prompt markers were discussed.

Changes included in this revision:

- Build all prompts the same way
- Remove space after the prompt marker (add it via CSS instead)
- Add server path prefix
- Make the prompt unselectable

Test Plan:
- Visit any of the setup issue pages, e.g. <PHORGE_URL>/config/issue/auth.config-unlocked/ (after ensuring that the corresponding issue is present — in this case, by doing `./bin/auth unlock`)
- For example, Deactivate all PHP extensions to trigger each /config/issue/extension.gd/ etc.
- For example, update at least up to `dc10a7e69ea3` to see the database upgrade tip etc.
- Confirm that the command line prompts now include the path prefix
- Confirm that selecting the command via double-click (or click-and-drag) does not select the prompt

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Tags: #ux, #config

Differential Revision: https://we.phorge.it/D25466
This commit is contained in:
Waldir Pimenta 2023-12-07 16:21:39 +00:00
parent 6c8329fb66
commit c49eeb235e
10 changed files with 60 additions and 25 deletions

View file

@ -45,7 +45,7 @@ return array(
'rsrc/css/application/conduit/conduit-api.css' => 'ce2cfc41',
'rsrc/css/application/config/config-options.css' => '16c920ae',
'rsrc/css/application/config/config-template.css' => 'e689dbbd',
'rsrc/css/application/config/setup-issue.css' => '5eed85b2',
'rsrc/css/application/config/setup-issue.css' => '93231115',
'rsrc/css/application/config/unhandled-exception.css' => '9ecfc00d',
'rsrc/css/application/conpherence/color.css' => 'b17746b0',
'rsrc/css/application/conpherence/durable-column.css' => '2d57072b',
@ -903,7 +903,7 @@ return array(
'project-card-view-css' => 'c1200da7',
'project-triggers-css' => 'cd9c8bb9',
'project-view-css' => '2f7caa20',
'setup-issue-css' => '5eed85b2',
'setup-issue-css' => '93231115',
'sprite-login-css' => '07052ee0',
'sprite-tokens-css' => 'f1896dc5',
'syntax-default-css' => '055fc231',

View file

@ -74,7 +74,8 @@ final class PhabricatorAuthSetupCheck extends PhabricatorSetupCheck {
->addRelatedPhabricatorConfig('auth.lock-config')
->addCommand(
hsprintf(
'<tt>$</tt> ./bin/auth lock'));
'<tt>%s $</tt>./bin/auth lock',
PlatformSymbols::getPlatformServerPath()));
}
}
}

View file

@ -96,9 +96,8 @@ final class PhabricatorBaseURISetupCheck extends PhabricatorSetupCheck {
->setMessage($message)
->addCommand(
hsprintf(
'<tt>$</tt> %s',
csprintf(
'./bin/config set phabricator.base-uri %s',
$base_uri_guess)));
'<tt>%s $</tt>./bin/config set phabricator.base-uri %s',
PlatformSymbols::getPlatformServerPath(),
$base_uri_guess));
}
}

View file

@ -49,7 +49,10 @@ final class PhabricatorDaemonsSetupCheck extends PhabricatorSetupCheck {
->setName(pht('Daemons Are Not Running'))
->setSummary($summary)
->setMessage($message)
->addCommand('$ ./bin/phd start');
->addCommand(
hsprintf(
'<tt>%s $</tt>./bin/phd start',
PlatformSymbols::getPlatformServerPath()));
}
$expect_user = PhabricatorEnv::getEnvConfig('phd.user');
@ -90,7 +93,10 @@ final class PhabricatorDaemonsSetupCheck extends PhabricatorSetupCheck {
->setSummary($summary)
->setMessage($message)
->addPhabricatorConfig('phd.user')
->addCommand('$ ./bin/phd restart');
->addCommand(
hsprintf(
'<tt>%s $</tt>./bin/phd restart',
PlatformSymbols::getPlatformServerPath()));
break;
}

View file

@ -35,11 +35,13 @@ final class PhabricatorDatabaseSetupCheck extends PhabricatorSetupCheck {
->addPhabricatorConfig('mysql.port')
->addCommand(
hsprintf(
'<tt>$</tt> ./bin/config set mysql.host %s',
'<tt>%s $</tt>./bin/config set mysql.host %s',
PlatformSymbols::getPlatformServerPath(),
$host))
->addCommand(
hsprintf(
'<tt>$</tt> ./bin/config set mysql.port %s',
'<tt>%s $</tt>./bin/config set mysql.port %s',
PlatformSymbols::getPlatformServerPath(),
$port));
}
@ -134,7 +136,10 @@ final class PhabricatorDatabaseSetupCheck extends PhabricatorSetupCheck {
->setName(pht('Setup MySQL Schema'))
->setMessage($message)
->setIsFatal(true)
->addCommand(hsprintf('<tt>$</tt> ./bin/storage upgrade'));
->addCommand(
hsprintf(
'<tt>%s $</tt>./bin/storage upgrade',
PlatformSymbols::getPlatformServerPath()));
return true;
}
@ -160,7 +165,9 @@ final class PhabricatorDatabaseSetupCheck extends PhabricatorSetupCheck {
->setIsFatal(true)
->setMessage($message)
->addCommand(
hsprintf('<tt>$</tt> ./bin/storage upgrade'));
hsprintf(
'<tt>%s $</tt>./bin/storage upgrade',
PlatformSymbols::getPlatformServerPath()));
return true;
}

View file

@ -60,7 +60,10 @@ final class PhabricatorElasticsearchSetupCheck extends PhabricatorSetupCheck {
$this
->newIssue('elastic.missing-index')
->setName(pht('Elasticsearch Index Not Found'))
->addCommand('./bin/search init')
->addCommand(
hsprintf(
'<tt>%s $</tt>./bin/search init',
PlatformSymbols::getPlatformServerPath()))
->setSummary($summary)
->setMessage($message);
@ -76,7 +79,10 @@ final class PhabricatorElasticsearchSetupCheck extends PhabricatorSetupCheck {
$this
->newIssue('elastic.broken-index')
->setName(pht('Elasticsearch Index Schema Mismatch'))
->addCommand('./bin/search init')
->addCommand(
hsprintf(
'<tt>%s $</tt>./bin/search init',
PlatformSymbols::getPlatformServerPath()))
->setSummary($summary)
->setMessage($message);
}

View file

@ -76,7 +76,10 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck {
$issue->setMessage($message);
if ($found_local) {
$command = csprintf('$ ./bin/config delete %s', $key);
$command = hsprintf(
'<tt>%s $</tt>./bin/config delete %s',
PlatformSymbols::getPlatformServerPath(),
$key);
$issue->addCommand($command);
}
@ -166,9 +169,12 @@ final class PhabricatorExtraConfigSetupCheck extends PhabricatorSetupCheck {
'target' => '_blank',
),
$doc_name));
$command = csprintf(
'$ ./bin/config delete --database %R',
$key);
$command = hsprintf(
'<tt>%s $</tt>%s',
PlatformSymbols::getPlatformServerPath(),
csprintf(
'./bin/config delete --database %R',
$key));
$this->newIssue('config.locked.'.$key)
->setShortName(pht('Deprecated Config Source'))

View file

@ -83,11 +83,11 @@ final class PhabricatorSetupIssueView extends AphrontView {
// TODO: We should do a better job of detecting how to install extensions
// on the current system.
$install_commands = hsprintf(
"\$ sudo apt-get install php-<em>extname</em> ".
"<tt>$</tt>sudo apt-get install php-<em>extname</em> ".
"# Debian / Ubuntu\n".
"\$ sudo dnf install php-<em>extname</em> ".
"<tt>$</tt>sudo dnf install php-<em>extname</em> ".
"# Red Hat / Derivatives\n".
"\$ sudo yum install php-<em>extname</em> ".
"<tt>$</tt>sudo yum install php-<em>extname</em> ".
"# Older Red Hat versions");
$fallback_info = pht(
@ -286,7 +286,8 @@ final class PhabricatorSetupIssueView extends AphrontView {
$update = array();
foreach ($configs as $key) {
$update[] = hsprintf(
'<tt>$</tt> ./bin/config set %s <em>value</em>',
'<tt>%s $</tt>./bin/config set %s <em>value</em>',
PlatformSymbols::getPlatformServerPath(),
$key);
}
$update = phutil_tag('pre', array(), phutil_implode_html("\n", $update));

View file

@ -24,8 +24,12 @@ final class PhabricatorSetupIssueUIExample extends PhabricatorUIExample {
->setSummary(pht('Summary'))
->setMessage(pht('Message'))
->setIssueKey('example.key')
->addCommand('$ # Add Command')
->addCommand(hsprintf('<tt>$</tt> %s', '$ ls -1 > /dev/null'))
->addCommand(hsprintf(
'<tt>%s $</tt># Add Command',
PlatformSymbols::getPlatformServerPath()))
->addCommand(hsprintf(
'<tt>%s $</tt>ls -1 > /dev/null',
PlatformSymbols::getPlatformServerPath()))
->addPHPConfig('php.config.example')
->addPhabricatorConfig('test.value')
->addPHPExtension('libexample');

View file

@ -122,6 +122,11 @@
padding: 12px 0;
}
.setup-issue-config > pre > tt {
user-select: none;
margin-right: 0.5em;
}
.setup-issue-config + .setup-issue-config {
padding-top: 0;
}