fixing search using repo info instead

This commit is contained in:
Jeffrey Morgan 2015-03-06 13:16:46 -05:00
Родитель cdeb9bfd4d
Коммит 5e41e428a6
1 изменённых файлов: 13 добавлений и 6 удалений

Просмотреть файл

@ -67,12 +67,19 @@ var NewContainer = React.createClass({
cache: false,
dataType: 'json',
})).then(res => res.repos).map(repo => {
return $.get('https://registry.hub.docker.com/v1/search?q=' + repo.repo).then(data => {
var results = data.results;
var result = _.find(results, function (r) {
return r.name === repo.repo;
});
return _.extend(result, repo);
var query = repo.repo;
var vals = query.split('/');
var official = false;
if (vals.length === 1) {
official = true;
query = 'library/' + vals[0];
}
return $.get('https://registry.hub.docker.com/v1/repositories_info/' + query).then(data => {
var res = _.extend(data, repo);
res.description = data.short_description;
res.is_official = data.is_official || official;
res.name = data.repo;
return res;
});
}).then(results => {
_recommended = results.filter(r => !!r);