Esempio n. 1
0
    def view(self, request, repoid):
        start = datetime.datetime.now()
        repo = Repo.objects.select_related("server", "platform").prefetch_related("components", "containers", "projects", "note_set", "platform__issuetracker_set", "graph_set").get(pk = repoid)
        filter_repos = set(request.GET.getlist("repo", None))
        filter_meta = _get_filter_meta(request.GET)
        packages = request.GET.getlist("packages", None)
        if request.GET.get('digraph', False):
            dot = _get_dot([repo], None, packages, int(request.GET.get('depth', 1)), int(request.GET.get('direction', 0)))
            return HttpResponse(dot, content_type='text/vnd.graphviz')
        end = datetime.datetime.now() - start
        context = {
            "title": "Repository details",
            "opts": self.model._meta,
            "app_label": self.model._meta.app_label,
            'container' : repo,
            'container_packages' : _regroup_repo_packages(repo, pkgs=packages, repos=filter_repos, meta=filter_meta),
            'notes' : list(repo.note_set.all()),
            'issue_ref' : json.dumps([ {'name' : i.name, 're' : i.re, 'url' : i.url} for i in repo.platform.issuetracker_set.all() ]),
            'graphs' : list(repo.graph_set.all()),
            'packagemetatypes' : list(PackageMetaType.objects.all()),
            'request' : request,
            'is_popup' : request.GET.get('is_popup', False),
            'details' : request.GET.get('details', False),
            'processing_time' : end.total_seconds(),
        }

        return TemplateResponse(request, 'view.html', context = context, current_app=self.admin_site.name)
Esempio n. 2
0
    def view(self, request, repoid):
        start = datetime.datetime.now()
        repo = Repo.objects.select_related("server",
                                           "platform").prefetch_related(
                                               "components", "containers",
                                               "projects", "note_set",
                                               "platform__issuetracker_set",
                                               "graph_set").get(pk=repoid)
        filter_repos = set(request.GET.getlist("repo", None))
        filter_meta = _get_filter_meta(request.GET)
        packages = request.GET.getlist("packages", None)
        if request.GET.get('digraph', False):
            dot = _get_dot([repo], None, packages,
                           int(request.GET.get('depth', 1)),
                           int(request.GET.get('direction', 0)))
            return HttpResponse(dot, content_type='text/vnd.graphviz')
        end = datetime.datetime.now() - start
        context = {
            "title":
            "Repository details",
            "opts":
            self.model._meta,
            "app_label":
            self.model._meta.app_label,
            'container':
            repo,
            'container_packages':
            _regroup_repo_packages(repo,
                                   pkgs=packages,
                                   repos=filter_repos,
                                   meta=filter_meta),
            'notes':
            list(repo.note_set.all()),
            'issue_ref':
            json.dumps([{
                'name': i.name,
                're': i.re,
                'url': i.url
            } for i in repo.platform.issuetracker_set.all()]),
            'graphs':
            list(repo.graph_set.all()),
            'packagemetatypes':
            list(PackageMetaType.objects.all()),
            'request':
            request,
            'is_popup':
            request.GET.get('is_popup', False),
            'details':
            request.GET.get('details', False),
            'processing_time':
            end.total_seconds(),
        }

        return TemplateResponse(request,
                                'view.html',
                                context=context,
                                current_app=self.admin_site.name)
Esempio n. 3
0
    def view(self, request, imageid):
        img = Image.objects.select_related("container_repo").prefetch_related(
            "repo", "container_repo__platform").get(pk=imageid)
        issue_ref = []
        for repo in img.repo.all():
            for i in repo.platform.issuetracker_set.all():
                issue_ref.append({'name': i.name, 're': i.re, 'url': i.url})
        graphs = Graph.objects.filter(image__pk=img.id,
                                      packages__in=[None, ""])

        filter_repos = set(request.GET.getlist("repo", None))
        filter_meta = _get_filter_meta(request.GET)

        context = {
            "title":
            "Image details",
            "opts":
            self.model._meta,
            "app_label":
            self.model._meta.app_label,
            'issue_ref':
            json.dumps(issue_ref),
            'container':
            img,
            'container_packages':
            _regroup_repo_packages(img.container_repo,
                                   pkgs=img.packages.keys(),
                                   repos=filter_repos,
                                   meta=filter_meta),
            'graphs':
            graphs,
            'packagemetatypes':
            list(PackageMetaType.objects.all()),
            'is_popup':
            request.GET.get('is_popup', False),
        }
        return TemplateResponse(request,
                                'view.html',
                                context=context,
                                current_app=self.admin_site.name)
Esempio n. 4
0
    def view(self, request, imageid):
        img = Image.objects.select_related("container_repo").prefetch_related("repo", "container_repo__platform").get(pk = imageid)
        issue_ref = []
        for repo in img.repo.all():
            for i in repo.platform.issuetracker_set.all():
                issue_ref.append({'name' : i.name, 're' : i.re, 'url' : i.url})
        graphs = Graph.objects.filter(image__pk = img.id, packages__in=[None,""])

        filter_repos = set(request.GET.getlist("repo", None))
        filter_meta = _get_filter_meta(request.GET)

        context = {
            "title": "Image details",
            "opts": self.model._meta,
            "app_label": self.model._meta.app_label,
            'issue_ref' : json.dumps(issue_ref),
            'container' : img,
            'container_packages' : _regroup_repo_packages(img.container_repo, pkgs=img.packages.keys(), repos=filter_repos, meta=filter_meta),
            'graphs' : graphs,
            'packagemetatypes' : list(PackageMetaType.objects.all()),
            'is_popup' : request.GET.get('is_popup', False),
        }
        return TemplateResponse(request, 'view.html', context = context, current_app=self.admin_site.name)