@@ -168,7 +168,8 @@ export const App = {
168168 experience : 'experienced'
169169 } ,
170170 categories : { } ,
171- issues : [ ]
171+ issues : [ ] ,
172+ octokit : null
172173 }
173174 } ,
174175 computed : {
@@ -179,38 +180,59 @@ export const App = {
179180 */
180181 filteredIssues ( ) {
181182 return this . issues . filter ( issue => {
183+ // If aim is to triage issues
184+ if ( this . filters . aim === 'triage' ) {
185+ // Show all issues as they all have the label "🚦 status: awaiting triage"
186+ return true
187+ }
188+
182189 // Check experience match
183190 if ( this . filters . experience === 'beginner' && ! issue . labels . includes ( 'good first issue' ) ) {
184191 return false
185192 }
186193
187194 // Check skill set match
188195 const joinedLabels = issue . labels . join ( ',' )
189- if ( this . filters . skills . length && ! this . filters . skills . some ( skill => joinedLabels . includes ( skill ) ) ) {
190- return false
191- }
192-
193- return true
196+ return ! ( this . filters . skills . length && ! this . filters . skills . some ( skill => joinedLabels . includes ( skill ) ) ) ;
194197 } ) . sort ( ( a , b ) => b . createdAt - a . createdAt )
195198 }
196199 } ,
200+ watch : {
201+ 'filters.aim' ( to , from ) {
202+ if ( to !== from ) {
203+ this . loadIssues ( )
204+ }
205+ }
206+ } ,
207+ methods : {
208+ loadIssues ( ) {
209+ const q = [ 'org:creativecommons' , 'is:open' , 'is:issue' ]
210+ if ( this . filters . aim === 'contribute' ) {
211+ q . push ( 'label:"help wanted"' )
212+ } else if ( this . filters . aim === 'triage' ) {
213+ q . push ( 'label:"🚦 status: awaiting triage"' )
214+ }
215+ this . octokit . search . issuesAndPullRequests ( {
216+ q : q . join ( ' ' ) ,
217+ per_page : 100 ,
218+ sort : 'updated'
219+ } ) . then ( res => {
220+ this . issues = res . data . items
221+ this . issues . forEach ( issue => {
222+ issue . labels = issue . labels . map ( label => label . name )
223+
224+ const repoUrl = issue . repository_url
225+ issue . repo = repoUrl . slice ( repoUrl . lastIndexOf ( '/' ) + 1 )
226+ } )
227+ } )
228+ }
229+ } ,
197230 mounted ( ) {
198231 const BASE_URL = 'https://raw.githubusercontent.com/creativecommons/ccos-scripts/master/normalize_repos'
199232 const FILE_URL = name => `${ BASE_URL } /${ name } .json`
200233
201- const octokit = new Octokit ( ) ;
202- octokit . search . issuesAndPullRequests ( {
203- q : 'org:creativecommons is:open is:issue label:"help wanted"' ,
204- per_page : 100
205- } ) . then ( res => {
206- this . issues = res . data . items
207- this . issues . forEach ( issue => {
208- issue . labels = issue . labels . map ( label => label . name )
209-
210- const repoUrl = issue . repository_url
211- issue . repo = repoUrl . slice ( repoUrl . lastIndexOf ( '/' ) + 1 )
212- } )
213- } )
234+ this . octokit = new Octokit ( )
235+ this . loadIssues ( )
214236
215237 Promise
216238 . all ( [
0 commit comments