Пример #1
0
def pt_comparison_tables_info_json(request,
                                   api_ver,
                                   project_id,
                                   cmp_id,
                                   group_id=None,
                                   section_id=None):
    try:
        obj = ComparisonModel.objects.get(pk=cmp_id)
    except ComparisonModel.DoesNotExist:
        raise Http404

    section_ids = [] if group_id is None and section_id is None else [
        int(section_id)
    ]

    ret = {}
    obj.tables_type = PTCmpTableType.SHOW  # override optional table hiding
    cmp_view = PTComparisonServSideView(obj, section_ids)

    for group in cmp_view.groups.values():
        for section in group.sections.values():
            if not section_ids or section.id in section_ids:
                d = {
                    'table_data': section.table_data,
                    'table_type': section.table_type,
                    'pageable': int(section.pageable),
                    'add_title': int(section.same_tag),
                }
                if section.same_tag:
                    d['title'] = list(section.tests_tags)[0]
                ret[str(section.id)] = d

    return JsonResponse(ret, safe=False)
Пример #2
0
def pt_comparison_tables_info_json(request,
                                   api_ver,
                                   project_id,
                                   cmp_id,
                                   group_id=None,
                                   section_id=None):
    try:
        obj = ComparisonModel.objects.get(pk=cmp_id)
    except ComparisonModel.DoesNotExist:
        raise Http404

    ret = {}
    cmp_view = PTComparisonServSideView(obj)

    requested_tables = [] if group_id is None and section_id is None else [
        (int(group_id), int(section_id))
    ]

    for group in cmp_view.groups.values():
        for section in group.sections.values():
            if not requested_tables or (group.id,
                                        section.id) in requested_tables:
                ret[f'{group.id}_{section.id}'] = {
                    'table_data':
                    [t.table_data for t in section.tests.values()],
                    'table_type': section.table_type,
                    'pageable': int(section.pageable),
                }

    return JsonResponse(json.dumps(ret), safe=False)
Пример #3
0
def pt_comparison_id_html(request, project_id, cmp_id):
    try:
        obj = ComparisonModel.objects.get(pk=cmp_id)
    except ComparisonModel.DoesNotExist:
        raise Http404

    # register 'range' template tag

    return pt_base_html(request, project_id, 'comparison_id.html',
                      params={'jobs': obj.jobs.all(),
                              'cmp_view': PTComparisonServSideView(obj),
                              'PTCmpChartType': PTCmpChartType,
                              'PTCmpTableType': PTCmpTableType
                              },
                      obj=obj)
Пример #4
0
def pt_comparison_id_html(request, project_id, cmp_id):
    try:
        obj = ComparisonModel.objects.get(pk=cmp_id)
    except ComparisonModel.DoesNotExist:
        raise Http404

    uuid = request.GET.get('link', '')
    data = {
        'identifiers_list': [],
        'search_pattern': '',
    }

    if uuid:
        perm_link_obj = ComparisonLink.objects.get(uuid=uuid,
                                                   project_id=project_id,
                                                   comparison_id=cmp_id)
        identifiers_list = perm_link_obj.plots_identifiers.split(
            ",") if perm_link_obj.plots_identifiers != "" else []
        data['identifiers_list'] = identifiers_list
        data['search_pattern'] = perm_link_obj.search_pattern

    # register 'range' template tag
    cmp_view = PTComparisonServSideView(obj)
    return pt_base_html(request,
                        project_id,
                        'comparison_id.html',
                        params={
                            'jobs': cmp_view.job_objs,
                            'perm_link_info': data,
                            'cmp_view': cmp_view,
                            'PTCmpChartType': PTCmpChartType,
                            'PTCmpTableType': PTCmpTableType,
                            'CHART_FUNCTION_TYPE': CHART_FUNCTION_TYPE,
                            'CHART_OUTLIERS': CHART_OUTLIERS,
                            'CHART_DEVIATION': CHART_DEVIATION,
                            'CHART_ANOMALY': CHART_ANOMALY,
                            'CHART_IS_OK': CHART_IS_OK,
                            'DEV_MODE': DEV_MODE,
                        },
                        obj=obj)
Пример #5
0
def pt_comparison_id_html(request, project_id, cmp_id):
    try:
        obj = ComparisonModel.objects.get(pk=cmp_id)
    except ComparisonModel.DoesNotExist:
        raise Http404

    # register 'range' template tag
    cmp_view = PTComparisonServSideView(obj)
    return pt_base_html(request,
                        project_id,
                        'comparison_id.html',
                        params={
                            'jobs': cmp_view.job_objs,
                            'cmp_view': cmp_view,
                            'PTCmpChartType': PTCmpChartType,
                            'PTCmpTableType': PTCmpTableType,
                            'CHART_FUNCTION_TYPE': CHART_FUNCTION_TYPE,
                            'CHART_OUTLIERS': CHART_OUTLIERS,
                            'CHART_DEVIATION': CHART_DEVIATION,
                            'CHART_ANOMALY': CHART_ANOMALY,
                            'CHART_IS_OK': CHART_IS_OK,
                            'DEV_MODE': DEV_MODE,
                        },
                        obj=obj)