diff options
author | Dave Lerner <dave.lerner@windriver.com> | 2016-03-24 12:12:09 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-26 07:34:58 +0000 |
commit | d5a419d6281f0547826fcae5b7f38148dcf643ed (patch) | |
tree | e90199fe37d8740ce2b4e8b91877e0b8be179bc6 /bitbake/lib/toaster | |
parent | fda94f4e2daada949423cd88240dc0c52b48498d (diff) | |
download | poky-d5a419d6281f0547826fcae5b7f38148dcf643ed.tar.gz |
bitbake: toaster: show full list of dependents to remove
When a package is to be removed, show the full list of packages that are
dependent on that package, telling user that these packages will also be
removed.
[YOCTO #9121]
(Bitbake rev: f5cb59b6b10a714b18b1c00b9a8598dd855c84b5)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r-- | bitbake/lib/toaster/toastergui/static/js/customrecipe.js | 72 |
1 files changed, 66 insertions, 6 deletions
diff --git a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js index 3c57899420..f1b8afbf2f 100644 --- a/bitbake/lib/toaster/toastergui/static/js/customrecipe.js +++ b/bitbake/lib/toaster/toastergui/static/js/customrecipe.js | |||
@@ -89,7 +89,21 @@ function customRecipePageInit(ctx) { | |||
89 | var depsList = modal.find("#package-reverse-dep-list"); | 89 | var depsList = modal.find("#package-reverse-dep-list"); |
90 | var deps = pkgData.reverse_dependencies; | 90 | var deps = pkgData.reverse_dependencies; |
91 | 91 | ||
92 | var depsCount = deps.length; | ||
93 | var vDepends = "depends"; | ||
94 | var vPackage = "package"; | ||
95 | var vThis = "this"; | ||
96 | if (depsCount > 1) { | ||
97 | vDepends = "depend"; | ||
98 | vPackage = "packages"; | ||
99 | vThis = "these"; | ||
100 | } | ||
92 | modal.find(".package-to-rm-name").text(targetPkg.name); | 101 | modal.find(".package-to-rm-name").text(targetPkg.name); |
102 | modal.find(".reverse-deps-count").text(depsCount); | ||
103 | modal.find(".reverse-deps-count-plus1").text((depsCount+1) + " packages"); | ||
104 | modal.find(".reverse-deps-depends").text(vDepends); | ||
105 | modal.find(".reverse-deps-package").text(vPackage); | ||
106 | modal.find(".reverse-deps-this").text(vThis); | ||
93 | 107 | ||
94 | depsList.text(""); | 108 | depsList.text(""); |
95 | 109 | ||
@@ -103,6 +117,8 @@ function customRecipePageInit(ctx) { | |||
103 | modal.find("#package-reverse-deps-total-size").text( | 117 | modal.find("#package-reverse-deps-total-size").text( |
104 | pkgData.reverse_dependencies_size_formatted); | 118 | pkgData.reverse_dependencies_size_formatted); |
105 | 119 | ||
120 | targetPkg.depsRemoved = deps; | ||
121 | |||
106 | rmdPkgReverseDepsModalBtn.data(targetPkg); | 122 | rmdPkgReverseDepsModalBtn.data(targetPkg); |
107 | modal.modal('show'); | 123 | modal.modal('show'); |
108 | } | 124 | } |
@@ -121,6 +137,10 @@ function customRecipePageInit(ctx) { | |||
121 | var btnCell = $("#package-btn-cell-" + targetPkg.id); | 137 | var btnCell = $("#package-btn-cell-" + targetPkg.id); |
122 | var inlineNotify = btnCell.children(".inline-notification"); | 138 | var inlineNotify = btnCell.children(".inline-notification"); |
123 | 139 | ||
140 | var i; | ||
141 | var dep; | ||
142 | var depBtnCell; | ||
143 | |||
124 | if (targetPkg.directive === 'add') { | 144 | if (targetPkg.directive === 'add') { |
125 | method = 'PUT'; | 145 | method = 'PUT'; |
126 | /* If the package had dependencies also notify that they were added */ | 146 | /* If the package had dependencies also notify that they were added */ |
@@ -132,15 +152,15 @@ function customRecipePageInit(ctx) { | |||
132 | msg += " packages to " + ctx.recipe.name + ": "; | 152 | msg += " packages to " + ctx.recipe.name + ": "; |
133 | msg += "<strong>" + targetPkg.name + "</strong> and its dependencies"; | 153 | msg += "<strong>" + targetPkg.name + "</strong> and its dependencies"; |
134 | 154 | ||
135 | for (var i in targetPkg.depsAdded){ | 155 | for (i in targetPkg.depsAdded){ |
136 | var dep = targetPkg.depsAdded[i]; | 156 | dep = targetPkg.depsAdded[i]; |
137 | 157 | ||
138 | msg += " <strong>" + dep.name + "</strong>"; | 158 | msg += " <strong>" + dep.name + "</strong>"; |
139 | 159 | ||
140 | /* Add any cells currently in view to the list of cells which get | 160 | /* Add any cells currently in view to the list of cells which get |
141 | * an inline notification inside them and which change add/rm state | 161 | * an inline notification inside them and which change add/rm state |
142 | */ | 162 | */ |
143 | var depBtnCell = $("#package-btn-cell-" + dep.pk); | 163 | depBtnCell = $("#package-btn-cell-" + dep.pk); |
144 | btnCell = btnCell.add(depBtnCell); | 164 | btnCell = btnCell.add(depBtnCell); |
145 | 165 | ||
146 | inlineNotify = inlineNotify.add( | 166 | inlineNotify = inlineNotify.add( |
@@ -159,9 +179,49 @@ function customRecipePageInit(ctx) { | |||
159 | 179 | ||
160 | } else if (targetPkg.directive === 'remove') { | 180 | } else if (targetPkg.directive === 'remove') { |
161 | method = 'DELETE'; | 181 | method = 'DELETE'; |
162 | msg += "removed 1 package from "+ctx.recipe.name+":"; | 182 | var numPackageString = "1 package "; |
163 | msg += ' <strong>' + targetPkg.name + '<strong>'; | 183 | var revDepList = ""; |
164 | inlineNotify.text("1 package removed"); | 184 | if (targetPkg.hasOwnProperty('depsRemoved') && |
185 | targetPkg.depsRemoved.length > 0) { | ||
186 | var depsRemovedLength = targetPkg.depsRemoved.length; | ||
187 | var ending = "y: "; | ||
188 | var maxRevDepsDisplayed = 5; | ||
189 | var d = 0; | ||
190 | if (depsRemovedLength > 1) { | ||
191 | ending = "ies: "; | ||
192 | } | ||
193 | numPackageString = (depsRemovedLength + 1) + " packages"; | ||
194 | revDepList = " and its " + depsRemovedLength + " reverse dependenc" + ending; | ||
195 | for (i in targetPkg.depsRemoved){ | ||
196 | /* include up to maxRevDepsDisplayed rev deps on the page notification */ | ||
197 | var notShownCount = depsRemovedLength - maxRevDepsDisplayed; | ||
198 | dep = targetPkg.depsRemoved[i]; | ||
199 | if (d < maxRevDepsDisplayed) { | ||
200 | if (d > 0) { | ||
201 | revDepList += ", "; | ||
202 | } | ||
203 | revDepList += dep.name; | ||
204 | d++; | ||
205 | if ((d === maxRevDepsDisplayed) && (notShownCount > 0)) { | ||
206 | revDepList += " and " + notShownCount + " more"; | ||
207 | } | ||
208 | } | ||
209 | |||
210 | /* Add any cells currently in view to the list of cells which get | ||
211 | * an inline notification inside them and which change add/rm state | ||
212 | */ | ||
213 | depBtnCell = $("#package-btn-cell-" + dep.pk); | ||
214 | btnCell = btnCell.add(depBtnCell); | ||
215 | |||
216 | inlineNotify = inlineNotify.add( | ||
217 | depBtnCell.children(".inline-notification")); | ||
218 | } | ||
219 | } | ||
220 | msg+= "removed " + numPackageString + " from " + ctx.recipe.name + ":"; | ||
221 | msg += " <strong>" + targetPkg.name + "</strong>"; | ||
222 | msg += revDepList; | ||
223 | |||
224 | inlineNotify.text(numPackageString + " removed"); | ||
165 | } else { | 225 | } else { |
166 | throw("Unknown package directive: should be add or remove"); | 226 | throw("Unknown package directive: should be add or remove"); |
167 | } | 227 | } |