mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 19:40:55 +01:00
In Packages, give publishers a list of packages and packages a list of versions
Summary: Ref T8116. Puts a list of packages on the publisher page, and a list of versions on the package page. Test Plan: Viewed a publisher, saw packages. Viewed a package, saw versions. Looked at list views. Reviewers: chad Reviewed By: chad Maniphest Tasks: T8116 Differential Revision: https://secure.phabricator.com/D16321
This commit is contained in:
parent
08a19f35f0
commit
7517d40519
11 changed files with 233 additions and 33 deletions
|
@ -2990,6 +2990,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesPackageEditor' => 'applications/packages/editor/PhabricatorPackagesPackageEditor.php',
|
'PhabricatorPackagesPackageEditor' => 'applications/packages/editor/PhabricatorPackagesPackageEditor.php',
|
||||||
'PhabricatorPackagesPackageKeyTransaction' => 'applications/packages/xaction/package/PhabricatorPackagesPackageKeyTransaction.php',
|
'PhabricatorPackagesPackageKeyTransaction' => 'applications/packages/xaction/package/PhabricatorPackagesPackageKeyTransaction.php',
|
||||||
'PhabricatorPackagesPackageListController' => 'applications/packages/controller/PhabricatorPackagesPackageListController.php',
|
'PhabricatorPackagesPackageListController' => 'applications/packages/controller/PhabricatorPackagesPackageListController.php',
|
||||||
|
'PhabricatorPackagesPackageListView' => 'applications/packages/view/PhabricatorPackagesPackageListView.php',
|
||||||
'PhabricatorPackagesPackageNameNgrams' => 'applications/packages/storage/PhabricatorPackagesPackageNameNgrams.php',
|
'PhabricatorPackagesPackageNameNgrams' => 'applications/packages/storage/PhabricatorPackagesPackageNameNgrams.php',
|
||||||
'PhabricatorPackagesPackageNameTransaction' => 'applications/packages/xaction/package/PhabricatorPackagesPackageNameTransaction.php',
|
'PhabricatorPackagesPackageNameTransaction' => 'applications/packages/xaction/package/PhabricatorPackagesPackageNameTransaction.php',
|
||||||
'PhabricatorPackagesPackagePHIDType' => 'applications/packages/phid/PhabricatorPackagesPackagePHIDType.php',
|
'PhabricatorPackagesPackagePHIDType' => 'applications/packages/phid/PhabricatorPackagesPackagePHIDType.php',
|
||||||
|
@ -3011,6 +3012,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesPublisherEditor' => 'applications/packages/editor/PhabricatorPackagesPublisherEditor.php',
|
'PhabricatorPackagesPublisherEditor' => 'applications/packages/editor/PhabricatorPackagesPublisherEditor.php',
|
||||||
'PhabricatorPackagesPublisherKeyTransaction' => 'applications/packages/xaction/publisher/PhabricatorPackagesPublisherKeyTransaction.php',
|
'PhabricatorPackagesPublisherKeyTransaction' => 'applications/packages/xaction/publisher/PhabricatorPackagesPublisherKeyTransaction.php',
|
||||||
'PhabricatorPackagesPublisherListController' => 'applications/packages/controller/PhabricatorPackagesPublisherListController.php',
|
'PhabricatorPackagesPublisherListController' => 'applications/packages/controller/PhabricatorPackagesPublisherListController.php',
|
||||||
|
'PhabricatorPackagesPublisherListView' => 'applications/packages/view/PhabricatorPackagesPublisherListView.php',
|
||||||
'PhabricatorPackagesPublisherNameNgrams' => 'applications/packages/storage/PhabricatorPackagesPublisherNameNgrams.php',
|
'PhabricatorPackagesPublisherNameNgrams' => 'applications/packages/storage/PhabricatorPackagesPublisherNameNgrams.php',
|
||||||
'PhabricatorPackagesPublisherNameTransaction' => 'applications/packages/xaction/publisher/PhabricatorPackagesPublisherNameTransaction.php',
|
'PhabricatorPackagesPublisherNameTransaction' => 'applications/packages/xaction/publisher/PhabricatorPackagesPublisherNameTransaction.php',
|
||||||
'PhabricatorPackagesPublisherPHIDType' => 'applications/packages/phid/PhabricatorPackagesPublisherPHIDType.php',
|
'PhabricatorPackagesPublisherPHIDType' => 'applications/packages/phid/PhabricatorPackagesPublisherPHIDType.php',
|
||||||
|
@ -3031,6 +3033,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesVersionEditEngine' => 'applications/packages/editor/PhabricatorPackagesVersionEditEngine.php',
|
'PhabricatorPackagesVersionEditEngine' => 'applications/packages/editor/PhabricatorPackagesVersionEditEngine.php',
|
||||||
'PhabricatorPackagesVersionEditor' => 'applications/packages/editor/PhabricatorPackagesVersionEditor.php',
|
'PhabricatorPackagesVersionEditor' => 'applications/packages/editor/PhabricatorPackagesVersionEditor.php',
|
||||||
'PhabricatorPackagesVersionListController' => 'applications/packages/controller/PhabricatorPackagesVersionListController.php',
|
'PhabricatorPackagesVersionListController' => 'applications/packages/controller/PhabricatorPackagesVersionListController.php',
|
||||||
|
'PhabricatorPackagesVersionListView' => 'applications/packages/view/PhabricatorPackagesVersionListView.php',
|
||||||
'PhabricatorPackagesVersionNameNgrams' => 'applications/packages/storage/PhabricatorPackagesVersionNameNgrams.php',
|
'PhabricatorPackagesVersionNameNgrams' => 'applications/packages/storage/PhabricatorPackagesVersionNameNgrams.php',
|
||||||
'PhabricatorPackagesVersionNameTransaction' => 'applications/packages/xaction/version/PhabricatorPackagesVersionNameTransaction.php',
|
'PhabricatorPackagesVersionNameTransaction' => 'applications/packages/xaction/version/PhabricatorPackagesVersionNameTransaction.php',
|
||||||
'PhabricatorPackagesVersionPHIDType' => 'applications/packages/phid/PhabricatorPackagesVersionPHIDType.php',
|
'PhabricatorPackagesVersionPHIDType' => 'applications/packages/phid/PhabricatorPackagesVersionPHIDType.php',
|
||||||
|
@ -3042,6 +3045,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesVersionTransactionQuery' => 'applications/packages/query/PhabricatorPackagesVersionTransactionQuery.php',
|
'PhabricatorPackagesVersionTransactionQuery' => 'applications/packages/query/PhabricatorPackagesVersionTransactionQuery.php',
|
||||||
'PhabricatorPackagesVersionTransactionType' => 'applications/packages/xaction/version/PhabricatorPackagesVersionTransactionType.php',
|
'PhabricatorPackagesVersionTransactionType' => 'applications/packages/xaction/version/PhabricatorPackagesVersionTransactionType.php',
|
||||||
'PhabricatorPackagesVersionViewController' => 'applications/packages/controller/PhabricatorPackagesVersionViewController.php',
|
'PhabricatorPackagesVersionViewController' => 'applications/packages/controller/PhabricatorPackagesVersionViewController.php',
|
||||||
|
'PhabricatorPackagesView' => 'applications/packages/view/PhabricatorPackagesView.php',
|
||||||
'PhabricatorPagerUIExample' => 'applications/uiexample/examples/PhabricatorPagerUIExample.php',
|
'PhabricatorPagerUIExample' => 'applications/uiexample/examples/PhabricatorPagerUIExample.php',
|
||||||
'PhabricatorPassphraseApplication' => 'applications/passphrase/application/PhabricatorPassphraseApplication.php',
|
'PhabricatorPassphraseApplication' => 'applications/passphrase/application/PhabricatorPassphraseApplication.php',
|
||||||
'PhabricatorPasswordAuthProvider' => 'applications/auth/provider/PhabricatorPasswordAuthProvider.php',
|
'PhabricatorPasswordAuthProvider' => 'applications/auth/provider/PhabricatorPasswordAuthProvider.php',
|
||||||
|
@ -7822,6 +7826,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesPackageEditor' => 'PhabricatorPackagesEditor',
|
'PhabricatorPackagesPackageEditor' => 'PhabricatorPackagesEditor',
|
||||||
'PhabricatorPackagesPackageKeyTransaction' => 'PhabricatorPackagesPackageTransactionType',
|
'PhabricatorPackagesPackageKeyTransaction' => 'PhabricatorPackagesPackageTransactionType',
|
||||||
'PhabricatorPackagesPackageListController' => 'PhabricatorPackagesPackageController',
|
'PhabricatorPackagesPackageListController' => 'PhabricatorPackagesPackageController',
|
||||||
|
'PhabricatorPackagesPackageListView' => 'PhabricatorPackagesView',
|
||||||
'PhabricatorPackagesPackageNameNgrams' => 'PhabricatorPackagesNgrams',
|
'PhabricatorPackagesPackageNameNgrams' => 'PhabricatorPackagesNgrams',
|
||||||
'PhabricatorPackagesPackageNameTransaction' => 'PhabricatorPackagesPackageTransactionType',
|
'PhabricatorPackagesPackageNameTransaction' => 'PhabricatorPackagesPackageTransactionType',
|
||||||
'PhabricatorPackagesPackagePHIDType' => 'PhabricatorPHIDType',
|
'PhabricatorPackagesPackagePHIDType' => 'PhabricatorPHIDType',
|
||||||
|
@ -7852,6 +7857,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesPublisherEditor' => 'PhabricatorPackagesEditor',
|
'PhabricatorPackagesPublisherEditor' => 'PhabricatorPackagesEditor',
|
||||||
'PhabricatorPackagesPublisherKeyTransaction' => 'PhabricatorPackagesPublisherTransactionType',
|
'PhabricatorPackagesPublisherKeyTransaction' => 'PhabricatorPackagesPublisherTransactionType',
|
||||||
'PhabricatorPackagesPublisherListController' => 'PhabricatorPackagesPublisherController',
|
'PhabricatorPackagesPublisherListController' => 'PhabricatorPackagesPublisherController',
|
||||||
|
'PhabricatorPackagesPublisherListView' => 'PhabricatorPackagesView',
|
||||||
'PhabricatorPackagesPublisherNameNgrams' => 'PhabricatorPackagesNgrams',
|
'PhabricatorPackagesPublisherNameNgrams' => 'PhabricatorPackagesNgrams',
|
||||||
'PhabricatorPackagesPublisherNameTransaction' => 'PhabricatorPackagesPublisherTransactionType',
|
'PhabricatorPackagesPublisherNameTransaction' => 'PhabricatorPackagesPublisherTransactionType',
|
||||||
'PhabricatorPackagesPublisherPHIDType' => 'PhabricatorPHIDType',
|
'PhabricatorPackagesPublisherPHIDType' => 'PhabricatorPHIDType',
|
||||||
|
@ -7882,6 +7888,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesVersionEditEngine' => 'PhabricatorPackagesEditEngine',
|
'PhabricatorPackagesVersionEditEngine' => 'PhabricatorPackagesEditEngine',
|
||||||
'PhabricatorPackagesVersionEditor' => 'PhabricatorPackagesEditor',
|
'PhabricatorPackagesVersionEditor' => 'PhabricatorPackagesEditor',
|
||||||
'PhabricatorPackagesVersionListController' => 'PhabricatorPackagesVersionController',
|
'PhabricatorPackagesVersionListController' => 'PhabricatorPackagesVersionController',
|
||||||
|
'PhabricatorPackagesVersionListView' => 'PhabricatorPackagesView',
|
||||||
'PhabricatorPackagesVersionNameNgrams' => 'PhabricatorPackagesNgrams',
|
'PhabricatorPackagesVersionNameNgrams' => 'PhabricatorPackagesNgrams',
|
||||||
'PhabricatorPackagesVersionNameTransaction' => 'PhabricatorPackagesVersionTransactionType',
|
'PhabricatorPackagesVersionNameTransaction' => 'PhabricatorPackagesVersionTransactionType',
|
||||||
'PhabricatorPackagesVersionPHIDType' => 'PhabricatorPHIDType',
|
'PhabricatorPackagesVersionPHIDType' => 'PhabricatorPHIDType',
|
||||||
|
@ -7893,6 +7900,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPackagesVersionTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
'PhabricatorPackagesVersionTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||||
'PhabricatorPackagesVersionTransactionType' => 'PhabricatorPackagesTransactionType',
|
'PhabricatorPackagesVersionTransactionType' => 'PhabricatorPackagesTransactionType',
|
||||||
'PhabricatorPackagesVersionViewController' => 'PhabricatorPackagesVersionController',
|
'PhabricatorPackagesVersionViewController' => 'PhabricatorPackagesVersionController',
|
||||||
|
'PhabricatorPackagesView' => 'AphrontView',
|
||||||
'PhabricatorPagerUIExample' => 'PhabricatorUIExample',
|
'PhabricatorPagerUIExample' => 'PhabricatorUIExample',
|
||||||
'PhabricatorPassphraseApplication' => 'PhabricatorApplication',
|
'PhabricatorPassphraseApplication' => 'PhabricatorApplication',
|
||||||
'PhabricatorPasswordAuthProvider' => 'PhabricatorAuthProvider',
|
'PhabricatorPasswordAuthProvider' => 'PhabricatorAuthProvider',
|
||||||
|
|
|
@ -32,14 +32,21 @@ final class PhabricatorPackagesPackageViewController
|
||||||
$header = $this->buildHeaderView($package);
|
$header = $this->buildHeaderView($package);
|
||||||
$curtain = $this->buildCurtain($package);
|
$curtain = $this->buildCurtain($package);
|
||||||
|
|
||||||
|
$versions_view = $this->buildVersionsView($package);
|
||||||
|
|
||||||
$timeline = $this->buildTransactionTimeline(
|
$timeline = $this->buildTransactionTimeline(
|
||||||
$package,
|
$package,
|
||||||
new PhabricatorPackagesPackageTransactionQuery());
|
new PhabricatorPackagesPackageTransactionQuery());
|
||||||
|
$timeline->setShouldTerminate(true);
|
||||||
|
|
||||||
$package_view = id(new PHUITwoColumnView())
|
$package_view = id(new PHUITwoColumnView())
|
||||||
->setHeader($header)
|
->setHeader($header)
|
||||||
->setCurtain($curtain)
|
->setCurtain($curtain)
|
||||||
->setMainColumn($timeline);
|
->setMainColumn(
|
||||||
|
array(
|
||||||
|
$versions_view,
|
||||||
|
$timeline,
|
||||||
|
));
|
||||||
|
|
||||||
return $this->newPage()
|
return $this->newPage()
|
||||||
->setCrumbs($crumbs)
|
->setCrumbs($crumbs)
|
||||||
|
@ -84,4 +91,39 @@ final class PhabricatorPackagesPackageViewController
|
||||||
return $curtain;
|
return $curtain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function buildVersionsView(PhabricatorPackagesPackage $package) {
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
|
$versions = id(new PhabricatorPackagesVersionQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withPackagePHIDs(array($package->getPHID()))
|
||||||
|
->setLimit(25)
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$versions_list = id(new PhabricatorPackagesVersionListView())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->setVersions($versions);
|
||||||
|
|
||||||
|
$all_href = urisprintf(
|
||||||
|
'version/?package=%s#R',
|
||||||
|
$package->getPHID());
|
||||||
|
$all_href = $this->getApplicationURI($all_href);
|
||||||
|
|
||||||
|
$view_all = id(new PHUIButtonView())
|
||||||
|
->setTag('a')
|
||||||
|
->setIcon('fa-search')
|
||||||
|
->setText(pht('View All'))
|
||||||
|
->setHref($all_href);
|
||||||
|
|
||||||
|
$header = id(new PHUIHeaderView())
|
||||||
|
->setHeader(pht('Versions'))
|
||||||
|
->addActionLink($view_all);
|
||||||
|
|
||||||
|
$versions_view = id(new PHUIObjectBoxView())
|
||||||
|
->setHeader($header)
|
||||||
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||||
|
->setObjectList($versions_list);
|
||||||
|
|
||||||
|
return $versions_view;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,14 +29,21 @@ final class PhabricatorPackagesPublisherViewController
|
||||||
$header = $this->buildHeaderView($publisher);
|
$header = $this->buildHeaderView($publisher);
|
||||||
$curtain = $this->buildCurtain($publisher);
|
$curtain = $this->buildCurtain($publisher);
|
||||||
|
|
||||||
|
$packages_view = $this->buildPackagesView($publisher);
|
||||||
|
|
||||||
$timeline = $this->buildTransactionTimeline(
|
$timeline = $this->buildTransactionTimeline(
|
||||||
$publisher,
|
$publisher,
|
||||||
new PhabricatorPackagesPublisherTransactionQuery());
|
new PhabricatorPackagesPublisherTransactionQuery());
|
||||||
|
$timeline->setShouldTerminate(true);
|
||||||
|
|
||||||
$publisher_view = id(new PHUITwoColumnView())
|
$publisher_view = id(new PHUITwoColumnView())
|
||||||
->setHeader($header)
|
->setHeader($header)
|
||||||
->setCurtain($curtain)
|
->setCurtain($curtain)
|
||||||
->setMainColumn($timeline);
|
->setMainColumn(
|
||||||
|
array(
|
||||||
|
$packages_view,
|
||||||
|
$timeline,
|
||||||
|
));
|
||||||
|
|
||||||
return $this->newPage()
|
return $this->newPage()
|
||||||
->setCrumbs($crumbs)
|
->setCrumbs($crumbs)
|
||||||
|
@ -81,4 +88,40 @@ final class PhabricatorPackagesPublisherViewController
|
||||||
return $curtain;
|
return $curtain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function buildPackagesView(PhabricatorPackagesPublisher $publisher) {
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
|
$packages = id(new PhabricatorPackagesPackageQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withPublisherPHIDs(array($publisher->getPHID()))
|
||||||
|
->setLimit(25)
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$packages_list = id(new PhabricatorPackagesPackageListView())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->setPackages($packages);
|
||||||
|
|
||||||
|
$all_href = urisprintf(
|
||||||
|
'package/?publisher=%s#R',
|
||||||
|
$publisher->getPHID());
|
||||||
|
$all_href = $this->getApplicationURI($all_href);
|
||||||
|
|
||||||
|
$view_all = id(new PHUIButtonView())
|
||||||
|
->setTag('a')
|
||||||
|
->setIcon('fa-search')
|
||||||
|
->setText(pht('View All'))
|
||||||
|
->setHref($all_href);
|
||||||
|
|
||||||
|
$header = id(new PHUIHeaderView())
|
||||||
|
->setHeader(pht('Packages'))
|
||||||
|
->addActionLink($view_all);
|
||||||
|
|
||||||
|
$packages_view = id(new PHUIObjectBoxView())
|
||||||
|
->setHeader($header)
|
||||||
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||||
|
->setObjectList($packages_list);
|
||||||
|
|
||||||
|
return $packages_view;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ final class PhabricatorPackagesVersionViewController
|
||||||
$timeline = $this->buildTransactionTimeline(
|
$timeline = $this->buildTransactionTimeline(
|
||||||
$version,
|
$version,
|
||||||
new PhabricatorPackagesVersionTransactionQuery());
|
new PhabricatorPackagesVersionTransactionQuery());
|
||||||
|
$timeline->setShouldTerminate(true);
|
||||||
|
|
||||||
$version_view = id(new PHUITwoColumnView())
|
$version_view = id(new PHUITwoColumnView())
|
||||||
->setHeader($header)
|
->setHeader($header)
|
||||||
|
|
|
@ -74,19 +74,12 @@ final class PhabricatorPackagesPackageSearchEngine
|
||||||
array $handles) {
|
array $handles) {
|
||||||
|
|
||||||
assert_instances_of($packages, 'PhabricatorPackagesPackage');
|
assert_instances_of($packages, 'PhabricatorPackagesPackage');
|
||||||
|
|
||||||
$viewer = $this->requireViewer();
|
$viewer = $this->requireViewer();
|
||||||
|
|
||||||
$list = id(new PHUIObjectItemListView())
|
$list = id(new PhabricatorPackagesPackageListView())
|
||||||
->setViewer($viewer);
|
->setViewer($viewer)
|
||||||
foreach ($packages as $package) {
|
->setPackages($packages)
|
||||||
$item = id(new PHUIObjectItemView())
|
->newListView();
|
||||||
->setObjectName($package->getFullKey())
|
|
||||||
->setHeader($package->getName())
|
|
||||||
->setHref($package->getURI());
|
|
||||||
|
|
||||||
$list->addItem($item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return id(new PhabricatorApplicationSearchResultView())
|
return id(new PhabricatorApplicationSearchResultView())
|
||||||
->setObjectList($list)
|
->setObjectList($list)
|
||||||
|
|
|
@ -67,16 +67,10 @@ final class PhabricatorPackagesPublisherSearchEngine
|
||||||
|
|
||||||
$viewer = $this->requireViewer();
|
$viewer = $this->requireViewer();
|
||||||
|
|
||||||
$list = id(new PHUIObjectItemListView())
|
$list = id(new PhabricatorPackagesPublisherListView())
|
||||||
->setViewer($viewer);
|
->setViewer($viewer)
|
||||||
foreach ($publishers as $publisher) {
|
->setPublishers($publishers)
|
||||||
$item = id(new PHUIObjectItemView())
|
->newListView();
|
||||||
->setObjectName($publisher->getPublisherKey())
|
|
||||||
->setHeader($publisher->getName())
|
|
||||||
->setHref($publisher->getURI());
|
|
||||||
|
|
||||||
$list->addItem($item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return id(new PhabricatorApplicationSearchResultView())
|
return id(new PhabricatorApplicationSearchResultView())
|
||||||
->setObjectList($list)
|
->setObjectList($list)
|
||||||
|
|
|
@ -73,18 +73,12 @@ final class PhabricatorPackagesVersionSearchEngine
|
||||||
array $handles) {
|
array $handles) {
|
||||||
|
|
||||||
assert_instances_of($versions, 'PhabricatorPackagesVersion');
|
assert_instances_of($versions, 'PhabricatorPackagesVersion');
|
||||||
|
|
||||||
$viewer = $this->requireViewer();
|
$viewer = $this->requireViewer();
|
||||||
|
|
||||||
$list = id(new PHUIObjectItemListView())
|
$list = id(new PhabricatorPackagesVersionListView())
|
||||||
->setViewer($viewer);
|
->setViewer($viewer)
|
||||||
foreach ($versions as $version) {
|
->setVersions($versions)
|
||||||
$item = id(new PHUIObjectItemView())
|
->newListView();
|
||||||
->setHeader($version->getName())
|
|
||||||
->setHref($version->getURI());
|
|
||||||
|
|
||||||
$list->addItem($item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return id(new PhabricatorApplicationSearchResultView())
|
return id(new PhabricatorApplicationSearchResultView())
|
||||||
->setObjectList($list)
|
->setObjectList($list)
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorPackagesPackageListView
|
||||||
|
extends PhabricatorPackagesView {
|
||||||
|
|
||||||
|
private $packages;
|
||||||
|
|
||||||
|
public function setPackages(array $packages) {
|
||||||
|
assert_instances_of($packages, 'PhabricatorPackagesPackage');
|
||||||
|
$this->packages = $packages;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPackages() {
|
||||||
|
return $this->packages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render() {
|
||||||
|
return $this->newListView();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newListView() {
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
$packages = $this->getPackages();
|
||||||
|
|
||||||
|
$list = id(new PHUIObjectItemListView())
|
||||||
|
->setViewer($viewer);
|
||||||
|
|
||||||
|
foreach ($packages as $package) {
|
||||||
|
$item = id(new PHUIObjectItemView())
|
||||||
|
->setObjectName($package->getFullKey())
|
||||||
|
->setHeader($package->getName())
|
||||||
|
->setHref($package->getURI());
|
||||||
|
|
||||||
|
$list->addItem($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorPackagesPublisherListView
|
||||||
|
extends PhabricatorPackagesView {
|
||||||
|
|
||||||
|
private $publishers;
|
||||||
|
|
||||||
|
public function setPublishers(array $publishers) {
|
||||||
|
assert_instances_of($publishers, 'PhabricatorPackagesPublisher');
|
||||||
|
$this->publishers = $publishers;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPublishers() {
|
||||||
|
return $this->publishers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render() {
|
||||||
|
return $this->newListView();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newListView() {
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
$publishers = $this->getPublishers();
|
||||||
|
|
||||||
|
$list = id(new PHUIObjectItemListView())
|
||||||
|
->setViewer($viewer);
|
||||||
|
|
||||||
|
foreach ($publishers as $publisher) {
|
||||||
|
$item = id(new PHUIObjectItemView())
|
||||||
|
->setObjectName($publisher->getPublisherKey())
|
||||||
|
->setHeader($publisher->getName())
|
||||||
|
->setHref($publisher->getURI());
|
||||||
|
|
||||||
|
$list->addItem($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorPackagesVersionListView
|
||||||
|
extends PhabricatorPackagesView {
|
||||||
|
|
||||||
|
private $versions;
|
||||||
|
|
||||||
|
public function setVersions(array $versions) {
|
||||||
|
assert_instances_of($versions, 'PhabricatorPackagesVersion');
|
||||||
|
$this->versions = $versions;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getVersions() {
|
||||||
|
return $this->versions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render() {
|
||||||
|
return $this->newListView();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newListView() {
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
$versions = $this->getVersions();
|
||||||
|
|
||||||
|
$list = id(new PHUIObjectItemListView())
|
||||||
|
->setViewer($viewer);
|
||||||
|
|
||||||
|
foreach ($versions as $version) {
|
||||||
|
$item = id(new PHUIObjectItemView())
|
||||||
|
->setHeader($version->getName())
|
||||||
|
->setHref($version->getURI());
|
||||||
|
|
||||||
|
$list->addItem($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
abstract class PhabricatorPackagesView extends AphrontView {}
|
Loading…
Reference in a new issue