diff options
author | Michael Wood <michael.g.wood@intel.com> | 2015-05-18 20:08:28 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-29 11:59:45 +0100 |
commit | 2de01a68eb6a9ca74384957c674928944c235269 (patch) | |
tree | 7dbe5a8a2a169dac697bed032263c624e9c2be7e /bitbake/lib/toaster/toastergui/static/js/layerdetails.js | |
parent | a0ea663b83ecf5f286844420b071101feefc3d22 (diff) | |
download | poky-2de01a68eb6a9ca74384957c674928944c235269.tar.gz |
bitbake: toaster: Port layerdetails to ToasterTables
This ports the layerdetails page to using ToasterTables
Also some whitespace and strict clean ups in the existing layerdetails
js and html template.
(Bitbake rev: 8ce35f81631e31539aeb82f8a85abbb3312e5097)
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.js | 70 |
1 files changed, 52 insertions, 18 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js index 3c4d632563..3746ea26e3 100644 --- a/bitbake/lib/toaster/toastergui/static/js/layerdetails.js +++ b/bitbake/lib/toaster/toastergui/static/js/layerdetails.js | |||
@@ -1,4 +1,4 @@ | |||
1 | "use strict" | 1 | "use strict"; |
2 | 2 | ||
3 | function layerDetailsPageInit (ctx) { | 3 | function layerDetailsPageInit (ctx) { |
4 | 4 | ||
@@ -54,7 +54,7 @@ function layerDetailsPageInit (ctx) { | |||
54 | 54 | ||
55 | /* Add dependency layer button click handler */ | 55 | /* Add dependency layer button click handler */ |
56 | layerDepBtn.click(function(){ | 56 | layerDepBtn.click(function(){ |
57 | if (currentLayerDepSelection == undefined) | 57 | if (currentLayerDepSelection === undefined) |
58 | return; | 58 | return; |
59 | 59 | ||
60 | addRemoveDep(currentLayerDepSelection.id, true, function(){ | 60 | addRemoveDep(currentLayerDepSelection.id, true, function(){ |
@@ -122,13 +122,6 @@ function layerDetailsPageInit (ctx) { | |||
122 | }); | 122 | }); |
123 | }); | 123 | }); |
124 | 124 | ||
125 | $(".build-target-btn").click(function(){ | ||
126 | /* fire a build */ | ||
127 | var target = $(this).data('target-name'); | ||
128 | libtoaster.startABuild(ctx.projectBuildUrl, libtoaster.ctx.projectId, target, null, null); | ||
129 | window.location.replace(libtoaster.ctx.projectPageUrl); | ||
130 | }); | ||
131 | |||
132 | function defaultAddBtnText(){ | 125 | function defaultAddBtnText(){ |
133 | var text = " Add the "+ctx.layerVersion.name+" layer to your project"; | 126 | var text = " Add the "+ctx.layerVersion.name+" layer to your project"; |
134 | addRmLayerBtn.text(text); | 127 | addRmLayerBtn.text(text); |
@@ -155,9 +148,48 @@ function layerDetailsPageInit (ctx) { | |||
155 | } | 148 | } |
156 | } | 149 | } |
157 | 150 | ||
158 | window.location.hash = "targets"; | 151 | window.location.hash = "recipes"; |
159 | } | 152 | } |
160 | 153 | ||
154 | $("#recipestable").on('table-done', function(e, total, tableParams){ | ||
155 | ctx.numTargets = total; | ||
156 | |||
157 | if (total === 0 && !tableParams.search) { | ||
158 | $("#no-recipes-yet").show(); | ||
159 | } else { | ||
160 | $("#no-recipes-yet").hide(); | ||
161 | } | ||
162 | |||
163 | $("#targets-tab").removeClass("muted"); | ||
164 | if (window.location.hash === "#recipes"){ | ||
165 | /* re run the machinesTabShow to update the text */ | ||
166 | targetsTabShow(); | ||
167 | } | ||
168 | |||
169 | $(".build-target-btn").unbind('click'); | ||
170 | $(".build-target-btn").click(function(){ | ||
171 | /* fire a build */ | ||
172 | var target = $(this).data('target-name'); | ||
173 | libtoaster.startABuild(ctx.projectBuildUrl, libtoaster.ctx.projectId, target, null, null); | ||
174 | window.location.replace(libtoaster.ctx.projectPageUrl); | ||
175 | }); | ||
176 | }); | ||
177 | |||
178 | $("#machinestable").on('table-done', function(e, total, tableParams){ | ||
179 | ctx.numMachines = total; | ||
180 | |||
181 | if (total === 0 && !tableParams.search) | ||
182 | $("#no-machines-yet").show(); | ||
183 | else | ||
184 | $("#no-machines-yet").hide(); | ||
185 | |||
186 | $("#machines-tab").removeClass("muted"); | ||
187 | if (window.location.hash === "#machines"){ | ||
188 | /* re run the machinesTabShow to update the text */ | ||
189 | machinesTabShow(); | ||
190 | } | ||
191 | }); | ||
192 | |||
161 | $("#targets-tab").on('show', targetsTabShow); | 193 | $("#targets-tab").on('show', targetsTabShow); |
162 | 194 | ||
163 | function machinesTabShow(){ | 195 | function machinesTabShow(){ |
@@ -187,7 +219,7 @@ function layerDetailsPageInit (ctx) { | |||
187 | /* Enables the Build target and Select Machine buttons and switches the | 219 | /* Enables the Build target and Select Machine buttons and switches the |
188 | * add/remove button | 220 | * add/remove button |
189 | */ | 221 | */ |
190 | function setLayerInCurrentPrj(added, depsList) { | 222 | function setLayerInCurrentPrj(added) { |
191 | ctx.layerVersion.inCurrentPrj = added; | 223 | ctx.layerVersion.inCurrentPrj = added; |
192 | 224 | ||
193 | if (added){ | 225 | if (added){ |
@@ -224,18 +256,20 @@ function layerDetailsPageInit (ctx) { | |||
224 | } | 256 | } |
225 | } | 257 | } |
226 | 258 | ||
227 | $("#dismiss-alert").click(function(){ $(this).parent().hide() }); | 259 | $("#dismiss-alert").click(function(){ |
260 | $(this).parent().fadeOut(); | ||
261 | }); | ||
228 | 262 | ||
229 | /* Add or remove this layer from the project */ | 263 | /* Add or remove this layer from the project */ |
230 | addRmLayerBtn.click(function() { | 264 | addRmLayerBtn.click(function() { |
231 | 265 | ||
232 | var add = ($(this).data('directive') === "add") | 266 | var add = ($(this).data('directive') === "add"); |
233 | 267 | ||
234 | libtoaster.addRmLayer(ctx.layerVersion, add, function (layersList){ | 268 | libtoaster.addRmLayer(ctx.layerVersion, add, function (layersList){ |
235 | var alertMsg = $("#alert-msg"); | 269 | var alertMsg = $("#alert-msg"); |
236 | alertMsg.html(libtoaster.makeLayerAddRmAlertMsg(ctx.layerVersion, layersList, add)); | 270 | alertMsg.html(libtoaster.makeLayerAddRmAlertMsg(ctx.layerVersion, layersList, add)); |
237 | 271 | ||
238 | setLayerInCurrentPrj(add, layersList); | 272 | setLayerInCurrentPrj(add); |
239 | 273 | ||
240 | $("#alert-area").show(); | 274 | $("#alert-area").show(); |
241 | }); | 275 | }); |
@@ -250,9 +284,9 @@ function layerDetailsPageInit (ctx) { | |||
250 | * from. | 284 | * from. |
251 | */ | 285 | */ |
252 | var entryElement = mParent.find("input"); | 286 | var entryElement = mParent.find("input"); |
253 | if (entryElement.length == 0) | 287 | if (entryElement.length === 0) |
254 | entryElement = mParent.find("textarea"); | 288 | entryElement = mParent.find("textarea"); |
255 | if (entryElement.length == 0) { | 289 | if (entryElement.length === 0) { |
256 | console.warn("Could not find element to get data from for this change"); | 290 | console.warn("Could not find element to get data from for this change"); |
257 | return; | 291 | return; |
258 | } | 292 | } |
@@ -293,7 +327,7 @@ function layerDetailsPageInit (ctx) { | |||
293 | 327 | ||
294 | /* Disable the change button when we have no data in the input */ | 328 | /* Disable the change button when we have no data in the input */ |
295 | $("dl input, dl textarea").on("input",function() { | 329 | $("dl input, dl textarea").on("input",function() { |
296 | if ($(this).val().length == 0) | 330 | if ($(this).val().length === 0) |
297 | $(this).parent().children(".change-btn").attr("disabled", "disabled"); | 331 | $(this).parent().children(".change-btn").attr("disabled", "disabled"); |
298 | else | 332 | else |
299 | $(this).parent().children(".change-btn").removeAttr("disabled"); | 333 | $(this).parent().children(".change-btn").removeAttr("disabled"); |
@@ -322,7 +356,7 @@ function layerDetailsPageInit (ctx) { | |||
322 | }); | 356 | }); |
323 | 357 | ||
324 | /* Hide the right column if it contains no information */ | 358 | /* Hide the right column if it contains no information */ |
325 | if ($("dl.item-info").children(':visible').length == 0) { | 359 | if ($("dl.item-info").children(':visible').length === 0) { |
326 | $("dl.item-info").parent().hide(); | 360 | $("dl.item-info").parent().hide(); |
327 | } | 361 | } |
328 | 362 | ||