1) Removed ability for super admin to edit other gateway's preferences.
2) Added UI for super admin to view their own gateway separately.


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

Branch: refs/heads/master
Commit: 39df35a893e8310089ea13f2f0d760ef27be1ad6
Parents: ea5afa3
Author: Nipurn Doshi <[email protected]>
Authored: Fri Jan 29 11:52:49 2016 -0500
Committer: Nipurn Doshi <[email protected]>
Committed: Fri Jan 29 11:52:49 2016 -0500

----------------------------------------------------------------------
 app/views/admin/manage-gateway.blade.php | 281 ++++----------------------
 1 file changed, 36 insertions(+), 245 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/39df35a8/app/views/admin/manage-gateway.blade.php
----------------------------------------------------------------------
diff --git a/app/views/admin/manage-gateway.blade.php 
b/app/views/admin/manage-gateway.blade.php
index 6c47742..7e99d3f 100644
--- a/app/views/admin/manage-gateway.blade.php
+++ b/app/views/admin/manage-gateway.blade.php
@@ -24,11 +24,19 @@
             @endif
         </div>
         <div class="container-fluid">
+            <div class="panel-group" id="accordion2">
+                <h3>Your Gateway Preferences</h3>
+                @foreach( $gateways as $indexGP => $gp )
+                    @if( $gp->gatewayId == Session::get("gateway_id"))
+                        @include('partials/gateway-preferences-block', 
array("gp" => $gp, "accName" => "accordion2") )
+                    @endif
+                @endforeach
+            </div>
 
+            @if( Session::has('super-admin'))
             <div class="row">
-
                 <div class="col-md-6">
-                    <h3>Gateway Preferences</h3>
+                    <h3>Other Gateway Preferences</h3>
                 </div>
                 @if( Session::has("super-admin"))
                 <div class="col-md-6" style="margin-top:2%">
@@ -83,251 +91,18 @@
                 </form>
                  @endif
             </div>
-            <div class="panel-group" id="accordion2">
-                @foreach( $gateways as $indexGP => $gp )
-                <div class="panel panel-default">
-                    <div class="panel-heading">
-                        <h4 class="panel-title">
-                            <a class="accordion-toggle collapsed gateway-name" 
data-toggle="collapse"
-                               data-parent="#accordion2" 
href="#collapse-gateway-{{$indexGP}}">
-                                {{ $gp->gatewayName }}
-                            </a>
-                            @if(Session::has("admin"))
-                            <!-- Backend needs to be added for this
-                            
-                            <div class="pull-right col-md-2 gateway-options 
fade">
-                                <span class="glyphicon glyphicon-pencil 
edit-gateway" style="cursor:pointer;"
-                                      data-toggle="modal" 
data-target="#edit-gateway-block"
-                                      data-gp-id="{{ $gp->gatewayId }}" 
data-gp-name="{{ $gp->gatewayName }}"></span>
-                            </div>
-                            -->
-                            @endif
-                        </h4>
-                    </div>
-                    <div id="collapse-gateway-{{$indexGP}}" 
class="panel-collapse collapse">
-                        <div class="panel-body">
-                            <div class="app-interface-block">
-                                <div class="row">
-                                     @if(Session::has("admin"))
-                                    <div class="col-md-10 
credential-store-token-change">
-                                        <form>
-                                            <div class="form-group">
-                                                <label class="control-label 
col-md-12">{{ Session::get('theme') }} Credential Store Token</label>
-                                                <div class="col-md-9">
-                                                    <select 
class="form-control gateway-credential-store-token" 
name="resourceSpecificCredentialStoreToken"  data-gpid="{{$gp->gatewayId}}" >
-                                                        @if( isset( 
$gp->profile->credentialStoreToken) )
-                                                        <option 
value="{{$gp->profile->credentialStoreToken}}">{{$gp->profile->credentialStoreToken}}</option>
-                                                        @else
-                                                        <option 
value="">Select a Credential Token from Store</option>
-                                                        @endif
-                                                        <option 
value="">DO-NO-SET</option>
-                                                        @foreach( $tokens as 
$token => $publicKey)
-                                                        <option 
value="{{$token}}">{{$token}}</option>
-                                                        @endforeach
-                                                    </select>
-                                                    <!--
-                                                    <input type="text" 
name="resourceSpecificCredentialStoreToken"  data-gpid="{{$gp->gatewayId}}" 
class="form-control credential-store-token"
-                                                           value="@if( isset( 
$gp->profile->credentialStoreToken) 
){{$gp->profile->credentialStoreToken}}@endif"/>
-                                                    -->
-                                                </div>
-                                                <div class="col-md-3">
-                                                        <input type="submit" 
class="form-control btn btn-primary" value="Set"/>
-                                                </div>
-                                            </div>
-                                        </form>
-                                    </div>
-                                    <div class="col-md-10">
-                                        <button class="btn btn-default add-cr" 
data-gpid="{{$gp->gatewayId}}"><span
-                                                class="glyphicon 
glyphicon-plus"></span> Add a Compute Resource Preference
-                                        </button>
-                                    </div>
-                                    @endif
-                                </div>
-                                    
-                                    <div class="col-md-10">
-                                        @if( isset( 
$gp->profile->computeResourcePreferences) )
-                                        <div>
-                                            <h3>Compute Resource Preferences 
:</h3>
-                                        </div>
-                                        <div class="accordion-inner">
-                                            <div class="panel-group" 
id="accordion-{{$indexGP}}">
-                                                @foreach( 
(array)$gp->profile->computeResourcePreferences as $indexCRP
-                                                => $crp )
-                                                <div class="panel 
panel-default">
-                                                    <div class="panel-heading">
-                                                        <h4 
class="panel-title">
-                                                            <a 
class="accordion-toggle collapsed gateway-name"
-                                                               
data-toggle="collapse" data-parent="#accordion"
-                                                               
href="#collapse-crp-{{$indexGP}}-{{$indexCRP}}">
-                                                                {{ 
$crp->crDetails->hostName }}
-                                                            </a>
-                                                            
@if(Session::has("admin"))
-                                                            <div 
class="pull-right col-md-2 gateway-options fade">
-                                                                <span 
class="glyphicon glyphicon-remove remove-compute-resource"
-                                                                      
style="cursor:pointer;" data-toggle="modal"
-                                                                      
data-target="#remove-compute-resource-block"
-                                                                      
data-cr-name="{{$crp->crDetails->hostName}}"
-                                                                      
data-cr-id="{{$crp->computeResourceId}}"
-                                                                      
data-gp-id="{{ $gp->gatewayId }}"></span>
-                                                            </div>
-                                                            @endif
-                                                        </h4>
-                                                    </div>
-                                                    <div 
id="collapse-crp-{{$indexGP}}-{{$indexCRP}}"
-                                                         class="panel-collapse 
collapse">
-                                                        <div 
class="panel-body">
-                                                            <div 
class="app-compute-resource-preferences-block">
-                                                                <form 
action="{{URL::to('/')}}/gp/update-crp"
-                                                                      
method="POST">
-                                                                    <input 
type="hidden" name="gatewayId" id="gatewayId"
-                                                                           
value="{{$gp->gatewayId}}">
-                                                                    <input 
type="hidden" name="computeResourceId"
-                                                                           
id="gatewayId"
-                                                                           
value="{{$crp->computeResourceId}}">
-
-                                                                    <div 
class="form-horizontal">
-                                                                        
@include('partials/compute-resource-preferences',
-                                                                        
array('computeResource' => $crp->crDetails,
-                                                                        
'crData' => $crData, 'preferences'=>$crp,
-                                                                        
'show'=>true))
-                                                                    </div>
-                                                                </form>
-                                                            </div>
-                                                        </div>
-                                                    </div>
-                                                </div>
-                                                @endforeach
-                                            </div>
-                                        </div>
-                                        @endif
-                                        @if( isset( 
$gp->profile->storagePreferences) )
-                                        <div>
-                                            <h3>Storage Resource Preferences 
:</h3>
-                                        </div>
-                                        <div class="accordion-inner">
-                                            <div class="panel-group" 
id="accordion-{{$indexGP}}">
-                                                @foreach( 
(array)$gp->profile->storagePreferences as $indexSRP
-                                                => $srp )
-                                                <div class="panel 
panel-default">
-                                                    <div class="panel-heading">
-                                                        <h4 
class="panel-title">
-                                                            <a 
class="accordion-toggle collapsed gateway-name"
-                                                               
data-toggle="collapse" data-parent="#accordion"
-                                                               
href="#collapse-srp-{{$indexGP}}-{{$indexSRP}}">
-                                                                {{ 
$srp->srDetails->hostName }}
-                                                            </a>
-                                                            
@if(Session::has("admin"))
-                                                            <div 
class="pull-right col-md-2 gateway-options fade">
-                                                                <span 
class="glyphicon glyphicon-remove remove-storage-resource"
-                                                                      
style="cursor:pointer;" data-toggle="modal"
-                                                                      
data-target="#remove-storage-resource-block"
-                                                                      
data-sr-name="{{$srp->srDetails->hostName}}"
-                                                                      
data-sr-id="{{$srp->storageResourceId}}"
-                                                                      
data-gp-id="{{ $gp->gatewayId }}"></span>
-                                                            </div>
-                                                            @endif
-                                                        </h4>
-                                                    </div>
-                                                    <div 
id="collapse-srp-{{$indexGP}}-{{$indexSRP}}"
-                                                         class="panel-collapse 
collapse">
-                                                        <div 
class="panel-body">
-                                                            <div 
class="app-compute-resource-preferences-block">
-                                                                <form 
action="{{URL::to('/')}}/gp/update-srp"
-                                                                      
method="POST">
-                                                                    <input 
type="hidden" name="gatewayId" id="gatewayId"
-                                                                           
value="{{$gp->gatewayId}}">
-                                                                    <input 
type="hidden" name="storageResourceId"
-                                                                           
id="gatewayId"
-                                                                           
value="{{$srp->storageResourceId}}">
-
-                                                                    <div 
class="form-horizontal">
-                                                                        
@include('partials/storage-resource-preferences',
-                                                                        
array('storageResource' => $srp->srDetails,
-                                                                        
'srData' => $srData, 'preferences'=>$srp,
-                                                                        
'show'=>true))
-                                                                    </div>
-                                                                </form>
-                                                            </div>
-                                                        </div>
-                                                    </div>
-                                                </div>
-                                                @endforeach
-                                            </div>
-                                        </div>
-                                        @endif
-                                    </div>
-
-                                    <div class="col-md-10">
-                                        <button class="btn btn-default 
add-dsp" data-gpid="{{$gp->gatewayId}}"><span
-                                                class="glyphicon 
glyphicon-plus"></span> Add a Data Storage Preference
-                                        </button>
-                                    </div>
-
-                                    <div class="col-md-10">
-                                        @if( isset( 
$gp->profile->dataStoragePreferences) )
-                                        <div>
-                                            <h3>Data Storage Preferences :</h3>
-                                        </div>
-
-                                        <div class="accordion-inner">
-                                            <div class="panel-group" 
id="accordion-{{$indexGP}}">
-                                                @foreach( 
(array)$gp->profile->dataStoragePreferences as $indexDSP
-                                                => $dsp )
-                                                <div class="panel 
panel-default">
-                                                    <div class="panel-heading">
-                                                        <h4 
class="panel-title">
-                                                            <a 
class="accordion-toggle collapsed gateway-name"
-                                                               
data-toggle="collapse" data-parent="#accordion"
-                                                               
href="#collapse-dsp-{{$indexGP}}-{{$indexDSP}}">
-                                                                {{ 
$dsp->dataMovememtResourceId }}
-                                                            </a>
-                                                            
@if(Session::has("admin"))
-                                                            <div 
class="pull-right col-md-2 gateway-options fade">
-                                                                <span 
class="glyphicon glyphicon-remove remove-storage-resource"
-                                                                      
style="cursor:pointer;" data-toggle="modal"
-                                                                      
data-target="#remove-storage-resource-block"
-                                                                      
data-dsp-id="{{$ds->computeResourceId}}"
-                                                                      
data-gp-id="{{ $gp->gatewayId }}"></span>
-                                                            </div>
-                                                            @endif
-                                                        </h4>
-                                                    </div>
-                                                    <div 
id="collapse-dsp-{{$indexGP}}-{{$indexDSP}}"
-                                                         class="panel-collapse 
collapse">
-                                                        <div 
class="panel-body">
-                                                            <div 
class="app-data-storage-preferences-block">
-                                                                <form 
action="{{URL::to('/')}}/gp/update-dsp"
-                                                                      
method="POST">
-                                                                    <input 
type="hidden" name="gatewayId" id="gatewayId"
-                                                                           
value="{{$gp->gatewayId}}">
-                                                                    <input 
type="hidden" name="dataStorageId"
-                                                                           
id="gatewayId"
-                                                                           
value="{{$crp->dataMovememtResourceId}}">
-
-                                                                    <div 
class="form-horizontal">
-                                                                        
@include('partials/compute-resource-preferences',
-                                                                        
array('computeResource' => $crp->crDetails,
-                                                                        
'crData' => $crData, 'preferences'=>$crp,
-                                                                        
'show'=>true))
-                                                                    </div>
-                                                                </form>
-                                                            </div>
-                                                        </div>
-                                                    </div>
-                                                </div>
-                                                @endforeach
-                                            </div>
-                                        </div>
-                                        @endif
-
-                                    </div>
-                                </div>
-                            </div>
-                        </div>
+
+            <div class="panel-group" id="accordion1">
+                    @foreach( $gateways as $indexGP => $gp )
+                    <div class='super-admin-gateways-view'>
+                        @include('partials/gateway-preferences-block', 
array("gp" => $gp, "accName" => "accordion1"))
                     </div>
-                @endforeach
+                    @endforeach
                 </div>
             </div>
+
+            @endif
+
         </div>
         <!-- /.container-fluid -->
 
@@ -468,7 +243,7 @@
 <script>
     //make first tab of accordion open by default.
     //temporary fix
-    $("#accordion2 #collapse-gateway-0").addClass("in");
+    $("#accordion2 #accordion2-collapse-gateway-0").addClass("in");
 
     $(".credential-store-token-change > form").submit( function(e){
         $(this).prepend( "<img id='loading-gif' 
src='{{URL::to('/')}}/assets/ajax-loader.gif'/>");
@@ -524,5 +299,21 @@
         });
     });
 
+    disableInputs( $(".super-admin-gateways-view"));
+
+    function disableInputs( elem){
+      elem.find("input").each( function( i,e){
+          if( $(e).attr("type")=='submit' || $(e).attr("type")=='button'  )
+              $(e).attr("disabled", "true");
+           else
+              $(e).prop("readonly", "true");
+      });
+      elem.find("textarea").prop("readonly", "true");
+      elem.find("select").attr("disabled", "true");
+      elem.find(".hide").prop("readonly", "true");
+      elem.find("button").attr("disabled", "true");
+      $(".glyphicon").hide();
+    }
+
 </script>
 @stop
\ No newline at end of file

Reply via email to