def get_benchmark_executions_quick_page(request):
    """ Returns the view for the executions quick page """
    if request.method != 'GET':
        return res.get_template_data(request, 'presenter/not_found.html', {})

    control1 = {}
    control1['name'] = ' Quick View'
    control1['link'] = ViewUrlGenerator.get_benchmark_executions_quick_url()
    control1['icon'] = 'fa fa-bar-chart'
    control1['onclick'] = 'window.location="{0}"'.format(control1['link'])

    control2 = {}
    control2['name'] = ' Per Branch'
    control2['link'] = ViewUrlGenerator.get_benchmark_executions_branches_url()
    control2['icon'] = 'fa fa-code-fork'
    control2['onclick'] = 'window.location="{0}"'.format(control2['link'])

    data = {}
    data['menu'] = ViewPrepareObjects.prepare_menu_for_html([])
    data['controls'] = []
    data['controls'].append(control1)
    data['controls'].append(control2)

    return res.get_template_data(request,
                                 'presenter/benchmark_executions_quick.html',
                                 data)
def get_benchmark_executions_of_branch(request):
    """ Returns the view for the executions of a branch """
    if request.method != 'GET':
        return res.get_template_data(request, 'presenter/not_found.html', {})

    layouts_obj = []
    layouts = BluesteelLayoutEntry.objects.all()

    for layout in layouts:
        layout_obj = {}
        layout_obj['id'] = layout.id
        layout_obj['name'] = layout.name
        layout_obj['projects'] = []

        projects = BluesteelProjectEntry.objects.filter(layout__id=layout.id)

        for project in projects:
            git_project = GitProjectEntry.objects.filter(
                id=project.git_project.id).first()

            if git_project is None:
                continue

            branch_names_and_orders = GitController.get_branch_names_and_order_values(
                git_project)
            executions_branch = []
            for name_and_order in branch_names_and_orders:
                obj = {}
                obj['name'] = name_and_order['name']
                obj['order'] = name_and_order['order']
                obj['url'] = {}
                obj['url'][
                    'executions_branch'] = ViewUrlGenerator.get_project_branch_single_links_url(
                        git_project.id, name_and_order['id'])
                executions_branch.append(obj)

            project_obj = {}
            project_obj['name'] = project.name
            project_obj['git_project_id'] = git_project.id
            project_obj['branches'] = executions_branch
            layout_obj['projects'].append(project_obj)

        layouts_obj.append(layout_obj)

    control1 = {}
    control1['name'] = ' Quick View'
    control1['link'] = ViewUrlGenerator.get_benchmark_executions_quick_url()
    control1['icon'] = 'fa fa-bar-chart'
    control1['onclick'] = 'window.location="{0}"'.format(control1['link'])

    control2 = {}
    control2['name'] = ' Per Branch'
    control2['link'] = ViewUrlGenerator.get_benchmark_executions_branches_url()
    control2['icon'] = 'fa fa-code-fork'
    control2['onclick'] = 'window.location="{0}"'.format(control2['link'])

    data = {}
    data['menu'] = ViewPrepareObjects.prepare_menu_for_html([])
    data['layouts'] = layouts_obj
    data['controls'] = []
    data['controls'].append(control1)
    data['controls'].append(control2)

    return res.get_template_data(
        request, 'presenter/benchmark_executions_branches.html', data)