summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-08-26 15:39:14 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-29 13:56:50 +0100
commit25a715a1191bae2ac20e598555f49203f59c88b0 (patch)
tree9de7bc08b839343f30fabc19a62a8ef34c3f046f
parentee250eb7e4be2c2964bbeeada93dfff7b8d5e72f (diff)
downloadpoky-25a715a1191bae2ac20e598555f49203f59c88b0.tar.gz
bitbake: toatergui: update pages to match project models
We update pages and queries to match the new project models. (Bitbake rev: 8f47ec259106da714260c7388cee75a6c1f4622d) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/toaster/toastergui/templates/newproject.html4
-rw-r--r--bitbake/lib/toaster/toastergui/templates/project.html4
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py13
3 files changed, 10 insertions, 11 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/newproject.html b/bitbake/lib/toaster/toastergui/templates/newproject.html
index 6ee27d12d2..12c4e9f07f 100644
--- a/bitbake/lib/toaster/toastergui/templates/newproject.html
+++ b/bitbake/lib/toaster/toastergui/templates/newproject.html
@@ -28,8 +28,8 @@
28 <i class="icon-question-sign get-help" title="This sets the branch for the Yocto Project core layers (meta, meta-yocto and meta-yocto-bsp), and for the layers you use from the OpenEmbedded Metadata Index"></i> 28 <i class="icon-question-sign get-help" title="This sets the branch for the Yocto Project core layers (meta, meta-yocto and meta-yocto-bsp), and for the layers you use from the OpenEmbedded Metadata Index"></i>
29 </label> 29 </label>
30 <select name="projectversion" id="projectversion"> 30 <select name="projectversion" id="projectversion">
31 {% for br in branches %} 31 {% for release in releases %}
32 <option value="{{br.id}}"{%if projectversion == br.id %} selected{%endif%}>{{br.name}} ({{br.short_description}})</option> 32 <option value="{{release.id}}"{%if projectversion == release.id %} selected{%endif%}>{{release.name}} ({{release.description}})</option>
33 {% endfor %} 33 {% endfor %}
34 </select> 34 </select>
35 </fieldset> 35 </fieldset>
diff --git a/bitbake/lib/toaster/toastergui/templates/project.html b/bitbake/lib/toaster/toastergui/templates/project.html
index 0ddfeb31ae..3c59fcf2ac 100644
--- a/bitbake/lib/toaster/toastergui/templates/project.html
+++ b/bitbake/lib/toaster/toastergui/templates/project.html
@@ -269,7 +269,7 @@ $(document).ready(function () {
269 <ul class="unstyled configuration-list"> 269 <ul class="unstyled configuration-list">
270 {% for pl in project.projectlayer_set.all %} 270 {% for pl in project.projectlayer_set.all %}
271 <li> 271 <li>
272 <a href="#">{{pl.name}} (<span class="layer-version">{{pl.giturl}}</span>)</a> 272 <a href="#">{{pl.layercommit.layer.name}} (<span class="layer-version">{{pl.layercommit.layer.layer_index_url}}</span>)</a>
273 {% if pl.optional %} 273 {% if pl.optional %}
274 <i title="" data-original-title="" class="icon-trash" id="del-layer-icon" x-data="{{pl.pk}}"></i> 274 <i title="" data-original-title="" class="icon-trash" id="del-layer-icon" x-data="{{pl.pk}}"></i>
275 {% endif %} 275 {% endif %}
@@ -358,7 +358,7 @@ $(document).ready(function () {
358 </p> 358 </p>
359 <h3>Yocto Project version</h3> 359 <h3>Yocto Project version</h3>
360 <p class="lead"> 360 <p class="lead">
361 {{project.branch}} - {{project.short_description}} 361 {{project.release}} - {{project.short_description}}
362 <i title="" data-original-title="" class="icon-pencil"></i> 362 <i title="" data-original-title="" class="icon-pencil"></i>
363 </p> 363 </p>
364 </div> 364 </div>
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 5b2336509a..e68f8b002f 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -1772,7 +1772,7 @@ if toastermain.settings.MANAGED:
1772 from django.contrib.auth.decorators import login_required 1772 from django.contrib.auth.decorators import login_required
1773 1773
1774 from orm.models import Project, ProjectLayer, ProjectTarget, ProjectVariable 1774 from orm.models import Project, ProjectLayer, ProjectTarget, ProjectVariable
1775 from orm.models import Branch, LayerSource, ToasterSetting 1775 from orm.models import Branch, LayerSource, ToasterSetting, Release
1776 from bldcontrol.models import BuildRequest 1776 from bldcontrol.models import BuildRequest
1777 1777
1778 import traceback 1778 import traceback
@@ -1792,7 +1792,7 @@ if toastermain.settings.MANAGED:
1792 context = { 1792 context = {
1793 'email': request.user.email if request.user.is_authenticated() else '', 1793 'email': request.user.email if request.user.is_authenticated() else '',
1794 'username': request.user.username if request.user.is_authenticated() else '', 1794 'username': request.user.username if request.user.is_authenticated() else '',
1795 'branches': Branch.objects.order_by("-up_id"), 1795 'releases': Release.objects.order_by("id"),
1796 'defaultbranch': ToasterSetting.objects.get(name = "DEFAULT_RELEASE").value, 1796 'defaultbranch': ToasterSetting.objects.get(name = "DEFAULT_RELEASE").value,
1797 } 1797 }
1798 1798
@@ -1819,15 +1819,14 @@ if toastermain.settings.MANAGED:
1819 1819
1820 # save the project 1820 # save the project
1821 prj = Project.objects.create_project(name = request.POST['projectname'], 1821 prj = Project.objects.create_project(name = request.POST['projectname'],
1822 branch = Branch.objects.get(pk = request.POST['projectversion'].split(" ")[0]), 1822 release = Release.objects.get(pk = request.POST['projectversion']))
1823 short_description=request.POST['projectversion'].split(" ")[1:])
1824 prj.user_id = request.user.pk 1823 prj.user_id = request.user.pk
1825 prj.save() 1824 prj.save()
1826 return redirect(reverse(project, args = (prj.pk,))) 1825 return redirect(reverse(project, args = (prj.pk,)))
1827 1826
1828 except (IntegrityError, BadParameterException) as e: 1827 except (IntegrityError, BadParameterException) as e:
1829 # fill in page with previously submitted values 1828 # fill in page with previously submitted values
1830 map(lambda x: context.__setitem__(x, request.POST[x]), mandatory_fields) 1829 map(lambda x: context.__setitem__(x, request.POST.get(x, "-- missing")), mandatory_fields)
1831 if isinstance(e, IntegrityError) and "username" in str(e): 1830 if isinstance(e, IntegrityError) and "username" in str(e):
1832 context['alert'] = "Your chosen username is already used" 1831 context['alert'] = "Your chosen username is already used"
1833 else: 1832 else:
@@ -1917,7 +1916,7 @@ if toastermain.settings.MANAGED:
1917 # return all project settings 1916 # return all project settings
1918 return HttpResponse(json.dumps( { 1917 return HttpResponse(json.dumps( {
1919 "error": "ok", 1918 "error": "ok",
1920 "layers": map(lambda x: (x.name, x.giturl), prj.projectlayer_set.all()), 1919 "layers": map(lambda x: (x.layercommit.layer.name, x.layercommit.layer.layer_index_url), prj.projectlayer_set.all()),
1921 "targets" : map(lambda x: {"target" : x.target, "task" : x.task, "pk": x.pk}, prj.projecttarget_set.all()), 1920 "targets" : map(lambda x: {"target" : x.target, "task" : x.task, "pk": x.pk}, prj.projecttarget_set.all()),
1922 "variables": map(lambda x: (x.name, x.value), prj.projectvariable_set.all()), 1921 "variables": map(lambda x: (x.name, x.value), prj.projectvariable_set.all()),
1923 }), content_type = "application/json") 1922 }), content_type = "application/json")
@@ -1945,7 +1944,7 @@ if toastermain.settings.MANAGED:
1945 1944
1946 queryset_all = Layer_Version.objects.all() 1945 queryset_all = Layer_Version.objects.all()
1947 if 'project' in request.session: 1946 if 'project' in request.session:
1948 queryset_all = queryset_all.filter(up_branch = request.session['project'].branch) 1947 queryset_all = queryset_all.filter(up_branch__in = Branch.objects.filter(name = request.session['project'].release.name))
1949 1948
1950 queryset_with_search = _get_queryset(Layer_Version, queryset_all, None, search_term, ordering_string, '-layer__name') 1949 queryset_with_search = _get_queryset(Layer_Version, queryset_all, None, search_term, ordering_string, '-layer__name')
1951 queryset = _get_queryset(Layer_Version, queryset_all, filter_string, search_term, ordering_string, '-layer__name') 1950 queryset = _get_queryset(Layer_Version, queryset_all, filter_string, search_term, ordering_string, '-layer__name')