You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by nd...@apache.org on 2016/12/01 07:28:39 UTC

airavata-php-gateway git commit: AIRAVATA-2153 Fixed in Develop Branch.

Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop 1e2b71df3 -> bed878377


AIRAVATA-2153 Fixed in Develop Branch.


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

Branch: refs/heads/develop
Commit: bed87837764581c215025be43f50dc77df661f1e
Parents: 1e2b71d
Author: Nipurn Doshi <ni...@gmail.com>
Authored: Wed Nov 30 23:28:03 2016 -0800
Committer: Nipurn Doshi <ni...@gmail.com>
Committed: Wed Nov 30 23:28:03 2016 -0800

----------------------------------------------------------------------
 app/controllers/AdminController.php      |  5 ++++-
 app/libraries/AdminUtilities.php         |  5 +++++
 app/views/admin/manage-gateway.blade.php | 30 +++++++++++++++++++++------
 3 files changed, 33 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bed87837/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 33fc58d..6439b4b 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -160,7 +160,10 @@ class AdminController extends BaseController {
 		//first step of adding tenant and changing gateway request status to Approved.	 
 		$returnVal = AdminUtilities::update_gateway( Input::get("gateway_id"), Input::all());
 		if( Request::ajax()){
-			return $returnVal;
+			if( $returnVal == 1)
+				return json_encode( AdminUtilities::get_gateway( Input::get("gateway_id")) );
+			else
+				return $returnVal; // anything other than positive update result
 		}
 		else{
 			if( $returnVal == 1)

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bed87837/app/libraries/AdminUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AdminUtilities.php b/app/libraries/AdminUtilities.php
index e0829d7..b2637a0 100644
--- a/app/libraries/AdminUtilities.php
+++ b/app/libraries/AdminUtilities.php
@@ -25,6 +25,11 @@ class AdminUtilities
         return Airavata::addGateway(Session::get('authz-token'), $gateway);
     }
 
+    public static function get_gateway( $gateway_id)
+    {
+        return Airavata::getGateway( Session::get("authz-token"), $gateway_id);
+    }
+
     public static function request_gateway( $inputs)
     {
         $gateway = new Gateway( $inputs);

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bed87837/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 914293d..3dea01e 100644
--- a/app/views/admin/manage-gateway.blade.php
+++ b/app/views/admin/manage-gateway.blade.php
@@ -102,7 +102,7 @@
                                 <tbody>
                                 @foreach( $gateways as $indexGP => $gp )
                                     <tr class="gatewayRow gatewayStatus-{{$gatewayApprovalStatuses[$gp->gatewayApprovalStatus]}}">
-                                        <td>{{$gp->gatewayName }}</td>
+                                        <td class="form-gatewayName">{{$gp->gatewayName }}</td>
                                         <?php 
 
                                             $timeDifference = Session::get("user_timezone");
@@ -114,12 +114,12 @@
                                         ?>
                                         <td>{{ $creationTime}}</td>
                                         <td>{{ $gp->gatewayAdminFirstName }} {{ $gp->gatewayAdminLastName }} </td>
-                                        <td>{{ $gp->gatewayURL }}</td>
+                                        <td class="form-gatewayURL">{{ $gp->gatewayURL }}</td>
                                         <td style="max-width: 400px; word-wrap: break-word;">{{ $gp->reviewProposalDescription}}</td>
-                                        <td>{{ $gp->gatewayPublicAbstract}}</td>
+                                        <td style="max-width: 400px; word-wrap: break-word;">{{ $gp->gatewayPublicAbstract}}</td>
                                         <td>{{$gatewayApprovalStatuses[$gp->gatewayApprovalStatus] }}</td>
                                         <td>
-                                            <input type="button" class="btn btn-primary btn-xs start-approval" data-gatewayobject="{{htmlentities(json_encode( $gp))}}" value="View"/>
+                                            <input type="button" class="btn btn-primary btn-xs start-approval" id="view-{{ preg_replace('/[\s]/', '-',$gp->gatewayId) }}" data-gatewayobject='{{htmlentities(json_encode( $gp))}}' value="View"/>
                                         </td>
                                     </tr>
                                 @endforeach
@@ -571,6 +571,11 @@
 
         var gatewayObject = $(this).data("gatewayobject");
         var gatewayId = gatewayObject.gatewayId;
+        if( gatewayId == undefined){
+            gatewayObject = $.parseJSON( $(this).data("gatewayobject"));
+            gatewayId = gatewayObject.gatewayId;
+        }
+
         var gatewayApprovalStatuses = $.parseJSON( $(".gatewayApprovalStatuses").val() );
 
         $(".onTenantLoad").removeClass("hide");
@@ -633,6 +638,7 @@
         }).done( function( data){
             $(".loading-gif").remove();
             if( data == -1 ){
+                //errors only with -1
                 if( updateVal == "createTenant"){
                 $(".submit-actions").after("<div class='alert alert-danger fail-alert'>Tenant creation has failed as Tenant with the same Domain name- airavata." + $(".gatewayAcronym").val() + " already exists in Identity Server. Please change Gateway Acronym and try again.");
                 }
@@ -640,16 +646,28 @@
                     $(".submit-actions").after("<div class='alert alert-danger fail-alert'>Error updating Gateway. Please try again.");
                 }
             }
-            else if( data == 1){
+            else{
                 if( updateVal == "createTenant"){
                     $(".submit-actions").after("<div class='alert alert-success success-alert'>Tenant has been created with domain name- airavata." + $(".gatewayAcronym").val());
                     $(".notCreatedGateway").addClass("hide");
+
+                    $(".createdGateway").removeClass("hide");
+
                 }
                 else{
                     $(".submit-actions").after("<div class='alert alert-success success-alert'>Gateway has been updated successfully.");
                 }
-                $(".createdGateway").removeClass("hide");
 
+                dataObj = {};
+
+                for (i=0; i<updateGatewayData.length; i++) {
+                  dataObj[updateGatewayData[i].name] = updateGatewayData[i].value;
+                }
+
+                var gatewayIdWithoutSpaces = dataObj['gateway_id'].replace(/\s+/g, '-');
+                $("#view-" +  gatewayIdWithoutSpaces).data("gatewayobject", data);
+                $("#view-" + gatewayIdWithoutSpaces ).parent().parent().find(".form-gatewayName").html( dataObj['gatewayName']);
+                $("#view-" + gatewayIdWithoutSpaces ).parent().parent().find(".form-gatewayURL").html( dataObj['gatewayURL']);
             }
             //$(".onTenantComplete").removeClass("hide");
             //$(".onTenantLoad").addClass("hide");