diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 3a4d0df442..1ac5528904 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2990,6 +2990,7 @@ phutil_register_library_map(array( 'PhabricatorPackagesPackageEditor' => 'applications/packages/editor/PhabricatorPackagesPackageEditor.php', 'PhabricatorPackagesPackageKeyTransaction' => 'applications/packages/xaction/package/PhabricatorPackagesPackageKeyTransaction.php', 'PhabricatorPackagesPackageListController' => 'applications/packages/controller/PhabricatorPackagesPackageListController.php', + 'PhabricatorPackagesPackageListView' => 'applications/packages/view/PhabricatorPackagesPackageListView.php', 'PhabricatorPackagesPackageNameNgrams' => 'applications/packages/storage/PhabricatorPackagesPackageNameNgrams.php', 'PhabricatorPackagesPackageNameTransaction' => 'applications/packages/xaction/package/PhabricatorPackagesPackageNameTransaction.php', 'PhabricatorPackagesPackagePHIDType' => 'applications/packages/phid/PhabricatorPackagesPackagePHIDType.php', @@ -3011,6 +3012,7 @@ phutil_register_library_map(array( 'PhabricatorPackagesPublisherEditor' => 'applications/packages/editor/PhabricatorPackagesPublisherEditor.php', 'PhabricatorPackagesPublisherKeyTransaction' => 'applications/packages/xaction/publisher/PhabricatorPackagesPublisherKeyTransaction.php', 'PhabricatorPackagesPublisherListController' => 'applications/packages/controller/PhabricatorPackagesPublisherListController.php', + 'PhabricatorPackagesPublisherListView' => 'applications/packages/view/PhabricatorPackagesPublisherListView.php', 'PhabricatorPackagesPublisherNameNgrams' => 'applications/packages/storage/PhabricatorPackagesPublisherNameNgrams.php', 'PhabricatorPackagesPublisherNameTransaction' => 'applications/packages/xaction/publisher/PhabricatorPackagesPublisherNameTransaction.php', 'PhabricatorPackagesPublisherPHIDType' => 'applications/packages/phid/PhabricatorPackagesPublisherPHIDType.php', @@ -3031,6 +3033,7 @@ phutil_register_library_map(array( 'PhabricatorPackagesVersionEditEngine' => 'applications/packages/editor/PhabricatorPackagesVersionEditEngine.php', 'PhabricatorPackagesVersionEditor' => 'applications/packages/editor/PhabricatorPackagesVersionEditor.php', 'PhabricatorPackagesVersionListController' => 'applications/packages/controller/PhabricatorPackagesVersionListController.php', + 'PhabricatorPackagesVersionListView' => 'applications/packages/view/PhabricatorPackagesVersionListView.php', 'PhabricatorPackagesVersionNameNgrams' => 'applications/packages/storage/PhabricatorPackagesVersionNameNgrams.php', 'PhabricatorPackagesVersionNameTransaction' => 'applications/packages/xaction/version/PhabricatorPackagesVersionNameTransaction.php', 'PhabricatorPackagesVersionPHIDType' => 'applications/packages/phid/PhabricatorPackagesVersionPHIDType.php', @@ -3042,6 +3045,7 @@ phutil_register_library_map(array( 'PhabricatorPackagesVersionTransactionQuery' => 'applications/packages/query/PhabricatorPackagesVersionTransactionQuery.php', 'PhabricatorPackagesVersionTransactionType' => 'applications/packages/xaction/version/PhabricatorPackagesVersionTransactionType.php', 'PhabricatorPackagesVersionViewController' => 'applications/packages/controller/PhabricatorPackagesVersionViewController.php', + 'PhabricatorPackagesView' => 'applications/packages/view/PhabricatorPackagesView.php', 'PhabricatorPagerUIExample' => 'applications/uiexample/examples/PhabricatorPagerUIExample.php', 'PhabricatorPassphraseApplication' => 'applications/passphrase/application/PhabricatorPassphraseApplication.php', 'PhabricatorPasswordAuthProvider' => 'applications/auth/provider/PhabricatorPasswordAuthProvider.php', @@ -7822,6 +7826,7 @@ phutil_register_library_map(array( 'PhabricatorPackagesPackageEditor' => 'PhabricatorPackagesEditor', 'PhabricatorPackagesPackageKeyTransaction' => 'PhabricatorPackagesPackageTransactionType', 'PhabricatorPackagesPackageListController' => 'PhabricatorPackagesPackageController', + 'PhabricatorPackagesPackageListView' => 'PhabricatorPackagesView', 'PhabricatorPackagesPackageNameNgrams' => 'PhabricatorPackagesNgrams', 'PhabricatorPackagesPackageNameTransaction' => 'PhabricatorPackagesPackageTransactionType', 'PhabricatorPackagesPackagePHIDType' => 'PhabricatorPHIDType', @@ -7852,6 +7857,7 @@ phutil_register_library_map(array( 'PhabricatorPackagesPublisherEditor' => 'PhabricatorPackagesEditor', 'PhabricatorPackagesPublisherKeyTransaction' => 'PhabricatorPackagesPublisherTransactionType', 'PhabricatorPackagesPublisherListController' => 'PhabricatorPackagesPublisherController', + 'PhabricatorPackagesPublisherListView' => 'PhabricatorPackagesView', 'PhabricatorPackagesPublisherNameNgrams' => 'PhabricatorPackagesNgrams', 'PhabricatorPackagesPublisherNameTransaction' => 'PhabricatorPackagesPublisherTransactionType', 'PhabricatorPackagesPublisherPHIDType' => 'PhabricatorPHIDType', @@ -7882,6 +7888,7 @@ phutil_register_library_map(array( 'PhabricatorPackagesVersionEditEngine' => 'PhabricatorPackagesEditEngine', 'PhabricatorPackagesVersionEditor' => 'PhabricatorPackagesEditor', 'PhabricatorPackagesVersionListController' => 'PhabricatorPackagesVersionController', + 'PhabricatorPackagesVersionListView' => 'PhabricatorPackagesView', 'PhabricatorPackagesVersionNameNgrams' => 'PhabricatorPackagesNgrams', 'PhabricatorPackagesVersionNameTransaction' => 'PhabricatorPackagesVersionTransactionType', 'PhabricatorPackagesVersionPHIDType' => 'PhabricatorPHIDType', @@ -7893,6 +7900,7 @@ phutil_register_library_map(array( 'PhabricatorPackagesVersionTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 'PhabricatorPackagesVersionTransactionType' => 'PhabricatorPackagesTransactionType', 'PhabricatorPackagesVersionViewController' => 'PhabricatorPackagesVersionController', + 'PhabricatorPackagesView' => 'AphrontView', 'PhabricatorPagerUIExample' => 'PhabricatorUIExample', 'PhabricatorPassphraseApplication' => 'PhabricatorApplication', 'PhabricatorPasswordAuthProvider' => 'PhabricatorAuthProvider', diff --git a/src/applications/packages/controller/PhabricatorPackagesPackageViewController.php b/src/applications/packages/controller/PhabricatorPackagesPackageViewController.php index f0a9483a28..a79f5d3b4e 100644 --- a/src/applications/packages/controller/PhabricatorPackagesPackageViewController.php +++ b/src/applications/packages/controller/PhabricatorPackagesPackageViewController.php @@ -32,14 +32,21 @@ final class PhabricatorPackagesPackageViewController $header = $this->buildHeaderView($package); $curtain = $this->buildCurtain($package); + $versions_view = $this->buildVersionsView($package); + $timeline = $this->buildTransactionTimeline( $package, new PhabricatorPackagesPackageTransactionQuery()); + $timeline->setShouldTerminate(true); $package_view = id(new PHUITwoColumnView()) ->setHeader($header) ->setCurtain($curtain) - ->setMainColumn($timeline); + ->setMainColumn( + array( + $versions_view, + $timeline, + )); return $this->newPage() ->setCrumbs($crumbs) @@ -84,4 +91,39 @@ final class PhabricatorPackagesPackageViewController 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; + } } diff --git a/src/applications/packages/controller/PhabricatorPackagesPublisherViewController.php b/src/applications/packages/controller/PhabricatorPackagesPublisherViewController.php index fad00ad665..f0df21e93f 100644 --- a/src/applications/packages/controller/PhabricatorPackagesPublisherViewController.php +++ b/src/applications/packages/controller/PhabricatorPackagesPublisherViewController.php @@ -29,14 +29,21 @@ final class PhabricatorPackagesPublisherViewController $header = $this->buildHeaderView($publisher); $curtain = $this->buildCurtain($publisher); + $packages_view = $this->buildPackagesView($publisher); + $timeline = $this->buildTransactionTimeline( $publisher, new PhabricatorPackagesPublisherTransactionQuery()); + $timeline->setShouldTerminate(true); $publisher_view = id(new PHUITwoColumnView()) ->setHeader($header) ->setCurtain($curtain) - ->setMainColumn($timeline); + ->setMainColumn( + array( + $packages_view, + $timeline, + )); return $this->newPage() ->setCrumbs($crumbs) @@ -81,4 +88,40 @@ final class PhabricatorPackagesPublisherViewController 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; + } + } diff --git a/src/applications/packages/controller/PhabricatorPackagesVersionViewController.php b/src/applications/packages/controller/PhabricatorPackagesVersionViewController.php index bf2abd1920..f2aacea057 100644 --- a/src/applications/packages/controller/PhabricatorPackagesVersionViewController.php +++ b/src/applications/packages/controller/PhabricatorPackagesVersionViewController.php @@ -39,6 +39,7 @@ final class PhabricatorPackagesVersionViewController $timeline = $this->buildTransactionTimeline( $version, new PhabricatorPackagesVersionTransactionQuery()); + $timeline->setShouldTerminate(true); $version_view = id(new PHUITwoColumnView()) ->setHeader($header) diff --git a/src/applications/packages/query/PhabricatorPackagesPackageSearchEngine.php b/src/applications/packages/query/PhabricatorPackagesPackageSearchEngine.php index 2ba031b057..e01c8db503 100644 --- a/src/applications/packages/query/PhabricatorPackagesPackageSearchEngine.php +++ b/src/applications/packages/query/PhabricatorPackagesPackageSearchEngine.php @@ -74,19 +74,12 @@ final class PhabricatorPackagesPackageSearchEngine array $handles) { assert_instances_of($packages, 'PhabricatorPackagesPackage'); - $viewer = $this->requireViewer(); - $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); - } + $list = id(new PhabricatorPackagesPackageListView()) + ->setViewer($viewer) + ->setPackages($packages) + ->newListView(); return id(new PhabricatorApplicationSearchResultView()) ->setObjectList($list) diff --git a/src/applications/packages/query/PhabricatorPackagesPublisherSearchEngine.php b/src/applications/packages/query/PhabricatorPackagesPublisherSearchEngine.php index 4914fbef9e..f11738f730 100644 --- a/src/applications/packages/query/PhabricatorPackagesPublisherSearchEngine.php +++ b/src/applications/packages/query/PhabricatorPackagesPublisherSearchEngine.php @@ -67,16 +67,10 @@ final class PhabricatorPackagesPublisherSearchEngine $viewer = $this->requireViewer(); - $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); - } + $list = id(new PhabricatorPackagesPublisherListView()) + ->setViewer($viewer) + ->setPublishers($publishers) + ->newListView(); return id(new PhabricatorApplicationSearchResultView()) ->setObjectList($list) diff --git a/src/applications/packages/query/PhabricatorPackagesVersionSearchEngine.php b/src/applications/packages/query/PhabricatorPackagesVersionSearchEngine.php index 368e7bf02f..da1581bf80 100644 --- a/src/applications/packages/query/PhabricatorPackagesVersionSearchEngine.php +++ b/src/applications/packages/query/PhabricatorPackagesVersionSearchEngine.php @@ -73,18 +73,12 @@ final class PhabricatorPackagesVersionSearchEngine array $handles) { assert_instances_of($versions, 'PhabricatorPackagesVersion'); - $viewer = $this->requireViewer(); - $list = id(new PHUIObjectItemListView()) - ->setViewer($viewer); - foreach ($versions as $version) { - $item = id(new PHUIObjectItemView()) - ->setHeader($version->getName()) - ->setHref($version->getURI()); - - $list->addItem($item); - } + $list = id(new PhabricatorPackagesVersionListView()) + ->setViewer($viewer) + ->setVersions($versions) + ->newListView(); return id(new PhabricatorApplicationSearchResultView()) ->setObjectList($list) diff --git a/src/applications/packages/view/PhabricatorPackagesPackageListView.php b/src/applications/packages/view/PhabricatorPackagesPackageListView.php new file mode 100644 index 0000000000..78022bde38 --- /dev/null +++ b/src/applications/packages/view/PhabricatorPackagesPackageListView.php @@ -0,0 +1,41 @@ +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; + } + +} diff --git a/src/applications/packages/view/PhabricatorPackagesPublisherListView.php b/src/applications/packages/view/PhabricatorPackagesPublisherListView.php new file mode 100644 index 0000000000..fe7b2b37e4 --- /dev/null +++ b/src/applications/packages/view/PhabricatorPackagesPublisherListView.php @@ -0,0 +1,41 @@ +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; + } + +} diff --git a/src/applications/packages/view/PhabricatorPackagesVersionListView.php b/src/applications/packages/view/PhabricatorPackagesVersionListView.php new file mode 100644 index 0000000000..45840016ee --- /dev/null +++ b/src/applications/packages/view/PhabricatorPackagesVersionListView.php @@ -0,0 +1,40 @@ +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; + } + +} diff --git a/src/applications/packages/view/PhabricatorPackagesView.php b/src/applications/packages/view/PhabricatorPackagesView.php new file mode 100644 index 0000000000..88cc6730cb --- /dev/null +++ b/src/applications/packages/view/PhabricatorPackagesView.php @@ -0,0 +1,3 @@ +