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 prepare_menu_for_html(menu): """ Adds default items to menu plus already existing ones """ menu_items = [] item_1 = {} item_1['name'] = '' item_1['icon'] = 'fa fa-home fa-lg' item_1['link'] = '/main/view/' item_2 = {} item_2['name'] = 'Layouts' item_2['icon'] = '' item_2['link'] = ViewUrlGenerator.get_layout_all_url(1) item_3 = {} item_3['name'] = 'Projects' item_3['icon'] = '' item_3['link'] = ViewUrlGenerator.get_project_all_url(1) item_4 = {} item_4['name'] = 'Workers' item_4['icon'] = '' item_4['link'] = ViewUrlGenerator.get_worker_all_url(1) item_5 = {} item_5['name'] = 'Definitions' item_5['icon'] = '' item_5['link'] = ViewUrlGenerator.get_benchmark_definitions_url(1) item_6 = {} item_6['name'] = 'Executions' item_6['icon'] = '' item_6['link'] = ViewUrlGenerator.get_benchmark_executions_quick_url() item_7 = {} item_7['name'] = 'Notifications' item_7['icon'] = '' item_7['link'] = ViewUrlGenerator.get_notifications_url() menu_items.append(item_1) menu_items.append(item_2) menu_items.append(item_3) menu_items.append(item_4) menu_items.append(item_5) menu_items.append(item_6) menu_items.append(item_7) for item in menu: menu_items.append(item) return menu_items
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)