diff --git a/server/app/routes/v1.0/routes_d4dMasters.js b/server/app/routes/v1.0/routes_d4dMasters.js index 624450b06..d4562e615 100755 --- a/server/app/routes/v1.0/routes_d4dMasters.js +++ b/server/app/routes/v1.0/routes_d4dMasters.js @@ -2736,8 +2736,7 @@ module.exports.setRoutes = function (app, sessionVerification) { logger.error('Hit getting setting wizard error', err); res.send(500); return; - } - if (settingWizards.currentStep && settingWizards.currentStep.name === 'User Configuration') { + }else if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.name === 'User Configuration') { var settingWizardSteps = appConfig.settingWizardSteps; settingWizards.currentStep.nestedSteps[1].isCompleted = true; settingWizards.currentStep.isCompleted = true; @@ -2753,6 +2752,9 @@ module.exports.setRoutes = function (app, sessionVerification) { res.send(200); return; }); + }else { + res.send(200); + return; } }) } diff --git a/server/app/services/settingsService.js b/server/app/services/settingsService.js index 4eea8841f..e9f0c79fb 100644 --- a/server/app/services/settingsService.js +++ b/server/app/services/settingsService.js @@ -81,7 +81,10 @@ settingsService.updateProjectData = function updateProjectData(enviornment,callb }; settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callback){ - if(id === '1'){ + if(orgId === null || orgId === ''){ + callback(null,orgId); + return; + }else if(id === '1'){ settingWizard.removeSettingWizardByOrgId(orgId,function(err,data){ if(err){ callback(err,null); @@ -89,14 +92,14 @@ settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callba } callback(null,data); }) - }else if(id === '2'){ + }else if(id === '2'){ settingWizard.getSettingWizardByOrgId(orgId,function(err,settingWizards) { if (err) { callback(err, null); return; } logger.debug(JSON.stringify(settingWizards)); - if (settingWizards.currentStep && settingWizards.currentStep.nestedSteps + if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.nestedSteps && settingWizards.currentStep.name === 'Org Configuration' && settingWizards.currentStep.nestedSteps[1].isCompleted === true) { settingWizards.currentStep.nestedSteps[1].isCompleted = false; @@ -113,13 +116,13 @@ settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callba return; } }) - }else if(id === '4'){ + }else if(id === '4'){ settingWizard.getSettingWizardByOrgId(orgId,function(err,settingWizards) { if (err) { callback(err, null); return; } - if (settingWizards.currentStep && settingWizards.currentStep.nestedSteps + if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.nestedSteps && settingWizards.currentStep.name === 'Config Management' && settingWizards.currentStep.nestedSteps[0].isCompleted === false) { var settingWizardSteps = appConfig.settingWizardSteps; settingWizards.currentStep = settingWizards.previousStep; @@ -145,7 +148,7 @@ settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callba callback(err, null); return; } - if (settingWizards.currentStep && settingWizards.currentStep.nestedSteps + if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.nestedSteps && settingWizards.currentStep.name === 'Config Management' && settingWizards.currentStep.nestedSteps[1].isCompleted === false) { settingWizards.currentStep.nestedSteps[0].isCompleted = false; @@ -167,7 +170,7 @@ settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callba callback(err, null); return; } - if (settingWizards.currentStep && settingWizards.currentStep.nestedSteps + if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.nestedSteps && settingWizards.currentStep.name === 'User Configuration' && settingWizards.currentStep.nestedSteps[0].isCompleted === false) { var settingWizardSteps = appConfig.settingWizardSteps; @@ -199,7 +202,7 @@ settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callba callback(err, null); return; } - if (settingWizards.currentStep && settingWizards.currentStep.nestedSteps + if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.nestedSteps && settingWizards.currentStep.name === 'User Configuration' && settingWizards.currentStep.nestedSteps[1].isCompleted === false) { settingWizards.currentStep.nestedSteps[0].isCompleted = false; @@ -222,7 +225,7 @@ settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callba callback(err, null); return; } - if (settingWizards.currentStep && settingWizards.currentStep.nestedSteps + if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.nestedSteps && settingWizards.currentStep.name === 'Provider Configuration' && settingWizards.currentStep.nestedSteps[0].isCompleted === false) { var settingWizardSteps = appConfig.settingWizardSteps; @@ -253,7 +256,7 @@ settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callba callback(err, null); return; } - if (settingWizards.currentStep && settingWizards.currentStep.nestedSteps + if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.nestedSteps && settingWizards.currentStep.name === 'Devops Roles' && settingWizards.currentStep.nestedSteps[1].isCompleted === false) { settingWizards.currentStep.nestedSteps[0].isCompleted = false; @@ -275,7 +278,7 @@ settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callba callback(err, null); return; } - if (settingWizards.currentStep && settingWizards.currentStep.nestedSteps + if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.nestedSteps && settingWizards.currentStep.name === 'Devops Roles' && settingWizards.currentStep.nestedSteps[2].isCompleted === false) { settingWizards.currentStep.nestedSteps[1].isCompleted = false; @@ -297,7 +300,7 @@ settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callba callback(err, null); return; } - if (settingWizards.currentStep && settingWizards.currentStep.nestedSteps + if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.nestedSteps && settingWizards.currentStep.name === 'Wizard Status' && settingWizards.currentStep.isCompleted === true) { var settingWizardSteps = appConfig.settingWizardSteps; @@ -329,7 +332,7 @@ settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callba callback(err, null); return; } - if (settingWizards.currentStep && settingWizards.currentStep.nestedSteps + if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.nestedSteps && settingWizards.currentStep.name === 'Gallery Setup' && settingWizards.nestedSteps[1].isCompleted === false) { settingWizards.nestedSteps[0].isCompleted = false; @@ -351,7 +354,7 @@ settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callba callback(err, null); return; } - if (settingWizards.currentStep && settingWizards.currentStep.nestedSteps + if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.nestedSteps && settingWizards.currentStep.name === 'Gallery Setup' && settingWizards.nestedSteps[2].isCompleted === false) { settingWizards.nestedSteps[1].isCompleted = false; @@ -373,7 +376,7 @@ settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callba callback(err, null); return; } - if (settingWizards.currentStep && settingWizards.currentStep.nestedSteps + if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.nestedSteps && settingWizards.currentStep.name === 'Provider Configuration' && settingWizards.currentStep.nestedSteps[1].isCompleted === false) { settingWizards.currentStep.nestedSteps[0].isCompleted = false; @@ -395,7 +398,7 @@ settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callba callback(err, null); return; } - if (settingWizards.currentStep && settingWizards.currentStep.nestedSteps + if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.nestedSteps && settingWizards.currentStep.name === 'Gallery Setup' && settingWizards.currentStep.nestedSteps[0].isCompleted === false) { var settingWizardSteps = appConfig.settingWizardSteps; @@ -426,7 +429,7 @@ settingsService.trackSettingWizard = function trackSettingWizard(id,orgId,callba callback(err, null); return; } - if (settingWizards.currentStep && settingWizards.currentStep.nestedSteps + if (settingWizards !== null && settingWizards.currentStep && settingWizards.currentStep.nestedSteps && settingWizards.currentStep.name === 'Devops Roles' && settingWizards.currentStep.nestedSteps[0].isCompleted === false) { var settingWizardSteps = appConfig.settingWizardSteps; var previousStep = settingWizardSteps[4];