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:
@@ -47,7 +47,24 @@ final class DiffusionRepositoryEditActivateController
|
|||||||
$submit = pht('Deactivate Repository');
|
$submit = pht('Deactivate Repository');
|
||||||
} else {
|
} else {
|
||||||
$title = pht('Activate Repository');
|
$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');
|
$submit = pht('Activate Repository');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ final class DiffusionRepositoryEditEngine
|
|||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
$repository = PhabricatorRepository::initializeNewRepository($viewer);
|
$repository = PhabricatorRepository::initializeNewRepository($viewer);
|
||||||
|
|
||||||
|
$repository->setDetail('newly-initialized', true);
|
||||||
|
|
||||||
$vcs = $this->getVersionControlSystem();
|
$vcs = $this->getVersionControlSystem();
|
||||||
if ($vcs) {
|
if ($vcs) {
|
||||||
$repository->setVersionControlSystem($vcs);
|
$repository->setVersionControlSystem($vcs);
|
||||||
|
|||||||
@@ -103,7 +103,38 @@ final class DiffusionRepositoryBasicsManagementPanel
|
|||||||
public function buildManagementPanelContent() {
|
public function buildManagementPanelContent() {
|
||||||
$result = array();
|
$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();
|
$description = $this->buildDescription();
|
||||||
if ($description) {
|
if ($description) {
|
||||||
|
|||||||
@@ -113,18 +113,34 @@ final class DiffusionRepositoryURIsManagementPanel
|
|||||||
->setTag('a')
|
->setTag('a')
|
||||||
->setText(pht('Documentation')));
|
->setText(pht('Documentation')));
|
||||||
|
|
||||||
|
$is_new = $repository->isNewlyInitialized();
|
||||||
|
|
||||||
$messages = array();
|
$messages = array();
|
||||||
if ($repository->isHosted()) {
|
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(
|
$messages[] = array(
|
||||||
id(new PHUIIconView())->setIcon('fa-folder'),
|
id(new PHUIIconView())->setIcon('fa-folder'),
|
||||||
' ',
|
' ',
|
||||||
pht('Phabricator is hosting this repository.'),
|
$host_message,
|
||||||
);
|
);
|
||||||
} else {
|
} 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(
|
$messages[] = array(
|
||||||
id(new PHUIIconView())->setIcon('fa-download'),
|
id(new PHUIIconView())->setIcon('fa-download'),
|
||||||
' ',
|
' ',
|
||||||
pht('This repository is hosted remotely. Phabricator is observing it.'),
|
$observe_message,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,15 @@ final class PhabricatorRepositoryEditor
|
|||||||
$object->setVersionControlSystem($xaction->getNewValue());
|
$object->setVersionControlSystem($xaction->getNewValue());
|
||||||
break;
|
break;
|
||||||
case PhabricatorRepositoryTransaction::TYPE_ACTIVATE:
|
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;
|
break;
|
||||||
case PhabricatorRepositoryTransaction::TYPE_NAME:
|
case PhabricatorRepositoryTransaction::TYPE_NAME:
|
||||||
$object->setName($xaction->getNewValue());
|
$object->setName($xaction->getNewValue());
|
||||||
|
|||||||
@@ -964,6 +964,10 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
|
|||||||
return (bool)$this->getDetail('importing', false);
|
return (bool)$this->getDetail('importing', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isNewlyInitialized() {
|
||||||
|
return (bool)$this->getDetail('newly-initialized', false);
|
||||||
|
}
|
||||||
|
|
||||||
public function loadImportProgress() {
|
public function loadImportProgress() {
|
||||||
$progress = queryfx_all(
|
$progress = queryfx_all(
|
||||||
$this->establishConnection('r'),
|
$this->establishConnection('r'),
|
||||||
|
|||||||
Reference in New Issue
Block a user