def tags(self, pid=None, tid=None, dfrom=None, dto=None, inc_repos=None): t = Tags(index.Connector()) projects_index = Projects() query_kwargs = utils.resolv_filters(projects_index, None, pid, tid, None, None, dfrom, dto, inc_repos, None, None, None, None) p_filter = [":".join(r.split(':')[:-1]) for r in query_kwargs['repos']] dfrom = query_kwargs['fromdate'] dto = query_kwargs['todate'] ret = [r['_source'] for r in t.get_tags(p_filter, dfrom, dto)] # TODO: if tid is given we can include user defined releases # for repo tagged with tid. if not pid: return ret # now append user defined releases ur = {} project = projects_index.get_projects()[pid] for repo in project['repos']: if 'releases' in repo: for release in repo['releases']: ur[release['name']] = { 'name': release['name'], 'date': release['date'], 'repo': repo['name'] } for rel in ur.values(): ret.append(rel) return ret
def get_projects(self): projects_index = Projects() projects = projects_index.get_projects() projects = OrderedDict( sorted(projects.items(), key=lambda t: t[0])) tags = projects_index.get_tags() return {'projects': projects, 'tags': tags.keys()}
def get_status(self): projects_index = Projects() projects = projects_index.get_projects(source=['name', 'refs']) num_projects = len(projects) num_repos = len(set([ ref['name'] for ref in itertools.chain( *[p['refs'] for p in list(projects.values())])])) return {'customtext': index_custom_html, 'projects': num_projects, 'repos': num_repos, 'users_endpoint': conf.get('users_endpoint', False), 'version': rx_version}
def projects(self, pid=None): projects_index = Projects() if pid: project = projects_index.get(pid) if not project: abort(404, detail="Project ID has not been found") return {pid: projects_index.get(pid)} else: projects = projects_index.get_projects( source=['name', 'description', 'logo', 'refs']) _projects = OrderedDict( sorted(projects.items(), key=lambda t: t[0])) return {'projects': _projects, 'tags': projects_index.get_tags()}
def get_repos(self, pid=None, tid=None): projects_index = Projects() if pid: repos = projects_index.get_projects().get(pid) elif tid: repos = projects_index.get_tags().get(tid) else: abort(404, detail="A tag ID or project ID must be passed as parameter") if repos is None: abort(404, detail='Project ID or Tag ID has not been found') return repos
def get_status(self): projects_index = Projects() projects = projects_index.get_projects(source=['name', 'refs']) num_projects = len(projects) num_repos = len( set([ ref['name'] for ref in itertools.chain( *[p['refs'] for p in projects.values()]) ])) return { 'customtext': index_custom_html, 'projects': num_projects, 'repos': num_repos, 'users_endpoint': conf.get('users_endpoint', False), 'version': rx_version }