aboutsummaryrefslogtreecommitdiffstats
path: root/lib/toaster/toastergui/static/js/importlayer.js
diff options
context:
space:
mode:
authorDavid Reyna <David.Reyna@windriver.com>2017-09-14 16:58:15 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-17 23:23:41 +0100
commit04bd9c9341e8390a7923fa0122cd4cb0befa569f (patch)
tree6de3cdcf9421543d9153176f54b8aac9c395d234 /lib/toaster/toastergui/static/js/importlayer.js
parent013047484a03185c0ce281c53c1db4949cdc4e69 (diff)
downloadbitbake-contrib-04bd9c9341e8390a7923fa0122cd4cb0befa569f.tar.gz
toaster: reserve HEAD from imported layers
The HEAD reference in Toaster layers are reserved for the "Local Yocto Project" layers, stored at the top directory. Imported layers are not allowed to use this since they are managed differently - for example the 'remotes' will collide. Fix the add layer handler to not drop the data fields when it is a git repo. Explicitly inform the user when an internal Toaster error is returned via AJAX, so that they know why clicking the layer add button did not do anything. [YOCTO #9924] Signed-off-by: David Reyna <David.Reyna@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/toaster/toastergui/static/js/importlayer.js')
-rw-r--r--lib/toaster/toastergui/static/js/importlayer.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/toaster/toastergui/static/js/importlayer.js b/lib/toaster/toastergui/static/js/importlayer.js
index b3f094e69..59652b9a3 100644
--- a/lib/toaster/toastergui/static/js/importlayer.js
+++ b/lib/toaster/toastergui/static/js/importlayer.js
@@ -176,6 +176,8 @@ function importLayerPageInit (ctx) {
success: function (data) {
if (data.error != "ok") {
console.log(data.error);
+ /* let the user know why nothing happened */
+ alert(data.error)
} else {
createImportedNotification(data);
window.location.replace(libtoaster.ctx.projectPageUrl);
@@ -244,9 +246,18 @@ function importLayerPageInit (ctx) {
enable_import_btn(true);
}
- if ($("#git-repo-radio").prop("checked") &&
- vcsURLInput.val().length > 0 && gitRefInput.val().length > 0) {
- enable_import_btn(true);
+ if ($("#git-repo-radio").prop("checked")) {
+ if (gitRefInput.val().length > 0 &&
+ gitRefInput.val() == 'HEAD') {
+ $('#invalid-layer-revision-hint').show();
+ $('#layer-revision-ctrl').addClass('has-error');
+ enable_import_btn(false);
+ } else if (vcsURLInput.val().length > 0 &&
+ gitRefInput.val().length > 0) {
+ $('#invalid-layer-revision-hint').hide();
+ $('#layer-revision-ctrl').removeClass('has-error');
+ enable_import_btn(true);
+ }
}
}