summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-08-22 16:42:31 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-02 18:09:50 +0100
commit50a8d3a34ca89862b41fbe27f87bbe85a772db8b (patch)
tree930cafe5c7aae5263175c0902d9da8168ac1dc65 /bitbake/lib/toaster
parente99b4cd625ca812cdd88a818a1ad11aa93b28d78 (diff)
downloadpoky-50a8d3a34ca89862b41fbe27f87bbe85a772db8b.tar.gz
bitbake: toaster: layerdetails clean ups after integrating local layer changes
A few clean ups for the work done to integrate editing imported local layers into the layer detail page. (Bitbake rev: 092ef32e695b43c3337b7116722c4c6eba981396) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r--bitbake/lib/toaster/toastergui/api.py6
-rw-r--r--bitbake/lib/toaster/toastergui/static/css/default.css2
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/layerdetails.js86
-rw-r--r--bitbake/lib/toaster/toastergui/templates/layerdetails.html59
4 files changed, 72 insertions, 81 deletions
diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py
index 8dde1288fd..09fb02b8fc 100644
--- a/bitbake/lib/toaster/toastergui/api.py
+++ b/bitbake/lib/toaster/toastergui/api.py
@@ -135,7 +135,8 @@ class XhrLayer(View):
135 Method: POST 135 Method: POST
136 136
137 Args: 137 Args:
138 vcs_url, dirpath, commit, up_branch, summary, description, local_source_dir 138 vcs_url, dirpath, commit, up_branch, summary, description,
139 local_source_dir
139 140
140 add_dep = append a layerversion_id as a dependency 141 add_dep = append a layerversion_id as a dependency
141 rm_dep = remove a layerversion_id as a depedency 142 rm_dep = remove a layerversion_id as a depedency
@@ -167,7 +168,8 @@ class XhrLayer(View):
167 if "description" in request.POST: 168 if "description" in request.POST:
168 layer_version.layer.description = request.POST["description"] 169 layer_version.layer.description = request.POST["description"]
169 if "local_source_dir" in request.POST: 170 if "local_source_dir" in request.POST:
170 layer_version.layer.local_source_dir = request.POST["local_source_dir"] 171 layer_version.layer.local_source_dir = \
172 request.POST["local_source_dir"]
171 173
172 if "add_dep" in request.POST: 174 if "add_dep" in request.POST:
173 lvd = LayerVersionDependency( 175 lvd = LayerVersionDependency(
diff --git a/bitbake/lib/toaster/toastergui/static/css/default.css b/bitbake/lib/toaster/toastergui/static/css/default.css
index f71b37e7fc..a56bb8cbff 100644
--- a/bitbake/lib/toaster/toastergui/static/css/default.css
+++ b/bitbake/lib/toaster/toastergui/static/css/default.css
@@ -316,6 +316,8 @@ h2.panel-title { font-size: 30px; }
316/* Make the help in tables insivisble until you hover over the right cell */ 316/* Make the help in tables insivisble until you hover over the right cell */
317.hover-help { visibility: hidden; } 317.hover-help { visibility: hidden; }
318 318
319#add-remove-layer-btn { margin-bottom: 20px; }
320
319/* Blue hightlight animation for tasks and directory structure tables */ 321/* Blue hightlight animation for tasks and directory structure tables */
320.highlight { -webkit-animation: target-fade 15s 1; -moz-animation: target-fade 15s 1; animation: target-fade 15s 1; } 322.highlight { -webkit-animation: target-fade 15s 1; -moz-animation: target-fade 15s 1; animation: target-fade 15s 1; }
321@-webkit-keyframes target-fade { 0% { background-color: #D9EDF7; } 25% { background-color: #D9EDF7; } 100% { background-color: white; } } 323@-webkit-keyframes target-fade { 0% { background-color: #D9EDF7; } 25% { background-color: #D9EDF7; } 100% { background-color: white; } }
diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
index 2ff8e598a9..5fd7274894 100644
--- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
+++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
@@ -11,11 +11,19 @@ function layerDetailsPageInit (ctx) {
11 var machineTab = $("#machines-tab"); 11 var machineTab = $("#machines-tab");
12 var detailsTab = $("#details-tab"); 12 var detailsTab = $("#details-tab");
13 var editLayerSource = $("#edit-layer-source"); 13 var editLayerSource = $("#edit-layer-source");
14 var saveSourceChangesBtn = $("#save-changes-for-switch");
15 var layerGitRefInput = $("#layer-git-ref");
16 var layerSubDirInput = $('#layer-subdir');
17
18 targetTab.on('show.bs.tab', targetsTabShow);
19 detailsTab.on('show.bs.tab', detailsTabShow);
20 machineTab.on('show.bs.tab', machinesTabShow);
14 21
15 /* setup the dependencies typeahead */ 22 /* setup the dependencies typeahead */
16 libtoaster.makeTypeahead(layerDepInput, libtoaster.ctx.layersTypeAheadUrl, { include_added: "true" }, function(item){ 23 libtoaster.makeTypeahead(layerDepInput,
24 libtoaster.ctx.layersTypeAheadUrl,
25 { include_added: "true" }, function(item){
17 currentLayerDepSelection = item; 26 currentLayerDepSelection = item;
18
19 layerDepBtn.removeAttr("disabled"); 27 layerDepBtn.removeAttr("disabled");
20 }); 28 });
21 29
@@ -26,20 +34,6 @@ function layerDetailsPageInit (ctx) {
26 } 34 }
27 }); 35 });
28 36
29 $(window).on('hashchange', function(e){
30 switch(window.location.hash){
31 case '#machines':
32 machineTab.tab('show');
33 break;
34 case '#recipes':
35 targetTab.tab('show');
36 break;
37 default:
38 detailsTab.tab('show');
39 break;
40 }
41 });
42
43 function addRemoveDep(depLayerId, add, doneCb) { 37 function addRemoveDep(depLayerId, add, doneCb) {
44 var data = { layer_version_id : ctx.layerVersion.id }; 38 var data = { layer_version_id : ctx.layerVersion.id };
45 if (add) 39 if (add)
@@ -151,6 +145,7 @@ function layerDetailsPageInit (ctx) {
151 }); 145 });
152 }); 146 });
153 147
148
154 function defaultAddBtnText(){ 149 function defaultAddBtnText(){
155 var text = " Add the "+ctx.layerVersion.name+" layer to your project"; 150 var text = " Add the "+ctx.layerVersion.name+" layer to your project";
156 addRmLayerBtn.text(text); 151 addRmLayerBtn.text(text);
@@ -158,12 +153,12 @@ function layerDetailsPageInit (ctx) {
158 addRmLayerBtn.removeClass("btn-danger"); 153 addRmLayerBtn.removeClass("btn-danger");
159 } 154 }
160 155
161 detailsTab.on('show', function(){ 156 function detailsTabShow(){
162 if (!ctx.layerVersion.inCurrentPrj) 157 if (!ctx.layerVersion.inCurrentPrj)
163 defaultAddBtnText(); 158 defaultAddBtnText();
164 159
165 window.location.hash = "details"; 160 window.location.hash = "information";
166 }); 161 }
167 162
168 function targetsTabShow(){ 163 function targetsTabShow(){
169 if (!ctx.layerVersion.inCurrentPrj){ 164 if (!ctx.layerVersion.inCurrentPrj){
@@ -217,7 +212,6 @@ function layerDetailsPageInit (ctx) {
217 212
218 }); 213 });
219 214
220 targetTab.on('show.bs.tab', targetsTabShow);
221 215
222 function machinesTabShow(){ 216 function machinesTabShow(){
223 if (!ctx.layerVersion.inCurrentPrj) { 217 if (!ctx.layerVersion.inCurrentPrj) {
@@ -234,8 +228,6 @@ function layerDetailsPageInit (ctx) {
234 window.location.hash = "machines"; 228 window.location.hash = "machines";
235 } 229 }
236 230
237 machineTab.on('show.bs.tab', machinesTabShow);
238
239 $(".pagesize").change(function(){ 231 $(".pagesize").change(function(){
240 var search = libtoaster.parseUrlParams(); 232 var search = libtoaster.parseUrlParams();
241 search.limit = this.value; 233 search.limit = this.value;
@@ -425,9 +417,11 @@ function layerDetailsPageInit (ctx) {
425 $(".commit").tooltip(); 417 $(".commit").tooltip();
426 418
427 editLayerSource.click(function() { 419 editLayerSource.click(function() {
428 // Kindly bring the git layers imported from layerindex to normal page and not this new page :( 420 /* Kindly bring the git layers imported from layerindex to normal page
421 * and not this new page :(
422 */
429 $(this).hide(); 423 $(this).hide();
430 $("#save-changes-for-switch").attr("disabled", "disabled"); 424 saveSourceChangesBtn.attr("disabled", "disabled");
431 425
432 $("#git-repo-info", "#directory-info").hide(); 426 $("#git-repo-info", "#directory-info").hide();
433 $("#edit-layer-source-form").fadeIn(); 427 $("#edit-layer-source-form").fadeIn();
@@ -446,9 +440,9 @@ function layerDetailsPageInit (ctx) {
446 if ($('input[name=source-location]:checked').val() == "repo") { 440 if ($('input[name=source-location]:checked').val() == "repo") {
447 $("#layer-git").fadeIn(); 441 $("#layer-git").fadeIn();
448 $("#layer-dir").hide(); 442 $("#layer-dir").hide();
449 if ($("#layer-git-repo-url").val().length === 0 && $("#layer-git-ref").val().length === 0) { 443 if ($("#layer-git-repo-url").val().length === 0 && layerGitRefInput.val().length === 0) {
450 $("#save-changes-for-switch").attr("disabled", "disabled"); 444 saveSourceChangesBtn.attr("disabled", "disabled");
451 } 445 }
452 } else { 446 } else {
453 $("#layer-dir").fadeIn(); 447 $("#layer-dir").fadeIn();
454 $("#layer-git").hide(); 448 $("#layer-git").hide();
@@ -456,42 +450,40 @@ function layerDetailsPageInit (ctx) {
456 }); 450 });
457 451
458 $("#layer-dir-path-in-details").keyup(function() { 452 $("#layer-dir-path-in-details").keyup(function() {
459 $("#save-changes-for-switch").removeAttr("disabled"); 453 saveSourceChangesBtn.removeAttr("disabled");
460 }); 454 });
461 455
462 $("#layer-git-repo-url").keyup(function() { 456 $("#layer-git-repo-url").keyup(function() {
463 if ($("#layer-git-repo-url").val().length > 0 && $("#layer-git-ref").val().length > 0) { 457 if ($("#layer-git-repo-url").val().length > 0 && layerGitRefInput.val().length > 0) {
464 $("#save-changes-for-switch").removeAttr("disabled"); 458 saveSourceChangesBtn.removeAttr("disabled");
465 } 459 }
466 }); 460 });
467 461
468 $("#layer-git-ref").keyup(function() { 462 layerGitRefInput.keyup(function() {
469 if ($("#layer-git-repo-url").val().length > 0 && $("#layer-git-ref").val().length > 0) { 463 if ($("#layer-git-repo-url").val().length > 0 && layerGitRefInput.val().length > 0) {
470 $("#save-changes-for-switch").removeAttr("disabled"); 464 saveSourceChangesBtn.removeAttr("disabled");
471 } 465 }
472 }); 466 });
473 467
474 $('#cancel-changes-for-switch').click(function() {
475 editLayerSource.show();
476 $("#git-repo-info", "#directory-info").fadeIn();
477 $("#edit-layer-source-form").fadeOut();
478 468
479 if ($("#layer-dir-path-in-details").val().length) { 469 layerSubDirInput.keyup(function(){
480 $("#dir").prop("checked", true); 470 if ($(this).val().length > 0){
481 $("#layer-git").fadeOut(); 471 saveSourceChangesBtn.removeAttr("disabled");
482 $("#layer-dir").fadeIn();
483 } else {
484 $("#layer-git").fadeIn();
485 $("#layer-dir").fadeOut();
486 } 472 }
487 }); 473 });
488 474
489 $('#save-changes-for-switch').click(function() { 475 $('#cancel-changes-for-switch').click(function() {
476 $("#edit-layer-source-form").add("#layer-git").add("#layer-dir").fadeOut().promise().done(function(){
477 editLayerSource.show();
478 });
479 });
480
481 saveSourceChangesBtn.click(function() {
490 482
491 var layerData = { 483 var layerData = {
492 vcs_url: $('#layer-git-repo-url').val(), 484 vcs_url: $('#layer-git-repo-url').val(),
493 commit: $('#layer-git-ref').val(), 485 commit: layerGitRefInput.val(),
494 dirpath: $('#layer-subdir').val(), 486 dirpath: layerSubDirInput.val(),
495 local_source_dir: $('#layer-dir-path-in-details').val(), 487 local_source_dir: $('#layer-dir-path-in-details').val(),
496 }; 488 };
497 489
diff --git a/bitbake/lib/toaster/toastergui/templates/layerdetails.html b/bitbake/lib/toaster/toastergui/templates/layerdetails.html
index 3e1375617d..08e41ce75c 100644
--- a/bitbake/lib/toaster/toastergui/templates/layerdetails.html
+++ b/bitbake/lib/toaster/toastergui/templates/layerdetails.html
@@ -103,7 +103,6 @@
103 <span id="alert-msg"></span> 103 <span id="alert-msg"></span>
104 </div> 104 </div>
105 105
106 <span class="button-place">
107 {% if layerversion.id not in projectlayers %} 106 {% if layerversion.id not in projectlayers %}
108 <button id="add-remove-layer-btn" data-directive="add" class="btn btn-default btn-lg btn-block"> 107 <button id="add-remove-layer-btn" data-directive="add" class="btn btn-default btn-lg btn-block">
109 <span class="glyphicon glyphicon-plus"></span> 108 <span class="glyphicon glyphicon-plus"></span>
@@ -115,7 +114,6 @@
115 Remove the {{layerversion.layer.name}} layer from your project 114 Remove the {{layerversion.layer.name}} layer from your project
116 </button> 115 </button>
117 {% endif %} 116 {% endif %}
118 </span>
119 117
120 <ul class="nav nav-tabs"> 118 <ul class="nav nav-tabs">
121 <li class="active"> 119 <li class="active">
@@ -159,7 +157,7 @@
159 </div> 157 </div>
160 </form> 158 </form>
161 </dd> 159 </dd>
162 {% if layerversion.dirpath %} 160 {% if layerversion.dirpath %}
163 <dt> 161 <dt>
164 <span class="glyphicon glyphicon-question-sign get-help" title="Subdirectory within the repository where the layer is located, if not in the root (usually only used if the repository contains more than one layer)"></span> 162 <span class="glyphicon glyphicon-question-sign get-help" title="Subdirectory within the repository where the layer is located, if not in the root (usually only used if the repository contains more than one layer)"></span>
165 Repository subdirectory 163 Repository subdirectory
@@ -176,7 +174,7 @@
176 </div> 174 </div>
177 </form> 175 </form>
178 </dd> 176 </dd>
179 {% endif %} 177 {% endif %}
180 <dt> 178 <dt>
181 <span class="glyphicon glyphicon-question-sign get-help" title="The Git branch, tag or commit"></span> 179 <span class="glyphicon glyphicon-question-sign get-help" title="The Git branch, tag or commit"></span>
182 Git revision 180 Git revision
@@ -221,7 +219,7 @@
221 Git repository URL 219 Git repository URL
222 <span class="glyphicon glyphicon-question-sign get-help" title="Fetch/clone URL of the repository. Currently, Toaster only supports Git repositories." ></span> 220 <span class="glyphicon glyphicon-question-sign get-help" title="Fetch/clone URL of the repository. Currently, Toaster only supports Git repositories." ></span>
223 </label> 221 </label>
224 <input type="text" id="layer-git-repo-url" class="form-control"> 222 <input type="text" id="layer-git-repo-url" class="form-control" value="{{layerversion.layer.vcs_url|default_if_none:''}}">
225 </div> 223 </div>
226 <div class="form-group"> 224 <div class="form-group">
227 <label for="layer-subdir"> 225 <label for="layer-subdir">
@@ -229,13 +227,13 @@
229 <span class="text-muted">(optional)</span> 227 <span class="text-muted">(optional)</span>
230 <span class="glyphicon glyphicon-question-sign get-help" title="Subdirectory within the repository where the layer is located, if not in the root (usually only used if the repository contains more than one layer)"></span> 228 <span class="glyphicon glyphicon-question-sign get-help" title="Subdirectory within the repository where the layer is located, if not in the root (usually only used if the repository contains more than one layer)"></span>
231 </label> 229 </label>
232 <input type="text" class="form-control" id="layer-subdir"> 230 <input type="text" class="form-control" id="layer-subdir" value="{{layerversion.dirpath|default_if_none:''}}">
233 </div> 231 </div>
234 <div class="form-group" id="layer-revision-ctrl"> 232 <div class="form-group" id="layer-revision-ctrl">
235 <label for="layer-git-ref">Git revision 233 <label for="layer-git-ref">Git revision
236 <span class="glyphicon glyphicon-question-sign get-help" title="You can provide a Git branch, a tag or a commit SHA as the revision"></span> 234 <span class="glyphicon glyphicon-question-sign get-help" title="You can provide a Git branch, a tag or a commit SHA as the revision"></span>
237 </label> 235 </label>
238 <input type="text" class="form-control" id="layer-git-ref"> 236 <input type="text" class="form-control" id="layer-git-ref" value="{{layerversion.get_vcs_reference|default_if_none:''}}">
239 <span class="help-inline" style="display:none;" id="invalid-layer-revision-hint"></span> 237 <span class="help-inline" style="display:none;" id="invalid-layer-revision-hint"></span>
240 </div> 238 </div>
241 </fieldset> 239 </fieldset>
@@ -256,31 +254,28 @@
256 </div> 254 </div>
257 </form> 255 </form>
258 256
259 <dt> 257 <h3 class="top-air">Layer dependencies
260 <span class="glyphicon glyphicon-question-sign get-help" title="Other layers this layer depends upon"></span> 258 <span class="glyphicon glyphicon-question-sign get-help" title="Other layers this layer depends upon"></span>
261 Layer dependencies 259 </h3>
262 </dt> 260
263 <dd> 261 <ul class="list-unstyled current-value" id="layer-deps-list">
264 <ul class="list-unstyled current-value" id="layer-deps-list"> 262 {% for ld in layerversion.dependencies.all %}
265 {% for ld in layerversion.dependencies.all %} 263 <li data-layer-id="{{ld.depends_on.id}}">
266 <li data-layer-id="{{ld.depends_on.id}}"> 264 <a data-toggle="tooltip" title="{{ld.depends_on.layer.vcs_url}} | {{ld.depends_on.get_vcs_reference}}" href="{% url 'layerdetails' project.id ld.depends_on.id %}">{{ld.depends_on.layer.name}}</a>
267 <a data-toggle="tooltip" title="{{ld.depends_on.layer.vcs_url}} | {{ld.depends_on.get_vcs_reference}}" href="{% url 'layerdetails' project.id ld.depends_on.id %}">{{ld.depends_on.layer.name}}</a> 265 <span class="glyphicon glyphicon-trash " data-toggle="tooltip" title="Delete"></span>
268 <span class="glyphicon glyphicon-trash " data-toggle="tooltip" title="Delete"></span> 266 </li>
269 </li> 267 {% endfor %}
270 {% endfor %} 268 </ul>
271 </ul> 269 <form class="form-inline add-deps">
272 <form class="form-inline add-deps"> 270 <div class="form-group">
273 <div class="form-group"> 271 <input class="form-control" type="text" autocomplete="off" data-minLength="1" data-autocomplete="off" placeholder="Type a layer name" id="layer-dep-input">
274 <input class="form-control" type="text" autocomplete="off" data-minLength="1" data-autocomplete="off" placeholder="Type a layer name" id="layer-dep-input"> 272 </div>
275 </div> 273 <a class="btn btn-default" id="add-layer-dependency-btn" disabled="disabled">
276 <a class="btn btn-default" id="add-layer-dependency-btn" disabled="disabled"> 274 Add layer
277 Add layer 275 </a>
278 </a> 276 <span class="help-block add-deps">You can only add layers Toaster knows about</span>
279 <span class="help-block add-deps">You can only add layers Toaster knows about</span> 277 </form>
280 </form> 278 </div>
281 </dd>
282 </dl>
283 </div>
284 <!-- end layerdetails tab --> 279 <!-- end layerdetails tab -->
285 <!-- targets tab --> 280 <!-- targets tab -->
286 <div id="recipes" class="tab-pane"> 281 <div id="recipes" class="tab-pane">