Page MenuHomePhorge

Convert tokens given to use SearchEngine
ClosedPublic

Authored by taavi on Tue, Feb 4, 13:11.
Tags
None
Referenced Files
F2992937: D25863.1740261254.diff
Fri, Feb 21, 21:54
F2992670: D25863.1740240665.diff
Fri, Feb 21, 16:11
F2985551: D25863.1740067720.diff
Wed, Feb 19, 16:08
F2981731: D25863.1739926164.diff
Tue, Feb 18, 00:49
F2980131: D25863.1739875681.diff
Mon, Feb 17, 10:48
F2978042: D25863.1739661557.diff
Fri, Feb 14, 23:19
F2978041: D25863.1739661418.diff
Fri, Feb 14, 23:16
F2977661: D25863.1739641951.diff
Fri, Feb 14, 17:52

Details

Summary

Now the page /token/given/ allows to sort tokens by newest (default) and oldest.
The default sort is unchanged.

The given tokens are also now easily usable into any Dashboard.

This introduces creative space to add future filters.

refs T15988

Test Plan

Tested that /token/ still renders fine.

Order by Creation (Newest First): it works.

Order by Creation (Oldest First): it works.

Activate the DarkConsole's top bar and open the tab Services to inspect the generated queries, that are like this, and not anything alien,
accordingly to the current "order by":

SELECT * FROM `token_given`      ORDER BY `id` DESC LIMIT 101
SELECT * FROM `token_given`      ORDER BY `id` ASC LIMIT 101

Test the page /token/given/ as logged-out: it the Tokens app is configured as public, it still works like before.

From the page /token/given/ order by "Creation (oldest first)", use Use ResultsAdd Dashboard and see that it works.

From the same Dashboard: Create PanelQuery Panel and select "Tokens Given" with Limit=1 and title "Most Recent Tokenzzz" and see that it works as expected.

Visit the Leader Board page at /token/leaders/: it still works like before.

Diff Detail

Repository
rP Phorge
Branch
tokens-search
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1683
Build 1683: arc lint + arc unit

Event Timeline

taavi requested review of this revision.Tue, Feb 4, 13:11

It works on my computer but I see that in the left sidebar usually there is "Queries" 🤔 instead it seems to work for ManiphestController and similar ones

OK probably just this is missing

diff --git a/src/applications/tokens/controller/PhabricatorTokenController.php b/src/applications/tokens/controller/PhabricatorTokenController.php
index 8cd61b92b6..c1ff7408aa 100644
--- a/src/applications/tokens/controller/PhabricatorTokenController.php
+++ b/src/applications/tokens/controller/PhabricatorTokenController.php
@@ -3,9 +3,15 @@
 abstract class PhabricatorTokenController extends PhabricatorController {
 
   protected function buildSideNav() {
+    $viewer = $this->getViewer();
+
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
 
+    id(new PhabricatorTokenGivenSearchEngine())
+      ->setViewer($viewer)
+      ->addNavigationItems($nav->getMenu());
+
     $nav->addLabel(pht('Tokens'));
     $nav->addFilter('given/', pht('Tokens Given'));
     $nav->addFilter('leaders/', pht('Leader Board'));

If you want to easily try that missing piece I can add it with a little cute amend (keeping your authorship). We can always rollback the patch if you don't like the result or if it creates a nuclear weapon. Sounds OK?

Add searches to navigation menu

If you want to easily try that missing piece I can add it with a little cute amend (keeping your authorship). We can always rollback the patch if you don't like the result or if it creates a nuclear weapon. Sounds OK?

I did that in PhabricatorTokenGivenController since I don't think that menu should show up on the token leaderboard. WDYT?

valerio.bozzolan edited the test plan for this revision. (Show Details)
valerio.bozzolan edited the test plan for this revision. (Show Details)

sgtm

Thaaanks taavi! Known non-issue: somebody may wonder why in Maniphest the "Queries" are listed before other things. I may answer that in Phame the "Queries" are listed after other things. So this is consistent with Phame /phame/post/ page. lol

Please wait at least next Wednesday before landing, so to attract more eyeballs and maybe receive suggestions to expand the test plan. But seems very Phorgi to me.

This revision is now accepted and ready to land.Wed, Feb 5, 16:03