summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/templates
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-05-19 16:14:29 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-12 00:01:47 +0100
commitafe06e313eac61f598f65e622ceb5951a9fabc9a (patch)
tree02e37805b7b10a30c77fc3c82987bf435b221423 /bitbake/lib/toaster/toastergui/templates
parent94aa0d5408f71a2e9fd48fd2c0e283acfc9ac2a2 (diff)
downloadpoky-afe06e313eac61f598f65e622ceb5951a9fabc9a.tar.gz
bitbake: toaster: move project data typeahead to the REST API
This patch enables JSON requests on the project REST endpoint, and replaces the universal queries "xhr_datatypeahead" with the `project` type to the REST project endpoint. The patch adds a decorator that takes a context returned by a view and either renders the template specified as the decorator argument, or converts the context to JSON. Normal "search", "filter" and "order" options for view work as normal on the JSON API format. To enable the JSON return, set the "format" GET parameter to "json". In order to demonstrate the functionality, the "New build" button is switched from using the xhr_datatypeahead to the project REST API with JSON formatting. Additionally, the XHR APIs that perform actions with the project id passed as parameter are removed, and the needed URLs are populated from the project JSON API returns after the project has been selected. (Bitbake rev: 15a2274eba13d19b864f337057d61c75ff7849cc) 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/templates')
-rw-r--r--bitbake/lib/toaster/toastergui/templates/base.html24
-rw-r--r--bitbake/lib/toaster/toastergui/templates/basetable_bottom.html2
-rw-r--r--bitbake/lib/toaster/toastergui/templates/detail_pagination_bottom.html2
3 files changed, 17 insertions, 11 deletions
diff --git a/bitbake/lib/toaster/toastergui/templates/base.html b/bitbake/lib/toaster/toastergui/templates/base.html
index 230dee49d6..e10dc11673 100644
--- a/bitbake/lib/toaster/toastergui/templates/base.html
+++ b/bitbake/lib/toaster/toastergui/templates/base.html
@@ -31,11 +31,19 @@
31 projectId : {{project.id|default:'undefined'}}, 31 projectId : {{project.id|default:'undefined'}},
32 jsUrl : "{% static 'js/' %}", 32 jsUrl : "{% static 'js/' %}",
33 htmlUrl : "{% static 'html/' %}", 33 htmlUrl : "{% static 'html/' %}",
34 projectsUrl : "{% url 'all-projects' %}",
34 {% if project.id %} 35 {% if project.id %}
35 xhrDataTypeaheadUrl : "{% url 'xhr_datatypeahead' project.id %}", 36 xhrProjectDataTypeaheadUrl : "{% url 'xhr_datatypeahead' project.id %}",
36 xhrProjectEditUrl : "{% url 'xhr_projectedit' project.id %}", 37 xhrProjectEditUrl : "{% url 'xhr_projectedit' project.id %}",
37 projectPageUrl : "{% url 'project' project.id %}", 38 projectPageUrl : "{% url 'project' project.id %}",
38 projectName : "{{project.name}}", 39 projectName : "{{project.name}}",
40 projectId : {{project.id}},
41 {% else %}
42 xhrProjectDataTypeaheadUrl : undefined,
43 xhrProjectEditUrl : undefined,
44 projectPageUrl : undefined,
45 projectName : undefined,
46 projectId : undefined,
39 {% endif %} 47 {% endif %}
40 }; 48 };
41</script> 49</script>
@@ -45,8 +53,6 @@
45 $(document).ready(function () { 53 $(document).ready(function () {
46 /* Vars needed for base.js */ 54 /* Vars needed for base.js */
47 var ctx = {}; 55 var ctx = {};
48 ctx.projectBuildUrl = "{% url 'xhr_build' %}";
49 ctx.projectBasePageUrl = "{% url 'base_project' %}";
50 ctx.projectInfoUrl = "{% url 'xhr_projectinfo' %}"; 56 ctx.projectInfoUrl = "{% url 'xhr_projectinfo' %}";
51 ctx.numProjects = {{projects|length}}; 57 ctx.numProjects = {{projects|length}};
52 ctx.currentUrl = "{{request.path|escapejs}}"; 58 ctx.currentUrl = "{{request.path|escapejs}}";
@@ -99,7 +105,7 @@
99 <div class="input-append"> 105 <div class="input-append">
100 <input type="text" class="input-medium" id="project-name-input" placeholder="Type a project name" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead"/> 106 <input type="text" class="input-medium" id="project-name-input" placeholder="Type a project name" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead"/>
101 <button id="save-project-button" class="btn" type="button">Save</button> 107 <button id="save-project-button" class="btn" type="button">Save</button>
102 <a href="#" id="cancel-change-project" class="btn btn-link">Cancel</a> 108 <a href="#" id="cancel-change-project" class="btn btn-link" style="display: none">Cancel</a>
103 </div> 109 </div>
104 <p><a id="view-all-projects" href="{% url 'all-projects' %}">View all projects</a></p> 110 <p><a id="view-all-projects" href="{% url 'all-projects' %}">View all projects</a></p>
105 </form> 111 </form>
@@ -111,9 +117,9 @@
111 <li id="targets-form"> 117 <li id="targets-form">
112 <h6>Recipe(s):</h6> 118 <h6>Recipe(s):</h6>
113 <form> 119 <form>
114 <input type="text" class="input-xlarge" id="build-target-input" placeholder="Type a recipe name" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead" /> 120 <input type="text" class="input-xlarge" id="build-target-input" placeholder="Type a recipe name" autocomplete="off" data-minLength="1" data-autocomplete="off" data-provide="typeahead" disabled/>
115 <div> 121 <div>
116 <a class="btn btn-primary" id="build-button" data-project-id="{{project.id}}">Build</a> 122 <button class="btn btn-primary" id="build-button" data-project-id="{{project.id}}" disabled>Build</button>
117 </div> 123 </div>
118 </form> 124 </form>
119 </li> 125 </li>
diff --git a/bitbake/lib/toaster/toastergui/templates/basetable_bottom.html b/bitbake/lib/toaster/toastergui/templates/basetable_bottom.html
index 4c28cae810..ce023f51af 100644
--- a/bitbake/lib/toaster/toastergui/templates/basetable_bottom.html
+++ b/bitbake/lib/toaster/toastergui/templates/basetable_bottom.html
@@ -57,7 +57,7 @@
57 } 57 }
58 } 58 }
59 59
60 // load cookie for number of entries to be displayed on page 60 // load data for number of entries to be displayed on page
61 if ({{request.GET.count}} != "") { 61 if ({{request.GET.count}} != "") {
62 pagesize = {{request.GET.count}}; 62 pagesize = {{request.GET.count}};
63 } 63 }
diff --git a/bitbake/lib/toaster/toastergui/templates/detail_pagination_bottom.html b/bitbake/lib/toaster/toastergui/templates/detail_pagination_bottom.html
index 434facba93..f40c21d99f 100644
--- a/bitbake/lib/toaster/toastergui/templates/detail_pagination_bottom.html
+++ b/bitbake/lib/toaster/toastergui/templates/detail_pagination_bottom.html
@@ -38,7 +38,7 @@
38<!-- Update page display settings --> 38<!-- Update page display settings -->
39<script> 39<script>
40 $(document).ready(function() { 40 $(document).ready(function() {
41 // load cookie for number of entries to be displayed on page 41 // load data for number of entries to be displayed on page
42 if ({{request.GET.count}} != "") { 42 if ({{request.GET.count}} != "") {
43 pagesize = {{request.GET.count}}; 43 pagesize = {{request.GET.count}};
44 } 44 }