diff options
| author | Michael Wood <michael.g.wood@intel.com> | 2016-08-22 16:42:31 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-02 18:09:50 +0100 |
| commit | 50a8d3a34ca89862b41fbe27f87bbe85a772db8b (patch) | |
| tree | 930cafe5c7aae5263175c0902d9da8168ac1dc65 /bitbake/lib/toaster/toastergui/static | |
| parent | e99b4cd625ca812cdd88a818a1ad11aa93b28d78 (diff) | |
| download | poky-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/toastergui/static')
| -rw-r--r-- | bitbake/lib/toaster/toastergui/static/css/default.css | 2 | ||||
| -rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/layerdetails.js | 86 |
2 files changed, 41 insertions, 47 deletions
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 | ||
