airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [01/50] [abbrv] airavata-php-gateway git commit: Confirmation to remove token added.
Date Thu, 14 Jan 2016 15:42:57 GMT
Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop b3adcfe88 -> 2b0a8601b


Confirmation to remove token added.


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/8f85afc2
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/8f85afc2
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/8f85afc2

Branch: refs/heads/develop
Commit: 8f85afc2c2ae6ce28ff3f075092ec46a510a218b
Parents: b85b15b
Author: Nipurn Doshi <nipunhere@gmail.com>
Authored: Fri Dec 11 14:04:41 2015 -0500
Committer: Nipurn Doshi <nipunhere@gmail.com>
Committed: Fri Dec 11 14:04:41 2015 -0500

----------------------------------------------------------------------
 app/views/admin/manage-credentials.blade.php | 44 ++++++++++++++++-------
 1 file changed, 31 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/8f85afc2/app/views/admin/manage-credentials.blade.php
----------------------------------------------------------------------
diff --git a/app/views/admin/manage-credentials.blade.php b/app/views/admin/manage-credentials.blade.php
index eacd67c..6b0b476 100644
--- a/app/views/admin/manage-credentials.blade.php
+++ b/app/views/admin/manage-credentials.blade.php
@@ -201,21 +201,39 @@
 
    $(".remove-token").click( function(){
         var removeSpan = $(this);
+        var tr = removeSpan.parent().parent();
         var tokenToRemove = removeSpan.data("token");
-        $(".loading-img").removeClass("hide");
-        $.ajax({
-          type: "POST",
-          data:{ "token" : tokenToRemove},
-          url: "{{URL::to('/')}}/admin/remove-ssh-token"
-          }).success( function( data){
-            if( data.responseText == 1)
-                removeSpan.parent().parent().addClass("alert").addClass("alert-danger");
-                setTimeout( function(){
-                    removeSpan.parent().parent().slideUp(1000);
-                }, 2000);
-        }).fail( function( data){
-            removeSpan.parent().parent().after("<tr class='alert alert-danger'><td></td><td>Error
occurred : " + $.parseJSON( data.responseText).error.message + "</td><td></td></tr>");
+        var publicKey = tr.children(".public-key").html();
+        tr.children(".public-key").html("<div class='alert alert-danger'>Do you really
want to remove the token? This action cannot be undone.<br/>" +
+                                                                    "<span class='btn-group'>"+
+                                                                    "<input type='button'
class='btn btn-default remove-token-confirmation' value='Yes'/>" +
+                                                                    "<input type='button'
class='btn btn-default remove-token-cancel' value='Cancel'/>"+
+                                                                    "</span></div>");
+
+        
+        tr.find( ".remove-token-confirmation").click( function(){
+            $(".loading-img").removeClass("hide");
+            $.ajax({
+              type: "POST",
+              data:{ "token" : tokenToRemove},
+              url: "{{URL::to('/')}}/admin/remove-ssh-token"
+              }).success( function( data){
+                if( data.responseText == 1)
+                    tr.addClass("alert").addClass("alert-danger");
+                    setTimeout( function(){
+                        tr.slideUp(1000);
+                    }, 2000);
+            }).fail( function( data){
+                tr.after("<tr class='alert alert-danger'><td></td><td>Error
occurred : " + $.parseJSON( data.responseText).error.message + "</td><td></td></tr>");
+            }).complete( function(){
+                $(".loading-img").addClass("hide");
+
+            });
+        });
+        tr.find( ".remove-token-cancel").click( function(){
+            tr.children(".public-key").html( publicKey);
         });
+        
    });
 </script>
 @stop
\ No newline at end of file


Mime
View raw message