Merge lp:~lamont/maas/bug-1642040-2.1 into lp:maas/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
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
Mike Pontillo (mpontillo) wrote :

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.

review: Needs Information
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
=== modified file 'src/maasserver/static/js/angular/directives/boot_images.js'
--- src/maasserver/static/js/angular/directives/boot_images.js 2016-12-07 12:59:10 +0000
+++ src/maasserver/static/js/angular/directives/boot_images.js 2017-03-23 21:33:25 +0000
@@ -84,6 +84,7 @@
84 $scope.generatedImages = [];84 $scope.generatedImages = [];
85 $scope.customImages = [];85 $scope.customImages = [];
86 $scope.ubuntuDeleteId = null;86 $scope.ubuntuDeleteId = null;
87 $scope.removingImage = null;
8788
88 // Return true if the authenticated user is super user.89 // Return true if the authenticated user is super user.
89 $scope.isSuperUser = function() {90 $scope.isSuperUser = function() {
@@ -498,6 +499,7 @@
498 icon: 'icon--status-' + resource.icon,499 icon: 'icon--status-' + resource.icon,
499 title: resource.title,500 title: resource.title,
500 arch: resource.arch,501 arch: resource.arch,
502 image_id: resource.id,
501 size: resource.size,503 size: resource.size,
502 status: resource.status504 status: resource.status
503 };505 };
@@ -537,6 +539,30 @@
537 return false;539 return false;
538 };540 };
539541
542 // Return if we are asking about deleting this image.
543 $scope.isShowingDeleteConfirm = function(image) {
544 return image === $scope.removingImage;
545 };
546
547 // Mark the image for deletion.
548 $scope.quickRemove = function(image) {
549 $scope.removingImage = image;
550 };
551
552 // Cancel image deletion.
553 $scope.cancelRemove = function() {
554 $scope.removingImage = null;
555 };
556
557 // Mark the image for deletion.
558 $scope.confirmRemove = function(image) {
559 if(image === $scope.removingImage) {
560 BootResourcesManager.deleteImage(
561 {id: image.image_id});
562 }
563 $scope.cancelRemove();
564 };
565
540 // Return true if the stop import button should be shown.566 // Return true if the stop import button should be shown.
541 $scope.showStopImportButton = function() {567 $scope.showStopImportButton = function() {
542 return $scope.bootResources.region_import_running;568 return $scope.bootResources.region_import_running;
543569
=== modified file 'src/maasserver/static/js/angular/directives/tests/test_boot_images.js'
--- src/maasserver/static/js/angular/directives/tests/test_boot_images.js 2016-12-07 12:59:10 +0000
+++ src/maasserver/static/js/angular/directives/tests/test_boot_images.js 2017-03-23 21:33:25 +0000
@@ -88,6 +88,7 @@
88 expect(scope.generatedImages).toEqual([]);88 expect(scope.generatedImages).toEqual([]);
89 expect(scope.customImages).toEqual([]);89 expect(scope.customImages).toEqual([]);
90 expect(scope.ubuntuDeleteId).toBeNull();90 expect(scope.ubuntuDeleteId).toBeNull();
91 expect(scope.removingImage).toBeNull();
91 });92 });
9293
93 it("clears loading once polling and user manager loaded", function() {94 it("clears loading once polling and user manager loaded", function() {
@@ -1166,6 +1167,7 @@
1166 var size = makeName("size");1167 var size = makeName("size");
1167 var status = makeName("status");1168 var status = makeName("status");
1168 scope.bootResources.resources = [{1169 scope.bootResources.resources = [{
1170 id: 3,
1169 rtype: 1,1171 rtype: 1,
1170 icon: icon,1172 icon: icon,
1171 title: title,1173 title: title,
@@ -1179,6 +1181,7 @@
1179 icon: 'icon--status-' + icon + ' u-animation--pulse',1181 icon: 'icon--status-' + icon + ' u-animation--pulse',
1180 title: title,1182 title: title,
1181 arch: arch,1183 arch: arch,
1184 image_id: 3,
1182 size: size,1185 size: size,
1183 status: status1186 status: status
1184 }]);1187 }]);
@@ -1197,6 +1200,7 @@
1197 var status = makeName("status");1200 var status = makeName("status");
1198 scope.bootResources.resources = [{1201 scope.bootResources.resources = [{
1199 rtype: 2,1202 rtype: 2,
1203 id: 3,
1200 icon: icon,1204 icon: icon,
1201 title: title,1205 title: title,
1202 arch: arch,1206 arch: arch,
@@ -1209,12 +1213,88 @@
1209 icon: 'icon--status-' + icon + ' u-animation--pulse',1213 icon: 'icon--status-' + icon + ' u-animation--pulse',
1210 title: title,1214 title: title,
1211 arch: arch,1215 arch: arch,
1216 image_id: 3,
1212 size: size,1217 size: size,
1213 status: status1218 status: status
1214 }]);1219 }]);
1215 });1220 });
1216 });1221 });
12171222
1223 describe("isShowingDeleteConfirm", function() {
1224 it("returns false when not deleting", function() {
1225 var directive = compileDirective();
1226 var scope = directive.isolateScope();
1227 var image = {image_id: 3};
1228 expect(scope.isShowingDeleteConfirm(image)).toBe(false);
1229 });
1230
1231 it("returns true when deleting this image", function() {
1232 var directive = compileDirective();
1233 var scope = directive.isolateScope();
1234 var image1 = {image_id: 3};
1235 var image2 = {image_id: 7};
1236 scope.removingImage = image1;
1237 expect(scope.isShowingDeleteConfirm(image1)).toBe(true);
1238 });
1239
1240 it("returns false when deleting other image", function() {
1241 var directive = compileDirective();
1242 var scope = directive.isolateScope();
1243 var image1 = {image_id: 3};
1244 var image2 = {image_id: 7};
1245 scope.removingImage = image1;
1246 expect(scope.isShowingDeleteConfirm(image2)).toBe(false);
1247 });
1248 });
1249
1250 describe("quickRemove", function() {
1251 it("sets removingImage", function() {
1252 var directive = compileDirective();
1253 var scope = directive.isolateScope();
1254 var image = {image_id: 3};
1255 scope.quickRemove(image);
1256 expect(scope.removingImage).toBe(image);
1257 });
1258 });
1259
1260 describe("cancelRemove", function() {
1261 it("clears removingImage", function() {
1262 var directive = compileDirective();
1263 var scope = directive.isolateScope();
1264 var image = {image_id: 3};
1265 scope.removingImage = image;
1266 scope.cancelRemove();
1267 expect(scope.removingImage).toBe(null);
1268 });
1269 });
1270
1271 describe("confirmRemove", function() {
1272 it("calls delete_image if given removingImage", function() {
1273 var directive = compileDirective();
1274 var scope = directive.isolateScope();
1275 var image1 = {image_id: 3};
1276 var image2 = {image_id: 7};
1277 scope.removingImage = image1;
1278 spyOn(BootResourcesManager, "deleteImage");
1279 scope.confirmRemove(image1);
1280 expect(scope.removingImage).toBe(null);
1281 expect(BootResourcesManager.deleteImage).toHaveBeenCalledWith(
1282 {id: image1.image_id});
1283 });
1284
1285 it("does not call delete_image if given other image", function() {
1286 var directive = compileDirective();
1287 var scope = directive.isolateScope();
1288 var image1 = {image_id: 3};
1289 var image2 = {image_id: 7};
1290 scope.removingImage = image1;
1291 spyOn(BootResourcesManager, "deleteImage");
1292 scope.confirmRemove(image2);
1293 expect(scope.removingImage).toBe(null);
1294 expect(BootResourcesManager.deleteImage).not.toHaveBeenCalled();
1295 });
1296 });
1297
1218 describe("ltsIsSelected", function() {1298 describe("ltsIsSelected", function() {
12191299
1220 it("returns true if LTS is selected", function() {1300 it("returns true if LTS is selected", function() {
12211301
=== modified file 'src/maasserver/static/partials/boot-images.html'
--- src/maasserver/static/partials/boot-images.html 2016-12-07 12:59:10 +0000
+++ src/maasserver/static/partials/boot-images.html 2017-03-23 21:33:25 +0000
@@ -116,7 +116,7 @@
116 <div class="table__header table-col--25">Release</div>116 <div class="table__header table-col--25">Release</div>
117 <div class="table__header table-col--15">Architecture</div>117 <div class="table__header table-col--15">Architecture</div>
118 <div class="table__header table-col--20">Size</div>118 <div class="table__header table-col--20">Size</div>
119 <div class="table__header table-col--30">Status</div>119 <div class="table__header table-col--40">Status</div>
120 </div>120 </div>
121 </header>121 </header>
122 <main class="table__body">122 <main class="table__body">
@@ -192,7 +192,7 @@
192 <div class="table__header table-col--25">Release</div>192 <div class="table__header table-col--25">Release</div>
193 <div class="table__header table-col--15">Architecture</div>193 <div class="table__header table-col--15">Architecture</div>
194 <div class="table__header table-col--20">Size</div>194 <div class="table__header table-col--20">Size</div>
195 <div class="table__header table-col--30">Status</div>195 <div class="table__header table-col--40">Status</div>
196 </div>196 </div>
197 </header>197 </header>
198 <main class="table__body">198 <main class="table__body">
@@ -205,12 +205,12 @@
205 <div class="table__data table-col--2">205 <div class="table__data table-col--2">
206 <i class="icon {$ image.icon $}"></i>206 <i class="icon {$ image.icon $}"></i>
207 </div>207 </div>
208 <div class="table__data table-col--23">208 <div class="table__data table-col--23" aria-label="Release">
209 {$ image.title $}209 {$ image.title $}
210 </div>210 </div>
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>
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>
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>
214 </div>214 </div>
215 </main>215 </main>
216 </section>216 </section>
@@ -233,7 +233,7 @@
233 <div class="table__header table-col--25">Release</div>233 <div class="table__header table-col--25">Release</div>
234 <div class="table__header table-col--15">Architecture</div>234 <div class="table__header table-col--15">Architecture</div>
235 <div class="table__header table-col--20">Size</div>235 <div class="table__header table-col--20">Size</div>
236 <div class="table__header table-col--30">Status</div>236 <div class="table__header table-col--40">Status</div>
237 </div>237 </div>
238 </header>238 </header>
239 <main class="table__body">239 <main class="table__body">
@@ -246,12 +246,28 @@
246 <div class="table__data table-col--2">246 <div class="table__data table-col--2">
247 <i class="icon {$ image.icon $}"></i>247 <i class="icon {$ image.icon $}"></i>
248 </div>248 </div>
249 <div class="table__data table-col--23">249 <div class="table__data table-col--23" aria-label="Release">
250 {$ image.title $}250 {$ image.title $}
251 </div>251 </div>
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>
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>
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>
255 <div class="table__data table-col--3">
256 <div class="table__controls u-align--right">
257 <a class="u-display--desktop icon icon--delete tooltip"
258 aria-label="Remove"
259 data-ng-click="quickRemove(image)"></a>
260 </div>
261 </div>
262 <div class="table__row is-active" data-ng-if="isShowingDeleteConfirm(image)">
263 <div class="table__data u-float--left">
264 <p><span class="icon icon--warning u-margin--right-small"></span> Are you sure you want to remove this image?</p>
265 </div>
266 <div class="table__data u-float--right">
267 <a class="button--base button--inline" data-ng-click="cancelRemove()">Cancel</a>
268 <button class="button--destructive button--inline" data-ng-click="confirmRemove(image)">Remove</button>
269 </div>
270 </div>
255 </div>271 </div>
256 </main>272 </main>
257 </section>273 </section>
@@ -266,7 +282,7 @@
266 <div class="table__header table-col--25">Release</div>282 <div class="table__header table-col--25">Release</div>
267 <div class="table__header table-col--15">Architecture</div>283 <div class="table__header table-col--15">Architecture</div>
268 <div class="table__header table-col--20">Size</div>284 <div class="table__header table-col--20">Size</div>
269 <div class="table__header table-col--30">Status</div>285 <div class="table__header table-col--40">Status</div>
270 </div>286 </div>
271 </header>287 </header>
272 <main class="table__body">288 <main class="table__body">
@@ -279,12 +295,28 @@
279 <div class="table__data table-col--2">295 <div class="table__data table-col--2">
280 <i class="icon {$ image.icon $}"></i>296 <i class="icon {$ image.icon $}"></i>
281 </div>297 </div>
282 <div class="table__data table-col--23">298 <div class="table__data table-col--23" aria-label="Release">
283 {$ image.title $}299 {$ image.title $}
284 </div>300 </div>
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>
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>
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>
304 <div class="table__data table-col--3">
305 <div class="table__controls u-align--right">
306 <a class="u-display--desktop icon icon--delete tooltip"
307 aria-label="Remove"
308 data-ng-click="quickRemove(image)"></a>
309 </div>
310 </div>
311 <div class="table__row is-active" data-ng-if="isShowingDeleteConfirm(image)">
312 <div class="table__data u-float--left">
313 <p><span class="icon icon--warning u-margin--right-small"></span> Are you sure you want to remove this image?</p>
314 </div>
315 <div class="table__data u-float--right">
316 <a class="button--base button--inline" data-ng-click="cancelRemove()">Cancel</a>
317 <button class="button--destructive button--inline" data-ng-click="confirmRemove(image)">Remove</button>
318 </div>
319 </div>
288 </div>320 </div>
289 </main>321 </main>
290 </section>322 </section>

Subscribers

People subscribed via source and target branches

to all changes: