bitbake: toaster: Fix stale layer state buttons

Move the "is available to the project" state computation to the template
for the Layer add/remove buttons, Recipe build/Add layer as done for the
Package add/remove. This is more reliable as we can get an inconsistent
state on the front end JS as there are many opportunities for hitting
out of date project information.

[YOCTO #8294]

(Bitbake rev: 43469c3360566ad4897785f14f8717a9bc8b6078)

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>
This commit is contained in:
Michael Wood
2015-10-09 10:32:42 +01:00
committed by Richard Purdie
parent 41a5f82b4a
commit ab896df63b
7 changed files with 27 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
"use strict";
function layerBtnsInit(ctx) {
function layerBtnsInit() {
/* Remove any current bindings to avoid duplicated binds */
$(".layerbtn").unbind('click');
@@ -80,11 +80,4 @@ function layerBtnsInit(ctx) {
imgCustomModal.data('recipe', $(this).data('recipe'));
imgCustomModal.modal('show');
});
/* Setup the initial state of the buttons */
for (var i in ctx.projectLayers){
$(".layer-exists-" + ctx.projectLayers[i]).show();
$(".layer-add-" + ctx.projectLayers[i]).hide();
}
}

View File

@@ -130,7 +130,7 @@ function tableInit(ctx){
tableBody.append(row);
/* If we have layerbtns then initialise them */
layerBtnsInit(ctx);
layerBtnsInit();
/* If we have popovers initialise them now */
$('td > a.btn').popover({

View File

@@ -152,7 +152,7 @@ QUnit.test("Layer details page init", function(assert){
});
QUnit.test("Layer btns init", function(assert){
assert.throws(layerBtnsInit({ projectLayers : [] }));
assert.throws(layerBtnsInit());
});
QUnit.test("Table init", function(assert){