Merge lp:~lamont/maas/bug-1642040-2.1 into lp:maas/2.1
- bug-1642040-2.1
- Merge into 2.1
Proposed by
LaMont Jones
Status: | Rejected |
---|---|
Rejected by: | Mike Pontillo |
Proposed branch: | lp:~lamont/maas/bug-1642040-2.1 |
Merge into: | lp:maas/2.1 |
Diff against target: |
298 lines (+154/-16) 3 files modified
src/maasserver/static/js/angular/directives/boot_images.js (+26/-0) src/maasserver/static/js/angular/directives/tests/test_boot_images.js (+80/-0) src/maasserver/static/partials/boot-images.html (+48/-16) |
To merge this branch: | bzr merge lp:~lamont/maas/bug-1642040-2.1 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mike Pontillo (community) | Needs Information | ||
Richard McCartney | Pending | ||
Review via email: mp+320875@code.launchpad.net |
Commit message
Backport r5847 from lp:maas: Add delete to other and generated images on the boot-images page.
Description of the change
Backport r5847 from lp:maas: Add delete to other and generated images on the boot-images page.
To post a comment you must log in.
Revision history for this message
LaMont Jones (lamont) wrote : | # |
Yes, it was. Having said that, I think I'd like Richard to review it too.
Revision history for this message
Mike Pontillo (mpontillo) wrote : | # |
Moving this to 'rejected' state since we have deprecated MAAS 2.1.
Unmerged revisions
- 5597. By LaMont Jones
-
Backport r5847 from lp:maas: Add delete to other and generated images on the boot-images page.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/maasserver/static/js/angular/directives/boot_images.js' | |||
2 | --- src/maasserver/static/js/angular/directives/boot_images.js 2016-12-07 12:59:10 +0000 | |||
3 | +++ src/maasserver/static/js/angular/directives/boot_images.js 2017-03-23 21:33:25 +0000 | |||
4 | @@ -84,6 +84,7 @@ | |||
5 | 84 | $scope.generatedImages = []; | 84 | $scope.generatedImages = []; |
6 | 85 | $scope.customImages = []; | 85 | $scope.customImages = []; |
7 | 86 | $scope.ubuntuDeleteId = null; | 86 | $scope.ubuntuDeleteId = null; |
8 | 87 | $scope.removingImage = null; | ||
9 | 87 | 88 | ||
10 | 88 | // Return true if the authenticated user is super user. | 89 | // Return true if the authenticated user is super user. |
11 | 89 | $scope.isSuperUser = function() { | 90 | $scope.isSuperUser = function() { |
12 | @@ -498,6 +499,7 @@ | |||
13 | 498 | icon: 'icon--status-' + resource.icon, | 499 | icon: 'icon--status-' + resource.icon, |
14 | 499 | title: resource.title, | 500 | title: resource.title, |
15 | 500 | arch: resource.arch, | 501 | arch: resource.arch, |
16 | 502 | image_id: resource.id, | ||
17 | 501 | size: resource.size, | 503 | size: resource.size, |
18 | 502 | status: resource.status | 504 | status: resource.status |
19 | 503 | }; | 505 | }; |
20 | @@ -537,6 +539,30 @@ | |||
21 | 537 | return false; | 539 | return false; |
22 | 538 | }; | 540 | }; |
23 | 539 | 541 | ||
24 | 542 | // Return if we are asking about deleting this image. | ||
25 | 543 | $scope.isShowingDeleteConfirm = function(image) { | ||
26 | 544 | return image === $scope.removingImage; | ||
27 | 545 | }; | ||
28 | 546 | |||
29 | 547 | // Mark the image for deletion. | ||
30 | 548 | $scope.quickRemove = function(image) { | ||
31 | 549 | $scope.removingImage = image; | ||
32 | 550 | }; | ||
33 | 551 | |||
34 | 552 | // Cancel image deletion. | ||
35 | 553 | $scope.cancelRemove = function() { | ||
36 | 554 | $scope.removingImage = null; | ||
37 | 555 | }; | ||
38 | 556 | |||
39 | 557 | // Mark the image for deletion. | ||
40 | 558 | $scope.confirmRemove = function(image) { | ||
41 | 559 | if(image === $scope.removingImage) { | ||
42 | 560 | BootResourcesManager.deleteImage( | ||
43 | 561 | {id: image.image_id}); | ||
44 | 562 | } | ||
45 | 563 | $scope.cancelRemove(); | ||
46 | 564 | }; | ||
47 | 565 | |||
48 | 540 | // Return true if the stop import button should be shown. | 566 | // Return true if the stop import button should be shown. |
49 | 541 | $scope.showStopImportButton = function() { | 567 | $scope.showStopImportButton = function() { |
50 | 542 | return $scope.bootResources.region_import_running; | 568 | return $scope.bootResources.region_import_running; |
51 | 543 | 569 | ||
52 | === modified file 'src/maasserver/static/js/angular/directives/tests/test_boot_images.js' | |||
53 | --- src/maasserver/static/js/angular/directives/tests/test_boot_images.js 2016-12-07 12:59:10 +0000 | |||
54 | +++ src/maasserver/static/js/angular/directives/tests/test_boot_images.js 2017-03-23 21:33:25 +0000 | |||
55 | @@ -88,6 +88,7 @@ | |||
56 | 88 | expect(scope.generatedImages).toEqual([]); | 88 | expect(scope.generatedImages).toEqual([]); |
57 | 89 | expect(scope.customImages).toEqual([]); | 89 | expect(scope.customImages).toEqual([]); |
58 | 90 | expect(scope.ubuntuDeleteId).toBeNull(); | 90 | expect(scope.ubuntuDeleteId).toBeNull(); |
59 | 91 | expect(scope.removingImage).toBeNull(); | ||
60 | 91 | }); | 92 | }); |
61 | 92 | 93 | ||
62 | 93 | it("clears loading once polling and user manager loaded", function() { | 94 | it("clears loading once polling and user manager loaded", function() { |
63 | @@ -1166,6 +1167,7 @@ | |||
64 | 1166 | var size = makeName("size"); | 1167 | var size = makeName("size"); |
65 | 1167 | var status = makeName("status"); | 1168 | var status = makeName("status"); |
66 | 1168 | scope.bootResources.resources = [{ | 1169 | scope.bootResources.resources = [{ |
67 | 1170 | id: 3, | ||
68 | 1169 | rtype: 1, | 1171 | rtype: 1, |
69 | 1170 | icon: icon, | 1172 | icon: icon, |
70 | 1171 | title: title, | 1173 | title: title, |
71 | @@ -1179,6 +1181,7 @@ | |||
72 | 1179 | icon: 'icon--status-' + icon + ' u-animation--pulse', | 1181 | icon: 'icon--status-' + icon + ' u-animation--pulse', |
73 | 1180 | title: title, | 1182 | title: title, |
74 | 1181 | arch: arch, | 1183 | arch: arch, |
75 | 1184 | image_id: 3, | ||
76 | 1182 | size: size, | 1185 | size: size, |
77 | 1183 | status: status | 1186 | status: status |
78 | 1184 | }]); | 1187 | }]); |
79 | @@ -1197,6 +1200,7 @@ | |||
80 | 1197 | var status = makeName("status"); | 1200 | var status = makeName("status"); |
81 | 1198 | scope.bootResources.resources = [{ | 1201 | scope.bootResources.resources = [{ |
82 | 1199 | rtype: 2, | 1202 | rtype: 2, |
83 | 1203 | id: 3, | ||
84 | 1200 | icon: icon, | 1204 | icon: icon, |
85 | 1201 | title: title, | 1205 | title: title, |
86 | 1202 | arch: arch, | 1206 | arch: arch, |
87 | @@ -1209,12 +1213,88 @@ | |||
88 | 1209 | icon: 'icon--status-' + icon + ' u-animation--pulse', | 1213 | icon: 'icon--status-' + icon + ' u-animation--pulse', |
89 | 1210 | title: title, | 1214 | title: title, |
90 | 1211 | arch: arch, | 1215 | arch: arch, |
91 | 1216 | image_id: 3, | ||
92 | 1212 | size: size, | 1217 | size: size, |
93 | 1213 | status: status | 1218 | status: status |
94 | 1214 | }]); | 1219 | }]); |
95 | 1215 | }); | 1220 | }); |
96 | 1216 | }); | 1221 | }); |
97 | 1217 | 1222 | ||
98 | 1223 | describe("isShowingDeleteConfirm", function() { | ||
99 | 1224 | it("returns false when not deleting", function() { | ||
100 | 1225 | var directive = compileDirective(); | ||
101 | 1226 | var scope = directive.isolateScope(); | ||
102 | 1227 | var image = {image_id: 3}; | ||
103 | 1228 | expect(scope.isShowingDeleteConfirm(image)).toBe(false); | ||
104 | 1229 | }); | ||
105 | 1230 | |||
106 | 1231 | it("returns true when deleting this image", function() { | ||
107 | 1232 | var directive = compileDirective(); | ||
108 | 1233 | var scope = directive.isolateScope(); | ||
109 | 1234 | var image1 = {image_id: 3}; | ||
110 | 1235 | var image2 = {image_id: 7}; | ||
111 | 1236 | scope.removingImage = image1; | ||
112 | 1237 | expect(scope.isShowingDeleteConfirm(image1)).toBe(true); | ||
113 | 1238 | }); | ||
114 | 1239 | |||
115 | 1240 | it("returns false when deleting other image", function() { | ||
116 | 1241 | var directive = compileDirective(); | ||
117 | 1242 | var scope = directive.isolateScope(); | ||
118 | 1243 | var image1 = {image_id: 3}; | ||
119 | 1244 | var image2 = {image_id: 7}; | ||
120 | 1245 | scope.removingImage = image1; | ||
121 | 1246 | expect(scope.isShowingDeleteConfirm(image2)).toBe(false); | ||
122 | 1247 | }); | ||
123 | 1248 | }); | ||
124 | 1249 | |||
125 | 1250 | describe("quickRemove", function() { | ||
126 | 1251 | it("sets removingImage", function() { | ||
127 | 1252 | var directive = compileDirective(); | ||
128 | 1253 | var scope = directive.isolateScope(); | ||
129 | 1254 | var image = {image_id: 3}; | ||
130 | 1255 | scope.quickRemove(image); | ||
131 | 1256 | expect(scope.removingImage).toBe(image); | ||
132 | 1257 | }); | ||
133 | 1258 | }); | ||
134 | 1259 | |||
135 | 1260 | describe("cancelRemove", function() { | ||
136 | 1261 | it("clears removingImage", function() { | ||
137 | 1262 | var directive = compileDirective(); | ||
138 | 1263 | var scope = directive.isolateScope(); | ||
139 | 1264 | var image = {image_id: 3}; | ||
140 | 1265 | scope.removingImage = image; | ||
141 | 1266 | scope.cancelRemove(); | ||
142 | 1267 | expect(scope.removingImage).toBe(null); | ||
143 | 1268 | }); | ||
144 | 1269 | }); | ||
145 | 1270 | |||
146 | 1271 | describe("confirmRemove", function() { | ||
147 | 1272 | it("calls delete_image if given removingImage", function() { | ||
148 | 1273 | var directive = compileDirective(); | ||
149 | 1274 | var scope = directive.isolateScope(); | ||
150 | 1275 | var image1 = {image_id: 3}; | ||
151 | 1276 | var image2 = {image_id: 7}; | ||
152 | 1277 | scope.removingImage = image1; | ||
153 | 1278 | spyOn(BootResourcesManager, "deleteImage"); | ||
154 | 1279 | scope.confirmRemove(image1); | ||
155 | 1280 | expect(scope.removingImage).toBe(null); | ||
156 | 1281 | expect(BootResourcesManager.deleteImage).toHaveBeenCalledWith( | ||
157 | 1282 | {id: image1.image_id}); | ||
158 | 1283 | }); | ||
159 | 1284 | |||
160 | 1285 | it("does not call delete_image if given other image", function() { | ||
161 | 1286 | var directive = compileDirective(); | ||
162 | 1287 | var scope = directive.isolateScope(); | ||
163 | 1288 | var image1 = {image_id: 3}; | ||
164 | 1289 | var image2 = {image_id: 7}; | ||
165 | 1290 | scope.removingImage = image1; | ||
166 | 1291 | spyOn(BootResourcesManager, "deleteImage"); | ||
167 | 1292 | scope.confirmRemove(image2); | ||
168 | 1293 | expect(scope.removingImage).toBe(null); | ||
169 | 1294 | expect(BootResourcesManager.deleteImage).not.toHaveBeenCalled(); | ||
170 | 1295 | }); | ||
171 | 1296 | }); | ||
172 | 1297 | |||
173 | 1218 | describe("ltsIsSelected", function() { | 1298 | describe("ltsIsSelected", function() { |
174 | 1219 | 1299 | ||
175 | 1220 | it("returns true if LTS is selected", function() { | 1300 | it("returns true if LTS is selected", function() { |
176 | 1221 | 1301 | ||
177 | === modified file 'src/maasserver/static/partials/boot-images.html' | |||
178 | --- src/maasserver/static/partials/boot-images.html 2016-12-07 12:59:10 +0000 | |||
179 | +++ src/maasserver/static/partials/boot-images.html 2017-03-23 21:33:25 +0000 | |||
180 | @@ -116,7 +116,7 @@ | |||
181 | 116 | <div class="table__header table-col--25">Release</div> | 116 | <div class="table__header table-col--25">Release</div> |
182 | 117 | <div class="table__header table-col--15">Architecture</div> | 117 | <div class="table__header table-col--15">Architecture</div> |
183 | 118 | <div class="table__header table-col--20">Size</div> | 118 | <div class="table__header table-col--20">Size</div> |
185 | 119 | <div class="table__header table-col--30">Status</div> | 119 | <div class="table__header table-col--40">Status</div> |
186 | 120 | </div> | 120 | </div> |
187 | 121 | </header> | 121 | </header> |
188 | 122 | <main class="table__body"> | 122 | <main class="table__body"> |
189 | @@ -192,7 +192,7 @@ | |||
190 | 192 | <div class="table__header table-col--25">Release</div> | 192 | <div class="table__header table-col--25">Release</div> |
191 | 193 | <div class="table__header table-col--15">Architecture</div> | 193 | <div class="table__header table-col--15">Architecture</div> |
192 | 194 | <div class="table__header table-col--20">Size</div> | 194 | <div class="table__header table-col--20">Size</div> |
194 | 195 | <div class="table__header table-col--30">Status</div> | 195 | <div class="table__header table-col--40">Status</div> |
195 | 196 | </div> | 196 | </div> |
196 | 197 | </header> | 197 | </header> |
197 | 198 | <main class="table__body"> | 198 | <main class="table__body"> |
198 | @@ -205,12 +205,12 @@ | |||
199 | 205 | <div class="table__data table-col--2"> | 205 | <div class="table__data table-col--2"> |
200 | 206 | <i class="icon {$ image.icon $}"></i> | 206 | <i class="icon {$ image.icon $}"></i> |
201 | 207 | </div> | 207 | </div> |
203 | 208 | <div class="table__data table-col--23"> | 208 | <div class="table__data table-col--23" aria-label="Release"> |
204 | 209 | {$ image.title $} | 209 | {$ image.title $} |
205 | 210 | </div> | 210 | </div> |
209 | 211 | <div class="table__data table-col--15">{$ image.arch $}</div> | 211 | <div class="table__data table-col--15" aria-label="Architecture">{$ image.arch $}</div> |
210 | 212 | <div class="table__data table-col--20">{$ image.size $}</div> | 212 | <div class="table__data table-col--20" aria-label="Size">{$ image.size $}</div> |
211 | 213 | <div class="table__data table-col--30">{$ image.status $}</div> | 213 | <div class="table__data table-col--40" aria-label="Status">{$ image.status $}</div> |
212 | 214 | </div> | 214 | </div> |
213 | 215 | </main> | 215 | </main> |
214 | 216 | </section> | 216 | </section> |
215 | @@ -233,7 +233,7 @@ | |||
216 | 233 | <div class="table__header table-col--25">Release</div> | 233 | <div class="table__header table-col--25">Release</div> |
217 | 234 | <div class="table__header table-col--15">Architecture</div> | 234 | <div class="table__header table-col--15">Architecture</div> |
218 | 235 | <div class="table__header table-col--20">Size</div> | 235 | <div class="table__header table-col--20">Size</div> |
220 | 236 | <div class="table__header table-col--30">Status</div> | 236 | <div class="table__header table-col--40">Status</div> |
221 | 237 | </div> | 237 | </div> |
222 | 238 | </header> | 238 | </header> |
223 | 239 | <main class="table__body"> | 239 | <main class="table__body"> |
224 | @@ -246,12 +246,28 @@ | |||
225 | 246 | <div class="table__data table-col--2"> | 246 | <div class="table__data table-col--2"> |
226 | 247 | <i class="icon {$ image.icon $}"></i> | 247 | <i class="icon {$ image.icon $}"></i> |
227 | 248 | </div> | 248 | </div> |
229 | 249 | <div class="table__data table-col--23"> | 249 | <div class="table__data table-col--23" aria-label="Release"> |
230 | 250 | {$ image.title $} | 250 | {$ image.title $} |
231 | 251 | </div> | 251 | </div> |
235 | 252 | <div class="table__data table-col--15">{$ image.arch $}</div> | 252 | <div class="table__data table-col--15" aria-label="Architecture">{$ image.arch $}</div> |
236 | 253 | <div class="table__data table-col--20">{$ image.size $}</div> | 253 | <div class="table__data table-col--20" aria-label="Size">{$ image.size $}</div> |
237 | 254 | <div class="table__data table-col--30">{$ image.status $}</div> | 254 | <div class="table__data table-col--37" aria-label="Status">{$ image.status $}</div> |
238 | 255 | <div class="table__data table-col--3"> | ||
239 | 256 | <div class="table__controls u-align--right"> | ||
240 | 257 | <a class="u-display--desktop icon icon--delete tooltip" | ||
241 | 258 | aria-label="Remove" | ||
242 | 259 | data-ng-click="quickRemove(image)"></a> | ||
243 | 260 | </div> | ||
244 | 261 | </div> | ||
245 | 262 | <div class="table__row is-active" data-ng-if="isShowingDeleteConfirm(image)"> | ||
246 | 263 | <div class="table__data u-float--left"> | ||
247 | 264 | <p><span class="icon icon--warning u-margin--right-small"></span> Are you sure you want to remove this image?</p> | ||
248 | 265 | </div> | ||
249 | 266 | <div class="table__data u-float--right"> | ||
250 | 267 | <a class="button--base button--inline" data-ng-click="cancelRemove()">Cancel</a> | ||
251 | 268 | <button class="button--destructive button--inline" data-ng-click="confirmRemove(image)">Remove</button> | ||
252 | 269 | </div> | ||
253 | 270 | </div> | ||
254 | 255 | </div> | 271 | </div> |
255 | 256 | </main> | 272 | </main> |
256 | 257 | </section> | 273 | </section> |
257 | @@ -266,7 +282,7 @@ | |||
258 | 266 | <div class="table__header table-col--25">Release</div> | 282 | <div class="table__header table-col--25">Release</div> |
259 | 267 | <div class="table__header table-col--15">Architecture</div> | 283 | <div class="table__header table-col--15">Architecture</div> |
260 | 268 | <div class="table__header table-col--20">Size</div> | 284 | <div class="table__header table-col--20">Size</div> |
262 | 269 | <div class="table__header table-col--30">Status</div> | 285 | <div class="table__header table-col--40">Status</div> |
263 | 270 | </div> | 286 | </div> |
264 | 271 | </header> | 287 | </header> |
265 | 272 | <main class="table__body"> | 288 | <main class="table__body"> |
266 | @@ -279,12 +295,28 @@ | |||
267 | 279 | <div class="table__data table-col--2"> | 295 | <div class="table__data table-col--2"> |
268 | 280 | <i class="icon {$ image.icon $}"></i> | 296 | <i class="icon {$ image.icon $}"></i> |
269 | 281 | </div> | 297 | </div> |
271 | 282 | <div class="table__data table-col--23"> | 298 | <div class="table__data table-col--23" aria-label="Release"> |
272 | 283 | {$ image.title $} | 299 | {$ image.title $} |
273 | 284 | </div> | 300 | </div> |
277 | 285 | <div class="table__data table-col--15">{$ image.arch $}</div> | 301 | <div class="table__data table-col--15" aria-label="Architecture">{$ image.arch $}</div> |
278 | 286 | <div class="table__data table-col--20">{$ image.size $}</div> | 302 | <div class="table__data table-col--20" aria-label="Size">{$ image.size $}</div> |
279 | 287 | <div class="table__data table-col--30">{$ image.status $}</div> | 303 | <div class="table__data table-col--37" aria-label="Status">{$ image.status $}</div> |
280 | 304 | <div class="table__data table-col--3"> | ||
281 | 305 | <div class="table__controls u-align--right"> | ||
282 | 306 | <a class="u-display--desktop icon icon--delete tooltip" | ||
283 | 307 | aria-label="Remove" | ||
284 | 308 | data-ng-click="quickRemove(image)"></a> | ||
285 | 309 | </div> | ||
286 | 310 | </div> | ||
287 | 311 | <div class="table__row is-active" data-ng-if="isShowingDeleteConfirm(image)"> | ||
288 | 312 | <div class="table__data u-float--left"> | ||
289 | 313 | <p><span class="icon icon--warning u-margin--right-small"></span> Are you sure you want to remove this image?</p> | ||
290 | 314 | </div> | ||
291 | 315 | <div class="table__data u-float--right"> | ||
292 | 316 | <a class="button--base button--inline" data-ng-click="cancelRemove()">Cancel</a> | ||
293 | 317 | <button class="button--destructive button--inline" data-ng-click="confirmRemove(image)">Remove</button> | ||
294 | 318 | </div> | ||
295 | 319 | </div> | ||
296 | 288 | </div> | 320 | </div> |
297 | 289 | </main> | 321 | </main> |
298 | 290 | </section> | 322 | </section> |
Was this tested on 2.1 after the backport? Some of the CSS framework changed between 2.1 and 2.2, so that could be important.