Page MenuHomePhabricator

D13025.diff
No OneTemporary

D13025.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -7,7 +7,7 @@
*/
return array(
'names' => array(
- 'core.pkg.css' => '439658b5',
+ 'core.pkg.css' => '4e7df908',
'core.pkg.js' => '328799d0',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '30602b8c',
@@ -134,7 +134,7 @@
'rsrc/css/phui/phui-document.css' => '94d5dcd8',
'rsrc/css/phui/phui-feed-story.css' => 'c9f3a0b5',
'rsrc/css/phui/phui-fontkit.css' => 'dd8ddf27',
- 'rsrc/css/phui/phui-form-view.css' => '79793450',
+ 'rsrc/css/phui/phui-form-view.css' => '808329f2',
'rsrc/css/phui/phui-form.css' => 'f535f938',
'rsrc/css/phui/phui-header-view.css' => '75aaf372',
'rsrc/css/phui/phui-icon.css' => 'bc766998',
@@ -443,7 +443,7 @@
'rsrc/js/core/behavior-device.js' => 'a205cf28',
'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '6d49590e',
'rsrc/js/core/behavior-error-log.js' => '6882e80a',
- 'rsrc/js/core/behavior-fancy-datepicker.js' => '5c0f680f',
+ 'rsrc/js/core/behavior-fancy-datepicker.js' => '510b5809',
'rsrc/js/core/behavior-file-tree.js' => '88236f00',
'rsrc/js/core/behavior-form.js' => '5c54cbf3',
'rsrc/js/core/behavior-gesture.js' => '3ab51e2c',
@@ -576,7 +576,7 @@
'javelin-behavior-durable-column' => '16c695bf',
'javelin-behavior-error-log' => '6882e80a',
'javelin-behavior-event-all-day' => '38dcf3c8',
- 'javelin-behavior-fancy-datepicker' => '5c0f680f',
+ 'javelin-behavior-fancy-datepicker' => '510b5809',
'javelin-behavior-global-drag-and-drop' => 'c8e57404',
'javelin-behavior-herald-rule-editor' => '7ebaeed3',
'javelin-behavior-high-security-warning' => 'a464fe03',
@@ -776,7 +776,7 @@
'phui-font-icon-base-css' => '3dad2ae3',
'phui-fontkit-css' => 'dd8ddf27',
'phui-form-css' => 'f535f938',
- 'phui-form-view-css' => '79793450',
+ 'phui-form-view-css' => '808329f2',
'phui-header-view-css' => '75aaf372',
'phui-icon-view-css' => 'bc766998',
'phui-image-mask-css' => '5a8b09c8',
@@ -1175,6 +1175,13 @@
'javelin-typeahead-source',
'javelin-util',
),
+ '510b5809' => array(
+ 'javelin-behavior',
+ 'javelin-util',
+ 'javelin-dom',
+ 'javelin-stratcom',
+ 'javelin-vector',
+ ),
'519705ea' => array(
'javelin-install',
'javelin-dom',
@@ -1242,13 +1249,6 @@
'javelin-uri',
'javelin-routable',
),
- '5c0f680f' => array(
- 'javelin-behavior',
- 'javelin-util',
- 'javelin-dom',
- 'javelin-stratcom',
- 'javelin-vector',
- ),
'5c54cbf3' => array(
'javelin-behavior',
'javelin-stratcom',
diff --git a/src/applications/owners/controller/PhabricatorOwnersDetailController.php b/src/applications/owners/controller/PhabricatorOwnersDetailController.php
--- a/src/applications/owners/controller/PhabricatorOwnersDetailController.php
+++ b/src/applications/owners/controller/PhabricatorOwnersDetailController.php
@@ -19,7 +19,6 @@
}
$paths = $package->loadPaths();
- $owners = $package->loadOwners();
$repository_phids = array();
foreach ($paths as $path) {
@@ -36,98 +35,18 @@
$repositories = array();
}
- $phids = array();
- foreach ($owners as $owner) {
- $phids[$owner->getUserPHID()] = true;
- }
- $phids = array_keys($phids);
-
- $handles = $this->loadViewerHandles($phids);
-
- $rows = array();
-
- $rows[] = array(pht('Name'), $package->getName());
- $rows[] = array(pht('Description'), $package->getDescription());
-
- $primary_owner = null;
- $primary_phid = $package->getPrimaryOwnerPHID();
- if ($primary_phid && isset($handles[$primary_phid])) {
- $primary_owner = phutil_tag(
- 'strong',
- array(),
- $handles[$primary_phid]->renderLink());
- }
- $rows[] = array(pht('Primary Owner'), $primary_owner);
-
- $owner_links = array();
- foreach ($owners as $owner) {
- $owner_links[] = $handles[$owner->getUserPHID()]->renderLink();
- }
- $owner_links = phutil_implode_html(phutil_tag('br'), $owner_links);
- $rows[] = array(pht('Owners'), $owner_links);
-
- $rows[] = array(
- pht('Auditing'),
- $package->getAuditingEnabled() ?
- pht('Enabled') :
- pht('Disabled'),
- );
-
- $path_links = array();
- foreach ($paths as $path) {
- $repo = idx($repositories, $path->getRepositoryPHID());
- if (!$repo) {
- continue;
- }
- $href = DiffusionRequest::generateDiffusionURI(
- array(
- 'callsign' => $repo->getCallsign(),
- 'branch' => $repo->getDefaultBranch(),
- 'path' => $path->getPath(),
- 'action' => 'browse',
- ));
- $repo_name = phutil_tag('strong', array(), $repo->getName());
- $path_link = phutil_tag(
- 'a',
- array(
- 'href' => (string)$href,
- ),
- $path->getPath());
- $path_links[] = hsprintf(
- '%s %s %s',
- ($path->getExcluded() ? "\xE2\x80\x93" : '+'),
- $repo_name,
- $path_link);
- }
- $path_links = phutil_implode_html(phutil_tag('br'), $path_links);
- $rows[] = array(pht('Paths'), $path_links);
-
- $table = new AphrontTableView($rows);
- $table->setColumnClasses(
- array(
- 'header',
- 'wide',
- ));
+ $actions = $this->buildPackageActionView($package);
+ $properties = $this->buildPackagePropertyView($package);
+ $properties->setActionList($actions);
- $panel = new PHUIObjectBoxView();
- $header = new PHUIHeaderView();
- $header->setHeader(
- pht('Package Details for "%s"', $package->getName()));
- $header->addActionLink(
- id(new PHUIButtonView())
- ->setTag('a')
- ->setHref('/owners/delete/'.$package->getID().'/')
- ->addSigil('workflow')
- ->setText(pht('Delete Package')));
-
- $header->addActionLink(
- id(new PHUIButtonView())
- ->setTag('a')
- ->setHref('/owners/edit/'.$package->getID().'/')
- ->setText(pht('Edit Package')));
+ $header = id(new PHUIHeaderView())
+ ->setUser($viewer)
+ ->setHeader($package->getName())
+ ->setPolicyObject($package);
- $panel->setHeader($header);
- $panel->appendChild($table);
+ $panel = id(new PHUIObjectBoxView())
+ ->setHeader($header)
+ ->addPropertyList($properties);
$commit_views = array();
@@ -209,11 +128,138 @@
array(
$crumbs,
$panel,
+ $this->renderPathsTable($paths, $repositories),
$commit_panels,
),
array(
- 'title' => pht('Package %s', $package->getName()),
+ 'title' => $package->getName(),
));
}
+
+ private function buildPackagePropertyView(PhabricatorOwnersPackage $package) {
+ $viewer = $this->getViewer();
+
+ $view = id(new PHUIPropertyListView())
+ ->setUser($viewer);
+
+ $primary_phid = $package->getPrimaryOwnerPHID();
+ if ($primary_phid) {
+ $primary_owner = $viewer->renderHandle($primary_phid);
+ } else {
+ $primary_owner = phutil_tag('em', array(), pht('None'));
+ }
+ $view->addProperty(pht('Primary Owner'), $primary_owner);
+
+ // TODO: needOwners() this on the Query.
+ $owners = $package->loadOwners();
+ if ($owners) {
+ $owner_list = $viewer->renderHandleList(mpull($owners, 'getUserPHID'));
+ } else {
+ $owner_list = phutil_tag('em', array(), pht('None'));
+ }
+ $view->addProperty(pht('Owners'), $owner_list);
+
+ if ($package->getAuditingEnabled()) {
+ $auditing = pht('Enabled');
+ } else {
+ $auditing = pht('Disabled');
+ }
+ $view->addProperty(pht('Auditing'), $auditing);
+
+ $description = $package->getDescription();
+ if (strlen($description)) {
+ $view->addSectionHeader(pht('Description'));
+ $view->addTextContent(
+ $output = PhabricatorMarkupEngine::renderOneObject(
+ id(new PhabricatorMarkupOneOff())->setContent($description),
+ 'default',
+ $viewer));
+ }
+
+ return $view;
+ }
+
+ private function buildPackageActionView(PhabricatorOwnersPackage $package) {
+ $viewer = $this->getViewer();
+
+ // TODO: Implement this capability.
+ $can_edit = true;
+
+ $id = $package->getID();
+ $edit_uri = $this->getApplicationURI("/edit/{$id}/");
+ $delete_uri = $this->getApplicationURI("/delete/{$id}/");
+
+ $view = id(new PhabricatorActionListView())
+ ->setUser($viewer)
+ ->setObject($package)
+ ->addAction(
+ id(new PhabricatorActionView())
+ ->setName(pht('Edit Package'))
+ ->setIcon('fa-pencil')
+ ->setDisabled(!$can_edit)
+ ->setWorkflow(!$can_edit)
+ ->setHref($edit_uri))
+ ->addAction(
+ id(new PhabricatorActionView())
+ ->setName(pht('Delete Package'))
+ ->setIcon('fa-times')
+ ->setDisabled(!$can_edit)
+ ->setWorkflow(true)
+ ->setHref($delete_uri));
+
+ return $view;
+ }
+
+ private function renderPathsTable(array $paths, array $repositories) {
+ $viewer = $this->getViewer();
+
+ $rows = array();
+ foreach ($paths as $path) {
+ $repo = idx($repositories, $path->getRepositoryPHID());
+ if (!$repo) {
+ continue;
+ }
+ $href = DiffusionRequest::generateDiffusionURI(
+ array(
+ 'callsign' => $repo->getCallsign(),
+ 'branch' => $repo->getDefaultBranch(),
+ 'path' => $path->getPath(),
+ 'action' => 'browse',
+ ));
+
+ $path_link = phutil_tag(
+ 'a',
+ array(
+ 'href' => (string)$href,
+ ),
+ $path->getPath());
+
+ $rows[] = array(
+ ($path->getExcluded() ? '-' : '+'),
+ $repo->getName(),
+ $path_link,
+ );
+ }
+
+ $table = id(new AphrontTableView($rows))
+ ->setHeaders(
+ array(
+ null,
+ pht('Repository'),
+ pht('Path'),
+ ))
+ ->setColumnClasses(
+ array(
+ null,
+ null,
+ 'wide',
+ ));
+
+ return id(new PHUIObjectBoxView())
+ ->setHeaderText(pht('Paths'))
+ ->appendChild($table);
+
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 14, 12:09 AM (4 h, 15 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6726396
Default Alt Text
D13025.diff (10 KB)

Event Timeline