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:50:27 UTC
[2/2] airavata-php-gateway git commit: AIRAVATA-2199 fixed in develop
branch.
AIRAVATA-2199 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/dd77f70b
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/dd77f70b
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/dd77f70b
Branch: refs/heads/develop
Commit: dd77f70be3e12cc3190e5b1c8625e473b8999bf7
Parents: 8f7d7d5
Author: Nipurn Doshi <ni...@gmail.com>
Authored: Wed Nov 30 23:49:02 2016 -0800
Committer: Nipurn Doshi <ni...@gmail.com>
Committed: Wed Nov 30 23:49:02 2016 -0800
----------------------------------------------------------------------
app/views/admin/manage-gateway.blade.php | 81 +++++++++++++++------------
1 file changed, 46 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/dd77f70b/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 3dea01e..4d85215 100644
--- a/app/views/admin/manage-gateway.blade.php
+++ b/app/views/admin/manage-gateway.blade.php
@@ -624,6 +624,7 @@
$(".update-gateway").click( function( ev){
ev.preventDefault();
$(this).prepend( "<img class='loading-gif' src='<?php echo URL::to('/'); ?>/assets/ajax-loader.gif'/>");
+
$(".fail-alert").remove();
$(".success-alert").remove();
var updateVal = $(this).val();
@@ -631,48 +632,58 @@
updateGatewayData.push({name: updateVal, value: true});
- $.ajax({
- url: "{{URL::to('/')}}/admin/update-gateway-request",
- method: "GET",
- data: updateGatewayData
- }).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.");
- }
- else{
- $(".submit-actions").after("<div class='alert alert-danger fail-alert'>Error updating Gateway. Please try again.");
- }
- }
- 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");
+ dataObj = {}; // object containing all updatable gateway object elements
+
+ for (i=0; i<updateGatewayData.length; i++) {
+ dataObj[updateGatewayData[i].name] = updateGatewayData[i].value;
+ }
- $(".createdGateway").removeClass("hide");
+ if( updateVal == "createTenant" &&
+ ( $.trim( dataObj['oauthClientId'] ) == "" || $.trim( dataObj['oauthClientSecret'] ) == "") ){
+ $(".submit-actions").before("<div class='alert alert-danger fail-alert'>Tenant creation requires Oauth Client Id and Oauth Client Secret fields to be filled.</div>");
+ $(".loading-gif").remove();
+ }
+ else
+ {
+ $.ajax({
+ url: "{{URL::to('/')}}/admin/update-gateway-request",
+ method: "GET",
+ data: updateGatewayData
+ }).done( function( data){
+ $(".loading-gif").remove();
+ if( data == -1 ){
+ //errors only with -1
+ if( updateVal == "createTenant"){
+ $(".submit-actions").before("<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.");
+ }
+ else{
+ $(".submit-actions").before("<div class='alert alert-danger fail-alert'>Error updating Gateway. Please try again.");
+ }
}
else{
- $(".submit-actions").after("<div class='alert alert-success success-alert'>Gateway has been updated successfully.");
- }
+ if( updateVal == "createTenant"){
+ $(".submit-actions").before("<div class='alert alert-success success-alert'>Tenant has been created with domain name- airavata." + $(".gatewayAcronym").val());
+ $(".notCreatedGateway").addClass("hide");
- dataObj = {};
+ $(".createdGateway").removeClass("hide");
- for (i=0; i<updateGatewayData.length; i++) {
- dataObj[updateGatewayData[i].name] = updateGatewayData[i].value;
- }
+ }
+ else{
+ $(".submit-actions").before("<div class='alert alert-success success-alert'>Gateway has been updated successfully.");
+ }
- 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");
- //$(".onTenantComplete").removeClass("hide");
- });
+ //refresh data next time if same popup is opened.
+ 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");
+ //$(".onTenantComplete").removeClass("hide");
+ });
+ }
});
$(".gaStatuses option[value=REQUESTED]").prop("selected", true);