summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-08-08 17:50:02 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-29 13:56:49 +0100
commit3a4356dbfea07088b38881abe2c2b5d6bb6c7cf7 (patch)
tree1400c8217a18d1d94fcbb7f892cc12a76b1c596b
parent54530006b745d364d60dcf4ce372a1459d3fff78 (diff)
downloadpoky-3a4356dbfea07088b38881abe2c2b5d6bb6c7cf7.tar.gz
bitbake: toaster: create project section navigation structure
We create the navigation structure for the project section. This includes adding URLs for configuration, builds, all layers, layer details and all targets pages. Changes to existing pages to exemplify navigation links. (Bitbake rev: 6f0cb9d106129eb496a4c009d95b0727378e97c1) 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.html5
-rw-r--r--bitbake/lib/toaster/toastergui/templates/project.html47
-rw-r--r--bitbake/lib/toaster/toastergui/urls.py11
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py48
4 files changed, 85 insertions, 26 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/newproject.html b/bitbake/lib/toaster/toastergui/templates/newproject.html
index 8f1867a94f..6ee27d12d2 100644
--- a/bitbake/lib/toaster/toastergui/templates/newproject.html
+++ b/bitbake/lib/toaster/toastergui/templates/newproject.html
@@ -28,8 +28,9 @@
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 <!-- TODO: XHR data from http://layers.openembedded.org/layerindex/branch/master/layers/ --> 31 {% for br in branches %}
32 <option value="master" {%if projectversion == "master" %}selected{%endif%}>master</option> 32 <option value="{{br.id}}"{%if projectversion == br.id %} selected{%endif%}>{{br.name}} ({{br.short_description}})</option>
33 {% endfor %}
33 </select> 34 </select>
34 </fieldset> 35 </fieldset>
35 36
diff --git a/bitbake/lib/toaster/toastergui/templates/project.html b/bitbake/lib/toaster/toastergui/templates/project.html
index c859f6bcd1..0ddfeb31ae 100644
--- a/bitbake/lib/toaster/toastergui/templates/project.html
+++ b/bitbake/lib/toaster/toastergui/templates/project.html
@@ -71,10 +71,29 @@ function postEditAjaxRequest(reqdata) {
71 }) 71 })
72} 72}
73 73
74
75
76
74$(document).ready(function () { 77$(document).ready(function () {
75 setEventHandlers(); 78 setEventHandlers();
79
80 /* Provide XHR calls for the "build" buttons.*/
81 $("button#build-all-button").click( function (evt) {
82 var ajax = $.ajax({
83 type:"POST",
84 url:"{% url 'xhr_projectbuild' project.id %}",
85 headers: { 'X-CSRFToken': $.cookie("csrftoken")},
86 success: function (data, textstatus) {
87 if (data.error != "ok") {
88 alert("XHR fail: " + data.error );
89 }
90 },
91 error: function (jqXHR, textstatus, error) { alert("XHR errored:" + error + "(" + textstatus + ")"); },
92 })
93 });
76}); 94});
77 95
96
78</script> 97</script>
79 98
80 99
@@ -97,23 +116,7 @@ $(document).ready(function () {
97 <input class="huge input-xxlarge" placeholder="Or enter the target you want to build" autocomplete="off" data-minlength="1" data-autocomplete="off" data-provide="typeahead" data-source="" type="text"> 116 <input class="huge input-xxlarge" placeholder="Or enter the target you want to build" autocomplete="off" data-minlength="1" data-autocomplete="off" data-provide="typeahead" data-source="" type="text">
98 <button id="build-button" class="btn btn-large" disabled="">Build</button> 117 <button id="build-button" class="btn btn-large" disabled="">Build</button>
99 </div> 118 </div>
100 <script>
101/* Provide XHR calls for the "build" buttons.*/
102$("button#build-all-button").click( function (evt) {
103 var ajax = $.ajax({
104 type:"POST",
105 url:"{% url 'xhr_projectbuild' project.id %}",
106 headers: { 'X-CSRFToken': $.cookie("csrftoken")},
107 success: function (data, textstatus) {
108 if (data.error != "ok") {
109 alert("XHR fail: " + data.error );
110 }
111 },
112 error: function (jqXHR, textstatus, error) { alert("XHR errored:" + error + "(" + textstatus + ")"); },
113 })
114});
115 119
116 </script>
117 <!--span class="help-inline">This target is not provided <br />by any of your added layers 120 <!--span class="help-inline">This target is not provided <br />by any of your added layers
118 <i class="icon-question-sign get-help get-help-red" title="Review your list of added layers to make sure one of them provides core-image-xyz. Clicking on a layer name will give you all the information Toaster has about the layer"></i> 121 <i class="icon-question-sign get-help get-help-red" title="Review your list of added layers to make sure one of them provides core-image-xyz. Clicking on a layer name will give you all the information Toaster has about the layer"></i>
119 </span> 122 </span>
@@ -255,7 +258,7 @@ $("button#build-all-button").click( function (evt) {
255 <button id="add-layer-dependencies" class="btn btn-info add-layer">Add layers</button> 258 <button id="add-layer-dependencies" class="btn btn-info add-layer">Add layers</button>
256 </div> 259 </div>
257 260
258 <p><a href="#">Import your layer</a> | <a href="#">View all layers</a></p> 261 <p><a href="{% url 'importlayer' %}">Import your layer</a> | <a href="{% url 'layers'%}">View all layers</a></p>
259 </form> 262 </form>
260 263
261 <h4 class="air"> 264 <h4 class="air">
@@ -286,7 +289,7 @@ $("button#build-all-button").click( function (evt) {
286 <button id="add-target-button" class="btn" type="button">Add</button> 289 <button id="add-target-button" class="btn" type="button">Add</button>
287 </div> 290 </div>
288 291
289 <p><a href="#" class="link">View all targets</a></p> 292 <p><a href="{% url 'targets' %}" class="link">View all targets</a></p>
290 </form> 293 </form>
291 <h4 class="air"> 294 <h4 class="air">
292 Added targets 295 Added targets
@@ -328,10 +331,10 @@ $("button#build-all-button").click( function (evt) {
328 {{distro}} 331 {{distro}}
329 <i title="" data-original-title="" class="icon-pencil"></i> 332 <i title="" data-original-title="" class="icon-pencil"></i>
330 </p> 333 </p>
331 <p class="localconf"> 334 <p class="link-action">
332 <a href="#" class="link">Edit the <code>local.conf</code> file</a> 335 <a href="{% url 'projectconf' project.id %}" class="link">Edit configuration variables</a>
333 <i data-original-title="The <code>local.conf</code> file is where other project configuration options are set. Pretty much any configuration option can be set in this file. Each option, like everything else in the build system, is a variable - value pair" class="icon-question-sign get-help heading-help" title=""></i> 336 <i class="icon-question-sign get-help heading-help" title="You can set other project configuration options here. Each option, like everything else in the build system, is a variable - value pair"></i>
334 </p> 337 </p>
335 </div> 338 </div>
336 </div> 339 </div>
337 340
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py
index 7c4f894b9c..30f006348a 100644
--- a/bitbake/lib/toaster/toastergui/urls.py
+++ b/bitbake/lib/toaster/toastergui/urls.py
@@ -63,12 +63,21 @@ urlpatterns = patterns('toastergui.views',
63 63
64 64
65 # urls not linked from the dashboard 65 # urls not linked from the dashboard
66 url(r'^layers/$', 'layer', name='all-layers'),
67 url(r'^layerversions/(?P<layerversion_id>\d+)/recipes/.*$', 'layer_versions_recipes', name='layer_versions_recipes'), 66 url(r'^layerversions/(?P<layerversion_id>\d+)/recipes/.*$', 'layer_versions_recipes', name='layer_versions_recipes'),
68 67
69 # project URLs 68 # project URLs
70 url(r'^newproject/$', 'newproject', name='newproject'), 69 url(r'^newproject/$', 'newproject', name='newproject'),
70 url(r'^importlayer/$', 'importlayer', name='importlayer'),
71
72 url(r'^layers/$', 'layers', name='layers'),
73 url(r'^layer/(?P<layerid>\d+)/$', 'layerdetails', name='layerdetails'),
74 url(r'^targets/$', 'targets', name='targets'),
75 url(r'^machines/$', 'machines', name='machines'),
76
71 url(r'^project/(?P<pid>\d+)/$', 'project', name='project'), 77 url(r'^project/(?P<pid>\d+)/$', 'project', name='project'),
78 url(r'^project/(?P<pid>\d+)/configuration$', 'projectconf', name='projectconf'),
79 url(r'^project/(?P<pid>\d+)/builds$', 'projectbuilds', name='projectbuild'),
80
72 url(r'^xhr_projectbuild/(?P<pid>\d+)/$', 'xhr_projectbuild', name='xhr_projectbuild'), 81 url(r'^xhr_projectbuild/(?P<pid>\d+)/$', 'xhr_projectbuild', name='xhr_projectbuild'),
73 url(r'^xhr_projectedit/(?P<pid>\d+)/$', 'xhr_projectedit', name='xhr_projectedit'), 82 url(r'^xhr_projectedit/(?P<pid>\d+)/$', 'xhr_projectedit', name='xhr_projectedit'),
74 83
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index bd65c08b06..cad23570f8 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -1772,6 +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 bldcontrol.models import BuildRequest 1776 from bldcontrol.models import BuildRequest
1776 1777
1777 import traceback 1778 import traceback
@@ -1791,6 +1792,8 @@ if toastermain.settings.MANAGED:
1791 context = { 1792 context = {
1792 'email': request.user.email if request.user.is_authenticated() else '', 1793 'email': request.user.email if request.user.is_authenticated() else '',
1793 '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"),
1796 'defaultbranch': ToasterSetting.objects.get(name = "DEFAULT_RELEASE").value,
1794 } 1797 }
1795 1798
1796 1799
@@ -1816,7 +1819,7 @@ if toastermain.settings.MANAGED:
1816 1819
1817 # save the project 1820 # save the project
1818 prj = Project.objects.create_project(name = request.POST['projectname'], 1821 prj = Project.objects.create_project(name = request.POST['projectname'],
1819 branch = request.POST['projectversion'].split(" ")[0], 1822 branch = Branch.objects.get(pk = request.POST['projectversion'].split(" ")[0]),
1820 short_description=request.POST['projectversion'].split(" ")[1:]) 1823 short_description=request.POST['projectversion'].split(" ")[1:])
1821 prj.user_id = request.user.pk 1824 prj.user_id = request.user.pk
1822 prj.save() 1825 prj.save()
@@ -1919,6 +1922,26 @@ if toastermain.settings.MANAGED:
1919 except Exception as e: 1922 except Exception as e:
1920 return HttpResponse(json.dumps({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json") 1923 return HttpResponse(json.dumps({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json")
1921 1924
1925 def importlayer(request):
1926 raise Exception("TODO: implement page #6595")
1927
1928 def layers(request):
1929 raise Exception("TODO: implement page #6590")
1930
1931 def layerdetails(request, layerid):
1932 raise Exception("TODO: implement page #6591")
1933
1934 def targets(request):
1935 raise Exception("TODO: implement page #6592")
1936
1937 def machines(request):
1938 raise Exception("TODO: implement page #6593")
1939
1940 def projectconf(request, pid):
1941 raise Exception("TODO: implement page #6588")
1942
1943 def projectbuilds(request, pid):
1944 raise Exception("TODO: implement page #6589")
1922 1945
1923else: 1946else:
1924 # these are pages that are NOT available in interactive mode 1947 # these are pages that are NOT available in interactive mode
@@ -1940,3 +1963,26 @@ else:
1940 def xhr_projectedit(request, pid): 1963 def xhr_projectedit(request, pid):
1941 raise Exception("page not available in interactive mode") 1964 raise Exception("page not available in interactive mode")
1942 1965
1966 def importlayer(request):
1967 raise Exception("page not available in interactive mode")
1968
1969 def layers(request):
1970 raise Exception("page not available in interactive mode")
1971
1972 def layerdetails(request):
1973 raise Exception("page not available in interactive mode")
1974
1975 def targets(request):
1976 raise Exception("page not available in interactive mode")
1977
1978 def targetdetails(request):
1979 raise Exception("page not available in interactive mode")
1980
1981 def machines(request):
1982 raise Exception("page not available in interactive mode")
1983
1984 def projectconf(request):
1985 raise Exception("page not available in interactive mode")
1986
1987 def projectbuilds(request):
1988 raise Exception("page not available in interactive mode")