@@ -93,50 +93,82 @@ class CustomSubNavigationBar(Component):
9393
9494 implements (INavigationContributor )
9595
96+ queues = [
97+ {
98+ "name" : "unreviewed" ,
99+ "label" : "Needs Triage" ,
100+ "params" : "stage=Unreviewed&status=!closed&order=changetime&desc=1" ,
101+ },
102+ {
103+ "name" : "needs_patch" ,
104+ "label" : "Needs Patch" ,
105+ "params" : "has_patch=0&stage=Accepted&status=!closed&order=changetime&desc=1" ,
106+ },
107+ {
108+ "name" : "needs_pr_review" ,
109+ "label" : "Needs PR Review" ,
110+ "params" : (
111+ "has_patch=1&needs_better_patch=0&needs_docs=0&needs_tests=0&stage=Accepted"
112+ "&status=!closed&order=changetime&desc=1"
113+ ),
114+ },
115+ {
116+ "name" : "waiting_on_author" ,
117+ "label" : "Waiting On Author" ,
118+ "params" : (
119+ "has_patch=1&needs_better_patch=1&stage=Accepted&status=assigned"
120+ "&status=new&or&has_patch=1&needs_docs=1&stage=Accepted&status=assigned"
121+ "&status=new&or&has_patch=1&needs_better_patch=1&stage=Accepted"
122+ "&status=assigned&status=new&order=changetime&desc=1"
123+ ),
124+ },
125+ {
126+ "name" : "ready_for_checkin" ,
127+ "label" : "Ready For Checkin" ,
128+ "params" : "stage=Ready+for+checkin&status=!closed&order=changetime&desc=1" ,
129+ },
130+ ]
131+
96132 def get_active_navigation_item (self , req ):
97133 stage = req .args .get ("stage" )
98134 has_patch = req .args .get ("has_patch" )
99135 needs_better_patch = req .args .get ("needs_better_patch" )
136+ needs_docs = req .args .get ("needs_docs" )
137+ needs_tests = req .args .get ("needs_tests" )
100138
101- if stage == "Ready+for+checkin" :
139+ if stage == "Unreviewed" :
140+ return "unreviewed"
141+ if stage == "Ready for checkin" :
102142 return "ready_for_checkin"
103143 if stage == "Accepted" and has_patch == "0" :
104144 return "needs_patch"
105- if stage == "Accepted" and has_patch == "1" and needs_better_patch == "0" :
106- return "needs_review"
107- if stage == "Accepted" and has_patch == "1" and needs_better_patch == "1" :
145+ if (stage == "Accepted" and has_patch == "1" and needs_better_patch == "0"
146+ and needs_docs == "0" and needs_tests == "0"
147+ ):
148+ return "needs_pr_review"
149+ if stage == "Accepted" and has_patch == "1" :
108150 return "waiting_on_author"
109151
110- return "unreviewed"
152+ return ""
153+
154+ def _get_active_class (self , active_item , subnav_name ):
155+ return 'active' if active_item == subnav_name else None
111156
112157 def get_navigation_items (self , req ):
113- return [
114- (
115- "subnav" ,
116- "unreviewed" ,
117- tag .a ("Needs Triage" , href = "/query?stage=Unreviewed&status=!closed&order=changetime&desc=1" ),
118- ),
119- (
120- "subnav" ,
121- "needs_patch" ,
122- tag .a ("Needs Patch" , href = "/query?has_patch=0&stage=Accepted&status=!closed&order=changetime&desc=1" ),
123- ),
124- (
125- "subnav" ,
126- "needs_review" ,
127- tag .a ("Needs PR Review" , href = "/query?has_patch=1&needs_better_patch=0&needs_docs=0&needs_tests=0&stage=Accepted&status=!closed&order=changetime&desc=1" ),
128- ),
129- (
130- "subnav" ,
131- "waiting_on_author" ,
132- tag .a ("Waiting On Author" , href = "/query?has_patch=0&stage=Accepted&status=!closed&or&needs_better_patch=1&stage=Accepted&status=!closed&or&needs_docs=1&stage=Accepted&status=!closed&or&needs_tests=1&stage=Accepted&status=!closed&order=priority" ),
133- ),
134- (
135- "subnav" ,
136- "ready_for_checkin" ,
137- tag .a ("Ready For Checkin" , href = "/query?stage=Ready+for+checkin&status=!closed&order=changetime&desc=1" ),
138- ),
139- ]
158+ if req .path_info .startswith ('/query' ):
159+ active_item = self .get_active_navigation_item (req )
160+ return [
161+ (
162+ "subnav" ,
163+ queue ["name" ],
164+ tag .a (
165+ queue ["label" ],
166+ href = "/query?" + queue ["params" ],
167+ class_ = self ._get_active_class (active_item , queue ["name" ]),
168+ ),
169+ )
170+ for queue in self .queues
171+ ]
140172
141173
142174class GitHubBrowserWithSVNChangesets (GitHubBrowser ):
0 commit comments