From bd45989a31bd88c924c00b5a48a1c6b803ac06dc Mon Sep 17 00:00:00 2001 From: Durgesh1988 Date: Wed, 14 Sep 2016 13:34:25 +0530 Subject: [PATCH 1/3] CAT-2329 and CAT-2332 Fixed --- .../private/ajax/Settings/CreateProviders.html | 2 +- .../private/ajax/Settings/providerSync.html | 16 ++++++++-------- client/htmls/public/js/awsCapacity.js | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/client/htmls/private/ajax/Settings/CreateProviders.html b/client/htmls/private/ajax/Settings/CreateProviders.html index 3b997d41c..c677ead19 100755 --- a/client/htmls/private/ajax/Settings/CreateProviders.html +++ b/client/htmls/private/ajax/Settings/CreateProviders.html @@ -234,7 +234,7 @@

- +
diff --git a/client/htmls/private/ajax/Settings/providerSync.html b/client/htmls/private/ajax/Settings/providerSync.html index 1cdbbb150..76716513f 100644 --- a/client/htmls/private/ajax/Settings/providerSync.html +++ b/client/htmls/private/ajax/Settings/providerSync.html @@ -1115,12 +1115,12 @@ var tagsProjSelectedVal = $projecttagsList.val(); var tagsenvSelectedVal = $envtagsList.val(); var tagsbgSelectedVal = $bgtagsList.val(); - - if((tagsbgSelectedVal == tagsProjSelectedVal) && (tagsbgSelectedVal == tagsenvSelectedVal)){ + if((tagsbgSelectedVal === tagsProjSelectedVal) + || (tagsbgSelectedVal === tagsenvSelectedVal) + || (tagsProjSelectedVal === tagsenvSelectedVal)){ bootbox.alert("Tag name cannot be same to create catalyst entity mapping"); - return; + return false; } - //Creating the data to Post for Save tags. var tagsData = [{ "catalystEntityType": catalystEntityBgName, @@ -1695,9 +1695,9 @@ "columns": [ {"data": "platformId","orderable" : true }, {"data": "os","orderable" : false }, - {"data": "ip","orderable" : true, + {"data": "","orderable" : true, "render": function(data, type, full){ - if(data !== null){ + if(full.ip && full.ip !== null){ return data; }else{ return full.privateIpAddress; @@ -1868,9 +1868,9 @@ "columns": [ {"data": "platformId","orderable" : true }, {"data": "os","orderable" : false }, - {"data": "ip","orderable" : true, + {"data": "","orderable" : true, "render": function(data, type, full){ - if(data !== null){ + if(full.ip && full.ip !== null){ return data; }else{ return full.privateIpAddress; diff --git a/client/htmls/public/js/awsCapacity.js b/client/htmls/public/js/awsCapacity.js index 771fe231c..6bd34d537 100644 --- a/client/htmls/public/js/awsCapacity.js +++ b/client/htmls/public/js/awsCapacity.js @@ -300,12 +300,12 @@ $(document).ready(function() { } }, { - "data": "ip", + "data": "", "orderable": true, "render": function(data, type, full) { - if (data !== null) { + if(full.ip && full.ip !== null){ return data; - } else { + }else{ return full.privateIpAddress; } } @@ -373,12 +373,12 @@ $(document).ready(function() { "data": "os", "orderable": false }, { - "data": "ip", + "data": "", "orderable": true, "render": function(data, type, full) { - if (data !== null) { + if(full.ip && full.ip !== null){ return data; - } else { + }else{ return full.privateIpAddress; } } From 259c4c3b10579c9d5b48e06b5f1878dfba803a46 Mon Sep 17 00:00:00 2001 From: Durgesh1988 Date: Wed, 14 Sep 2016 16:04:08 +0530 Subject: [PATCH 2/3] CAT-2333 Fixed --- .../private/ajax/Settings/providerSync.html | 16 ++++------------ client/htmls/public/js/awsCapacity.js | 8 ++------ server/app/model/classes/instance/instance.js | 17 ++++++----------- .../unassigned-instances.js | 16 ++++++---------- .../unmanaged-instance/unmanaged-instance.js | 18 +++++++----------- 5 files changed, 25 insertions(+), 50 deletions(-) diff --git a/client/htmls/private/ajax/Settings/providerSync.html b/client/htmls/private/ajax/Settings/providerSync.html index 76716513f..701daf361 100644 --- a/client/htmls/private/ajax/Settings/providerSync.html +++ b/client/htmls/private/ajax/Settings/providerSync.html @@ -1696,12 +1696,8 @@ {"data": "platformId","orderable" : true }, {"data": "os","orderable" : false }, {"data": "","orderable" : true, - "render": function(data, type, full){ - if(full.ip && full.ip !== null){ - return data; - }else{ - return full.privateIpAddress; - } + "render":function(data, type, full, meta) { + return (full.ip !== null || full.ip !== 'null') ? full.ip:full.privateIpAddress; } }, {"data": "","orderable" : true, @@ -1869,12 +1865,8 @@ {"data": "platformId","orderable" : true }, {"data": "os","orderable" : false }, {"data": "","orderable" : true, - "render": function(data, type, full){ - if(full.ip && full.ip !== null){ - return data; - }else{ - return full.privateIpAddress; - } + "render":function(data, type, full, meta) { + return (full.ip !== null || full.ip !== 'null') ? full.ip:full.privateIpAddress; } }, {"data": "state","orderable" : true }, diff --git a/client/htmls/public/js/awsCapacity.js b/client/htmls/public/js/awsCapacity.js index 6bd34d537..492c73ed3 100644 --- a/client/htmls/public/js/awsCapacity.js +++ b/client/htmls/public/js/awsCapacity.js @@ -375,12 +375,8 @@ $(document).ready(function() { }, { "data": "", "orderable": true, - "render": function(data, type, full) { - if(full.ip && full.ip !== null){ - return data; - }else{ - return full.privateIpAddress; - } + "render":function(data, type, full, meta) { + return (full.ip !== null || full.ip !== 'null') ? full.ip:full.privateIpAddress; } }, { "data": "state", diff --git a/server/app/model/classes/instance/instance.js b/server/app/model/classes/instance/instance.js index 485885150..0d639e938 100755 --- a/server/app/model/classes/instance/instance.js +++ b/server/app/model/classes/instance/instance.js @@ -2118,23 +2118,18 @@ var InstancesDao = function() { this.updateInstanceStatus = function(instanceId, instance, callback) { var updateObj = {}; + updateObj['instanceState'] = instance.state; + updateObj['subnetId']= instance.subnetId; + updateObj['instanceIP'] = instance.ip; + updateObj['vpcId'] = instance.vpcId; + updateObj['privateIpAddress'] = instance.privateIpAddress; + updateObj['tags'] = instance.tags; if(instance.status && instance.status === 'shutting-down'){ - updateObj['instanceState'] = instance.status; updateObj['isDeleted'] = false; }else if (instance.state === 'terminated') { - updateObj['instanceState'] = instance.state; - updateObj['subnetId']= instance.subnetId; - updateObj['vpcId'] = instance.vpcId; - updateObj['privateIpAddress'] = instance.privateIpAddress; updateObj['isDeleted'] = true; - updateObj['tags'] = instance.tags; }else { - updateObj['instanceState'] = instance.state; - updateObj['subnetId']= instance.subnetId; - updateObj['vpcId'] = instance.vpcId; - updateObj['privateIpAddress'] = instance.privateIpAddress; updateObj['isDeleted'] = false; - updateObj['tags'] = instance.tags; } Instances.update({ "_id": ObjectId(instanceId) diff --git a/server/app/model/unassigned-instances/unassigned-instances.js b/server/app/model/unassigned-instances/unassigned-instances.js index 4a3075748..3c22fad2e 100644 --- a/server/app/model/unassigned-instances/unassigned-instances.js +++ b/server/app/model/unassigned-instances/unassigned-instances.js @@ -186,20 +186,16 @@ UnassignedInstancesSchema.statics.updateInstance = function updateInstance(param UnassignedInstancesSchema.statics.updateInstanceStatus = function updateInstanceStatus(instanceId,instance,callback) { var updateObj={}; + updateObj['state'] = instance.state; + updateObj['subnetId']= instance.subnetId; + updateObj['ip'] = instance.ip; + updateObj['vpcId'] = instance.vpcId; + updateObj['privateIpAddress'] = instance.privateIpAddress; + updateObj['tags'] = instance.tags; if(instance.state === 'terminated'){ - updateObj['state'] = instance.state; - updateObj['subnetId']= instance.subnetId; - updateObj['vpcId'] = instance.vpcId; - updateObj['privateIpAddress'] = instance.privateIpAddress; updateObj['isDeleted'] = true; - updateObj['tags'] = instance.tags; }else{ - updateObj['state'] = instance.state; - updateObj['subnetId']= instance.subnetId; - updateObj['vpcId'] = instance.vpcId; - updateObj['privateIpAddress'] = instance.privateIpAddress; updateObj['isDeleted'] = false; - updateObj['tags'] = instance.tags; } UnassignedInstances.update({ "_id": ObjectId(instanceId) diff --git a/server/app/model/unmanaged-instance/unmanaged-instance.js b/server/app/model/unmanaged-instance/unmanaged-instance.js index 5aee11688..4fdda1e63 100644 --- a/server/app/model/unmanaged-instance/unmanaged-instance.js +++ b/server/app/model/unmanaged-instance/unmanaged-instance.js @@ -291,20 +291,16 @@ UnmanagedInstanceSchema.statics.getInstancesByProviderIdOrgIdAndPlatformId = fun UnmanagedInstanceSchema.statics.updateInstanceStatus = function updateInstanceStatus(instanceId,instance,callback) { var updateObj={}; + updateObj['state'] = instance.state; + updateObj['subnetId']= instance.subnetId; + updateObj['ip'] = instance.ip; + updateObj['vpcId'] = instance.vpcId; + updateObj['privateIpAddress'] = instance.privateIpAddress; + updateObj['tags'] = instance.tags; if(instance.state === 'terminated'){ - updateObj['state'] = instance.state; - updateObj['subnetId']= instance.subnetId; - updateObj['vpcId'] = instance.vpcId; - updateObj['privateIpAddress'] = instance.privateIpAddress; updateObj['isDeleted'] = true; - updateObj['tags'] = instance.tags; }else{ - updateObj['state'] = instance.state; - updateObj['subnetId']= instance.subnetId; - updateObj['vpcId'] = instance.vpcId; - updateObj['privateIpAddress'] = instance.privateIpAddress; - updateObj['isDeleted'] = false; - updateObj['tags'] = instance.tags; + updateObj['isDeleted'] = false; } UnmanagedInstance.update({ "_id": ObjectId(instanceId) From 04723f282649d426343c303950ecc9fede7ba4aa Mon Sep 17 00:00:00 2001 From: Durgesh1988 Date: Wed, 14 Sep 2016 17:31:38 +0530 Subject: [PATCH 3/3] CAT-2333 Fixed --- client/htmls/private/ajax/Settings/providerSync.html | 4 ++-- client/htmls/public/js/awsCapacity.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/htmls/private/ajax/Settings/providerSync.html b/client/htmls/private/ajax/Settings/providerSync.html index 701daf361..bfb4727f6 100644 --- a/client/htmls/private/ajax/Settings/providerSync.html +++ b/client/htmls/private/ajax/Settings/providerSync.html @@ -1697,7 +1697,7 @@ {"data": "os","orderable" : false }, {"data": "","orderable" : true, "render":function(data, type, full, meta) { - return (full.ip !== null || full.ip !== 'null') ? full.ip:full.privateIpAddress; + return full.ip !== null ? full.ip:full.privateIpAddress; } }, {"data": "","orderable" : true, @@ -1866,7 +1866,7 @@ {"data": "os","orderable" : false }, {"data": "","orderable" : true, "render":function(data, type, full, meta) { - return (full.ip !== null || full.ip !== 'null') ? full.ip:full.privateIpAddress; + return full.ip !== null ? full.ip:full.privateIpAddress; } }, {"data": "state","orderable" : true }, diff --git a/client/htmls/public/js/awsCapacity.js b/client/htmls/public/js/awsCapacity.js index 492c73ed3..5a285514a 100644 --- a/client/htmls/public/js/awsCapacity.js +++ b/client/htmls/public/js/awsCapacity.js @@ -376,7 +376,7 @@ $(document).ready(function() { "data": "", "orderable": true, "render":function(data, type, full, meta) { - return (full.ip !== null || full.ip !== 'null') ? full.ip:full.privateIpAddress; + return full.ip !== null ? full.ip:full.privateIpAddress; } }, { "data": "state",