Summary:
Ref T13216. I want to add some new management options to repositories (e.g., filesize limit, clone timeouts). Before adding new stuff here, update the UI to a full-width, Phortune-style UI.
This partially reverts D18523. About a year ago, several UIs got converted to fixed-width (repository management, config, settings, instance management in SAAS). I didn't think these were good changes and have never really gotten used to them. The rationale wasn't clear to me and these changes just felt like "be more like GitHub". I think usability is significantly worse, e.g. actions are now hidden inside button menus instead of immediately visible.
Phortune also got converted less dramatically to a full-width-with-menu UI, which I like much better. Adjust repository management to use that UI style instead of the fixed-width style.
Test Plan:
{F6020884}
Viewed every panel, including the Subversion panel.
Reviewers: amckinley
Reviewed By: amckinley
Maniphest Tasks: T13216
Differential Revision: https://secure.phabricator.com/D19826
161 lines
4.1 KiB
PHP
161 lines
4.1 KiB
PHP
<?php
|
|
|
|
final class DiffusionRepositoryURIsManagementPanel
|
|
extends DiffusionRepositoryManagementPanel {
|
|
|
|
const PANELKEY = 'uris';
|
|
|
|
public function getManagementPanelLabel() {
|
|
return pht('URIs');
|
|
}
|
|
|
|
public function getManagementPanelIcon() {
|
|
return 'fa-globe';
|
|
}
|
|
|
|
public function getManagementPanelOrder() {
|
|
return 400;
|
|
}
|
|
|
|
public function buildManagementPanelCurtain() {
|
|
$repository = $this->getRepository();
|
|
$viewer = $this->getViewer();
|
|
$action_list = $this->newActionList();
|
|
|
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
|
$viewer,
|
|
$repository,
|
|
PhabricatorPolicyCapability::CAN_EDIT);
|
|
|
|
$doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: URIs');
|
|
$add_href = $repository->getPathURI('uri/edit/');
|
|
|
|
$action_list->addAction(
|
|
id(new PhabricatorActionView())
|
|
->setIcon('fa-plus')
|
|
->setHref($add_href)
|
|
->setDisabled(!$can_edit)
|
|
->setName(pht('Add New URI')));
|
|
|
|
$action_list->addAction(
|
|
id(new PhabricatorActionView())
|
|
->setIcon('fa-book')
|
|
->setHref($doc_href)
|
|
->setName(pht('URI Documentation')));
|
|
|
|
return $this->newCurtainView()
|
|
->setActionList($action_list);
|
|
}
|
|
|
|
public function buildManagementPanelContent() {
|
|
$repository = $this->getRepository();
|
|
$viewer = $this->getViewer();
|
|
$uris = $repository->getURIs();
|
|
|
|
Javelin::initBehavior('phabricator-tooltips');
|
|
$rows = array();
|
|
foreach ($uris as $uri) {
|
|
|
|
$uri_name = $uri->getDisplayURI();
|
|
$uri_name = phutil_tag(
|
|
'a',
|
|
array(
|
|
'href' => $uri->getViewURI(),
|
|
),
|
|
$uri_name);
|
|
|
|
if ($uri->getIsDisabled()) {
|
|
$status_icon = 'fa-times grey';
|
|
} else {
|
|
$status_icon = 'fa-check green';
|
|
}
|
|
|
|
$uri_status = id(new PHUIIconView())->setIcon($status_icon);
|
|
|
|
$io_type = $uri->getEffectiveIOType();
|
|
$io_map = PhabricatorRepositoryURI::getIOTypeMap();
|
|
$io_spec = idx($io_map, $io_type, array());
|
|
|
|
$io_icon = idx($io_spec, 'icon');
|
|
$io_color = idx($io_spec, 'color');
|
|
$io_label = idx($io_spec, 'label', $io_type);
|
|
|
|
$uri_io = array(
|
|
id(new PHUIIconView())->setIcon("{$io_icon} {$io_color}"),
|
|
' ',
|
|
$io_label,
|
|
);
|
|
|
|
$display_type = $uri->getEffectiveDisplayType();
|
|
$display_map = PhabricatorRepositoryURI::getDisplayTypeMap();
|
|
$display_spec = idx($display_map, $display_type, array());
|
|
|
|
$display_icon = idx($display_spec, 'icon');
|
|
$display_color = idx($display_spec, 'color');
|
|
$display_label = idx($display_spec, 'label', $display_type);
|
|
|
|
$uri_display = array(
|
|
id(new PHUIIconView())->setIcon("{$display_icon} {$display_color}"),
|
|
' ',
|
|
$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,
|
|
));
|
|
|
|
$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[] = $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[] = $observe_message;
|
|
}
|
|
|
|
$info_view = id(new PHUIInfoView())
|
|
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
|
|
->setErrors($messages);
|
|
|
|
$box = $this->newBox(pht('Repository URIs'), $table);
|
|
|
|
return array($info_view, $box);
|
|
}
|
|
|
|
}
|