mirror of https://github.com/docker/docs.git
fixing search using repo info instead
This commit is contained in:
parent
cdeb9bfd4d
commit
5e41e428a6
|
@ -67,12 +67,19 @@ var NewContainer = React.createClass({
|
||||||
cache: false,
|
cache: false,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
})).then(res => res.repos).map(repo => {
|
})).then(res => res.repos).map(repo => {
|
||||||
return $.get('https://registry.hub.docker.com/v1/search?q=' + repo.repo).then(data => {
|
var query = repo.repo;
|
||||||
var results = data.results;
|
var vals = query.split('/');
|
||||||
var result = _.find(results, function (r) {
|
var official = false;
|
||||||
return r.name === repo.repo;
|
if (vals.length === 1) {
|
||||||
});
|
official = true;
|
||||||
return _.extend(result, repo);
|
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 => {
|
}).then(results => {
|
||||||
_recommended = results.filter(r => !!r);
|
_recommended = results.filter(r => !!r);
|
||||||
|
|
Loading…
Reference in New Issue