1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 13:22:42 +01:00

Provide more UI guidance when creating repositories

Summary: Ref T10923. Walk users through the "create, configure, activate" workflow a little better and set expectations more clearly.

Test Plan:
  - Created a new repository, saw new UI help.
  - Activated repository, saw onboarding help disappear.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10923

Differential Revision: https://secure.phabricator.com/D15875
This commit is contained in:
epriestley 2016-05-10 05:54:16 -07:00
parent 0b5ab2330d
commit f05fce44aa
6 changed files with 83 additions and 5 deletions

View file

@ -47,7 +47,24 @@ final class DiffusionRepositoryEditActivateController
$submit = pht('Deactivate Repository');
} else {
$title = pht('Activate Repository');
$body = pht('Activate this repository?');
$is_new = $repository->isNewlyInitialized();
if ($is_new) {
if ($repository->isHosted()) {
$body = pht(
'This repository will become a new hosted repository. '.
'It will begin serving read and write traffic.');
} else {
$body = pht(
'This repository will observe an existing remote repository. '.
'It will begin fetching changes from the remote.');
}
} else {
$body = pht(
'This repository will resume updates, observation, mirroring, '.
'and serving any configured read and write traffic.');
}
$submit = pht('Activate Repository');
}

View file

@ -40,6 +40,8 @@ final class DiffusionRepositoryEditEngine
$viewer = $this->getViewer();
$repository = PhabricatorRepository::initializeNewRepository($viewer);
$repository->setDetail('newly-initialized', true);
$vcs = $this->getVersionControlSystem();
if ($vcs) {
$repository->setVersionControlSystem($vcs);

View file

@ -103,7 +103,38 @@ final class DiffusionRepositoryBasicsManagementPanel
public function buildManagementPanelContent() {
$result = array();
$result[] = $this->newBox(pht('Repository Basics'), $this->buildBasics());
$basics = $this->newBox(pht('Repository Basics'), $this->buildBasics());
$repository = $this->getRepository();
$is_new = $repository->isNewlyInitialized();
if ($is_new) {
$messages = array();
$messages[] = pht(
'This newly created repository is not active yet. Configure policies, '.
'options, and URIs. When ready, %s the repository.',
phutil_tag('strong', array(), pht('Activate')));
if ($repository->isHosted()) {
$messages[] = pht(
'If activated now, this repository will become a new hosted '.
'repository. To observe an existing repository instead, configure '.
'it in the %s panel.',
phutil_tag('strong', array(), pht('URIs')));
} else {
$messages[] = pht(
'If activated now, this repository will observe an existing remote '.
'repository and begin importing changes.');
}
$info_view = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->setErrors($messages);
$basics->setInfoView($info_view);
}
$result[] = $basics;
$description = $this->buildDescription();
if ($description) {

View file

@ -113,18 +113,34 @@ final class DiffusionRepositoryURIsManagementPanel
->setTag('a')
->setText(pht('Documentation')));
$is_new = $repository->isNewlyInitialized();
$messages = array();
if ($repository->isHosted()) {
if ($is_new) {
$host_message = pht('Phabricator will host this repository.');
} else {
$host_message = pht('Phabricator is hosting this repository.');
}
$messages[] = array(
id(new PHUIIconView())->setIcon('fa-folder'),
' ',
pht('Phabricator is hosting this repository.'),
$host_message,
);
} else {
if ($is_new) {
$observe_message = pht(
'Phabricator will observe a remote repository.');
} else {
$observe_message = pht(
'This repository is hosted remotely. Phabricator is observing it.');
}
$messages[] = array(
id(new PHUIIconView())->setIcon('fa-download'),
' ',
pht('This repository is hosted remotely. Phabricator is observing it.'),
$observe_message,
);
}

View file

@ -138,7 +138,15 @@ final class PhabricatorRepositoryEditor
$object->setVersionControlSystem($xaction->getNewValue());
break;
case PhabricatorRepositoryTransaction::TYPE_ACTIVATE:
$object->setDetail('tracking-enabled', $xaction->getNewValue());
$active = $xaction->getNewValue();
// The first time a repository is activated, clear the "new repository"
// flag so we stop showing setup hints.
if ($active) {
$object->setDetail('newly-initialized', false);
}
$object->setDetail('tracking-enabled', $active);
break;
case PhabricatorRepositoryTransaction::TYPE_NAME:
$object->setName($xaction->getNewValue());

View file

@ -964,6 +964,10 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
return (bool)$this->getDetail('importing', false);
}
public function isNewlyInitialized() {
return (bool)$this->getDetail('newly-initialized', false);
}
public function loadImportProgress() {
$progress = queryfx_all(
$this->establishConnection('r'),