summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
diff options
context:
space:
mode:
authorBelen Barros Pena <belen.barros.pena@linux.intel.com>2016-04-12 15:56:43 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-15 08:35:03 +0100
commit443f7b39158c891015a791814b9b1fe2324edc41 (patch)
tree3f570a138594273bc7498225e066b7f9a99bf0c5 /bitbake/lib/toaster/toastergui/static/js/layerdetails.js
parent79e0eb9e52e9b954aa3b6bc6dee15a75b5eb990c (diff)
downloadpoky-443f7b39158c891015a791814b9b1fe2324edc41.tar.gz
bitbake: toaster: Migrate project configuration from bootstrap 2 to bootstrap 3
Convert all the HTML templates, JS and CSS in the project parts of toaster to use bootstrap 3. (Bitbake rev: 69527a731eada699d3f604ff8f3ae9410981ba9b) Signed-off-by: Belen Barros Pena <belen.barros.pena@linux.intel.com> Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/static/js/layerdetails.js')
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/layerdetails.js67
1 files changed, 39 insertions, 28 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
index d545406262..a56087b738 100644
--- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
+++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js
@@ -18,6 +18,13 @@ function layerDetailsPageInit (ctx) {
18 layerDepBtn.removeAttr("disabled"); 18 layerDepBtn.removeAttr("disabled");
19 }); 19 });
20 20
21 /* disable the add layer button if its input field is empty */
22 layerDepInput.on("keyup",function(){
23 if ($(this).val().length === 0) {
24 layerDepBtn.attr("disabled", "disabled");
25 }
26 });
27
21 $(window).on('hashchange', function(e){ 28 $(window).on('hashchange', function(e){
22 switch(window.location.hash){ 29 switch(window.location.hash){
23 case '#machines': 30 case '#machines':
@@ -76,7 +83,7 @@ function layerDetailsPageInit (ctx) {
76 83
77 addRemoveDep(currentLayerDepSelection.id, true, function(){ 84 addRemoveDep(currentLayerDepSelection.id, true, function(){
78 /* Make a list item for the new layer dependency */ 85 /* Make a list item for the new layer dependency */
79 var newLayerDep = $("<li><a></a><span class=\"icon-trash\" data-toggle=\"tooltip\" title=\"Delete\"></span></li>"); 86 var newLayerDep = $("<li><a></a><span class=\"glyphicon glyphicon-trash\" data-toggle=\"tooltip\" title=\"Delete\"></span></li>");
80 87
81 newLayerDep.data('layer-id', currentLayerDepSelection.id); 88 newLayerDep.data('layer-id', currentLayerDepSelection.id);
82 newLayerDep.children("span").tooltip(); 89 newLayerDep.children("span").tooltip();
@@ -94,11 +101,11 @@ function layerDetailsPageInit (ctx) {
94 /* Clear the current selection */ 101 /* Clear the current selection */
95 layerDepInput.val(""); 102 layerDepInput.val("");
96 currentLayerDepSelection = undefined; 103 currentLayerDepSelection = undefined;
97 layerDepBtn.attr("disabled","disabled"); 104 layerDepBtn.attr("disabled", "disabled");
98 }); 105 });
99 }); 106 });
100 107
101 $(".icon-pencil").click(function (){ 108 $(".glyphicon-edit").click(function (){
102 var mParent = $(this).parent("dd"); 109 var mParent = $(this).parent("dd");
103 mParent.prev().css("margin-top", "10px"); 110 mParent.prev().css("margin-top", "10px");
104 mParent.children("form").slideDown(); 111 mParent.children("form").slideDown();
@@ -106,8 +113,12 @@ function layerDetailsPageInit (ctx) {
106 currentVal.hide(); 113 currentVal.hide();
107 /* Set the current value to the input field */ 114 /* Set the current value to the input field */
108 mParent.find("textarea,input").val(currentVal.text()); 115 mParent.find("textarea,input").val(currentVal.text());
116 /* If the input field is empty, disable the submit button */
117 if ( mParent.find("textarea,input").val().length == 0 ) {
118 mParent.find(".change-btn").attr("disabled", "disabled");
119 }
109 /* Hides the "Not set" text */ 120 /* Hides the "Not set" text */
110 mParent.children(".muted").hide(); 121 mParent.children(".text-muted").hide();
111 /* We're editing so hide the delete icon */ 122 /* We're editing so hide the delete icon */
112 mParent.children(".delete-current-value").hide(); 123 mParent.children(".delete-current-value").hide();
113 mParent.find(".cancel").show(); 124 mParent.find(".cancel").show();
@@ -128,21 +139,21 @@ function layerDetailsPageInit (ctx) {
128 mParent.children(".current-value").show(); 139 mParent.children(".current-value").show();
129 /* Show the "Not set" text if we ended up with no value */ 140 /* Show the "Not set" text if we ended up with no value */
130 if (!mParent.children(".current-value").html()){ 141 if (!mParent.children(".current-value").html()){
131 mParent.children(".muted").fadeIn(); 142 mParent.children(".text-muted").fadeIn();
132 mParent.children(".delete-current-value").hide(); 143 mParent.children(".delete-current-value").hide();
133 } else { 144 } else {
134 mParent.children(".delete-current-value").show(); 145 mParent.children(".delete-current-value").show();
135 } 146 }
136 147
137 mParent.children(".icon-pencil").show(); 148 mParent.children(".glyphicon-edit").show();
138 mParent.prev().css("margin-top", "0px"); 149 mParent.prev().css("margin-top", "0");
139 }); 150 });
140 }); 151 });
141 152
142 function defaultAddBtnText(){ 153 function defaultAddBtnText(){
143 var text = " Add the "+ctx.layerVersion.name+" layer to your project"; 154 var text = " Add the "+ctx.layerVersion.name+" layer to your project";
144 addRmLayerBtn.text(text); 155 addRmLayerBtn.text(text);
145 addRmLayerBtn.prepend("<span class=\"icon-plus\"></span>"); 156 addRmLayerBtn.prepend("<span class=\"glyphicon glyphicon-plus\"></span>");
146 addRmLayerBtn.removeClass("btn-danger"); 157 addRmLayerBtn.removeClass("btn-danger");
147 } 158 }
148 159
@@ -159,7 +170,7 @@ function layerDetailsPageInit (ctx) {
159 var text = " Add the "+ctx.layerVersion.name+" layer to your project "+ 170 var text = " Add the "+ctx.layerVersion.name+" layer to your project "+
160 "to enable these recipes"; 171 "to enable these recipes";
161 addRmLayerBtn.text(text); 172 addRmLayerBtn.text(text);
162 addRmLayerBtn.prepend("<span class=\"icon-plus\"></span>"); 173 addRmLayerBtn.prepend("<span class=\"glyphicon glyphicon-plus\"></span>");
163 } else { 174 } else {
164 defaultAddBtnText(); 175 defaultAddBtnText();
165 } 176 }
@@ -177,7 +188,7 @@ function layerDetailsPageInit (ctx) {
177 $("#no-recipes-yet").hide(); 188 $("#no-recipes-yet").hide();
178 } 189 }
179 190
180 targetTab.removeClass("muted"); 191 targetTab.removeClass("text-muted");
181 if (window.location.hash === "#recipes"){ 192 if (window.location.hash === "#recipes"){
182 /* re run the machinesTabShow to update the text */ 193 /* re run the machinesTabShow to update the text */
183 targetsTabShow(); 194 targetsTabShow();
@@ -192,20 +203,20 @@ function layerDetailsPageInit (ctx) {
192 else 203 else
193 $("#no-machines-yet").hide(); 204 $("#no-machines-yet").hide();
194 205
195 machineTab.removeClass("muted"); 206 machineTab.removeClass("text-muted");
196 if (window.location.hash === "#machines"){ 207 if (window.location.hash === "#machines"){
197 /* re run the machinesTabShow to update the text */ 208 /* re run the machinesTabShow to update the text */
198 machinesTabShow(); 209 machinesTabShow();
199 } 210 }
200 211
201 $(".select-machine-btn").click(function(e){ 212 $(".select-machine-btn").click(function(e){
202 if ($(this).attr("disabled") === "disabled") 213 if ($(this).hasClass("disabled"))
203 e.preventDefault(); 214 e.preventDefault();
204 }); 215 });
205 216
206 }); 217 });
207 218
208 targetTab.on('show', targetsTabShow); 219 targetTab.on('show.bs.tab', targetsTabShow);
209 220
210 function machinesTabShow(){ 221 function machinesTabShow(){
211 if (!ctx.layerVersion.inCurrentPrj) { 222 if (!ctx.layerVersion.inCurrentPrj) {
@@ -213,7 +224,7 @@ function layerDetailsPageInit (ctx) {
213 var text = " Add the "+ctx.layerVersion.name+" layer to your project " + 224 var text = " Add the "+ctx.layerVersion.name+" layer to your project " +
214 "to enable these machines"; 225 "to enable these machines";
215 addRmLayerBtn.text(text); 226 addRmLayerBtn.text(text);
216 addRmLayerBtn.prepend("<span class=\"icon-plus\"></span>"); 227 addRmLayerBtn.prepend("<span class=\"glyphicon glyphicon-plus\"></span>");
217 } else { 228 } else {
218 defaultAddBtnText(); 229 defaultAddBtnText();
219 } 230 }
@@ -222,7 +233,7 @@ function layerDetailsPageInit (ctx) {
222 window.location.hash = "machines"; 233 window.location.hash = "machines";
223 } 234 }
224 235
225 machineTab.on('show', machinesTabShow); 236 machineTab.on('show.bs.tab', machinesTabShow);
226 237
227 $(".pagesize").change(function(){ 238 $(".pagesize").change(function(){
228 var search = libtoaster.parseUrlParams(); 239 var search = libtoaster.parseUrlParams();
@@ -239,17 +250,17 @@ function layerDetailsPageInit (ctx) {
239 250
240 if (added){ 251 if (added){
241 /* enable and switch all the button states */ 252 /* enable and switch all the button states */
242 $(".build-recipe-btn").removeAttr("disabled"); 253 $(".build-recipe-btn").removeClass("disabled");
243 $(".select-machine-btn").removeAttr("disabled"); 254 $(".select-machine-btn").removeClass("disabled");
244 addRmLayerBtn.addClass("btn-danger"); 255 addRmLayerBtn.addClass("btn-danger");
245 addRmLayerBtn.data('directive', "remove"); 256 addRmLayerBtn.data('directive', "remove");
246 addRmLayerBtn.text(" Remove the "+ctx.layerVersion.name+" layer from your project"); 257 addRmLayerBtn.text(" Remove the "+ctx.layerVersion.name+" layer from your project");
247 addRmLayerBtn.prepend("<span class=\"icon-trash\"></span>"); 258 addRmLayerBtn.prepend("<span class=\"glyphicon glyphicon-trash\"></span>");
248 259
249 } else { 260 } else {
250 /* disable and switch all the button states */ 261 /* disable and switch all the button states */
251 $(".build-recipe-btn").attr("disabled","disabled"); 262 $(".build-recipe-btn").addClass("disabled");
252 $(".select-machine-btn").attr("disabled", "disabled"); 263 $(".select-machine-btn").addClass("disabled");
253 addRmLayerBtn.removeClass("btn-danger"); 264 addRmLayerBtn.removeClass("btn-danger");
254 addRmLayerBtn.data('directive', "add"); 265 addRmLayerBtn.data('directive', "add");
255 266
@@ -257,7 +268,7 @@ function layerDetailsPageInit (ctx) {
257 * on which tab is currently visible. Unfortunately we can't just call 268 * on which tab is currently visible. Unfortunately we can't just call
258 * tab('show') as if it's already visible it doesn't run the event. 269 * tab('show') as if it's already visible it doesn't run the event.
259 */ 270 */
260 switch ($(".nav-pills .active a").prop('id')){ 271 switch ($(".nav-tabs .active a").prop('id')){
261 case 'machines-tab': 272 case 'machines-tab':
262 machinesTabShow(); 273 machinesTabShow();
263 break; 274 break;
@@ -286,7 +297,7 @@ function layerDetailsPageInit (ctx) {
286 297
287 setLayerInCurrentPrj(add); 298 setLayerInCurrentPrj(add);
288 299
289 $("#alert-area").show(); 300 libtoaster.showChangeNotification(alertMsg);
290 }); 301 });
291 }); 302 });
292 303
@@ -325,7 +336,7 @@ function layerDetailsPageInit (ctx) {
325 text = entryElement.val(); 336 text = entryElement.val();
326 337
327 /* Hide the "Not set" text if it's visible */ 338 /* Hide the "Not set" text if it's visible */
328 inputArea.find(".muted").hide(); 339 inputArea.find(".text-muted").hide();
329 inputArea.find(".current-value").text(text); 340 inputArea.find(".current-value").text(text);
330 /* Same behaviour as cancel in that we hide the form/show current 341 /* Same behaviour as cancel in that we hide the form/show current
331 * value. 342 * value.
@@ -343,9 +354,9 @@ function layerDetailsPageInit (ctx) {
343 /* Disable the change button when we have no data in the input */ 354 /* Disable the change button when we have no data in the input */
344 $("dl input, dl textarea").on("input",function() { 355 $("dl input, dl textarea").on("input",function() {
345 if ($(this).val().length === 0) 356 if ($(this).val().length === 0)
346 $(this).parent().children(".change-btn").attr("disabled", "disabled"); 357 $(this).parent().next(".change-btn").attr("disabled", "disabled");
347 else 358 else
348 $(this).parent().children(".change-btn").removeAttr("disabled"); 359 $(this).parent().next(".change-btn").removeAttr("disabled");
349 }); 360 });
350 361
351 /* This checks to see if the dt's dd has data in it or if the change data 362 /* This checks to see if the dt's dd has data in it or if the change data
@@ -359,7 +370,7 @@ function layerDetailsPageInit (ctx) {
359 /* There's no current value and the layer is editable 370 /* There's no current value and the layer is editable
360 * so show the "Not set" and hide the delete icon 371 * so show the "Not set" and hide the delete icon
361 */ 372 */
362 dd.find(".muted").show(); 373 dd.find(".text-muted").show();
363 dd.find(".delete-current-value").hide(); 374 dd.find(".delete-current-value").hide();
364 } else { 375 } else {
365 /* We're not viewing an editable layer so hide the empty dd/dl pair */ 376 /* We're not viewing an editable layer so hide the empty dd/dl pair */
@@ -387,9 +398,9 @@ function layerDetailsPageInit (ctx) {
387 }); 398 });
388 399
389 400
390 layerDepsList.find(".icon-trash").click(layerDepRemoveClick); 401 layerDepsList.find(".glyphicon-trash").click(layerDepRemoveClick);
391 layerDepsList.find("a").tooltip(); 402 layerDepsList.find("a").tooltip();
392 $(".icon-trash").tooltip(); 403 $(".glyphicon-trash").tooltip();
393 $(".commit").tooltip(); 404 $(".commit").tooltip();
394 405
395} 406}