You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2018/03/26 14:37:19 UTC

[GitHub] dangogh closed pull request #2045: [Issue 2019] - when deleting a param, it shows the profiles that use the param.

dangogh closed pull request #2045: [Issue 2019] - when deleting a param, it shows the profiles that use the param.
URL: https://github.com/apache/incubator-trafficcontrol/pull/2045
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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 77b6de8ae..7d514288b 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
+                });
+            });
     };
 
 };


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services