From d946e483cd0bba8ca0386e8334c29fed0caca057 Mon Sep 17 00:00:00 2001 From: Shu Muto Date: Thu, 11 Jan 2018 13:43:53 +0900 Subject: [PATCH] Fix issue the deleted item is selected again with batch delete Items recently deleted with batch action are shown in deletion confirmation dialog when execute the batch delete action again. Steps to reproduce: 1. Create 2 new items 2. Delete one of them using the batch delete action on top of the table 3. Select the another item and click the batch delete action Expect to see the confirmation dialog shows one selected item, but it shows the item that was deleted in step 2 as well. Also, HTTP DELETE method for already deleted item is submitted again and occurs error. This patch fixes this issue. Change-Id: Ib475761363e85be8df3c64e94d8000295796fd1c Closes-Bug: #1742599 --- .../cluster-templates/delete/delete.service.js | 7 +++++-- .../container-infra/clusters/delete/delete.service.js | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/magnum_ui/static/dashboard/container-infra/cluster-templates/delete/delete.service.js b/magnum_ui/static/dashboard/container-infra/cluster-templates/delete/delete.service.js index cbd03d80..d8c8b674 100644 --- a/magnum_ui/static/dashboard/container-infra/cluster-templates/delete/delete.service.js +++ b/magnum_ui/static/dashboard/container-infra/cluster-templates/delete/delete.service.js @@ -136,8 +136,11 @@ deleteModalResult.fail.forEach(function markFailed(item) { result.failed(resourceType, getEntity(item).id); }); - if (result.result.failed.length === 0 && result.result.deleted.length > 0) { - $location.path("/project/cluster_templates"); + var indexPath = "/project/cluster_templates"; + var currentPath = $location.path(); + if (result.result.failed.length === 0 && result.result.deleted.length > 0 && + currentPath !== indexPath) { + $location.path(indexPath); } else { return result.result; } diff --git a/magnum_ui/static/dashboard/container-infra/clusters/delete/delete.service.js b/magnum_ui/static/dashboard/container-infra/clusters/delete/delete.service.js index e108ae2d..ccc58f32 100644 --- a/magnum_ui/static/dashboard/container-infra/clusters/delete/delete.service.js +++ b/magnum_ui/static/dashboard/container-infra/clusters/delete/delete.service.js @@ -136,8 +136,11 @@ deleteModalResult.fail.forEach(function markFailed(item) { result.failed(resourceType, getEntity(item).id); }); - if (result.result.failed.length === 0 && result.result.deleted.length > 0) { - $location.path("/project/clusters"); + var indexPath = "/project/clusters"; + var currentPath = $location.path(); + if (result.result.failed.length === 0 && result.result.deleted.length > 0 && + currentPath !== indexPath) { + $location.path(indexPath); } else { return result.result; }