This is an automated email from the ASF dual-hosted git repository.

dangogh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new c10af03  when deleting a param, it shows the profiles that use the 
param.
c10af03 is described below

commit c10af0338a80fcd0c78eee55cf9c8cf518fee5a4
Author: Jeremy Mitchell <mitchell...@gmail.com>
AuthorDate: Thu Mar 22 14:22:47 2018 -0600

    when deleting a param, it shows the profiles that use the param.
---
 .../parameter/edit/FormEditParameterController.js  | 63 +++++++++++++++-------
 1 file changed, 44 insertions(+), 19 deletions(-)

diff --git 
a/traffic_portal/app/src/common/modules/form/parameter/edit/FormEditParameterController.js
 
b/traffic_portal/app/src/common/modules/form/parameter/edit/FormEditParameterController.js
index 77b6de8..7d51428 100644
--- 
a/traffic_portal/app/src/common/modules/form/parameter/edit/FormEditParameterController.js
+++ 
b/traffic_portal/app/src/common/modules/form/parameter/edit/FormEditParameterController.js
@@ -72,29 +72,54 @@ var FormEditParameterController = function(parameter, 
$scope, $controller, $uibM
                 // do nothing
             });
         });
-
     };
 
     $scope.confirmDelete = function(parameter) {
-        var params = {
-            title: 'Delete Parameter: ' + parameter.name,
-            key: parameter.name
-        };
-        var modalInstance = $uibModal.open({
-            templateUrl: 'common/modules/dialog/delete/dialog.delete.tpl.html',
-            controller: 'DialogDeleteController',
-            size: 'md',
-            resolve: {
-                params: function () {
-                    return params;
+        profileService.getParameterProfiles(parameter.id).
+            then(function(result) {
+                var params = {
+                    title: 'Delete Parameter?',
+                    message: result.length + ' profiles use this 
parameter.<br><br>'
+                };
+                if (result.length > 0) {
+                    params.message += _.pluck(result, 'name').join('<br>') + 
'<br><br>';
                 }
-            }
-        });
-        modalInstance.result.then(function() {
-            deleteParameter(parameter);
-        }, function () {
-            // do nothing
-        });
+                params.message += 'Are you sure you want to delete the 
parameter?';
+
+                var modalInstance = $uibModal.open({
+                    templateUrl: 
'common/modules/dialog/confirm/dialog.confirm.tpl.html',
+                    controller: 'DialogConfirmController',
+                    size: 'md',
+                    resolve: {
+                        params: function () {
+                            return params;
+                        }
+                    }
+                });
+                modalInstance.result.then(function() {
+                    params = {
+                        title: 'Delete Parameter: ' + parameter.name,
+                        key: parameter.name
+                    };
+                    modalInstance = $uibModal.open({
+                        templateUrl: 
'common/modules/dialog/delete/dialog.delete.tpl.html',
+                        controller: 'DialogDeleteController',
+                        size: 'md',
+                        resolve: {
+                            params: function () {
+                                return params;
+                            }
+                        }
+                    });
+                    modalInstance.result.then(function() {
+                        deleteParameter(parameter);
+                    }, function () {
+                        // do nothing
+                    });
+                }, function () {
+                    // do nothing
+                });
+            });
     };
 
 };

-- 
To stop receiving notification emails like this one, please contact
dang...@apache.org.

Reply via email to