|
|
@ -1671,12 +1671,46 @@ function initVueComponents(){ |
|
|
|
reposTotalCount: 0, |
|
|
|
reposTotalCount: 0, |
|
|
|
reposFilter: 'all', |
|
|
|
reposFilter: 'all', |
|
|
|
searchQuery: '', |
|
|
|
searchQuery: '', |
|
|
|
isLoading: false |
|
|
|
isLoading: false, |
|
|
|
|
|
|
|
repoTypes: { |
|
|
|
|
|
|
|
'all': { |
|
|
|
|
|
|
|
count: 0, |
|
|
|
|
|
|
|
searchMode: '', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'forks': { |
|
|
|
|
|
|
|
count: 0, |
|
|
|
|
|
|
|
searchMode: 'fork', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'mirrors': { |
|
|
|
|
|
|
|
count: 0, |
|
|
|
|
|
|
|
searchMode: 'mirror', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'sources': { |
|
|
|
|
|
|
|
count: 0, |
|
|
|
|
|
|
|
searchMode: 'source', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'collaborative': { |
|
|
|
|
|
|
|
count: 0, |
|
|
|
|
|
|
|
searchMode: 'collaborative', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
computed: { |
|
|
|
|
|
|
|
showMoreReposLink: function() { |
|
|
|
|
|
|
|
return this.repos.length > 0 && this.repos.length < this.repoTypes[this.reposFilter].count; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
searchURL: function() { |
|
|
|
|
|
|
|
return this.suburl + '/api/v1/repos/search?uid=' + this.uid + '&q=' + this.searchQuery + '&limit=' + this.searchLimit + '&mode=' + this.repoTypes[this.reposFilter].searchMode + (this.reposFilter !== 'all' ? '&exclusive=1' : ''); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
repoTypeCount: function() { |
|
|
|
|
|
|
|
return this.repoTypes[this.reposFilter].count; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
mounted: function() { |
|
|
|
mounted: function() { |
|
|
|
this.searchRepos(); |
|
|
|
this.searchRepos(this.reposFilter); |
|
|
|
|
|
|
|
|
|
|
|
var self = this; |
|
|
|
var self = this; |
|
|
|
Vue.nextTick(function() { |
|
|
|
Vue.nextTick(function() { |
|
|
@ -1691,6 +1725,9 @@ function initVueComponents(){ |
|
|
|
|
|
|
|
|
|
|
|
changeReposFilter: function(filter) { |
|
|
|
changeReposFilter: function(filter) { |
|
|
|
this.reposFilter = filter; |
|
|
|
this.reposFilter = filter; |
|
|
|
|
|
|
|
this.repos = []; |
|
|
|
|
|
|
|
this.repoTypes[filter].count = 0; |
|
|
|
|
|
|
|
this.searchRepos(filter); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
showRepo: function(repo, filter) { |
|
|
|
showRepo: function(repo, filter) { |
|
|
@ -1708,28 +1745,31 @@ function initVueComponents(){ |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
searchRepos: function() { |
|
|
|
searchRepos: function(reposFilter) { |
|
|
|
var self = this; |
|
|
|
var self = this; |
|
|
|
|
|
|
|
|
|
|
|
this.isLoading = true; |
|
|
|
this.isLoading = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var searchedMode = this.repoTypes[reposFilter].searchMode; |
|
|
|
|
|
|
|
var searchedURL = this.searchURL; |
|
|
|
var searchedQuery = this.searchQuery; |
|
|
|
var searchedQuery = this.searchQuery; |
|
|
|
$.getJSON(this.searchURL(), function(result, textStatus, request) { |
|
|
|
|
|
|
|
if (searchedQuery == self.searchQuery) { |
|
|
|
$.getJSON(searchedURL, function(result, textStatus, request) { |
|
|
|
|
|
|
|
if (searchedURL == self.searchURL) { |
|
|
|
self.repos = result.data; |
|
|
|
self.repos = result.data; |
|
|
|
if (searchedQuery == "") { |
|
|
|
var count = request.getResponseHeader('X-Total-Count'); |
|
|
|
self.reposTotalCount = request.getResponseHeader('X-Total-Count'); |
|
|
|
if (searchedQuery === '' && searchedMode === '') { |
|
|
|
|
|
|
|
self.reposTotalCount = count; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
self.repoTypes[reposFilter].count = count; |
|
|
|
} |
|
|
|
} |
|
|
|
}).always(function() { |
|
|
|
}).always(function() { |
|
|
|
if (searchedQuery == self.searchQuery) { |
|
|
|
if (searchedURL == self.searchURL) { |
|
|
|
self.isLoading = false; |
|
|
|
self.isLoading = false; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
searchURL: function() { |
|
|
|
|
|
|
|
return this.suburl + '/api/v1/repos/search?uid=' + this.uid + '&q=' + this.searchQuery + '&limit=' + this.searchLimit; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
repoClass: function(repo) { |
|
|
|
repoClass: function(repo) { |
|
|
|
if (repo.fork) { |
|
|
|
if (repo.fork) { |
|
|
|
return 'octicon octicon-repo-forked'; |
|
|
|
return 'octicon octicon-repo-forked'; |
|
|
|