@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Restore "Limit" to dashboard Query panels

Summary: See PHI1220. Ref T13272. I accidentally left the ability to set a query limit behind when updating this.

Test Plan: Edited a query panel, set/removed the limit, tried to set an invalid limit.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13272

Differential Revision: https://secure.phabricator.com/D20472

+57
+2
src/__phutil_library_map__.php
··· 3007 3007 'PhabricatorDashboardQueryPanelApplicationEditField' => 'applications/dashboard/editfield/PhabricatorDashboardQueryPanelApplicationEditField.php', 3008 3008 'PhabricatorDashboardQueryPanelApplicationTransaction' => 'applications/dashboard/xaction/panel/PhabricatorDashboardQueryPanelApplicationTransaction.php', 3009 3009 'PhabricatorDashboardQueryPanelInstallController' => 'applications/dashboard/controller/PhabricatorDashboardQueryPanelInstallController.php', 3010 + 'PhabricatorDashboardQueryPanelLimitTransaction' => 'applications/dashboard/xaction/panel/PhabricatorDashboardQueryPanelLimitTransaction.php', 3010 3011 'PhabricatorDashboardQueryPanelQueryEditField' => 'applications/dashboard/editfield/PhabricatorDashboardQueryPanelQueryEditField.php', 3011 3012 'PhabricatorDashboardQueryPanelQueryTransaction' => 'applications/dashboard/xaction/panel/PhabricatorDashboardQueryPanelQueryTransaction.php', 3012 3013 'PhabricatorDashboardQueryPanelType' => 'applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php', ··· 9045 9046 'PhabricatorDashboardQueryPanelApplicationEditField' => 'PhabricatorEditField', 9046 9047 'PhabricatorDashboardQueryPanelApplicationTransaction' => 'PhabricatorDashboardPanelPropertyTransaction', 9047 9048 'PhabricatorDashboardQueryPanelInstallController' => 'PhabricatorDashboardController', 9049 + 'PhabricatorDashboardQueryPanelLimitTransaction' => 'PhabricatorDashboardPanelPropertyTransaction', 9048 9050 'PhabricatorDashboardQueryPanelQueryEditField' => 'PhabricatorEditField', 9049 9051 'PhabricatorDashboardQueryPanelQueryTransaction' => 'PhabricatorDashboardPanelPropertyTransaction', 9050 9052 'PhabricatorDashboardQueryPanelType' => 'PhabricatorDashboardPanelType',
+8
src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php
··· 41 41 PhabricatorDashboardQueryPanelQueryTransaction::TRANSACTIONTYPE) 42 42 ->setValue($panel->getProperty('key', '')); 43 43 44 + $limit_field = id(new PhabricatorIntEditField()) 45 + ->setKey('limit') 46 + ->setLabel(pht('Limit')) 47 + ->setTransactionType( 48 + PhabricatorDashboardQueryPanelLimitTransaction::TRANSACTIONTYPE) 49 + ->setValue($panel->getProperty('limit')); 50 + 44 51 return array( 45 52 $application_field, 46 53 $query_field, 54 + $limit_field, 47 55 ); 48 56 } 49 57
+43
src/applications/dashboard/xaction/panel/PhabricatorDashboardQueryPanelLimitTransaction.php
··· 1 + <?php 2 + 3 + final class PhabricatorDashboardQueryPanelLimitTransaction 4 + extends PhabricatorDashboardPanelPropertyTransaction { 5 + 6 + const TRANSACTIONTYPE = 'search.limit'; 7 + 8 + protected function getPropertyKey() { 9 + return 'limit'; 10 + } 11 + 12 + public function generateNewValue($object, $value) { 13 + if (!$value) { 14 + return null; 15 + } 16 + 17 + return $value; 18 + } 19 + 20 + public function validateTransactions($object, array $xactions) { 21 + $errors = array(); 22 + 23 + $old_value = $object->getProperty($this->getPropertyKey()); 24 + foreach ($xactions as $xaction) { 25 + $new_value = $xaction->getNewValue(); 26 + 27 + if ($new_value === $old_value) { 28 + continue; 29 + } 30 + 31 + if ($new_value < 0) { 32 + $errors[] = $this->newInvalidError( 33 + pht( 34 + 'Query result limit must be empty, or at least 1.'), 35 + $xaction); 36 + continue; 37 + } 38 + } 39 + 40 + return $errors; 41 + } 42 + 43 + }
+4
src/applications/transactions/editfield/PhabricatorIntEditField.php
··· 7 7 return new AphrontFormTextControl(); 8 8 } 9 9 10 + protected function newHTTPParameterType() { 11 + return new AphrontIntHTTPParameterType(); 12 + } 13 + 10 14 protected function newConduitParameterType() { 11 15 return new ConduitIntParameterType(); 12 16 }