summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/views.py
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-01-30 18:21:05 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-10 23:07:49 +0000
commit8c25c3491b851e5cfed66b7ec458ef369f531065 (patch)
treebcc5db4ee649ee6812958c5a7e320621418adcc9 /bitbake/lib/toaster/toastergui/views.py
parent6969a3d3ea1a428ae151669317e49b32ac198062 (diff)
downloadpoky-8c25c3491b851e5cfed66b7ec458ef369f531065.tar.gz
bitbake: toaster: Add add/select functionality to machines page
This feature for the machines page allows the user to add a layer and it's dependencies to the current project and then if successful select the machine(s) which become available due to being provided by the layer. AlexD merged the changes into the submission queue. (Bitbake rev: ca4e4ab09ba214363181eeb8ad54ccc716bd65f3) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 73a5c7e99f..641170e639 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2770,6 +2770,9 @@ if toastermain.settings.MANAGED:
2770 return response 2770 return response
2771 2771
2772 def machines(request): 2772 def machines(request):
2773 if not 'project_id' in request.session:
2774 raise Exception("invalid page: cannot show page without a project")
2775
2773 template = "machines.html" 2776 template = "machines.html"
2774 # define here what parameters the view needs in the GET portion in order to 2777 # define here what parameters the view needs in the GET portion in order to
2775 # be able to display something. 'count' and 'page' are mandatory for all views 2778 # be able to display something. 'count' and 'page' are mandatory for all views
@@ -2785,18 +2788,19 @@ if toastermain.settings.MANAGED:
2785 (filter_string, search_term, ordering_string) = _search_tuple(request, Machine) 2788 (filter_string, search_term, ordering_string) = _search_tuple(request, Machine)
2786 2789
2787 queryset_all = Machine.objects.all() 2790 queryset_all = Machine.objects.all()
2788# if 'project_id' in request.session:
2789# queryset_all = queryset_all.filter(Q(layer_version__up_branch__name = Project.objects.get(request.session['project_id']).release.branch_name) | Q(layer_version__build__in = Project.objects.get(request.session['project_id']).build_set.all()))
2790 2791
2791 queryset_with_search = _get_queryset(Machine, queryset_all, None, search_term, ordering_string, '-name') 2792 queryset_with_search = _get_queryset(Machine, queryset_all, None, search_term, ordering_string, '-name')
2792 queryset = _get_queryset(Machine, queryset_all, filter_string, search_term, ordering_string, '-name') 2793 queryset = _get_queryset(Machine, queryset_all, filter_string, search_term, ordering_string, '-name')
2793 2794
2795 project_layers = ProjectLayer.objects.filter(project_id=request.session['project_id']).values_list('layercommit',flat=True)
2796
2794 # retrieve the objects that will be displayed in the table; machines a paginator and gets a page range to display 2797 # retrieve the objects that will be displayed in the table; machines a paginator and gets a page range to display
2795 machine_info = _build_page_range(Paginator(queryset, request.GET.get('count', 10)),request.GET.get('page', 1)) 2798 machine_info = _build_page_range(Paginator(queryset, request.GET.get('count', 10)),request.GET.get('page', 1))
2796 2799
2797 2800
2798 context = { 2801 context = {
2799 'objects' : machine_info, 2802 'objects' : machine_info,
2803 'project_layers' : project_layers,
2800 'objectname' : "machines", 2804 'objectname' : "machines",
2801 'default_orderby' : 'name:+', 2805 'default_orderby' : 'name:+',
2802 'total_count': queryset_with_search.count(), 2806 'total_count': queryset_with_search.count(),
@@ -2810,10 +2814,6 @@ if toastermain.settings.MANAGED:
2810 'dclass': 'span5', 2814 'dclass': 'span5',
2811 'clclass': 'description', 2815 'clclass': 'description',
2812 }, 2816 },
2813 { 'name': 'Machine file',
2814 'clclass': 'machine-file',
2815 'hidden': 1,
2816 },
2817 { 'name': 'Layer', 2817 { 'name': 'Layer',
2818 'clclass': 'layer', 2818 'clclass': 'layer',
2819 }, 2819 },