summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r--bitbake/lib/toaster/orm/models.py4
-rw-r--r--bitbake/lib/toaster/toastergui/api.py8
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/libtoaster.js3
-rw-r--r--bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js7
-rw-r--r--bitbake/lib/toaster/toastergui/templates/customise_btn.html6
5 files changed, 23 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index be0bda5b15..849c22eede 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -1750,8 +1750,8 @@ class CustomImageRecipe(Recipe):
1750 if base_recipe_path: 1750 if base_recipe_path:
1751 base_recipe = open(base_recipe_path, 'r').read() 1751 base_recipe = open(base_recipe_path, 'r').read()
1752 else: 1752 else:
1753 raise IOError("Based on recipe file not found: %s" % 1753 # Pass back None to trigger error message to user
1754 base_recipe_path) 1754 return None
1755 1755
1756 # Add a special case for when the recipe we have based a custom image 1756 # Add a special case for when the recipe we have based a custom image
1757 # recipe on requires another recipe. 1757 # recipe on requires another recipe.
diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py
index 1bec56d468..564d595a1c 100644
--- a/bitbake/lib/toaster/toastergui/api.py
+++ b/bitbake/lib/toaster/toastergui/api.py
@@ -677,7 +677,13 @@ class XhrCustomRecipe(View):
677 recipe_path = os.path.join(layerpath, "recipes", "%s.bb" % 677 recipe_path = os.path.join(layerpath, "recipes", "%s.bb" %
678 recipe.name) 678 recipe.name)
679 with open(recipe_path, "w") as recipef: 679 with open(recipe_path, "w") as recipef:
680 recipef.write(recipe.generate_recipe_file_contents()) 680 content = recipe.generate_recipe_file_contents()
681 if not content:
682 # Delete this incomplete image recipe object
683 recipe.delete()
684 return error_response("recipe-parent-not-exist")
685 else:
686 recipef.write(recipe.generate_recipe_file_contents())
681 687
682 return JsonResponse( 688 return JsonResponse(
683 {"error": "ok", 689 {"error": "ok",
diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
index 2e8863af26..f2c45c833e 100644
--- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
+++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js
@@ -275,7 +275,8 @@ var libtoaster = (function () {
275 275
276 function _addRmLayer(layerObj, add, doneCb){ 276 function _addRmLayer(layerObj, add, doneCb){
277 if (layerObj.xhrLayerUrl === undefined){ 277 if (layerObj.xhrLayerUrl === undefined){
278 throw("xhrLayerUrl is undefined") 278 alert("ERROR: missing xhrLayerUrl object. Please file a bug.");
279 return;
279 } 280 }
280 281
281 if (add === true) { 282 if (add === true) {
diff --git a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js
index dace8e3258..e55fffcef5 100644
--- a/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js
+++ b/bitbake/lib/toaster/toastergui/static/js/newcustomimage_modal.js
@@ -25,6 +25,8 @@ function newCustomImageModalInit(){
25 var duplicateNameMsg = "An image with this name already exists. Image names must be unique."; 25 var duplicateNameMsg = "An image with this name already exists. Image names must be unique.";
26 var duplicateImageInProjectMsg = "An image with this name already exists in this project." 26 var duplicateImageInProjectMsg = "An image with this name already exists in this project."
27 var invalidBaseRecipeIdMsg = "Please select an image to customise."; 27 var invalidBaseRecipeIdMsg = "Please select an image to customise.";
28 var missingParentRecipe = "The parent recipe file was not found. Cancel this action, build any target (like 'quilt-native') to force all new layers to clone, and try again";
29 var unknownError = "Unexpected error: ";
28 30
29 // set button to "submit" state and enable text entry so user can 31 // set button to "submit" state and enable text entry so user can
30 // enter the custom recipe name 32 // enter the custom recipe name
@@ -62,6 +64,7 @@ function newCustomImageModalInit(){
62 if (nameInput.val().length > 0) { 64 if (nameInput.val().length > 0) {
63 libtoaster.createCustomRecipe(nameInput.val(), baseRecipeId, 65 libtoaster.createCustomRecipe(nameInput.val(), baseRecipeId,
64 function(ret) { 66 function(ret) {
67 showSubmitState();
65 if (ret.error !== "ok") { 68 if (ret.error !== "ok") {
66 console.warn(ret.error); 69 console.warn(ret.error);
67 if (ret.error === "invalid-name") { 70 if (ret.error === "invalid-name") {
@@ -73,6 +76,10 @@ function newCustomImageModalInit(){
73 } else if (ret.error === "image-already-exists") { 76 } else if (ret.error === "image-already-exists") {
74 showNameError(duplicateImageInProjectMsg); 77 showNameError(duplicateImageInProjectMsg);
75 return; 78 return;
79 } else if (ret.error === "recipe-parent-not-exist") {
80 showNameError(missingParentRecipe);
81 } else {
82 showNameError(unknownError + ret.error);
76 } 83 }
77 } else { 84 } else {
78 imgCustomModal.modal('hide'); 85 imgCustomModal.modal('hide');
diff --git a/bitbake/lib/toaster/toastergui/templates/customise_btn.html b/bitbake/lib/toaster/toastergui/templates/customise_btn.html
index 38c258ac32..ce462401c7 100644
--- a/bitbake/lib/toaster/toastergui/templates/customise_btn.html
+++ b/bitbake/lib/toaster/toastergui/templates/customise_btn.html
@@ -5,7 +5,11 @@
5 > 5 >
6 Customise 6 Customise
7</button> 7</button>
8<button class="btn btn-default btn-block layer-add-{{data.layer_version.pk}} layerbtn" data-layer='{ "id": {{data.layer_version.pk}}, "name": "{{data.layer_version.layer.name}}", "layerdetailurl": "{%url 'layerdetails' extra.pid data.layer_version.pk%}"}' data-directive="add" 8<button class="btn btn-default btn-block layer-add-{{data.layer_version.pk}} layerbtn"
9 data-layer='{ "id": {{data.layer_version.pk}}, "name": "{{data.layer_version.layer.name}}",
10 "layerdetailurl": "{%url 'layerdetails' extra.pid data.layer_version.pk%}",
11 "xhrLayerUrl": "{% url "xhr_layer" extra.pid data.layer_version.pk %}"}'
12 data-directive="add"
9 {% if data.layer_version.pk in extra.current_layers %} 13 {% if data.layer_version.pk in extra.current_layers %}
10 style="display:none;" 14 style="display:none;"
11 {% endif %} 15 {% endif %}