mirror of
https://we.phorge.it/source/phorge.git
synced 2025-04-08 02:18:33 +02:00
Summary: Ref T10748. Allow the new EditEngine workflow to create repositories by giving the user a modal repository type choice upfront. (The rest of this flow is still confusing/weird, though.) Test Plan: - Created a new repository. {F1249626} Reviewers: chad Reviewed By: chad Maniphest Tasks: T10748 Differential Revision: https://secure.phabricator.com/D15813
126 lines
3.2 KiB
PHP
126 lines
3.2 KiB
PHP
<?php
|
|
|
|
final class DiffusionRepositoryURIsManagementPanel
|
|
extends DiffusionRepositoryManagementPanel {
|
|
|
|
const PANELKEY = 'uris';
|
|
|
|
public function getManagementPanelLabel() {
|
|
return pht('Clone / Fetch / Mirror');
|
|
}
|
|
|
|
public function getManagementPanelOrder() {
|
|
return 300;
|
|
}
|
|
|
|
public function buildManagementPanelContent() {
|
|
$repository = $this->getRepository();
|
|
$viewer = $this->getViewer();
|
|
|
|
$repository->attachURIs(array());
|
|
$uris = $repository->getURIs();
|
|
|
|
Javelin::initBehavior('phabricator-tooltips');
|
|
$rows = array();
|
|
foreach ($uris as $uri) {
|
|
|
|
$uri_name = $uri->getDisplayURI();
|
|
|
|
if ($uri->getIsDisabled()) {
|
|
$status_icon = 'fa-times grey';
|
|
} else {
|
|
$status_icon = 'fa-check green';
|
|
}
|
|
|
|
$uri_status = id(new PHUIIconView())->setIcon($status_icon);
|
|
|
|
switch ($uri->getEffectiveIOType()) {
|
|
case PhabricatorRepositoryURI::IO_OBSERVE:
|
|
$io_icon = 'fa-download green';
|
|
$io_label = pht('Observe');
|
|
break;
|
|
case PhabricatorRepositoryURI::IO_MIRROR:
|
|
$io_icon = 'fa-upload green';
|
|
$io_label = pht('Mirror');
|
|
break;
|
|
case PhabricatorRepositoryURI::IO_NONE:
|
|
$io_icon = 'fa-times grey';
|
|
$io_label = pht('No I/O');
|
|
break;
|
|
case PhabricatorRepositoryURI::IO_READ:
|
|
$io_icon = 'fa-folder blue';
|
|
$io_label = pht('Read Only');
|
|
break;
|
|
case PhabricatorRepositoryURI::IO_READWRITE:
|
|
$io_icon = 'fa-folder-open blue';
|
|
$io_label = pht('Read/Write');
|
|
break;
|
|
}
|
|
|
|
$uri_io = array(
|
|
id(new PHUIIconView())->setIcon($io_icon),
|
|
' ',
|
|
$io_label,
|
|
);
|
|
|
|
switch ($uri->getEffectiveDisplayType()) {
|
|
case PhabricatorRepositoryURI::DISPLAY_NEVER:
|
|
$display_icon = 'fa-eye-slash grey';
|
|
$display_label = pht('Hidden');
|
|
break;
|
|
case PhabricatorRepositoryURI::DISPLAY_ALWAYS:
|
|
$display_icon = 'fa-eye green';
|
|
$display_label = pht('Visible');
|
|
break;
|
|
}
|
|
|
|
$uri_display = array(
|
|
id(new PHUIIconView())->setIcon($display_icon),
|
|
' ',
|
|
$display_label,
|
|
);
|
|
|
|
$rows[] = array(
|
|
$uri_status,
|
|
$uri_name,
|
|
$uri_io,
|
|
$uri_display,
|
|
);
|
|
}
|
|
|
|
$table = id(new AphrontTableView($rows))
|
|
->setNoDataString(pht('This repository has no URIs.'))
|
|
->setHeaders(
|
|
array(
|
|
null,
|
|
pht('URI'),
|
|
pht('I/O'),
|
|
pht('Display'),
|
|
))
|
|
->setColumnClasses(
|
|
array(
|
|
null,
|
|
'pri wide',
|
|
null,
|
|
null,
|
|
));
|
|
|
|
$doc_href = PhabricatorEnv::getDoclink(
|
|
'Diffusion User Guide: URIs');
|
|
|
|
$header = id(new PHUIHeaderView())
|
|
->setHeader(pht('Repository URIs'))
|
|
->addActionLink(
|
|
id(new PHUIButtonView())
|
|
->setIcon('fa-book')
|
|
->setHref($doc_href)
|
|
->setTag('a')
|
|
->setText(pht('Documentation')));
|
|
|
|
return id(new PHUIObjectBoxView())
|
|
->setHeader($header)
|
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
|
->setTable($table);
|
|
}
|
|
|
|
}
|