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 2019/10/15 18:23:12 UTC

[GitHub] [trafficcontrol] ocket8888 commented on a change in pull request #3963: TP: by default only show parameter diff when comparing 2 profiles

ocket8888 commented on a change in pull request #3963: TP: by default only show parameter diff when comparing 2 profiles
URL: https://github.com/apache/trafficcontrol/pull/3963#discussion_r335107432
 
 

 ##########
 File path: traffic_portal/app/src/common/service/utils/LocationUtils.js
 ##########
 @@ -17,13 +17,35 @@
  * under the License.
  */
 
-var LocationUtils = function($location) {
+var LocationUtils = function($location, $uibModal) {
 
-    this.navigateToPath = function(path) {
-        $location.url(path);
+    this.navigateToPath = function(path, unsavedChanges) {
+        if (unsavedChanges) {
+            const params = {
+                title: 'Confirm Navigation',
+                message: 'You have unsaved changes that will be lost if you decide to continue.<br><br>Do you want to continue?'
+            };
+            let 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() {
+                $location.url(path);
+            }, function () {
+                // do nothing
 
 Review comment:
   pls no do nothing
   you could just log the error.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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