airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject [17/18] airavata-php-gateway git commit: AIRAVATA-2152 Allow user to pick resource specific SSH key
Date Fri, 28 Oct 2016 20:05:03 GMT
AIRAVATA-2152 Allow user to pick resource specific SSH key


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

Branch: refs/heads/develop
Commit: 480021cf807d410ad6cea71dfe78a576679c4693
Parents: 2d6bf7f
Author: Marcus Christie <machrist@iu.edu>
Authored: Fri Oct 28 13:09:20 2016 -0400
Committer: Marcus Christie <machrist@iu.edu>
Committed: Fri Oct 28 15:05:16 2016 -0400

----------------------------------------------------------------------
 app/controllers/AccountController.php           | 20 +++++++----------
 .../account/user-compute-resources.blade.php    |  7 ++++--
 .../account/user-storage-resources.blade.php    |  7 ++++--
 .../user-compute-resource-preferences.blade.php | 23 +++++++++++---------
 .../user-storage-resource-preferences.blade.php | 19 +++++++++++-----
 5 files changed, 44 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/480021cf/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php
index 7b5e4cb..6037dda 100644
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@ -553,17 +553,15 @@ class AccountController extends BaseController
         }
         $unselectedCRs = array_values($allCRsById);
 
-        // TODO: actually get all of the user's credential store tokens, including description
-        URPUtilities::get_all_ssh_pub_keys_summary_for_user();
-        $tokens = array(
-            $userResourceProfile->credentialStoreToken => "Default SSH Key"
-        );
+        $credentialSummaries = URPUtilities::get_all_ssh_pub_keys_summary_for_user();
+        $defaultCredentialSummary = $credentialSummaries[$userResourceProfile->credentialStoreToken];
 
         return View::make("account/user-compute-resources", array(
             "userResourceProfile" => $userResourceProfile,
             "computeResources" => $allCRs,
             "unselectedCRs" => $unselectedCRs,
-            "tokens" => $tokens
+            "credentialSummaries" => $credentialSummaries,
+            "defaultCredentialSummary" => $defaultCredentialSummary
         ));
     }
 
@@ -609,17 +607,15 @@ class AccountController extends BaseController
         }
         $unselectedSRs = array_values($allSRsById);
 
-        // TODO: actually get all of the user's credential store tokens, including description
-        URPUtilities::get_all_ssh_pub_keys_summary_for_user();
-        $tokens = array(
-            $userResourceProfile->credentialStoreToken => "Default SSH Key"
-        );
+        $credentialSummaries = URPUtilities::get_all_ssh_pub_keys_summary_for_user();
+        $defaultCredentialSummary = $credentialSummaries[$userResourceProfile->credentialStoreToken];
 
         return View::make("account/user-storage-resources", array(
             "userResourceProfile" => $userResourceProfile,
             "storageResources" => $allSRs,
             "unselectedSRs" => $unselectedSRs,
-            "tokens" => $tokens
+            "credentialSummaries" => $credentialSummaries,
+            "defaultCredentialSummary" => $defaultCredentialSummary
         ));
     }
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/480021cf/app/views/account/user-compute-resources.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/user-compute-resources.blade.php b/app/views/account/user-compute-resources.blade.php
index d3cd844..2756a91 100644
--- a/app/views/account/user-compute-resources.blade.php
+++ b/app/views/account/user-compute-resources.blade.php
@@ -16,7 +16,9 @@ button.add-user-cr {
 
 @section('content')
 @foreach( (array)$computeResources as $index => $cr)
-@include('partials/user-compute-resource-preferences', array('computeResource' => $cr))
+@include('partials/user-compute-resource-preferences',
+    array('computeResource' => $cr, 'credentialSummaries' => $credentialSummaries,
+        'defaultCredentialSummary' => $defaultCredentialSummary))
 @endforeach
 <div class="container">
     @if( Session::has("message"))
@@ -60,7 +62,8 @@ button.add-user-cr {
                             @include('partials/user-compute-resource-preferences',
                             array('computeResource' => $user_crp->crDetails,
                             'preferences'=>$user_crp, 'show'=>true,
-                            'allowDelete'=>true))
+                            'allowDelete'=>true, 'credentialSummaries' => $credentialSummaries,
+                            'defaultCredentialSummary' => $defaultCredentialSummary))
                         </div>
                     </form>
                 </div>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/480021cf/app/views/account/user-storage-resources.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/user-storage-resources.blade.php b/app/views/account/user-storage-resources.blade.php
index e38ef96..b87660e 100644
--- a/app/views/account/user-storage-resources.blade.php
+++ b/app/views/account/user-storage-resources.blade.php
@@ -15,7 +15,9 @@ button.add-user-sr {
 
 @section('content')
 @foreach( (array)$storageResources as $index => $sr)
-@include('partials/user-storage-resource-preferences', array('storageResource' => $sr))
+@include('partials/user-storage-resource-preferences',
+    array('storageResource' => $sr, 'credentialSummaries' => $credentialSummaries,
+        'defaultCredentialSummary' => $defaultCredentialSummary))
 @endforeach
 <div class="container">
     @if( Session::has("message"))
@@ -59,7 +61,8 @@ button.add-user-sr {
                             @include('partials/user-storage-resource-preferences',
                             array('storageResource' => $user_srp->srDetails,
                             'preferences'=>$user_srp, 'show'=>true,
-                            'allowDelete'=>true))
+                            'allowDelete'=>true, 'credentialSummaries' => $credentialSummaries,
+                            'defaultCredentialSummary' => $defaultCredentialSummary))
                         </div>
                     </form>
                 </div>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/480021cf/app/views/partials/user-compute-resource-preferences.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/user-compute-resource-preferences.blade.php b/app/views/partials/user-compute-resource-preferences.blade.php
index 8753f6c..49c3f85 100644
--- a/app/views/partials/user-compute-resource-preferences.blade.php
+++ b/app/views/partials/user-compute-resource-preferences.blade.php
@@ -1,5 +1,7 @@
 <!-- partial template variables:
     computeResource - (required, ComputeResourceDescription) the compute resource object
+    credentialSummaries - (required, list of CredentialSummary) user's credentials
+    defaultCredentialSummary - (required, CredentialSummary) user's default credential
     preferences - (optional, UserComputeResourcePreference) the saved preference data
     show - (optional, boolean)
     allowDelete - (optional, boolean)
@@ -47,20 +49,21 @@
 </div>
 
 <div class="form-group">
-    <label class="control-label col-md-3">Resource Specific Credential Store Token</label>
+    <label class="control-label col-md-3">Resource Specific SSH Key</label>
 
     <div class="col-md-9">
-        <select class="form-control gateway-credential-store-token" name="resourceSpecificCredentialStoreToken"
>
-            <option value="">Select a Credential Token from Store</option>
-            @foreach( $tokens as $token => $description )
-                <option value="{{$token}}" @if( isset( $preferences) ) @if( $token ==
$preferences->resourceSpecificCredentialStoreToken) selected @endif @endif>{{$description}}</option>
+        <select class="form-control" name="resourceSpecificCredentialStoreToken" >
+            <option value="" @if( isset( $preferences) && $preferences->resourceSpecificCredentialStoreToken
== null) selected @endif>
+                No resource specific SSH key, just use the default one ({{{$defaultCredentialSummary->description}}})
+            </option>
+            @foreach( $credentialSummaries as $token => $credentialSummary )
+            @if( $token != $defaultCredentialSummary->token)
+            <option value="{{$token}}" @if( isset( $preferences) && $token ==
$preferences->resourceSpecificCredentialStoreToken) selected @endif>
+                Use {{{$credentialSummary->description}}}
+            </option>
+            @endif
             @endforeach
-            <option value="">DO-NO-SET</option>
         </select>
-        <!--
-        <input type="text" name="resourceSpecificCredentialStoreToken" class="form-control"
-               value="@if( isset( $preferences) ){{$preferences->resourceSpecificCredentialStoreToken}}@endif"/>
-        -->
     </div>
 </div>
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/480021cf/app/views/partials/user-storage-resource-preferences.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/user-storage-resource-preferences.blade.php b/app/views/partials/user-storage-resource-preferences.blade.php
index 16946d6..a5bc771 100644
--- a/app/views/partials/user-storage-resource-preferences.blade.php
+++ b/app/views/partials/user-storage-resource-preferences.blade.php
@@ -1,5 +1,7 @@
 <!-- partial template variables:
     storageResource - (required, StorageResourceDescription) the storage resource object
+    credentialSummaries - (required, list of CredentialSummary) user's credentials
+    defaultCredentialSummary - (required, CredentialSummary) user's default credential
     preferences - (optional, UserStoragePreference) the saved preference data
     show - (optional, boolean)
     allowDelete - (optional, boolean)
@@ -25,15 +27,20 @@
 </div>
 
 <div class="form-group">
-    <label class="control-label col-md-3">Resource Specific Credential Store Token</label>
+    <label class="control-label col-md-3">Resource Specific SSH Key</label>
 
     <div class="col-md-9">
-        <select class="form-control gateway-credential-store-token" name="resourceSpecificCredentialStoreToken"
>
-            <option value="">Select a Credential Token from Store</option>
-            @foreach( $tokens as $token => $description )
-                <option value="{{$token}}" @if( isset( $preferences) ) @if( $token ==
$preferences->resourceSpecificCredentialStoreToken) selected @endif @endif>{{$description}}</option>
+        <select class="form-control" name="resourceSpecificCredentialStoreToken" >
+            <option value="" @if( isset( $preferences) && $preferences->resourceSpecificCredentialStoreToken
== null) selected @endif>
+                No resource specific SSH key, just use the default one ({{{$defaultCredentialSummary->description}}})
+            </option>
+            @foreach( $credentialSummaries as $token => $credentialSummary )
+            @if( $token != $defaultCredentialSummary->token)
+            <option value="{{$token}}" @if( isset( $preferences) && $token ==
$preferences->resourceSpecificCredentialStoreToken) selected @endif>
+                Use {{{$credentialSummary->description}}}
+            </option>
+            @endif
             @endforeach
-            <option value="">DO-NO-SET</option>
         </select>
     </div>
 </div>


Mime
View raw message