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/Dashboard.html b/client/htmls/private/ajax/Settings/Dashboard.html index ce51aaae5..bcefc338e 100755 --- a/client/htmls/private/ajax/Settings/Dashboard.html +++ b/client/htmls/private/ajax/Settings/Dashboard.html @@ -2,6 +2,7 @@ .container { width:1166px; height:130px; + margin-top: 20px; } .btn-circle { width: 49px; @@ -29,6 +30,16 @@ color:#fff; box-shadow: 0 0 5px #286090; } +.green-btn { + background-color: green; + color:#fff; + box-shadow: 0 0 5px #286090; +} +.red-btn { + background-color: red; + color:#fff; + box-shadow: 0 0 5px #286090; +} .process-btn { background-color: #7d7676; color: #fff; @@ -71,53 +82,88 @@ color: #7d7676; } -/*.content { - margin:0 auto; - width: 80%; - border: 1px solid #757575; - padding: 10px; -}*/ +.form-controls { + display: inline; + height: 32px; + padding: 6px 12px; + font-size: 13px; + line-height: 1.428571429; + color: #555; + vertical-align: middle; + background-color: #fff; + background-image: none; + border: 1px solid #ccc; + transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; + height: 29px; + } + + .marginRight20 { + margin-right: 20px; + } + + #wizardActionListLoader { + opacity: 0.6; + height: 100%; + width: 100%; + position: absolute; + background: #ddd; +}
-

-
Setup & Configuration Wizard
-

+ +
+
+
+ Setup & Configuration Wizard +
+
+ + Choose Organization: + + + + + New Wizard + + +
+
-
- Start
+
+ Start

Introduction

1

Org Configuration

-
- 2
-

Chef Configuration

+
+ 2
+

Config Management

- 3
+ 3

Provider Configuration

-
- 4
-

Repositories

-
-
- 5
-

Security Access Control

+
+ 4
+

Devops Roles

-
- 6
-

Telemetry

+
+ 5
+

Track

- 7
+ 6

CMDB Configuration

+

@@ -126,11 +172,13 @@

\ No newline at end of file diff --git a/client/htmls/private/ajax/Settings/bgWizard.html b/client/htmls/private/ajax/Settings/bgWizard.html new file mode 100644 index 000000000..8b343e370 --- /dev/null +++ b/client/htmls/private/ajax/Settings/bgWizard.html @@ -0,0 +1,134 @@ + +
+
+
+

Create Business Group

+
+
+
+
+
+
+ + +
+
+ + +
+
+
+
+
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/client/htmls/private/ajax/Settings/configManagementWizard.html b/client/htmls/private/ajax/Settings/configManagementWizard.html new file mode 100644 index 000000000..64b02cccd --- /dev/null +++ b/client/htmls/private/ajax/Settings/configManagementWizard.html @@ -0,0 +1,290 @@ + + + + +
    +
  • Chef Server
  • +
  • Environments
  • +
+ +
+
+
+
+

New Configuration Management

+
+
+
+
+
+ +
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+ +
+
+
+
+ +
+
+ + \ No newline at end of file diff --git a/client/htmls/private/ajax/Settings/devopsRolesWizard.html b/client/htmls/private/ajax/Settings/devopsRolesWizard.html new file mode 100644 index 000000000..ad33f460a --- /dev/null +++ b/client/htmls/private/ajax/Settings/devopsRolesWizard.html @@ -0,0 +1,367 @@ + + + + +
    +
  • Nexus Server
  • +
  • Docker
  • +
  • Jenkins
  • +
  • Templates
  • +
+ +
+
+
+
+

Nexus Configuration Management

+
+
+
+
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+
+ + +
+ + + + + + + + + +
NameAction
+
+
+ +
+
+
+
+
+
+
+ +
+
+
+ \ No newline at end of file diff --git a/client/htmls/private/ajax/Settings/dockerWizard.html b/client/htmls/private/ajax/Settings/dockerWizard.html new file mode 100644 index 000000000..a27b3d964 --- /dev/null +++ b/client/htmls/private/ajax/Settings/dockerWizard.html @@ -0,0 +1,166 @@ +
+
+
+

Create Docker

+
+
+
+
+
+ +
+
+ + +
+
+ + + +
+
+ + + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+
+
+
+ +
+
+ \ No newline at end of file diff --git a/client/htmls/private/ajax/Settings/envWizard.html b/client/htmls/private/ajax/Settings/envWizard.html new file mode 100644 index 000000000..11dafed20 --- /dev/null +++ b/client/htmls/private/ajax/Settings/envWizard.html @@ -0,0 +1,239 @@ +
+
+
+
+

Create Environment

+
+
+
+
+
+ +
+
+ + +
+
+ + +
+
+ + Add + +
+ + +
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+ + + \ No newline at end of file diff --git a/client/htmls/private/ajax/Settings/jenkinsWizard.html b/client/htmls/private/ajax/Settings/jenkinsWizard.html new file mode 100644 index 000000000..fda12b6da --- /dev/null +++ b/client/htmls/private/ajax/Settings/jenkinsWizard.html @@ -0,0 +1,109 @@ +
+
+
+

Create Jenkins

+
+
+
+
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+
+
+
+ +
+
+ \ No newline at end of file diff --git a/client/htmls/private/ajax/Settings/projWizard.html b/client/htmls/private/ajax/Settings/projWizard.html new file mode 100644 index 000000000..0425d84f9 --- /dev/null +++ b/client/htmls/private/ajax/Settings/projWizard.html @@ -0,0 +1,156 @@ +
+
+
+
+

Create Project

+
+
+
+
+
+
+
+ + +
+ +
+
+ + +
+
+ + +
+
+ + +
+ + + + +
+
+
+
+
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/client/htmls/private/ajax/Settings/providerSync.html b/client/htmls/private/ajax/Settings/providerSync.html index 1cdbbb150..bfb4727f6 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,13 +1695,9 @@ "columns": [ {"data": "platformId","orderable" : true }, {"data": "os","orderable" : false }, - {"data": "ip","orderable" : true, - "render": function(data, type, full){ - if(data !== null){ - return data; - }else{ - return full.privateIpAddress; - } + {"data": "","orderable" : true, + "render":function(data, type, full, meta) { + return full.ip !== null ? full.ip:full.privateIpAddress; } }, {"data": "","orderable" : true, @@ -1868,13 +1864,9 @@ "columns": [ {"data": "platformId","orderable" : true }, {"data": "os","orderable" : false }, - {"data": "ip","orderable" : true, - "render": function(data, type, full){ - if(data !== null){ - return data; - }else{ - return full.privateIpAddress; - } + {"data": "","orderable" : true, + "render":function(data, type, full, meta) { + return full.ip !== null ? full.ip:full.privateIpAddress; } }, {"data": "state","orderable" : true }, diff --git a/client/htmls/private/ajax/Settings/providerWizard.html b/client/htmls/private/ajax/Settings/providerWizard.html new file mode 100644 index 000000000..b57b9788a --- /dev/null +++ b/client/htmls/private/ajax/Settings/providerWizard.html @@ -0,0 +1,916 @@ + + + +
    +
  • Create Providers
  • +
  • VmImages
  • +
+ +
+
+
+
+

Create Providers

+
+
+
+
+
+ +
+ +
+ +
+ +
+ +
+
+ + +
+
+ + +
+
+
+
+ + + + + + + + + + + + + + +
+
+
+
+ + + + +
+
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
+
+ + + +
+
+ + +
+
+
+ + +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+ + + + + +
+
+ + + + + +
+
+
+
+ + +
+
+
+ +
+ +
+ +
+ +
+ +
+
+
+
+
+ +
+
+
+ + + + + \ No newline at end of file diff --git a/client/htmls/private/ajax/Settings/settingsWizard.html b/client/htmls/private/ajax/Settings/settingsWizard.html index 99979d0ed..2e5657431 100644 --- a/client/htmls/private/ajax/Settings/settingsWizard.html +++ b/client/htmls/private/ajax/Settings/settingsWizard.html @@ -1,348 +1,240 @@ -
- -
    -
  • Create Organisation
  • -
  • Create BG
  • -
  • Create Project
  • - -
- -
+ + +
    +
  • Create Organisation
  • +
  • Create BG
  • +
  • Create Project
  • +
+ +
+

Create Organization

-
-
+
+
-
-
-
-
- - -
-
- - +
+
+
+
+ + +
+
+ + +
+
+ + + + + +
-
-
-
-
-
-
- -
- -
-
-
-

Create Business Group

-
-
-
-
-
-
- - -
-
- - -
-
-
+
+
-
-
- - - -
-
-
-

Create Project

-
-
-
-
-
- - - -
- - -
- -
-
- - -
-
- - -
- -
- - -
- - - - - - - - - - -
RepositoryNameAction
-
-
- - - -
-
-
-
-
- - -
- +
+
+
+ +
+
\ No newline at end of file diff --git a/client/htmls/private/ajax/Settings/templatesWizard.html b/client/htmls/private/ajax/Settings/templatesWizard.html new file mode 100644 index 000000000..1b58c3559 --- /dev/null +++ b/client/htmls/private/ajax/Settings/templatesWizard.html @@ -0,0 +1,529 @@ +
+
+
+

Create Templates

+
+
+
+
+
+ +
+
+
+ + + +
+
+
+ + +
+
+
+ + + +
+ + +
+ + + +
+ + + + + +
+ +
+ + + + + + +
+ +
+
+ + +
+
+ + + + +
+ + + + +
+ + + + +
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+
+ \ No newline at end of file diff --git a/client/htmls/private/ajax/Settings/trackWizard.html b/client/htmls/private/ajax/Settings/trackWizard.html new file mode 100644 index 000000000..fc447d96b --- /dev/null +++ b/client/htmls/private/ajax/Settings/trackWizard.html @@ -0,0 +1,125 @@ +
+
+
+

Create Track Dashboard

+
+
+
+
+
+ +
+
+
+ +
+ +
+
+
+ + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ Add Child Item + + + +
+
+ +
+
+
+
+
+
+ +
+
+ \ No newline at end of file diff --git a/client/htmls/private/ajax/Settings/vmImageWizard.html b/client/htmls/private/ajax/Settings/vmImageWizard.html new file mode 100644 index 000000000..8d651ffbe --- /dev/null +++ b/client/htmls/private/ajax/Settings/vmImageWizard.html @@ -0,0 +1,286 @@ +
+
+
+

Create VmImages

+
+
+
+
+
+ +
+ +
+ + +
+
+ + +
+ + +
+ + +
+
+ + +
+ + +
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+
+
+
+ +
+
+ \ No newline at end of file diff --git a/client/htmls/private/css/wizard.css b/client/htmls/private/css/wizard.css new file mode 100644 index 000000000..0a9a12cbb --- /dev/null +++ b/client/htmls/private/css/wizard.css @@ -0,0 +1,91 @@ +.wizardSetup form { + margin: 10px auto; + position: relative; + } + + /*Hide all except first fieldset*/ + .wizardSetup form:not(:first-of-type) { + display: none; + } + + /*buttons*/ + .wizardSetup form .action-button { + width: 100px; + background: #27AE60; + font-weight: bold; + color: white; + border: 0 none; + border-radius: 1px; + cursor: pointer; + padding: 10px 5px; + margin: 10px 5px; + } + .wizardSetup form .action-button:hover, #msform .action-button:focus { + box-shadow: 0 0 0 2px white, 0 0 0 3px #27AE60; + } + /*headings*/ + .wizardSetup .fs-title { + font-size: 15px; + text-transform: uppercase; + color: #2C3E50; + margin-bottom: 10px; + } + .wizardSetup .fs-subtitle { + font-weight: normal; + font-size: 13px; + color: #666; + margin-bottom: 20px; + } + /*progressbar*/ + #progressbar { + overflow: hidden; + text-align: center; + /*CSS counters to number the steps*/ + counter-reset: step; + margin-top: 5px; + } + #progressbar li { + list-style-type: none; + font-size: 15px; + width: 33.33%; + float: left; + position: relative; + } + #progressbar li:before { + content: counter(step); + counter-increment: step; + width: 20px; + line-height: 20px; + display: block; + font-size: 10px; + color: #fff; + background: #7d7676; + border-radius: 3px; + margin: 0 auto 5px auto; + } + /*progressbar connectors*/ + #progressbar li:after { + content: ''; + width: 100%; + height: 2px; + background: #7d7676; + position: absolute; + left: -50%; + top: 9px; + z-index: -1; /*put it behind the numbers*/ + } + #progressbar li:first-child:after { + /*connector not needed before the first step*/ + content: none; + } + /*marking active/completed steps green*/ + /*The number of the step and the connector before it = green*/ + #progressbar li.active:before, #progressbar li.active:after{ + background: #27AE60; + color: white; + } + + .wizardSetup form .content { + margin:0 auto!important; + padding: 10px; + } \ No newline at end of file diff --git a/client/htmls/private/js/settingscommon.js b/client/htmls/private/js/settingscommon.js index 2a258ad94..d9700abb9 100755 --- a/client/htmls/private/js/settingscommon.js +++ b/client/htmls/private/js/settingscommon.js @@ -2167,7 +2167,6 @@ function CreateTableFromJsonNew(formID, idFieldName, createFileName) { function saveform(formID, operationTypes) { //Validating the form - if (formID === "7") { if (isFormValid(formID) == false || !validateUserForm(formID)) { return (false); @@ -2190,7 +2189,6 @@ function saveform(formID, operationTypes) { if (isFormValid(formID) == false) return (false); } - var data1 = new FormData(); var fileNames = ''; var orgName = $('#orgname').val().trim(); @@ -3318,7 +3316,6 @@ function isFormValidOpenStack(formid, option) { function isFormValid(formid) { var isValid = true; - if ($('input[unique="true"], select[unique="true"]').length > 0) { // alert('in isFormValid'); $('input[unique="true"], select[unique="true"]').each(function() { @@ -3342,7 +3339,6 @@ function isFormValid(formid) { } var password = $('#password').val(); var cnfPassword = $('#cnfPassword').val(); - //alert(currCtrl.attr('id')); $.each(valiarr, function(vali) { switch (valiarr[vali]) { @@ -3459,7 +3455,6 @@ function isFormValid(formid) { } }); - }); if (formid && formid === 19) { diff --git a/client/htmls/public/js/awsCapacity.js b/client/htmls/public/js/awsCapacity.js index 771fe231c..5a285514a 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,14 +373,10 @@ $(document).ready(function() { "data": "os", "orderable": false }, { - "data": "ip", + "data": "", "orderable": true, - "render": function(data, type, full) { - if (data !== null) { - return data; - } else { - return full.privateIpAddress; - } + "render":function(data, type, full, meta) { + return full.ip !== null ? full.ip:full.privateIpAddress; } }, { "data": "state", diff --git a/seed/mongodump/devops_new/settingwizards.bson b/seed/mongodump/devops_new/settingwizards.bson new file mode 100644 index 000000000..8984f90df Binary files /dev/null and b/seed/mongodump/devops_new/settingwizards.bson differ diff --git a/seed/mongodump/devops_new/settingwizards.metadata.json b/seed/mongodump/devops_new/settingwizards.metadata.json new file mode 100644 index 000000000..5b8cee58c --- /dev/null +++ b/seed/mongodump/devops_new/settingwizards.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"devops_new.settingwizards"}]} \ No newline at end of file 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/setting-wizard/package.json b/server/app/model/setting-wizard/package.json new file mode 100644 index 000000000..74f37297d --- /dev/null +++ b/server/app/model/setting-wizard/package.json @@ -0,0 +1,3 @@ +{ + "main":"setting-wizard.js" +} \ No newline at end of file diff --git a/server/app/model/setting-wizard/setting-wizard.js b/server/app/model/setting-wizard/setting-wizard.js new file mode 100644 index 000000000..716dba86d --- /dev/null +++ b/server/app/model/setting-wizard/setting-wizard.js @@ -0,0 +1,88 @@ +/* + Copyright [2016] [Relevance Lab] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + + +var logger = require('_pr/logger')(module); +var mongoose = require('mongoose'); +var ObjectId = require('mongoose').Types.ObjectId; + + +var Schema = mongoose.Schema; + +var SettingWizardSchema = new Schema({ + orgId: { + type: String, + required: true, + trim: true + }, + orgName: { + type: String, + required: true, + trim: true + }, + previousStep: Schema.Types.Mixed, + currentStep: Schema.Types.Mixed, + nextStep:Schema.Types.Mixed +}); + + +SettingWizardSchema.statics.createSettingWizard = function createSettingWizard(settingWizard, callback) { + var that = this; + var settingWizardObj = new that(settingWizard); + settingWizardObj.save(function(err, settingWizardDetails) { + if (err) { + logger.debug("Got error while creating setting-Wizard: ", err); + callback(err, null); + return; + } + callback(null, settingWizardDetails); + return; + }); +}; + +SettingWizardSchema.statics.updateSettingWizard = function updateSettingWizard(settingWizard, callback) { + this.update({ + _id: new ObjectId(settingWizard._id) + }, { + $set: settingWizard + }, { + upsert: false + },function(err, data) { + if (err) { + logger.debug("Got error while updating setting-Wizard: ", err); + callback(err, null); + return; + } + callback(null, data); + return; + }); +}; + + +SettingWizardSchema.statics.getSettingWizardByOrgId = function getSettingWizardByOrgId(orgId, callback) { + this.findOne({ + orgId:orgId + }, function(err, settingWizardDetails) { + if (err) { + logger.debug("Got error while fetching getSettingWizardByOrgId: ", err); + callback(err, null); + } + callback(null, settingWizardDetails); + }); +}; + +var settingWizard = mongoose.model("settingWizard", SettingWizardSchema); +module.exports = settingWizard; \ No newline at end of file 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) diff --git a/server/app/routes/v1.0/routes.js b/server/app/routes/v1.0/routes.js index f9a8c588f..ee2f00cd0 100755 --- a/server/app/routes/v1.0/routes.js +++ b/server/app/routes/v1.0/routes.js @@ -72,6 +72,7 @@ var cors = require('cors'); var auditTrail = require('./routes_audit_trails'); var scripts = require('./routes_scripts'); var fileUpload = require('./routes_fileUpload'); +var settingWizard = require('./routes_setting_wizard'); /* * @TODO * Change app to router in internal routes files @@ -178,6 +179,8 @@ module.exports.setRoutes = function(app) { fileUpload.setRoutes(app, sessionVerificationFunc); + settingWizard.setRoutes(app, sessionVerificationFunc); + app.get('/', function(req, res) { res.redirect('/cat3'); diff --git a/server/app/routes/v1.0/routes_d4dMasters.js b/server/app/routes/v1.0/routes_d4dMasters.js index 4b024e28b..20c1de4d6 100755 --- a/server/app/routes/v1.0/routes_d4dMasters.js +++ b/server/app/routes/v1.0/routes_d4dMasters.js @@ -43,8 +43,9 @@ var parser = require('xml2json'); var util = require('util'); var Task = require('_pr/model/classes/tasks/tasks.js'); var async = require('async'); -var appDeployPipelineService = require('_pr/services/appDeployPipelineService'); -var settingsService = require('_pr/services/settingsService'); +var appDeployPipelineService = require('_pr/services/appDeployPipelineService'); +var settingsService = require('_pr/services/settingsService'); +var settingWizard = require('_pr/model/setting-wizard'); module.exports.setRoutes = function(app, sessionVerification) { @@ -2352,103 +2353,141 @@ module.exports.setRoutes = function(app, sessionVerification) { res.status(500).send("Failed to save Org."); return; } - for (var x1 = 0; x1 < 6; x1++) { - (function(x1) { - var templatetypename; - var designtemplateicon_filename; - var templatetype; - if (x1 === 0) { - templatetypename = "SoftwareStack"; - designtemplateicon_filename = "Appfactory.png"; - templatetype = "chef"; - } else if (x1 === 1) { - templatetypename = "OSImage"; - designtemplateicon_filename = "Desktop Provisining.png"; - templatetype = "ami"; - } else if (x1 === 2) { - templatetypename = "CloudFormation"; - designtemplateicon_filename = "CloudFormation.png"; - templatetype = "cft"; - - } else if (x1 === 3) { - templatetypename = "ARMTemplate"; - designtemplateicon_filename = "CloudFormation.png"; - templatetype = "arm"; - } else if(x1 === 4) { - templatetypename = "Docker"; - designtemplateicon_filename = "Docker.png"; - templatetype = "docker"; - } else { - templatetypename = "Composite"; - designtemplateicon_filename = "composite.png"; - templatetype = "composite"; - } + async.parallel({ + template:function(callback){ + for (var x1 = 0; x1 < 6; x1++) { + (function(x1) { + var templatetypename; + var designtemplateicon_filename; + var templatetype; + if (x1 === 0) { + templatetypename = "SoftwareStack"; + designtemplateicon_filename = "Appfactory.png"; + templatetype = "chef"; + } else if (x1 === 1) { + templatetypename = "OSImage"; + designtemplateicon_filename = "Desktop Provisining.png"; + templatetype = "ami"; + } else if (x1 === 2) { + templatetypename = "CloudFormation"; + designtemplateicon_filename = "CloudFormation.png"; + templatetype = "cft"; + + } else if (x1 === 3) { + templatetypename = "ARMTemplate"; + designtemplateicon_filename = "CloudFormation.png"; + templatetype = "arm"; + } else if(x1 === 4) { + templatetypename = "Docker"; + designtemplateicon_filename = "Docker.png"; + templatetype = "docker"; + } else { + templatetypename = "Composite"; + designtemplateicon_filename = "composite.png"; + templatetype = "composite"; + } - var templateTypeData = { - "templatetypename": templatetypename, - "orgname": bodyJson["orgname"], - "orgname_rowid": bodyJson["rowid"], - "rowid": uuid.v4(), - "id": "16", - "templatetype": templatetype + var templateTypeData = { + "templatetypename": templatetypename, + "orgname": bodyJson["orgname"], + "orgname_rowid": bodyJson["rowid"], + "rowid": uuid.v4(), + "id": "16", + "templatetype": templatetype + + }; + + var templateTypeModel = new d4dModelNew.d4dModelMastersDesignTemplateTypes(templateTypeData); + templateTypeModel.save(function(err, aTemplateType) { + if (err) { + logger.debug("Failed to save TemplateType."); + } + logger.debug("Default TemplateType created."); + if(x1 === 5){ + callback(null,aTemplateType); + return; + } + }); + })(x1); + } + }, + team:function(callback){ + for (var x = 0; x < 4; x++) { + (function(x) { + var teamName; + var descriptions; + if (x === 0) { + teamName = bodyJson["orgname"] + "_Admins"; + descriptions = "Team For " + teamName; + } else if (x === 1) { + teamName = bodyJson["orgname"] + "_DEV"; + descriptions = "Team For " + teamName; + } else if (x === 2) { + teamName = bodyJson["orgname"] + "_QA"; + descriptions = "Team For " + teamName; + } else { + teamName = bodyJson["orgname"] + "_DevOps"; + descriptions = "Team For " + teamName; + } - }; + var teamData = { + "teamname": teamName, + "description": descriptions, + "orgname": bodyJson["orgname"], + "orgname_rowid": bodyJson["rowid"], + "rowid": uuid.v4(), + "id": "21", + "loginname": "", + "loginname_rowid": "", + "projectname": "", + "projectname_rowid": "" + + }; + var teamModel = new d4dModelNew.d4dModelMastersTeams(teamData); + teamModel.save(function(err, aTeam) { + if (err) { + logger.debug("Failed to save Team."); + } + logger.debug("Auto created Team: ", JSON.stringify(aTeam)); + if (x === 3) { + callback(null,aTeam); + return; + } + }); + })(x); - var templateTypeModel = new d4dModelNew.d4dModelMastersDesignTemplateTypes(templateTypeData); - templateTypeModel.save(function(err, aTemplateType) { - if (err) { - logger.debug("Failed to save TemplateType."); - } - logger.debug("Default TemplateType created."); - }); - })(x1); - } - for (var x = 0; x < 4; x++) { - (function(x) { - var teamName; - var descriptions; - if (x === 0) { - teamName = bodyJson["orgname"] + "_Admins"; - descriptions = "Team For " + teamName; - } else if (x === 1) { - teamName = bodyJson["orgname"] + "_DEV"; - descriptions = "Team For " + teamName; - } else if (x === 2) { - teamName = bodyJson["orgname"] + "_QA"; - descriptions = "Team For " + teamName; - } else { - teamName = bodyJson["orgname"] + "_DevOps"; - descriptions = "Team For " + teamName; } - - var teamData = { - "teamname": teamName, - "description": descriptions, - "orgname": bodyJson["orgname"], - "orgname_rowid": bodyJson["rowid"], - "rowid": uuid.v4(), - "id": "21", - "loginname": "", - "loginname_rowid": "", - "projectname": "", - "projectname_rowid": "" - - }; - var teamModel = new d4dModelNew.d4dModelMastersTeams(teamData); - teamModel.save(function(err, aTeam) { + }, + wizard:function(callback){ + var settingWizardSteps = appConfig.settingWizardSteps; + var currentStep=settingWizardSteps[1]; + if(currentStep.nestedSteps){ + currentStep.nestedSteps[0].isCompleted = true; + } + var wizardBody = { + orgId:bodyJson["rowid"], + orgName:bodyJson["orgname"], + previousStep:settingWizardSteps[0], + currentStep:currentStep, + nextStep:settingWizardSteps[2] + } + settingWizard.createSettingWizard(wizardBody,function(err,data){ if (err) { - logger.debug("Failed to save Team."); + logger.debug("Failed to save Setting Wizard."); } - logger.debug("Auto created Team: ", JSON.stringify(aTeam)); - }); - if (x === 3) { - res.send(200); + logger.debug("Setting Wizard created."); + callback(null,data); return; - } - })(x); - - } - + }); + } + },function(err,results){ + if(err){ + res.status(500).send("Failed to save template/Team/Wizard."); + return; + } + res.send(200); + return; + }) }); } else if (req.params.id === '7') { authUtil.hashPassword(bodyJson["password"], function(err, hashedPassword) { @@ -2517,8 +2556,28 @@ module.exports.setRoutes = function(app, sessionVerification) { res.send(500); return; } - res.send(200); - return; + settingWizard.getSettingWizardByOrgId(bodyJson['orgname_rowid'],function(err,settingWizards){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + var settingWizardSteps = appConfig.settingWizardSteps; + settingWizards.currentStep.nestedSteps[2].isCompleted =true; + settingWizards.currentStep.isCompleted =true; + settingWizards.previousStep = settingWizards.currentStep; + settingWizards.currentStep =settingWizards.nextStep; + settingWizards.nextStep =settingWizardSteps[3]; + settingWizard.updateSettingWizard(settingWizards,function(err,data){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + res.send(200); + return; + }); + }) }); } else if (req.params.id === '26') { bodyJson['groupid'] = JSON.parse(bodyJson['groupid']); @@ -2529,8 +2588,23 @@ module.exports.setRoutes = function(app, sessionVerification) { res.send(500); return; } - res.send(200); - return; + settingWizard.getSettingWizardByOrgId(bodyJson['orgname_rowid'],function(err,settingWizards){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + settingWizards.currentStep.nestedSteps[0].isCompleted =true; + settingWizard.updateSettingWizard(settingWizards,function(err,data){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + res.send(200); + return; + }); + }) }); } else { eval('var mastersrdb = new d4dModelNew.' + dbtype + '({' + JSON.parse(FLD) + '})'); @@ -2543,6 +2617,118 @@ module.exports.setRoutes = function(app, sessionVerification) { } logger.debug('New Master Saved'); logger.debug(req.params.fileinputs == 'null'); + if(req.params.id === '2'){ + settingWizard.getSettingWizardByOrgId(bodyJson['orgname_rowid'],function(err,settingWizards){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + settingWizards.currentStep.nestedSteps[1].isCompleted =true; + settingWizard.updateSettingWizard(settingWizards,function(err,data){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + }); + }) + } + if(req.params.id === '10'){ + settingWizard.getSettingWizardByOrgId(bodyJson['orgname_rowid'],function(err,settingWizards){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + settingWizards.currentStep.nestedSteps[0].isCompleted =true; + settingWizard.updateSettingWizard(settingWizards,function(err,data){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + }); + }) + } + if(req.params.id === '18'){ + settingWizard.getSettingWizardByOrgId(bodyJson['orgname_rowid'],function(err,settingWizards){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + settingWizards.currentStep.nestedSteps[1].isCompleted =true; + settingWizard.updateSettingWizard(settingWizards,function(err,data){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + }); + }) + } + if(req.params.id === '20'){ + settingWizard.getSettingWizardByOrgId(bodyJson['orgname_rowid'],function(err,settingWizards){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + settingWizards.currentStep.nestedSteps[2].isCompleted =true; + settingWizard.updateSettingWizard(settingWizards,function(err,data){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + }); + }) + } + if(req.params.id === '17'){ + settingWizard.getSettingWizardByOrgId(bodyJson['orgname_rowid'],function(err,settingWizards){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + var settingWizardSteps = appConfig.settingWizardSteps; + settingWizards.currentStep.nestedSteps[3].isCompleted =true; + settingWizards.currentStep.isCompleted =true; + settingWizards.previousStep = settingWizards.currentStep; + settingWizards.currentStep =settingWizards.nextStep; + settingWizards.nextStep =settingWizardSteps[6]; + settingWizard.updateSettingWizard(settingWizards,function(err,data){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + }); + }) + } + if(req.params.id === '3'){ + settingWizard.getSettingWizardByOrgId(bodyJson['orgname_rowid'],function(err,settingWizards){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + var settingWizardSteps = appConfig.settingWizardSteps; + settingWizards.currentStep.nestedSteps[1].isCompleted =true; + settingWizards.currentStep.isCompleted =true; + settingWizards.previousStep = settingWizards.currentStep; + settingWizards.currentStep =settingWizards.nextStep; + settingWizards.nextStep =settingWizardSteps[4]; + settingWizard.updateSettingWizard(settingWizards,function(err,data){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + }); + }) + } logger.debug('New record folderpath: % rowid %s FLD["folderpath"]:', folderpath, newrowid, folderpath); if (!folderpath) { if (FLD["folderpath"] == undefined) //folderpath issue fix @@ -3553,4 +3739,4 @@ module.exports.setRoutes = function(app, sessionVerification) { }); }); -} +} \ No newline at end of file diff --git a/server/app/routes/v1.0/routes_provider.js b/server/app/routes/v1.0/routes_provider.js index c0cee7cde..148c69f35 100644 --- a/server/app/routes/v1.0/routes_provider.js +++ b/server/app/routes/v1.0/routes_provider.js @@ -39,6 +39,8 @@ var Cryptography = require('_pr/lib/utils/cryptography'); var rc = require('node-rest-client').Client; var appConfig = require('_pr/config'); var instanceService=require('_pr/services/instanceService'); +var settingWizard = require('_pr/model/setting-wizard'); + module.exports.setRoutes = function(app, sessionVerificationFunc) { @@ -258,6 +260,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { res.status(500).send("Not able to fetch org."); return; } + trackSettingWizard(providerData.orgId); if (orgs.length > 0) { var dommyProvider = { _id: provider._id, @@ -1248,6 +1251,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { res.status(500).send("Not able to fetch org."); return; } + trackSettingWizard(providerData.orgId); if (orgs.length > 0) { var dommyProvider = { _id: provider._id, @@ -1741,6 +1745,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { res.status(500).send("Not able to fetch org."); return; } + trackSettingWizard(providerData.orgId); if (orgs.length > 0) { var dommyProvider = { _id: provider._id, @@ -2162,6 +2167,9 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { var orgId = req.body.orgId; var s3BucketName=req.body.s3BucketName; var plannedCost=req.body.plannedCost; + if(plannedCost === null || plannedCost ===''){ + plannedCost=0.0; + } var isDefault = (req.body.isDefault === 'true') ? true : false; var hasDefaultProvider = false; @@ -2288,6 +2296,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { res.status(500).send("Not able to fetch org."); return; } + trackSettingWizard(providerData.orgId); if (orgs.length > 0) { if (keyPair) { var dommyProvider = { @@ -2457,6 +2466,9 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { var orgId = req.body.orgId; var s3BucketName = req.body.s3BucketName; var plannedCost = req.body.plannedCost; + if(plannedCost === null || plannedCost ===''){ + plannedCost=0.0; + } if (typeof providerId === 'undefined' || providerId.length === 0) { res.status(400).send("{Please Enter ProviderId.}"); return; @@ -3516,4 +3528,21 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { makeRequest(req.body.accessKey, req.body.secretKey); } }); +} + +function trackSettingWizard(orgId){ + settingWizard.getSettingWizardByOrgId(orgId,function(err,settingWizards){ + if(err){ + logger.error('Hit getting setting wizard error', err); + return; + } + settingWizards.currentStep.nestedSteps[0].isCompleted =true; + settingWizard.updateSettingWizard(settingWizards,function(err,data){ + if(err){ + logger.error('Hit getting setting wizard error', err); + return; + } + return; + }); + }) } \ No newline at end of file diff --git a/server/app/routes/v1.0/routes_setting_wizard.js b/server/app/routes/v1.0/routes_setting_wizard.js new file mode 100644 index 000000000..f0478ae73 --- /dev/null +++ b/server/app/routes/v1.0/routes_setting_wizard.js @@ -0,0 +1,35 @@ +/* + Copyright [2016] [Relevance Lab] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + + +var logger = require('_pr/logger')(module); +var settingWizard = require('_pr/model/setting-wizard'); + + +module.exports.setRoutes = function(app, sessionVerificationFunc) { + app.all('/setting-wizard/*', sessionVerificationFunc); + + app.get('/setting-wizard/org/:orgId', function(req, res) { + settingWizard.getSettingWizardByOrgId(req.params.orgId, function(err, settingWizard) { + if (err) { + res.status(500).send(errorResponses.db.error); + return; + } + res.status(200).send(settingWizard); + return; + }); + }); +}; \ No newline at end of file diff --git a/server/app/routes/v1.0/routes_vmImages.js b/server/app/routes/v1.0/routes_vmImages.js index 046733e61..c486fd910 100755 --- a/server/app/routes/v1.0/routes_vmImages.js +++ b/server/app/routes/v1.0/routes_vmImages.js @@ -30,6 +30,7 @@ var usersDao = require('_pr/model/users.js'); var configmgmtDao = require('_pr/model/d4dmasters/configmgmt.js'); var Cryptography = require('_pr/lib/utils/cryptography'); var appConfig = require('_pr/config'); +var settingWizard = require('_pr/model/setting-wizard'); module.exports.setRoutes = function(app, sessionVerificationFunc) { app.all('/vmimages/*', sessionVerificationFunc); @@ -109,19 +110,18 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { }; usersDao.haspermission(user.cn, category, permissionto, null, req.session.user.permissionset, function(err, data) { - if (!err) { + if(!err) { logger.debug('Returned from haspermission : ' + data + ' : ' + (data == false)); if (data == false) { logger.debug('No permission to ' + permissionto + ' on ' + category); res.send(401, "You don't have permission to perform this operation."); return; } - } else { + }else { logger.error("Hit and error in haspermission:", err); res.send(500); return; } - masterUtil.getLoggedInUser(user.cn, function(err, anUser) { if (err) { res.status(500).send("Failed to fetch User."); @@ -216,9 +216,30 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { res.status(500).send("Selected is already registered."); return; } - logger.debug("Exit post() for /vmimages"); - res.send(anImage); - return; + logger.debug("orgId>>>",orgId); + settingWizard.getSettingWizardByOrgId(orgId,function(err,settingWizards){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + var settingWizardSteps = appConfig.settingWizardSteps; + settingWizards.currentStep.nestedSteps[1].isCompleted =true; + settingWizards.currentStep.isCompleted =true; + settingWizards.previousStep = settingWizards.currentStep; + settingWizards.currentStep =settingWizards.nextStep; + settingWizards.nextStep =settingWizardSteps[5]; + settingWizard.updateSettingWizard(settingWizards,function(err,data){ + if(err){ + logger.error('Hit getting setting wizard error', err); + res.send(500); + return; + } + logger.debug("Exit post() for /vmimages"); + res.send(anImage); + return; + }); + }) }); } else { res.status(500).send("The image is empty for amid: " + vmimageData.imageIdentifier); @@ -658,4 +679,4 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { logger.debug("Enter /vmimages/regions/list"); res.send(appConfig.aws.operatingSystems); }); -} +} \ No newline at end of file diff --git a/server/install.js b/server/install.js index 370278b28..fa2f96c1f 100755 --- a/server/install.js +++ b/server/install.js @@ -67,6 +67,15 @@ function getDefaultsConfig() { return config.catalystHome + this.cookbooksDirName + "/"; } }, + settingWizardSteps:[{name :'Introduction',isCompleted:true}, + {name :'Org Configuration',isCompleted:false,nestedSteps:[{name:'Organization',isCompleted:false}, + {name :'BusinessGroup',isCompleted:false},{name:'Project',isCompleted:false}]}, + {name :'Config Management',isCompleted:false,nestedSteps:[{name:'ChefServer',isCompleted:false},{name:'Environment',isCompleted:false}]}, + {name :'Provider Configuration',isCompleted:false,nestedSteps:[{name:'Provider',isCompleted:false},{name:'VMImage',isCompleted:false}]}, + {name :'Devops Roles',isCompleted:false,nestedSteps:[{name:'Nexus',isCompleted:false},{name:'Docker',isCompleted:false},{name:'Jenkins',isCompleted:false},{name:'Templates',isCompleted:false}]}, + {name :'Track',isCompleted:false}, + {name :'CMDB Configuration',isCompleted:false} + ], constantData: { common_field: ['envId', 'providerId', 'orgId', 'bgId','organizationId','businessGroupId', 'projectId','templateType','blueprintConfig.cloudProviderType','cloudProviderType'], sort_field: ['name', 'description'],