diff options
author | Michael Wood <michael.g.wood@intel.com> | 2014-12-05 17:25:51 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-12-18 10:24:07 +0000 |
commit | dadc11a52f7048891f9be0118fa19c96c3061547 (patch) | |
tree | bfa0f453b46f507ccc67b2d588b80d4e161216b5 /bitbake/lib/toaster/toastergui/static/js/importlayer.js | |
parent | bd6b8796a1e12c06b98a9bd0a746d5b6896ca85c (diff) | |
download | poky-dadc11a52f7048891f9be0118fa19c96c3061547.tar.gz |
bitbake: toaster: Importlayer add notify exactly which layers changed
This changes when the dependencies are added to the project so that we
can know which ones were successfully added by waiting for the server to
respond with a list. This is more reliable because we may have specified
dependencies which are already in the project.
To pass this information to the project page a temporary cookie is used
with the values for the notification.
(Bitbake rev: 23ca89dc3e0f0ea387649f1e9e8d7d50846048d6)
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/importlayer.js')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/importlayer.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/importlayer.js b/bitbake/lib/toaster/toastergui/static/js/importlayer.js index e2bc1ab607..15830dded5 100644 --- a/bitbake/lib/toaster/toastergui/static/js/importlayer.js +++ b/bitbake/lib/toaster/toastergui/static/js/importlayer.js | |||
@@ -78,8 +78,14 @@ function importLayerPageInit (ctx) { | |||
78 | }); | 78 | }); |
79 | 79 | ||
80 | importAndAddBtn.click(function(){ | 80 | importAndAddBtn.click(function(){ |
81 | /* This is a list of the names from layerDeps for the layer deps | ||
82 | * modal dialog body | ||
83 | */ | ||
84 | var depNames = []; | ||
85 | |||
81 | /* arrray of all layer dep ids includes parent and child deps */ | 86 | /* arrray of all layer dep ids includes parent and child deps */ |
82 | var allDeps = []; | 87 | var allDeps = []; |
88 | |||
83 | /* temporary object to use to do a reduce on the dependencies for each | 89 | /* temporary object to use to do a reduce on the dependencies for each |
84 | * layer dependency added | 90 | * layer dependency added |
85 | */ | 91 | */ |
@@ -96,6 +102,7 @@ function importLayerPageInit (ctx) { | |||
96 | depDeps[layer.id] = layer; | 102 | depDeps[layer.id] = layer; |
97 | } | 103 | } |
98 | } | 104 | } |
105 | depNames.push(layerDeps[key].name); | ||
99 | allDeps.push(layerDeps[key].id); | 106 | allDeps.push(layerDeps[key].id); |
100 | } | 107 | } |
101 | 108 | ||
@@ -106,10 +113,14 @@ function importLayerPageInit (ctx) { | |||
106 | 113 | ||
107 | if (depDepsArray.length > 0) { | 114 | if (depDepsArray.length > 0) { |
108 | var layer = { name: layerNameInput.val(), url: "#", id: -1 }; | 115 | var layer = { name: layerNameInput.val(), url: "#", id: -1 }; |
109 | show_layer_deps_modal(ctx.projectId, layer, depDepsArray, function(selected){ | 116 | var title = "Layer"; |
117 | var body = "<strong>"+layer.name+"</strong>'s dependencies ("+ | ||
118 | depNames.join(", ")+"</span>) require some layers that are not added to your project. Select the ones you want to add:</p>"; | ||
119 | |||
120 | show_layer_deps_modal(ctx.projectId, layer, depDepsArray, title, body, false, function(selected){ | ||
110 | /* Add the accepted dependencies to the allDeps array */ | 121 | /* Add the accepted dependencies to the allDeps array */ |
111 | if (selected.length > 0){ | 122 | if (selected.length > 0){ |
112 | allDeps.concat (selected); | 123 | allDeps = allDeps.concat (selected); |
113 | } | 124 | } |
114 | import_and_add (); | 125 | import_and_add (); |
115 | }); | 126 | }); |
@@ -141,8 +152,10 @@ function importLayerPageInit (ctx) { | |||
141 | show_error_message(data, layerData); | 152 | show_error_message(data, layerData); |
142 | console.log(data.error); | 153 | console.log(data.error); |
143 | } else { | 154 | } else { |
155 | layerData.layersAdded = data.layers_added; | ||
144 | /* Success layer import now go to the project page */ | 156 | /* Success layer import now go to the project page */ |
145 | window.location.replace(ctx.projectPageUrl+'#/layerimported='+layerData.name); | 157 | $.cookie('layer-imported-alert', JSON.stringify(layerData), { path: '/'}); |
158 | window.location.replace(ctx.projectPageUrl+'#/layerimported'); | ||
146 | } | 159 | } |
147 | }, | 160 | }, |
148 | error: function (data) { | 161 | error: function (data) { |