airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject [26/33] airavata-php-gateway git commit: credential store token generation feature addition in progress.
Date Fri, 04 Dec 2015 19:56:50 GMT
credential store token generation feature addition in progress.


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/45f9f9e1
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/45f9f9e1
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/45f9f9e1

Branch: refs/heads/master
Commit: 45f9f9e1aa4f35eb123e3f9fde0d70b3f254e339
Parents: c490661
Author: Nipurn Doshi <Nipurn Doshi>
Authored: Wed Nov 25 13:11:07 2015 -0500
Committer: Nipurn Doshi <Nipurn Doshi>
Committed: Wed Nov 25 13:11:07 2015 -0500

----------------------------------------------------------------------
 app/controllers/ExperimentController.php     |  2 +-
 app/controllers/GatewayprofileController.php |  4 ++
 app/libraries/CommonUtilities.php            |  4 ++
 app/libraries/ExperimentUtilities.php        | 12 +++--
 app/routes.php                               |  2 +
 app/views/admin/manage-credentials.blade.php | 56 ++++++++++-------------
 app/views/partials/dashboard-block.blade.php | 12 ++---
 app/views/partials/experiment-info.blade.php | 18 +++++---
 8 files changed, 61 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45f9f9e1/app/controllers/ExperimentController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ExperimentController.php b/app/controllers/ExperimentController.php
index ebe870b..54bcf67 100755
--- a/app/controllers/ExperimentController.php
+++ b/app/controllers/ExperimentController.php
@@ -105,7 +105,7 @@ class ExperimentController extends BaseController
             }
             */
             // User should not clone or edit a failed experiment. Only create clones of it.
-            if ($expVal["experimentStatusString"] == "FAILED")
+            if ( $expVal["experimentStates"][$experiment->experimentStatus->state]
== "FAILED")
                 $expVal["editable"] = false;
 
             $expVal["cancelable"] = false;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45f9f9e1/app/controllers/GatewayprofileController.php
----------------------------------------------------------------------
diff --git a/app/controllers/GatewayprofileController.php b/app/controllers/GatewayprofileController.php
index f6bff16..e27c2bf 100644
--- a/app/controllers/GatewayprofileController.php
+++ b/app/controllers/GatewayprofileController.php
@@ -85,6 +85,10 @@ class GatewayprofileController extends BaseController {
             return "An error has occurred. Please try again later or report a bug using the
link in the Help menu";
 	}
 
+	public function createSSH(){
+		return CommonUtilities::create_ssh_token();
+	}
+
 }
 
 ?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45f9f9e1/app/libraries/CommonUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/CommonUtilities.php b/app/libraries/CommonUtilities.php
index 4c55d7b..682aa42 100644
--- a/app/libraries/CommonUtilities.php
+++ b/app/libraries/CommonUtilities.php
@@ -256,5 +256,9 @@ class CommonUtilities
             throw new Exception('Error: Cannot open tokens database!');
         }
     }
+
+    public static function create_ssh_token(){
+        return Airavata::generateAndRegisterSSHKeys( Session::get('authz-token'), Session::get("gateway_id"),
Session::get("username"));
+    }
 }
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45f9f9e1/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 77d9011..6971abf 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -650,8 +650,8 @@ class ExperimentUtilities
         if( $process)
         {
             $processStatusVal = array_search($status, ProcessState::$__names);
-            if ($processStatusVal != ProcessState::COMPLETED)
-            echo "Process hasn't completed. Process Status is : " . $status . '<br/>';
+            if ($status != ProcessState::COMPLETED)
+                echo "Process hasn't completed. Process Status is : " . $status . '<br/>';
         }
         else
         {
@@ -754,15 +754,21 @@ class ExperimentUtilities
     public static function get_experiment_values($experiment, $project, $forSearch = false)
     {
         $expVal = array();
-        $expVal["experimentStatusString"] = "";
+        //$expVal["experimentStatusString"] = "";
         $expVal["experimentTimeOfStateChange"] = "";
         $expVal["experimentCreationTime"] = "";
 
+        $expVal["experimentStates"] = ExperimentState::$__names;
+        $expVal["processStates"] = ProcessState::$__names;
+        $expVal["jobStates"] = JobState::$__names;
+
         if ($experiment->experimentStatus != null) {
             $experimentStatus = $experiment->experimentStatus;
+            /*
             $experimentState = $experimentStatus->state;
             $experimentStatusString = ExperimentState::$__names[$experimentState];
             $expVal["experimentStatusString"] = $experimentStatusString;
+            */
             $expVal["experimentTimeOfStateChange"] = $experimentStatus->timeOfStateChange
/ 1000; // divide by 1000 since timeOfStateChange is in ms
             $expVal["experimentCreationTime"] = $experiment->creationTime / 1000; // divide
by 1000 since creationTime is in ms
         }

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45f9f9e1/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index 502604a..8175b08 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -188,6 +188,8 @@ Route::post("gp/add-crp", "GatewayprofileController@modifyCRP");
 
 Route::post("gp/update-crp", "GatewayprofileController@modifyCRP");
 
+Route::post("gp/create-ssh-token", "GatewayprofileController@createSSH");
+
 Route::post("gp/credential-store-token-change", "GatewayprofileController@cstChange");
 
 //Management Dashboard

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45f9f9e1/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 040d1a8..556ef0f 100644
--- a/app/views/admin/manage-credentials.blade.php
+++ b/app/views/admin/manage-credentials.blade.php
@@ -26,7 +26,15 @@
                 @endif
 
                 <h1 class="text-center">SSH Keys</h1>
-
+                @if(Session::has("admin"))
+                <table class="table">
+                    <tr class="text-center table-condensed">
+                        <td>
+                            <button class="btn btn-default generate-ssh">Generate a
new token</button>
+                        </td>
+                    </tr>
+                </table>
+                @endif
                 <table class="table table-bordered table-condensed">
                     <tr>
                         <th class="text-center">
@@ -54,16 +62,9 @@
                         </td>
                     </tr>
                 </table>
-                @if(Session::has("admin"))
-                <table class="table">
-                    <tr class="text-center table-condensed">
-                        <td>
-                            <button class="btn btn-default">Generate a new token</button>
-                        </td>
-                    </tr>
-                </table>
-                @endif
+                
 
+                <!--
                 @if(Session::has("admin"))
                 <div class="row">
                     <h1 class="text-center">My Proxy Credentials</h1>
@@ -93,6 +94,7 @@
                     </div>
                 </div>
                 @endif
+                -->
 
                 <h1 class="text-center">Amazon Credentials</h1>
 
@@ -147,28 +149,16 @@
 @section('scripts')
 @parent
 <script>
-    $(".toggle-add-role").click(function () {
-        $(".add-role").slideDown();
-    });
-
-    $(".edit-role-name").click(function () {
-        var roleNameSpace = $(this).parent().parent().find(".role-name");
-        if (roleNameSpace.find(".edit-role-form").length) {
-            roleNameSpace.html(roleNameSpace.find(".original-role-name").val());
-        }
-        else {
-            var role = roleNameSpace.html();
-            roleNameSpace.html($(".edit-role").html());
-            roleNameSpace.find(".original-role-name").val(role);
-            roleNameSpace.find(".new-role-name").val(role);
-        }
-    });
-
-    $(".delete-role").click(function () {
-        $("#delete-role-block").modal("show");
-        var roleName = $(this).parent().parent().find(".role-name").html();
-        $(".delete-role-name").html(roleName);
-        $(".delete-roleName").val(roleName);
-    })
+   $(".generate-ssh").click( function(){
+        $.ajax({
+          type: "POST",
+          url: "{{URL::to('/')}}/gp/create-ssh-token"
+        }).success( function( data){
+            
+        }).fail( function( data){
+            failureObject = $.parseJSON( data.responseText);
+            $(".generate-ssh").after("<div class='alert alert-danger'>" + failureObject.error.message
+ "</div>");
+        });
+   });
 </script>
 @stop
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45f9f9e1/app/views/partials/dashboard-block.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/dashboard-block.blade.php b/app/views/partials/dashboard-block.blade.php
index c0db0a2..ad4ebea 100644
--- a/app/views/partials/dashboard-block.blade.php
+++ b/app/views/partials/dashboard-block.blade.php
@@ -17,12 +17,6 @@
          @if( Session::has("admin-nav") && Session::get("admin-nav") == "manage-roles")
class="active" @endif>
             <a class="dashboard-link" href="{{ URL::to('/')}}/admin/dashboard/roles"><span
class="glyphicon glyphicon-eye-open"></span>&nbsp; Roles</a>
         </li>
-
-<!--        <li-->
-<!--        @if( Session::has("admin-nav") && Session::get("admin-nav") == "credential-store")
class="active" @endif>-->
-<!--            <a class="dashboard-link" href="{{ URL::to('/')}}/admin/dashboard/credential-store"><i
class="fa fa-fw fa-table"></i>Credential-->
-<!--                Store</a>-->
-<!--        </li>-->
         <li>
             <a><span class="glyphicon glyphicon-briefcase"></span>&nbsp;
Compute Resources</a>
             <ul>
@@ -87,6 +81,12 @@
             <a class="dashboard-link" href="{{ URL::to('/')}}/admin/dashboard/gateway"><span
class="glyphicon glyphicon-sort"></span>&nbsp; @if(
                 Session::has("scigap_admin"))Gateways @else Gateway Preferences @endif</a>
         </li>
+
+        <li
+            @if( Session::has("admin-nav") && Session::get("admin-nav") == "credential-store")
class="active" @endif>
+            <a class="dashboard-link" href="{{ URL::to('/')}}/admin/dashboard/credential-store"><span
class="glyphicon glyphicon-lock"></span>&nbspCredential
+                Store</a>
+        </li>
 <!--        <li>-->
 <!--            <a href="forms.html"><i class="fa fa-fw fa-edit"></i>
Settings</a>-->
 <!--        </li>-->

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/45f9f9e1/app/views/partials/experiment-info.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/experiment-info.blade.php b/app/views/partials/experiment-info.blade.php
index 18ddd99..9fc39e5 100644
--- a/app/views/partials/experiment-info.blade.php
+++ b/app/views/partials/experiment-info.blade.php
@@ -126,9 +126,11 @@
         <tr>
             <td><strong>Errors</strong></td>
             <td>
-                @foreach( (array)$experiment->errors as $error)
+            @if( $detailedExperiment->errors != null)
+                @foreach( (array)$detailedExperiment->errors as $error)
                 {{ $error->actualErrorMessage }}
                 @endforeach
+            @endif
             </td>
         </tr>
         @endif
@@ -226,11 +228,15 @@
                 @endforeach
                 <li>
                     <span class="alert"><i class="icon-time"></i>
-                        Errors<br/>
-                        @foreach( $detailedExperiment->errors as $error)
-                            Error Id : {{ $error->errorId}}<br/>
-                            Error Message : {{ $error->actualErrorMessage}}
-                        @endforeach
+                        Errors : <br/>
+                        @if( $detailedExperiment->errors != null)
+                            @foreach( $detailedExperiment->errors as $error)
+                                Error Id : {{ $error->errorId}}<br/>
+                                Error Message : {{ $error->actualErrorMessage}}
+                            @endforeach
+                        @else
+                            No errors
+                        @endif
                     </span>
                 </li>
             </ul>


Mime
View raw message