airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [03/15] airavata-php-gateway git commit: Gateway usage reporting feature added.
Date Tue, 01 Mar 2016 19:20:42 GMT
Gateway usage reporting feature 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/0b2aa107
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/0b2aa107
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/0b2aa107

Branch: refs/heads/master
Commit: 0b2aa107e6192a6d1a4d2ac8259cf6451d056401
Parents: 282e5b2
Author: Nipurn Doshi <nipunhere@gmail.com>
Authored: Wed Feb 24 14:14:26 2016 -0500
Committer: Nipurn Doshi <nipunhere@gmail.com>
Committed: Wed Feb 24 14:14:26 2016 -0500

----------------------------------------------------------------------
 app/controllers/ComputeResourceController.php   | 18 ++++++++++
 .../compute-resource-preferences.blade.php      | 13 +++++++
 app/views/resource/edit.blade.php               | 38 +++++++++++++++++++-
 public/css/bootstrap.min.css                    |  6 +++-
 public/js/script.js                             | 16 +++++++++
 5 files changed, 89 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/0b2aa107/app/controllers/ComputeResourceController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ComputeResourceController.php b/app/controllers/ComputeResourceController.php
index b930367..d258c2d 100755
--- a/app/controllers/ComputeResourceController.php
+++ b/app/controllers/ComputeResourceController.php
@@ -168,6 +168,24 @@ class ComputeResourceController extends BaseController
             $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription,
true);
 
             return 1; //currently done by ajax.
+        } else if (Input::get("cr-edit") == "enableReporting") {
+            $inputs = Input::all();
+            $computeDescription = CRUtilities::get_compute_resource(Input::get("crId"));
+            //var_dump( $computeDescription); exit;
+            if( isset( $inputs["gatewayUsageReporting"]) && $inputs["gatewayUsageReporting"]
== 1){
+                $computeDescription->gatewayUsageReporting = true;
+                $computeDescription->gatewayUsageModuleLoadCommand = $inputs["gatewayUsageModuleLoadCommand"];
+                $computeDescription->gatewayUsageExecutable = $inputs["gatewayUsageExecutable"];
+
+            }
+            else{
+                $computeDescription->gatewayUsageReporting = false;
+                $computeDescription->gatewayUsageModuleLoadCommand = null;
+                $computeDescription->gatewayUsageExecutable = null;
+            }
+            //var_dump( $computeDescription); exit;
+            $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription,
true);
+            $tabName = "#tab-reporting";
         }
 
         return Redirect::to("cr/edit?crId=" . Input::get("crId") . $tabName);

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/0b2aa107/app/views/partials/compute-resource-preferences.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/compute-resource-preferences.blade.php b/app/views/partials/compute-resource-preferences.blade.php
index b31cb25..63413c2 100644
--- a/app/views/partials/compute-resource-preferences.blade.php
+++ b/app/views/partials/compute-resource-preferences.blade.php
@@ -105,6 +105,19 @@
         -->
     </div>
 </div>
+
+@if( isset( $computeResource->gatewayUsageReporting ) && $computeResource->gatewayUsageReporting
== true)
+<div class="form-group">
+    <label class="control-label col-md-3">Gateway Id for Usage Reporting</label>
+
+    <div class="col-md-9">
+        <input type="text" name="allocationProjectNumber" class="form-control"
+               value="@if( isset( $preferences) ) {{$preferences->usageReportingGatewayId
}}@endif"/>
+        <small>Enter Id of the Gateway using this resource if it requires reporting
its usage back to the resource.</small>
+    </div>
+</div>
+@endif
+
 @if(Session::has("admin"))
 <div class="form-group text-center">
     <input type="submit" class="btn btn-primary" value="Set preferences"/>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/0b2aa107/app/views/resource/edit.blade.php
----------------------------------------------------------------------
diff --git a/app/views/resource/edit.blade.php b/app/views/resource/edit.blade.php
index 1d44e3e..ee90041 100644
--- a/app/views/resource/edit.blade.php
+++ b/app/views/resource/edit.blade.php
@@ -14,7 +14,7 @@
 <div id="page-wrapper">
 
 <div class="container-fluid">
-<div class="col-md-offset-2 col-md-8 compute-resource-properties">
+<div class="col-md-offset-1 col-md-10 compute-resource-properties">
 
 <input type="hidden" class="base-url" value="{{URL::to('/')}}"/>
 
@@ -34,6 +34,7 @@
         <li><a href="#tab-filesystem" data-toggle="tab">FileSystem</a></li>
         <li><a href="#tab-jobSubmission" data-toggle="tab">Job Submission Interfaces</a></li>
         <li><a href="#tab-dataMovement" data-toggle="tab">Data Movement Interfaces</a></li>
+        <li><a href="#tab-reporting" data-toggle="tab">Reporting</a></li>
     </ul>
 </div>
 
@@ -510,6 +511,41 @@
 </div>
 
 
+<div class="tab-pane" id="tab-reporting">
+
+    <form role="form" method="POST" action="{{ URL::to('/') }}/cr/edit">
+        <input type="hidden" name="crId" value="{{Input::get('crId') }}"/>
+        <input type="hidden" name="cr-edit" value="enableReporting"/>
+
+         <div class="form-group required">
+            <div class="checkbox">
+                <input type="checkbox" name="gatewayUsageReporting" class="enable-gateway-check"
@if( $computeResource->gatewayUsageReporting == true) checked  value="1" @else value="0"
@endif>
+                <label class="control-label">Enable Gateway Usage Reporting</label>
+            </div>
+
+        </div>
+
+        <div class="gateway-commands">
+            <div class="form-group required">
+                <label class="control-label">Gateway Module Load Command</label>
+                <input class="form-control hostName" name="gatewayUsageModuleLoadCommand"
value="{{ $computeResource->gatewayUsageModuleLoadCommand }}" maxlength="100"
+                       name="hostname" required="required" @if( $computeResource->gatewayUsageReporting
!= true) disabled @endif/>
+            </div>
+            <div class="form-group required">
+                <label class="control-label">Gateway Usage Executable</label>
+                <input class="form-control hostName" name="gatewayUsageExecutable" value="{{
$computeResource->gatewayUsageExecutable }}" maxlength="100"
+                       name="hostname" required="required"  @if( $computeResource->gatewayUsageReporting
!= true) disabled @endif/>
+            </div>
+        </div>
+        <div class="form-group">
+            <input type="submit" class="btn btn-primary" value="Save changes"/>
+        </div>
+
+    </form>
+
+</div>
+
+
 </div>
 
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/0b2aa107/public/css/bootstrap.min.css
----------------------------------------------------------------------
diff --git a/public/css/bootstrap.min.css b/public/css/bootstrap.min.css
index 382fb66..9be6b94 100644
--- a/public/css/bootstrap.min.css
+++ b/public/css/bootstrap.min.css
@@ -58,4 +58,8 @@ body{
 
 .navbar{
 	margin-bottom: 0;
-}
\ No newline at end of file
+}
+
+.tab-content>.tab-pane {
+    margin-top: 10%;
+ }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/0b2aa107/public/js/script.js
----------------------------------------------------------------------
diff --git a/public/js/script.js b/public/js/script.js
index 6f013df..d00547f 100644
--- a/public/js/script.js
+++ b/public/js/script.js
@@ -344,5 +344,21 @@ $(document).ready( function(){
 
   });
 
+  $(".enable-gateway-check").change( function(){
+    var reportingCheckbox = this;
+    if( reportingCheckbox.checked ){
+      $(reportingCheckbox).val(1);
+      $(".gateway-commands").find("input").each( function( i,e){
+            $(e).removeAttr("disabled");
+            $(e).removeAttr("readonly");
+      });
+    }
+    else{
+      $(reportingCheckbox).val(0);
+      disableInputs( $(".gateway-commands"));
+    }
+
+  })
+
   
 });
\ No newline at end of file


Mime
View raw message