diff --git a/client/cat3/main.html b/client/cat3/main.html index 476a55985..74fa09a2d 100644 --- a/client/cat3/main.html +++ b/client/cat3/main.html @@ -105,6 +105,8 @@ + + diff --git a/client/cat3/src/clientRoutes.js b/client/cat3/src/clientRoutes.js index d9a6198b2..527ec017d 100644 --- a/client/cat3/src/clientRoutes.js +++ b/client/cat3/src/clientRoutes.js @@ -56,7 +56,7 @@ function routeConfig($stateProvider, $urlRouterProvider, $httpProvider, modulePe }).state('dashboard.design', { url: "/design", templateUrl: "src/partials/sections/dashboard/design/design.html", - controller: "designCtrl", + controller: "designCtrl as desCtrl", resolve: { auth: ["$q", function ($q) { var deferred = $q.defer(); diff --git a/client/cat3/src/main.js b/client/cat3/src/main.js index d1ee21288..429978e2e 100644 --- a/client/cat3/src/main.js +++ b/client/cat3/src/main.js @@ -30,9 +30,15 @@ var angularApp = angular.module('catapp', ['ui.router','ngTouch','toastr', 'global.messages' ]); -angularApp.run(['$rootScope', 'auth', '$state', '$stateParams', - function ($rootScope, Auth, $state, $stateParams) { +angularApp.run(['$rootScope', 'auth', '$state', '$stateParams','$http','$window', + function ($rootScope, Auth, $state, $stateParams,$http,$window) { 'use strict'; + $http.get('/organizations/getTreeNew').success(function (result) { + // if(result.data && result.data.length >0){ + // console.log(result); + // $window.location.href="/private/index.html#ajax/Settings/Dashboard.html"; + // } + }); $rootScope.$on('$stateChangeStart', function (event, toState) { //More function params: function (event, toState, toParams, fromState, fromParams) function checkAuthentication() { @@ -113,4 +119,4 @@ angularApp.controller('HeadNavigatorCtrl', ['$scope', '$rootScope', '$http', '$l $rootScope.$on('USER_LOGOUT', function () { $scope.doLogout(); }); -}]); \ No newline at end of file +}]); diff --git a/client/cat3/src/partials/global.scss b/client/cat3/src/partials/global.scss index 0cdca8e50..f1f8bcfb2 100644 --- a/client/cat3/src/partials/global.scss +++ b/client/cat3/src/partials/global.scss @@ -110,8 +110,10 @@ $imagePath : "../../../../../../cat3/images"; position: fixed; width: 254px; z-index: 10; + height: 100% !important; transition: all .4s ease 0s; left: -254px; + font-size: 12px !important; height: 100%; &.show-left-tree { @@ -122,7 +124,7 @@ $imagePath : "../../../../../../cat3/images"; background: linear-gradient(to right, #2c3638 99%, #2c3638 100%); color: #fff; overflow-y: auto; - height: 100%; + height: 100% !important; } div[data-angular-treeview] { diff --git a/client/cat3/src/partials/sections/dashboard/analytics/analytics.html b/client/cat3/src/partials/sections/dashboard/analytics/analytics.html index 385f6cdc9..d9e4627d7 100644 --- a/client/cat3/src/partials/sections/dashboard/analytics/analytics.html +++ b/client/cat3/src/partials/sections/dashboard/analytics/analytics.html @@ -117,10 +117,10 @@
- - - - + + + +
diff --git a/client/cat3/src/partials/sections/dashboard/analytics/analytics.js b/client/cat3/src/partials/sections/dashboard/analytics/analytics.js index ea1db5e30..92af46e0b 100644 --- a/client/cat3/src/partials/sections/dashboard/analytics/analytics.js +++ b/client/cat3/src/partials/sections/dashboard/analytics/analytics.js @@ -24,8 +24,8 @@ }).state('dashboard.analytics.capacity', { url: "capacity/", templateUrl: "src/partials/sections/dashboard/analytics/view/capacity.html", - controller: "capacityCtrl as capacity", - params:{filterView:{capacity:true}}, + controller: "capacityCtrl as capaCtr", + params:{filterView:{cost:true,viewBy:true,splitUpType:true,org:true}}, resolve: { auth: ["$q", function ($q) { var deferred = $q.defer(); diff --git a/client/cat3/src/partials/sections/dashboard/analytics/controller/capacityCtrl.js b/client/cat3/src/partials/sections/dashboard/analytics/controller/capacityCtrl.js index db0734e82..1d6737cff 100644 --- a/client/cat3/src/partials/sections/dashboard/analytics/controller/capacityCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/analytics/controller/capacityCtrl.js @@ -1,196 +1,302 @@ (function (angular) { "use strict"; angular.module('dashboard.analytics') - .controller('capacityCtrl', ['$scope', '$rootScope', '$state','analyticsServices', 'genericServices', function ($scope,$rootScope,$state,analyticsServices,genSevs){ - $rootScope.stateItems = $state.params; - $rootScope.organNewEnt=[]; - $rootScope.organNewEnt.org = '0'; - $rootScope.organNewEnt.buss='0'; - $rootScope.organNewEnt.proj='0'; - var capacityObj =this; - capacityObj.pieChat={ - option:{ - chart: { - type: 'pieChart', - margin: { - top: 20, - right: 0, - bottom: 60, - left:0 - }, - height:300, - x: function(d){return d.key;}, - y: function(d){return d.y;}, - showLabels: false, - showValues: true, - labelThreshold: 0.01, - labelSunbeamLayout: true, - legend: { + .controller('capacityCtrl', ['$scope', '$rootScope', '$state','analyticsServices', 'genericServices','$timeout', function ($scope,$rootScope,$state,analyticsServices,genSevs,$timeout){ + $rootScope.stateItems = $state.params; + //analyticsServices.initFilter(); + var capaCtr =this; + capaCtr.chartData=[]; + capaCtr.splitUp=null; + capaCtr.pieChat={ + option:{}, + totalCoust:'', + data: [] + }; + capaCtr.barChat={ + option:{}, + data: [] + }; + capaCtr.capaGridOptions={ + columnDefs:[], + data:[] + }; + capaCtr.createChart = function() { + capaCtr.pieChat = { + option: { + chart: { + type: 'pieChart', + margin: { + top: 20, + right: 0, + bottom: 60, + left: 0 + }, + height: 300, + x: function (d) { + return d.key; + }, + y: function (d) { + return d.value; + }, + showLabels: false, + labelType: "value", + labelThreshold: 0.01, + labelSunbeamLayout: true, + legend: {} + } + }, + totalCoust: '', + data: [] + }; + capaCtr.barChat = { + option: { + chart: { + type: 'multiBarChart', + height: 300, + margin: { + top: 20, + right: 20, + bottom: 60, + left: 60 + }, + duration:1000, + stacked: true, + x: function (d) { + return d.label; + }, + y: function (d) { + return d.value; + }, + showControls: true, + showValues: true, + xAxis: { + axisLabel: 'Aggregate', + showMaxMin: false, + staggerLabels:false + }, + yAxis: { + axisLabel: 'Cost in $', + tickFormat: function (d) { + return d3.format(',.2f')(d); + } + } } + }, + data: [] + + }; + + capaCtr.capaGridOptions = { + enableGridMenu: true, + enableSelectAll: true, + exporterMenuPdf: false, + exporterCsvFilename: 'costFile.csv', + exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), + onRegisterApi: function (gridApi) { + $scope.gridApi = gridApi; } - }, - totalCoust:'', - data:[] + }; + }; + capaCtr.getCapacityData=function(fltObj){ + var param = { + // url: 'src/partials/sections/dashboard/analytics/data/cost.json?org' + url:'' + }; + if(fltObj && fltObj.org){ + var entityId=null; + if(fltObj.provider){ + entityId=fltObj.provider.id; + } else { + entityId=fltObj.org.id; + } + //param.url='http://d4d.rlcatalyst.com/analytics/cost/aggregate?parentEntityId=46d1da9a-d927-41dc-8e9e-7e926d927537&entityId=57f49acdbc45e71f11491f8c&toTimeStamp=Wed%20Oct%2005%202016%2016:03:08%20GMT+0530%20(IST)&period=month'; + param.url='/analytics/capacity?parentEntityId='+fltObj.org.id+'&entityId='+entityId+'&toTimeStamp='+new Date()+'&period='+fltObj.period; + } - capacityObj.barChat ={ - option: { + genSevs.promiseGet(param).then(function (result) { + capaCtr.chartData=result; + $rootScope.splitUpCapacity=[]; + if(result.splitUpCapacity) { + angular.forEach(result.splitUpCapacity, function (val, key) { + var a=key.replace(/([A-Z])/g, ' $1').replace(/^./, function(str) { + return str.toUpperCase(); + }); + $rootScope.splitUpCapacity.push({id:key,val:a}); + }); + if( $rootScope.splitUpCapacity && $rootScope.splitUpCapacity.length >0) { + $scope.$emit('CHANGE_splitUp', $rootScope.splitUpCapacity[0].id); + capaCtr.splitUp = $rootScope.splitUpCapacity[0].val; + capaCtr.createLable(result, $rootScope.splitUpCapacity[0].id); + } + } else { + capaCtr.createLable(result,'provider'); + } + }); + }; + capaCtr.createLable= function(result,viewType){ + capaCtr.createChart(); + if(result && result.capacity) { + capaCtr.capaGridOptions.data = []; + capaCtr.capaGridOptions.columnDefs = [ + {name: 'name', field: 'name'}, + {name: 'totalCapacity', field: 'capacity.totalCapacity'} + ]; + capaCtr.pieChat.totalCoust = result.capacity.totalCapacity; + capaCtr.pieChat.data = []; + capaCtr.barChat.data = []; + // create bar + //if(viewType === 'ProviderView'){ + capaCtr.capaGridOptions.data = result.splitUpCapacity[viewType]; + angular.forEach(result.splitUpCapacity[viewType], function (value) { + capaCtr.pieChat.data.push({ + key: value.name, + value: value.capacity.totalCapacity + }); + }); + if(result.capacity && result.capacity.AWS && result.capacity.AWS.services) { + capaCtr.serviceCapacity = result.capacity.AWS.services; + angular.forEach(result.capacity.AWS.services, function (valueChild, keyChild) { + var va = []; + capaCtr.capaGridOptions.columnDefs.push({ + name: keyChild, + field: 'capacity.AWS.services.' + keyChild + }) + angular.forEach(result.splitUpCapacity[viewType], function (valBar) { + var chVal = ''; + if (valBar.capacity.AWS.services[keyChild]) { + chVal = valBar.capacity.AWS.services[keyChild]; + } else { + chVal = 0; + } + va.push( + { + "label": valBar.name, + "value": chVal + } + ); + }); + capaCtr.barChat.data.push({ + "key": keyChild, + "values": va + }); + }); + } + } + }; + capaCtr.trendsChart=function(fltObj){ + capaCtr.trendLineChart={}; + capaCtr.trendLineChart.options = { chart: { - type: 'multiBarHorizontalChart', - height: 300, + //type: 'stackedAreaChart', + type: 'lineChart', + height: 350, margin: { top: 20, right: 20, - bottom: 60, - left: 40 + bottom: 40, + left: 60 }, - duration: 50, x: function (d) { - return d.label; + return d[0]; }, y: function (d) { - return d.value; + return d[1]; }, - showControls: false, - showValues: true, + useVoronoi: false, + clipEdge: true, + duration: 1000, + useInteractiveGuideline: true, xAxis: { - showMaxMin: false + showMaxMin: false, + axisLabel: 'Date', + tickFormat: function (d) { + return d3.time.format('%x')(new Date(d)) + } }, yAxis: { - axisLabel: 'Values', + axisLabel: 'capacity in $', tickFormat: function (d) { return d3.format(',.2f')(d); } - } - } - }, - data: - [ - { - "key": "EC2", - "color": "#58AAE2", - "values": [] }, - { - "key": "RDS", - "color": "#EF892F", - "values": [] - }, - { - "key": "S3", - "color": "#8CAEDA", - "values": [] + zoom: { + enabled: true, + scaleExtent: [1, 10], + useFixedDomain: false, + useNiceScale: false, + horizontalOff: true, + verticalOff: true, + unzoomEventType: 'dblclick.zoom' } - ] - - }; + } + }; + capaCtr.trendLineChart.data = []; + var param = { + url: '' + }; - capacityObj.capacityGridOptions = { - columnDefs: [ - { name:'name',field: 'name' }, - { name:'totalCost',field: 'cost.totalCost'}, - { name:'EC2',field:'cost.awsCosts.serviceCosts.ec2'}, - { name:'RDS',field:'cost.awsCosts.serviceCosts.rds'}, - { name:'S3',field:'cost.awsCosts.serviceCosts.s3'} - ], - enableGridMenu: true, - enableSelectAll: true, - exporterMenuPdf: false, - exporterCsvFilename: 'costFile.csv', - exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")), - onRegisterApi: function(gridApi){ - $scope.gridApi = gridApi; + if(fltObj && fltObj.org){ + var entityId=null; + if(fltObj.provider){ + entityId=fltObj.provider.id; + } else { + entityId=fltObj.org.id; + } + //http://192.168.152.139:3001 + // param.url='/analytics/capacity/trend?parentEntityId='+fltObj.org.id+'&entityId='+fltObj.org.id+'&toTimeStamp='+new Date()+'&period='+fltObj.period+'&interval=86400' } - }; - var param={ - url:'src/partials/sections/dashboard/analytics/data/cost.json' + genSevs.promiseGet(param).then(function (result) { + if(result.capacityTrends && result.capacityTrends.length) { + capaCtr.trendLineChart.totalCapacity = result.capacity.totalCapacity; + capaCtr.trendLineChart.data = []; + angular.forEach(result.capacity.AWS.services, function (valueChild, keyChild) { + var va = []; + angular.forEach(result.capacityTrends, function (value) { + var chVal=''; + if(value.capacity.AWS.services[keyChild]){ + chVal=value.capacity.AWS.services[keyChild]; + } else { + chVal=0; + } + va.push([value.fromTime,chVal]); + }); + capaCtr.trendLineChart.data.push({ + "key": keyChild, + "values": va + }); + }); + capaCtr.trendLineChart.data[0].values.push([]); + } + }); }; - genSevs.promiseGet(param).then(function(result){ - capacityObj.capacityGridOptions.data = result.splitUpCosts.businessUnits; - capacityObj.pieChat.totalCoust= result.cost.totalCost; - angular.forEach(result.splitUpCosts.businessUnits,function (value) { - capacityObj.pieChat.data.push( { - key: value.name, - y:value.cost.totalCost - }); - capacityObj.barChat.data[0].values.push( { - "label" :value.name , - "value" : value.cost.awsCosts.serviceCosts.ec2 - }); - capacityObj.barChat.data[1].values.push( { - "label" :value.name , - "value" : value.cost.awsCosts.serviceCosts.rds + $scope.$on('CHANGE_VIEW', function (event, data) { + if (data) { + capaCtr.splitUp = data.replace(/([A-Z])/g, ' $1').replace(/^./, function (str) { + return str.toUpperCase(); }); - capacityObj.barChat.data[2].values.push( { - "label" :value.name , - "value" : value.cost.awsCosts.serviceCosts.s3 - }); - }); - // angular.forEach(result.splitUpCosts.providers,function (valu) { - // capacityObj.pieChat.data.push( { - // key: valu.name, - // y:valu.cost.totalCost - // }); - // }); + capaCtr.createLable(capaCtr.chartData, data); + } }); - - - - - $scope.optionsLine= { - chart: { - type: 'cumulativeLineChart', - height:250, - margin : { - top: 20, - right: 20, - bottom: 60, - left: 65 - }, - x: function(d){ return d[0]; }, - y: function(d){ return d[1]/10; }, - color: d3.scale.category10().range(), - duration: 300, - useInteractiveGuideline: true, - clipVoronoi: false, - - xAxis: { - axisLabel: 'X Axis', - tickFormat: function(d) { - return d3.time.format('%Y/%m/%d')(new Date(d)) - }, - showMaxMin: false, - staggerLabels: true - }, - - yAxis: { - axisLabel: 'Y Axis', - tickFormat: function(d){ - return d3.format(',.2f')(d); - }, - axisLabelDistance: 20 + $rootScope.applyFilter =function(filterApp,period){ + analyticsServices.applyFilter(filterApp,period); + if($state.current.name === "dashboard.analytics.capacity") { + capaCtr.getCapacityData($rootScope.filterNewEnt); } - } - }; - - $scope.dataLine = [ { - key: "EC2", - values: [ [ 1083297600000 , 30] , [ 1085976000000 , 50] , [ 1088568000000 , 20] ] - - }, - { - key: "RDS", - values: [ [ 1083297600000 , 20] , [ 1085976000000 ,20] , [ 1088568000000 , 60]] - - }, - - - { - key: "S3", - values: [ [ 1083297600000 , 10] , [ 1085976000000 , 50],[ 1088568000000 , 40]] - }]; + }; + capaCtr.init =function(){ + analyticsServices.initFilter(); + capaCtr.createChart(); + $timeout(function () { + $rootScope.applyFilter(true,'month'); + capaCtr.trendsChart($rootScope.filterNewEnt); + var treeNames = ['Analytics','capacity']; + $rootScope.$emit('treeNameUpdate', treeNames); + },500); + }; + capaCtr.init(); - }]); + }]); })(angular); diff --git a/client/cat3/src/partials/sections/dashboard/analytics/controller/usageCtrl.js b/client/cat3/src/partials/sections/dashboard/analytics/controller/usageCtrl.js index ab09f30e4..ea9e7332d 100644 --- a/client/cat3/src/partials/sections/dashboard/analytics/controller/usageCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/analytics/controller/usageCtrl.js @@ -80,11 +80,12 @@ angular.forEach(fltObj.resources, function (resId) { var param = { url: '/analytics/trend/usage?resource='+resId+'&fromTimeStamp='+$yesterday+'&toTimeStamp='+ $today+'&interval=3600' + //url:'src/partials/sections/dashboard/analytics/data/usage.json' }; genSevs.promiseGet(param).then(function (result) { // angular.forEach(result[usage.splitUp], function (valu, keyChild) { var va = []; - if(result && result.length >0) { + if(result) { usage.costGridOptions.columnDefs=[ {name: 'name', field: 'name'}, {name: 'fromTime', field: 'fromTime'}, diff --git a/client/cat3/src/partials/sections/dashboard/analytics/view/capacity.html b/client/cat3/src/partials/sections/dashboard/analytics/view/capacity.html index 0788db3bf..606e5300c 100644 --- a/client/cat3/src/partials/sections/dashboard/analytics/view/capacity.html +++ b/client/cat3/src/partials/sections/dashboard/analytics/view/capacity.html @@ -1,40 +1,56 @@ -
+

-
-
-
-
-

Aggregate capacity

-
- Total Cost - ${{capacity.pieChat.totalCoust}} -
-
-
-
-
-
-
-

Distribution of all services across BU's

-
- Total Cost - ${{capacity.pieChat.totalCoust}} -
-
-
-
-
-
-
-

Daily trends of usage across BU's

- - - -
-
-
-
-
-
+
+
+ Total capaCtr: ${{capaCtr.pieChat.totalCoust}}           + Services Capacity + {{value}} : ${{key}} + +
+
+
+ Segregated by + +
+
+
+
+
+
+
+
+
+
+

Aggregate Capacity

+
+
+
+
+
+
+

Distribution of all services across {{capaCtr.splitUp}}

+ +
+
+
+
+
+
+

Daily trends of cost across organization

+
+
+
+
+
+
-
+
+
+
+ No Data Available. +
+
+
\ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/design/controllers/appUrlCreateCtrl.js b/client/cat3/src/partials/sections/dashboard/design/controllers/appUrlCreateCtrl.js new file mode 100644 index 000000000..289f94e82 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/design/controllers/appUrlCreateCtrl.js @@ -0,0 +1,16 @@ +(function (angular) { + "use strict"; + angular.module('dashboard.design') + .controller('appUrlCreateCtrl',['$scope', '$modalInstance', function ($scope,$modalInstance) { + $scope.cancel = function() { + $modalInstance.dismiss('cancel'); + }; + $scope.ok=function(){ + $scope.appUrls = { + name: $scope.appUrlItem.name, + url: $scope.appUrlItem.url + }; + $modalInstance.close($scope.appUrls); + }; + }]); +})(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/design/controllers/blueprintCreateCtrl.js b/client/cat3/src/partials/sections/dashboard/design/controllers/blueprintCreateCtrl.js new file mode 100644 index 000000000..e49a69e57 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/design/controllers/blueprintCreateCtrl.js @@ -0,0 +1,509 @@ +(function (angular) { + "use strict"; + angular.module('dashboard.design') + .controller('blueprintCreateCtrl',['$scope','$modal','toastr','$state', 'blueprintCreateService','confirmbox', function ($scope,$modal,toastr,$state,bpCreateSer,confirmbox) { + var blueprintCreation = this; + //to get the templates listing. + if($state.params && $state.params.subItem && $state.params.templateObj){ + $scope.providerType = $state.params.subItem.toUpperCase(); + $scope.bpTypeName = $state.params.templateObj.templatetypename; + } + $scope.logo = 'images/global/cat-logo.png'; + $scope.osImageLogo = 'images/global/linux.png'; + $scope.isOSImage = false; + $scope.imageList = []; + //on initial load. + $scope.nextEnabled = false; + $scope.previousEnabled = false; + $scope.isNextVisible = true; + $scope.isSubmitVisible = false; + /*Open only One Accordian-Group at a time*/ + $scope.oneAtATime = true; + /*Initialising First Accordian-group open on load*/ + $scope.isFirstOpen = true; + if( $scope.bpTypeName === 'Composite'){ + $scope.isNextVisible = false; + $scope.isSubmitComposite = true; + } + blueprintCreation.newEnt = []; + blueprintCreation.osListing = []; + blueprintCreation.providerListing = []; + blueprintCreation.imageListing = []; + blueprintCreation.regionListing = ''; + blueprintCreation.keyPairListing = ''; + blueprintCreation.vpcListing = []; + blueprintCreation.subnetListing = []; + blueprintCreation.securityGroupListing = []; + blueprintCreation.instanceType = []; + blueprintCreation.orgBUProjListing = []; + blueprintCreation.buProjListing = []; + blueprintCreation.projListing = []; + blueprintCreation.appUrlList = []; + blueprintCreation.getCFTDetails = []; + blueprintCreation.providerListingAzure = []; + blueprintCreation.regionListingAzure = []; + blueprintCreation.subnetListingAzure = []; + blueprintCreation.dataStore = []; + + blueprintCreation.templateListing = function(){ + bpCreateSer.getTemplates().then(function(data){ + $scope.templateList = data; + }); + }; + + $scope.blueprintTemplateClick = function(templateDetail) { + templateDetail.selected = true; + $scope.nextEnabled = true; + $scope.templateSelected = templateDetail; + }; + + blueprintCreation.getImages = function(){ + bpCreateSer.getImages().then(function(data){ + //Note: The provider type should come in lowercase from the API. + var providerType = $scope.providerType.toLowerCase(); + for(var i=0;i ' + + '  ' + + '  ' + + '  '} + ]; + }); + } + }; + pbList.blueprintInfo = $scope.blueprintInfo =function($event,bpDetails,bpType){ + $event.stopPropagation(); + gencSers.moreInfo(bpDetails,bpType); + }; + pbList.launchInstance = $scope.launchInstance =function($event,pbId){ + $event.stopPropagation(); + bpServ.launchBp(pbId); + }; + pbList.selectCard = function (cardObj){ + pbList[cardObj._id] = !pbList[cardObj._id]; + if(pbList.selectedCards.indexOf(cardObj._id) === -1){ + pbList.selectedCards.push(cardObj._id); + } else { + pbList.selectedCards.splice(pbList.selectedCards.indexOf(cardObj._id),1); + } + + }; + pbList.copyBp = $scope.copyBp =function(ids){ + bpServ.copyBp(ids); + }; + pbList.deleteBp = $scope.deleteBp =function(ids){ + bpServ.deleteBp(ids); + }; + pbList.cloneBlueprint = $scope.cloneBlueprint =function($event,pbId){ + $event.stopPropagation(); + $rootScope.stateItems.current.params.blueId=pbId; + $state.go('dashboard.designSubView',{subItem:$state.params.subItem,view:'edit'}); + + }; + pbList.createList(); + }]).controller('bpLaunchInstanceCtrl',['$rootScope','$modalInstance',function ($rootScope,$modalInstance) { + var lanIns = this; + lanIns.newEnt=[]; + if($rootScope.organObject){ + lanIns.envOptions=$rootScope.organObject[$rootScope.organNewEnt.org].environments; + lanIns.newEnt.org =$rootScope.organObject[$rootScope.organNewEnt.org].name; + lanIns.newEnt.buss=$rootScope.organObject[$rootScope.organNewEnt.org].businessGroups[$rootScope.organNewEnt.buss].name; + lanIns.newEnt.proj=$rootScope.organObject[$rootScope.organNewEnt.org].businessGroups[$rootScope.organNewEnt.buss].projects[$rootScope.organNewEnt.proj].name; + } + lanIns.launch = function (){ + $modalInstance.close(lanIns.newEnt.env); + }; + }]).controller('bpCopyCtrl',['$rootScope','$modalInstance',function ($rootScope,$modalInstance) { + var bpCopy = this; + bpCopy.newEnt=[]; + bpCopy.newEnt.copyOrg='0'; + bpCopy.newEnt.copyBuss='0'; + bpCopy.newEnt.copyProj='0'; + bpCopy.cancel = function (){ + $modalInstance.dismiss('cancel'); + }; + bpCopy.copySelectedBlueprint = function (){ + $modalInstance.close(bpCopy.newEnt); + }; + }]); +})(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/design/controllers/createCompositeCtrl.js b/client/cat3/src/partials/sections/dashboard/design/controllers/createCompositeCtrl.js new file mode 100644 index 000000000..92345cd45 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/design/controllers/createCompositeCtrl.js @@ -0,0 +1,78 @@ +(function (angular) { + "use strict"; + angular.module('dashboard.design') + .controller('createCompositeCtrl',['$scope','$rootScope','$state','toastr','blueprintService','genericServices','designServices', function ($scope,$rootScope,$state,toastr,bpServ,gencSers,designServices) { + var createCBP = this; + createCBP.ExBlueprintList=[]; + createCBP.SelectedBPList=[]; + createCBP.selectBlueprintId=''; + createCBP.selectedBPDetails=''; + createCBP.compositeBPType='chef'; + createCBP.onSubmit =false; + createCBP.newEnt={ + bpName:'' + }; + createCBP.createList = function (){ + createCBP.ExBlueprintList=[]; + createCBP.SelectedBPList=[]; + var getResult = bpServ.createList(createCBP.compositeBPType); + if(getResult){ + getResult.then(function (result){ + createCBP.ExBlueprintList=result; + }); + } + }; + createCBP.addBP = function (indexArr){ + createCBP.SelectedBPList.push(createCBP.ExBlueprintList[indexArr]); + createCBP.ExBlueprintList.splice(indexArr,1); + }; + createCBP.deSelect =function ($event,indexArr){ + $event.stopPropagation(); + createCBP.ExBlueprintList.push(createCBP.SelectedBPList[indexArr]); + if(createCBP.SelectedBPList[indexArr]._id === createCBP.selectBlueprintId){ + createCBP.selectBlueprintId=''; + createCBP.selectedBPDetails=''; + } + createCBP.SelectedBPList.splice(indexArr,1); + + }; + createCBP.selectBpInfo =function ($event,bpDetails){ + $event.stopPropagation(); + gencSers.moreInfo(bpDetails,null); + }; + createCBP.editSelectBpInfo =function ($event,bpDetails){ + createCBP.selectBlueprintId=bpDetails._id; + createCBP.selectedBPDetails=bpDetails; + }; + createCBP.ord =function (){ + console.log(createCBP.selectedBpOrder); + }; + $rootScope.compositeSave =function (vali) { + createCBP.onSubmit =true; + if(!createCBP.newEnt.bpName || !createCBP.SelectedBPList.length > 0){ + return true; + } + if($rootScope.organObject){ + createCBP.newEnt.org =$rootScope.organObject[$rootScope.organNewEnt.org].rowid; + createCBP.newEnt.buss=$rootScope.organObject[$rootScope.organNewEnt.org].businessGroups[$rootScope.organNewEnt.buss].rowid; + createCBP.newEnt.proj=$rootScope.organObject[$rootScope.organNewEnt.org].businessGroups[$rootScope.organNewEnt.buss].projects[$rootScope.organNewEnt.proj].rowid; + } + var params = { + url: '/composite-blueprints/', + data:{ + "name": createCBP.newEnt.bpName, + "organizationId":createCBP.newEnt.org, + "businessGroupId": createCBP.newEnt.buss, + "projectId":createCBP.newEnt.proj, + "blueprints": createCBP.SelectedBPList, + "cloudProviderType": 'aws' + } + }; + designServices.promisePost(params).then(function () { + toastr.success('Successfully Created.'); + $state.go('dashboard.designSubView',{subItem:$state.params.subItem,view:'list'}); + }); + }; + createCBP.createList(); + }]); +})(angular); diff --git a/client/cat3/src/partials/sections/dashboard/design/data/providers.json b/client/cat3/src/partials/sections/dashboard/design/data/providers.json new file mode 100644 index 000000000..457f16c69 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/design/data/providers.json @@ -0,0 +1,30 @@ +[ + { + "name": "AWS", + "parent": "design", + "abstract": true, + "icon":"aws.png", + "filterArray":["arm"] + }, + { + "name": "AZURE", + "parent": "design", + "abstract": true, + "icon":"openstak.png", + "filterArray":["cft","composite"] + }, + { + "name": "OPENSTACK", + "parent": "design", + "abstract": true, + "icon":"azure-card.png", + "filterArray":["cft","arm","composite"] + }, + { + "name": "VMWARE", + "parent": "design", + "abstract": true, + "icon":"vmware-card.png", + "filterArray":["cft","arm","composite"] + } +] \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/design/design.html b/client/cat3/src/partials/sections/dashboard/design/design.html index 6103062cb..6e487d836 100644 --- a/client/cat3/src/partials/sections/dashboard/design/design.html +++ b/client/cat3/src/partials/sections/dashboard/design/design.html @@ -1,3 +1,71 @@ -
- {{Text}} +
+
+ + + +
+ +
+
+ + +
+
+ +
+
+
\ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/design/designCtrl.js b/client/cat3/src/partials/sections/dashboard/design/designCtrl.js index f945a8de4..0d04bee96 100644 --- a/client/cat3/src/partials/sections/dashboard/design/designCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/design/designCtrl.js @@ -1,7 +1,84 @@ (function (angular) { "use strict"; - angular.module('dashboard.design', []) - .controller('designCtrl',['$scope', function ($scope) { - $scope.Text = 'Design page'; + angular.module('dashboard.design', []).config(['$stateProvider', '$urlRouterProvider', '$httpProvider', 'modulePermissionProvider', function($stateProvider, $urlRouterProvider, $httpProvider, modulePermissionProvider) { + var modulePerms = modulePermissionProvider.$get(); + $stateProvider.state('dashboard.design.list', { + url: "/:provider/list", + templateUrl: "src/partials/sections/dashboard/design/view/designListView.html", + controller: "blueprintListCtrl as bpList", + params:{templateObj:null}, + resolve: { + auth: ["$q", function ($q) { + var deferred = $q.defer(); + // instead, go to a different page + if (modulePerms.analyticsBool()) { + // everything is fine, proceed + deferred.resolve(); + } else { + deferred.reject({redirectTo: 'dashboard'}); + } + return deferred.promise; + }] + } + }).state('dashboard.design.add', { + url: "/:provider/new", + templateUrl: "src/partials/sections/dashboard/design/view/blueprintCreate.html", + controller: "blueprintCreateCtrl as bpAdd", + params:{templateObj:null}, + resolve: { + auth: ["$q", function ($q) { + var deferred = $q.defer(); + // instead, go to a different page + if (modulePerms.analyticsBool()) { + // everything is fine, proceed + deferred.resolve(); + } else { + deferred.reject({redirectTo: 'dashboard'}); + } + return deferred.promise; + }] + } + }) + }]).filter('inArray',['$filter', function($filter){ + return function(list, arrayFilter, element){ + if(arrayFilter){ + return $filter("filter")(list, function(listItem){ + return arrayFilter.indexOf(listItem[element]) === -1; + }); + } + }; + }]) + .controller('designCtrl',['$scope','$state','genericServices', function ($scope,$state,genericServices) { + var design= this; + design.providersList= function () { + var params = { + url: 'src/partials/sections/dashboard/design/data/providers.json' + }; + genericServices.promiseGet(params).then(function (data){ + design.providersMenu=data; + design.tempType(data); + // $state.go('dashboard.designSubView',{subItem:data[0].name,view:'list'}); + }); + + }; + design.tempType=function (providers) { + var params = { + url: '/d4dMasters/readmasterjsonnew/16' + }; + genericServices.promiseGet(params).then(function (template){ + design.templateTypes=template; + + //var treeNames=['DESIGN', $state.params.subItem,template[0].templateName,'list']; + //$rootScope.$emit('treeNameUpdate', treeNames); + //$state.go('dashboard.designSubView',{subItem:providers[0].name,view:'list',templateObj:template[0]}); + + }); + // get organigetion + genericServices.getTreeNew().then(function (orgs) { + design.organObject=orgs; + }); + }; + design.providersList(); + return design; }]); })(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/design/services/blueprintCreateServices.js b/client/cat3/src/partials/sections/dashboard/design/services/blueprintCreateServices.js new file mode 100644 index 000000000..739ccca0f --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/design/services/blueprintCreateServices.js @@ -0,0 +1,267 @@ +(function (angular) { + "use strict"; + angular.module('design.bpCreate',[]) + .service('blueprintCreateService',['$rootScope','$http','$q','toastr', 'designServices', function ($rootScope,$http,$q,toastr,designServices) { + var blueprintServices = this; + //for getting the list of templates. + blueprintServices.getTemplates = function () { + var params = { + url: '/d4dMasters/readmasterjsonnew/17', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //services listed for aws blueprints save and update. + blueprintServices.getImages = function () { + var params = { + url: '/vmimages', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //list of operatig systems supported. + blueprintServices.getOperatingSytems = function () { + var params = { + url: '/aws/ec2/amiids', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down the aws providers. + blueprintServices.getAWSProviders = function () { + var params = { + url: '/aws/providers', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + /*getting the aws provider with respect to ID that can be used to list down the vmimage. + (gives region, key pair as well)*/ + blueprintServices.getAWSProviderWithId = function (providerId) { + var params = { + url: '/aws/providers/' + providerId, + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down the images created on the basis on aws providers. + blueprintServices.getImageLists = function (providerId) { + var params = { + url: '/vmimages/providers/' + providerId, + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down the images created on the basis on aws providers. + blueprintServices.getRegionLists = function () { + var params = { + url: '/vmimages/regions/list', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down the instance type based upon the image selected. + blueprintServices.getInstanceType = function () { + var params = { + url: '/vmimages/instancesizes/all/list', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down the vpcs for aws providers. + blueprintServices.postVpcs = function (providerId,region) { + var params = { + url: '/aws/providers/describe/vpcs', + inlineLoader:true, + data: { + "providerId": providerId, + "region": region + } + }; + return designServices.promisePost(params); + }; + //listing down the subnets based upon the VPC ID.(set the instance count to 10 from Ctrl) + blueprintServices.postSubnets = function (vpcId,providerId,region) { + var params = { + url: '/aws/providers/vpc/'+ vpcId +'/subnets', + inlineLoader:true, + data: { + "providerId": providerId, + "region": region + } + }; + return designServices.promisePost(params); + }; + //listing down the security groups based upon the VPC ID. + blueprintServices.postSecurityGroups = function (vpcId,providerId,region) { + var params = { + url: '/aws/providers/vpc/'+ vpcId +'/securitygroups', + inlineLoader:true, + data: { + "providerId": providerId, + "region": region + } + }; + return designServices.promisePost(params); + }; + //listing down the subnets based upon the VPC ID.(set the instance count to 10 from Ctrl) + blueprintServices.getOrgBuProj = function () { + var params = { + url: '/organizations/getTreeNew' + }; + return designServices.promiseGet(params); + }; + //listing down the nexus server details associated to a project(on enabling checkbox, get GroupId) + blueprintServices.getNexusServerList = function () { + var params = { + url: '/d4dMasters/readmasterjsonnew/26', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down the docker details associate to a project(on enabling checkbox) + blueprintServices.getDockerList = function () { + var params = { + url: '/d4dMasters/readmasterjsonnew/18', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down the repos for nexus and docker based upon project and projectId(RepoName & group) + blueprintServices.getRepoList = function (projectId) { + var params = { + url: '/d4dMasters/project/' + projectId, + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down the repo url related to the repository selected based upon nexusId + blueprintServices.getRepoUrl = function (nexusId) { + var params = { + url: '/nexus/'+ nexusId +'/repositories', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down the artifacts based upon nexusId,repo selected & the group. + blueprintServices.getArtifacts = function (nexusId, repoName, groupId) { + var params = { + url: '/nexus/' + nexusId + '/repositories/' + repoName + '/group/' + groupId + '/artifact', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down the versions based upon the nexuId, repo selected, group and artifact selected. + blueprintServices.getVersions = function (nexusId, repoName, groupId, artifactId) { + var params = { + url: '/nexus/' + nexusId + '/repositories/' + repoName + '/group/' + groupId + '/artifact/' + artifactId + '/versions', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //list down the chefServer. + blueprintServices.getChefServer = function () { + var params = { + url: '/d4dMasters/readmasterjsonnew/10', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //get the cft file details. + blueprintServices.getCFTParams = function (cftTemplateFileName) { + var params = { + url: '/d4dMasters/cftTemplate?templateFile=' + cftTemplateFileName, + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //save api for creating a blueprint + blueprintServices.postBlueprintSave = function (orgId,bgId,projectId,blueprintData) { + var params = { + url: '/organizations/' + orgId + '/businessgroups/' + bgId + '/projects/' + projectId + '/blueprints', + data: blueprintData + }; + return designServices.promisePost(params); + }; + + //services listed for azure blueprints save and update. + + //listing down the azure providers + blueprintServices.getAzureProviders = function() { + var params = { + url: '/azure/providers', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down azure locations + blueprintServices.getAzureLocations = function (azureProviderId) { + var params = { + //displayName + url: '/azure/' + azureProviderId + '/locations', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down the azure networks(VPC) + blueprintServices.getAzureVPC = function (azureProviderId) { + var params = { + url: '/azure/'+ azureProviderId +'/networks', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + + //services listed for openstack blueprints save and update. + //listing down openstack providers + blueprintServices.getOpenStackProviders = function() { + var params = { + url: '/openstack/providers', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down the openstack flavors related to provider + blueprintServices.getProviderFlavors = function(providerId) { + var params = { + url: '/openstack/' + providerId + '/flavors', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down the openstack networks related to provider + blueprintServices.getProviderNetwork = function(providerId) { + var params = { + url: '/openstack/' + providerId + '/networks', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down the security groups related to provider + blueprintServices.getProviderSecurityGroup = function(providerId) { + var params = { + url: '/openstack/' + providerId + '/securityGroups', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + + //services listed for vmware blueprints save and update. + //listing down vmware providers. + blueprintServices.getVmWareProviders = function() { + var params = { + url: '/vmware/providers', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + //listing down dataStore related to Provider. + blueprintServices.getProviderDataStore = function(providerId) { + var params = { + url: '/vmware/' + providerId + '/datastores', + inlineLoader:true + }; + return designServices.promiseGet(params); + }; + }]); +})(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/design/services/blueprintListServices.js b/client/cat3/src/partials/sections/dashboard/design/services/blueprintListServices.js new file mode 100644 index 000000000..3e484a3f4 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/design/services/blueprintListServices.js @@ -0,0 +1,108 @@ +(function (angular) { + "use strict"; + angular.module('design.BpList',[]) + .service('blueprintService',['$rootScope','$http','$q','toastr','$state','$modal','confirmbox','designServices',function ($rootScope,$http,$q,toastr,$state,$modal,confirmbox,designServices) { + var bpServ={}; + bpServ.createList = function(bpType){ + var organObjectId=[]; + ///organObjectId.envOptions=$rootScope.organObject[$rootScope.organNewEnt.org].environments; + if($rootScope.organObject){ + var tempType=(bpType) ? bpType :$state.params.templateObj.templatetype; + var pagination =(bpType) ? false :true; + organObjectId.org =$rootScope.organObject[$rootScope.organNewEnt.org].rowid; + organObjectId.buss=$rootScope.organObject[$rootScope.organNewEnt.org].businessGroups[$rootScope.organNewEnt.buss].rowid; + organObjectId.proj=$rootScope.organObject[$rootScope.organNewEnt.org].businessGroups[$rootScope.organNewEnt.buss].projects[$rootScope.organNewEnt.proj].rowid; + var params = { + url: '/organizations/'+organObjectId.org+'/businessgroups/'+organObjectId.buss+'/projects/'+organObjectId.proj+'/blueprintList?pagination='+pagination+'&templateType='+tempType+'&providerType='+angular.lowercase($state.params.subItem) + }; + return designServices.promiseGet(params); + } + }; + bpServ.launchBp = function (id) { + $modal.open({ + animate: true, + templateUrl: "src/partials/sections/dashboard/design/view/popups/blueprintLaunch.html", + controller: "bpLaunchInstanceCtrl as lanIns", + backdrop: 'static', + keyboard: false, + resolve: { + bpItem: function() { + return { + id:id, + organObject:$rootScope.organObject + }; + } + } + }).result.then(function(env) { + var params = { + url: '/blueprint-frames/', + data:{ + "blueprintId": id, + "environmentId": env + } + }; + designServices.promisePost(params).then(function () { + toastr.success('Successfully launched.'); + }); + }); + }; + bpServ.copyBp = function (ids) { + $modal.open({ + animate: true, + templateUrl: "src/partials/sections/dashboard/design/view/popups/blueprintCopy.html", + controller: "bpCopyCtrl as bpCopy", + backdrop: 'static', + keyboard: false, + resolve: { + bpItem: function() { + return { + ids:ids, + organObject:$rootScope.organObject + }; + } + } + }).result.then(function(orgDetails) { + var params = { + url: '/blueprints/copy/', + data:{ + "orgid": $rootScope.organObject[orgDetails.copyOrg].rowid, + "buid": $rootScope.organObject[orgDetails.copyOrg].businessGroups[orgDetails.copyBuss].rowid, + "projid": $rootScope.organObject[orgDetails.copyOrg].businessGroups[orgDetails.copyBuss].projects[orgDetails.copyProj].rowid, + "blueprints":ids + } + }; + designServices.promisePost(params).then(function () { + toastr.success('Successfully copied.'); + }); + }); + }; + bpServ.deleteBp = function (ids) { + var modalOptions = { + closeButtonText: 'Cancel', + actionButtonText: 'Delete', + actionButtonStyle: 'cat-btn-delete', + headerText: 'Delete Blueprint', + bodyText: 'Are you sure you would like to remove the selected blueprints ?' + }; + confirmbox.showModal({}, modalOptions).then(function() { + var bPIds=[]; + if(angular.isArray(ids)){ + bPIds=ids; + } else { + bPIds.push(ids); + } + var params = { + url: '/blueprints', + data:{blueprints:bPIds} + }; + return designServices.promiseDelete(params).then(function(){ + toastr.success('Successfully deleted'); + angular.each(ids,function (val) { + angular.element('#'+val).hide(); + }); + }); + }); + }; + return bpServ; + }]); +})(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/design/view/blueprintCreate.html b/client/cat3/src/partials/sections/dashboard/design/view/blueprintCreate.html new file mode 100644 index 000000000..d6eea0036 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/design/view/blueprintCreate.html @@ -0,0 +1,490 @@ +
+
+
+
+
+
+ +
+
+
+
+
+
    +
  • + templateLogo +
  • +
  • {{templateDetail.templatename}}
  • +
  • {{item}}
  • +
+
+
+
    +
  • + templateLogo +
  • +
  • {{templateDetail.name}}
  • +
+
+
+
+
+
    +
  • + templateLogo +
  • +
  • + OSImage +
  • +
  • {{templateSelected.templatename}}
  • +
  • {{templateSelected.name}}
  • +
  • {{item}}
  • +
+
+
+ + + + + Configure Provider Parameters + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
    +
  • +
+
+ +
+
+ + +
+
+ + +
+ +
+ + + + + Configure Organization Parameters + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ + Add + + + + + + + + + + + +
NameImage PathTagLaunch ParamsRe-Order
+
+ +
+ + + + + Configure Runlist Parameters + +
+ + + + +
+ + + + + + + + + + + +
View Runlist
{{item}}
+
+
+
+ + + + + + + Configure Application + + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ Application URL + + + + + + + + + + + + + + + + + + + +
+
+ + + + + Configure Stack Parameters + +
+ + +
+
+ + +
+
+ + +
+
+
+ + + + + Configure Resource : {{key}} + +
+ + +
+
+ + + +
+ + + + + + + +
View Runlist
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + +
+
diff --git a/client/cat3/src/partials/sections/dashboard/design/view/createComposite.html b/client/cat3/src/partials/sections/dashboard/design/view/createComposite.html new file mode 100644 index 000000000..214400814 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/design/view/createComposite.html @@ -0,0 +1,164 @@ + +
+
+
+ Composite Blueprint: +
+
+ +
+
+ + +
+
+ +
+ +
+ Please enter Composite Blueprint name! +
+
+
+
+
+
+
+
+
+
+
+ +
+
+ No Data Found! +
    +
  • + + + Zabix and Logstash  {{bp.name}} +
  • +
+
+
+
+
+
+
+
+
+ + Selected Blueprints   Please select blueprint. +
+
+
    +
  • + + + + {{(+createCBP.SelectedBPList.indexOf(selectedp)) +1}}Zabix and Logstash  {{selectedp.name}} +
  • +
+ +
+
+
+
+ +
+
+
+
+ + + +
+ + + + + Edit attribute of Composed Roles and Cookbooks + +
+
+ + +
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/design/view/designListView.html b/client/cat3/src/partials/sections/dashboard/design/view/designListView.html new file mode 100644 index 000000000..39301e1d7 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/design/view/designListView.html @@ -0,0 +1,75 @@ +
+
+
+ {{stateItems.params.templateObj.templatetypename}} blueprints +
+
+ + + + + +
+
+
+
+
No Data Found!
+
+
+
+
+
+
    +
  • {{blueprint.name}}
  • +
  • + +
  • +
    + + + +
+ +
+
+
+
+ +
+
+
+
+
+
+
    +
  • {{blueprint.name}}
  • + + + + + + +
    + + + +
+ +
+
+
+
+
+
+
+
+
+ +
diff --git a/client/cat3/src/partials/sections/dashboard/design/view/designSubMenu.html b/client/cat3/src/partials/sections/dashboard/design/view/designSubMenu.html new file mode 100644 index 000000000..e18d503eb --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/design/view/designSubMenu.html @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/design/view/filterSidebar.html b/client/cat3/src/partials/sections/dashboard/design/view/filterSidebar.html new file mode 100644 index 000000000..ae93a094e --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/design/view/filterSidebar.html @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/design/view/popups/blueprintCopy.html b/client/cat3/src/partials/sections/dashboard/design/view/popups/blueprintCopy.html new file mode 100644 index 000000000..23820ad36 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/design/view/popups/blueprintCopy.html @@ -0,0 +1,40 @@ + + + + diff --git a/client/cat3/src/partials/sections/dashboard/design/view/popups/blueprintLaunch.html b/client/cat3/src/partials/sections/dashboard/design/view/popups/blueprintLaunch.html new file mode 100644 index 000000000..cda51b860 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/design/view/popups/blueprintLaunch.html @@ -0,0 +1,40 @@ + + + + \ No newline at end of file diff --git a/server/app/model/blueprint/blueprint.js b/server/app/model/blueprint/blueprint.js index bb068a25f..ee9d2a26e 100755 --- a/server/app/model/blueprint/blueprint.js +++ b/server/app/model/blueprint/blueprint.js @@ -343,6 +343,7 @@ BlueprintSchema.methods.launch = function(opts, callback) { sessionUser: opts.sessionUser, users: self.users, blueprintData: self, + tagServer: opts.tagServer, }, function(err, launchData) { callback(err, launchData); }); @@ -366,6 +367,7 @@ BlueprintSchema.methods.launch = function(opts, callback) { sessionUser: opts.sessionUser, users: self.users, blueprintData: self, + tagServer: opts.tagServer, }, function(err, launchData) { callback(err, launchData); }); @@ -989,7 +991,21 @@ BlueprintSchema.statics.getBlueprintsServiceDeliveryCheck = function(serviceDeli callback(null, blueprints); return; }); +}; +BlueprintSchema.statics.removeServiceDeliveryBlueprints = function(blueprintId, callback) { + this.update({ "_id": new ObjectId(blueprintId)}, {serviceDeliveryCheck: false}, function (err, data) { + if (err) { + logger.error(err); + callback(err, null); + return; + } + if (data.length) { + callback(null, data[0]); + } else { + callback(null, null); + } + }); }; BlueprintSchema.statics.getBlueprintsByOrgBgProjectProvider = function(jsonData, callback) { diff --git a/server/app/model/classes/tasks/tasks.js b/server/app/model/classes/tasks/tasks.js index 85ded6e7b..d723b484f 100755 --- a/server/app/model/classes/tasks/tasks.js +++ b/server/app/model/classes/tasks/tasks.js @@ -580,6 +580,20 @@ taskSchema.statics.getTasksServiceDeliveryCheck = function(serviceDeliveryCheck, }); }; +taskSchema.statics.removeServiceDeliveryTask = function(taskId, callback) { + this.update({ "_id": new ObjectId(taskId)}, {serviceDeliveryCheck:false}, function (err, data) { + if (err) { + logger.error(err); + callback(err, null); + return; + } + if (data.length) { + callback(null, data[0]); + } else { + callback(null, null); + } + }); +}; taskSchema.statics.getTaskById = function(taskId, callback) { this.find({ diff --git a/server/app/model/monitors/monitors.js b/server/app/model/monitors/monitors.js index 3c23e2bdb..0214ed974 100644 --- a/server/app/model/monitors/monitors.js +++ b/server/app/model/monitors/monitors.js @@ -24,6 +24,11 @@ var MonitorsSchema = new Schema({ required: true, trim: true }, + name: { + type: String, + required: true, + trim: true + }, type: { type: String, trim: true, diff --git a/server/app/model/resource-costs/resource-costs.js b/server/app/model/resource-costs/resource-costs.js index 1d6151d7c..012c774f6 100644 --- a/server/app/model/resource-costs/resource-costs.js +++ b/server/app/model/resource-costs/resource-costs.js @@ -166,4 +166,4 @@ ResourceCostsSchema.statics.upsertResourceCost = function upsertResourceCost(res } var ResourceCosts = mongoose.model('ResourceCosts', ResourceCostsSchema) -module.exports = ResourceCosts \ No newline at end of file +module.exports = ResourceCosts diff --git a/server/app/routes/v1.0/routes_blueprints.js b/server/app/routes/v1.0/routes_blueprints.js index ef193cb6d..ce00c7a99 100755 --- a/server/app/routes/v1.0/routes_blueprints.js +++ b/server/app/routes/v1.0/routes_blueprints.js @@ -74,6 +74,20 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { }); }); + app.delete('/blueprints/serviceDelivery/:blueprintId', function(req, res) { + Blueprints.removeServiceDeliveryBlueprints(req.params.taskId, function(err, data) { + if (err) { + logger.error("Failed to delete ", err); + res.send(500, errorResponses.db.error); + return; + } + res.send(200, { + message: "deleted" + }); + }); + }); + + // This post() Not in use app.post('/blueprints', function(req, res) { logger.debug("Enter post() for /blueprints"); @@ -427,7 +441,8 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { ver: req.query.version, stackName: stackName, domainName:domainName, - sessionUser: req.session.user.cn + sessionUser: req.session.user.cn, + tagServer: req.query.tagServer }, function(err, launchData) { if (err) { res.status(500).send({ diff --git a/server/app/routes/v1.0/routes_instances.js b/server/app/routes/v1.0/routes_instances.js index 7de7c0b9e..d0f2452cc 100755 --- a/server/app/routes/v1.0/routes_instances.js +++ b/server/app/routes/v1.0/routes_instances.js @@ -220,6 +220,31 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { }); });*/ + // Instance list for tagging server + app.get('/instancesList', function(req, res, next) { + + var reqData = {}; + async.waterfall( + [ + function(next) { + apiUtil.paginationRequest(req.query, 'instances', next); + }, + function(paginationReq, next) { + reqData = paginationReq; + instancesDao.getInstanceList(paginationReq, next); + }, + function(instances, next) { + apiUtil.paginationResponse(instances, reqData, next); + } + ], + function(err, results) { + if (err) + next(err); + else + return res.status(200).send(results); + }); + }); + app.get('/instances', getInstanceList); function getInstanceList(req, res, next) { diff --git a/server/app/routes/v1.0/routes_monitors.js b/server/app/routes/v1.0/routes_monitors.js index 82c4eafe4..46f375bae 100644 --- a/server/app/routes/v1.0/routes_monitors.js +++ b/server/app/routes/v1.0/routes_monitors.js @@ -40,6 +40,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * @apiSuccess {String} organization.id Monitor organization id * @apiSuccess {String} organization.name Monitor organization name * @apiSuccess {String} type Monitor Server type + * @apiSuccess {String} name Monitor Server name * @apiSuccess {Object} parameters Monitor Server Parameters * @apiSuccess {String} parameters.url Monitor Server Url * @apiSuccess {String} parameters.transportProtocol Monitor Server Transport Protocols Name @@ -48,6 +49,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * HTTP/1.1 200 OK * {[ * "_id": "", + * "name": "someName", * "organization": { * "id": "", * "name": "Organization name" @@ -73,6 +75,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * HTTP/1.1 200 OK * {[ * "_id": "", + * "name": "someName", * "organization": { * "id": "", * "name": "Organization name" @@ -120,6 +123,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * @apiSuccess {String} organization.id Monitor organization id * @apiSuccess {String} organization.name Monitor organization name * @apiSuccess {String} type Monitor Server type + * @apiSuccess {String} name Monitor Server name * @apiSuccess {Object} parameters Monitor Server Parameters * @apiSuccess {String} parameters.url Monitor Server Url * @apiSuccess {String} parameters.transportProtocol Monitor Server Transport Protocols Name @@ -128,6 +132,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * HTTP/1.1 200 OK * { * "_id": "", + * "name": "someName", * "organization": { * "id": "", * "name": "Organization name" @@ -153,6 +158,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * HTTP/1.1 200 OK * { * "_id": "", + * "name": "someName", * "organization": { * "id": "", * "name": "Organization name" @@ -197,6 +203,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * @apiSuccess {Object} monitor monitor data * @apiSuccess {String} orgId Organization Id * @apiSuccess {String} type Monitor Server type + * @apiSuccess {String} name Monitor Server name * @apiSuccess {Object} parameters Monitor Server Parameters * @apiSuccess {String} parameters.url Monitor Server Url * @apiSuccess {String} parameters.transportProtocol Monitor Server Transport Protocols Name @@ -206,6 +213,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * { * "orgId": "46d1da9a-d927-41dc-8e9e-7e926d927535", * "type": "sensu", + * "name": "someName", * "parameters": { * "url": "Server Url", * "transportProtocol": "redis", @@ -221,6 +229,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * { * "orgId": "46d1da9a-d927-41dc-8e9e-7e926d927535", * "type": "sensu", + * "name": "someName", * "parameters": { * "url": "Server Url", * "transportProtocol": "rabbitmq", @@ -247,6 +256,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * "__v": 0, * "orgId": "46d1da9a-d927-41dc-8e9e-7e926d927535", * "type": "sensu", + * "name": "someName", * "parameters": { * "transportProtocolParameters": { * "password": "iEhK5+u/dBHRNbilkF7f7Q==", @@ -264,6 +274,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * "__v": 0, * "orgId": "46d1da9a-d927-41dc-8e9e-7e926d927535", * "type": "sensu", + * "name": "someName", * "parameters": { * "transportProtocolParameters": { * "ssl": { @@ -312,13 +323,14 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { /** - * @api {post} /monitors/:monitorId Update Monitor + * @api {put} /monitors/:monitorId Update Monitor * @apiName updateMonitor * @apiGroup monitors * * @apiSuccess {Object} monitor monitor data * @apiSuccess {String} orgId Organization Id * @apiSuccess {String} type Monitor Server type + * @apiSuccess {String} name Monitor Server name * @apiSuccess {Object} parameters Monitor Server Parameters * @apiSuccess {String} parameters.url Monitor Server Url * @apiSuccess {String} parameters.transportProtocol Monitor Server Transport Protocols Name @@ -328,6 +340,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * { * "orgId": "46d1da9a-d927-41dc-8e9e-7e926d927535", * "type": "sensu", + * "name": "someName", * "parameters": { * "url": "Server Url", * "transportProtocol": "redis", @@ -342,6 +355,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * { * "orgId": "46d1da9a-d927-41dc-8e9e-7e926d927535", * "type": "sensu", + * "name": "someName", * "parameters": { * "url": "Server Url", * "transportProtocol": "rabbitmq", @@ -368,6 +382,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * "__v": 0, * "orgId": "46d1da9a-d927-41dc-8e9e-7e926d927535", * "type": "sensu", + * "name": "someName", * "parameters": { * "transportProtocolParameters": { * "password": "iEhK5+u/dBHRNbilkF7f7Q==", @@ -384,6 +399,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { * { * "__v": 0, * "orgId": "46d1da9a-d927-41dc-8e9e-7e926d927535", + * "name": "someName", * "type": "sensu", * "parameters": { * "transportProtocolParameters": { diff --git a/server/app/routes/v1.0/routes_organizations.js b/server/app/routes/v1.0/routes_organizations.js index 9492bd8a5..ad51b8875 100755 --- a/server/app/routes/v1.0/routes_organizations.js +++ b/server/app/routes/v1.0/routes_organizations.js @@ -1741,7 +1741,7 @@ module.exports.setRoutes = function(app, sessionVerification) { instanceIP: req.body.fqdn, instanceState: nodeAlive, bootStrapStatus: 'waiting', - tagServer: req.body.tagServer, + tagServer: req.params.tagServer, runlist: [], appUrls: appUrls, users: [req.session.user.cn], //need to change this diff --git a/server/app/routes/v1.0/routes_tasks.js b/server/app/routes/v1.0/routes_tasks.js index ed43ab567..007316c17 100755 --- a/server/app/routes/v1.0/routes_tasks.js +++ b/server/app/routes/v1.0/routes_tasks.js @@ -56,6 +56,19 @@ module.exports.setRoutes = function(app, sessionVerification) { }); }); + app.delete('/tasks/serviceDelivery/:taskId', function(req, res) { + Tasks.removeServiceDeliveryTask(req.params.taskId, function(err, data) { + if (err) { + logger.error("Failed to delete service delivery Task", err); + res.send(500, errorResponses.db.error); + return; + } + res.send(200, { + message: "deleted" + }); + }); + }); + app.get('/tasks/history/list/all', function(req, res) { logger.debug("------------------ ",JSON.stringify(TaskHistory)); TaskHistory.listHistory(function(err, tHistories) { diff --git a/server/app/services/monitorsService.js b/server/app/services/monitorsService.js index b494aa17a..7200e95e2 100644 --- a/server/app/services/monitorsService.js +++ b/server/app/services/monitorsService.js @@ -44,6 +44,7 @@ monitorsService.formatResponse = function (monitor) { case 'sensu': case 'Sensu': formatted._id = monitor._id; + formatted.name = monitor.name; formatted.type = monitor.type; if (monitor.organization.length) { formatted.organization = { @@ -61,12 +62,35 @@ monitorsService.formatResponse = function (monitor) { }; -monitorsService.createMonitor = function (monitor, callback) { +monitorsService.createMonitor = function (monitorsObj, callback) { - switch (monitor.type) { + switch (monitorsObj.type) { case 'sensu': case 'Sensu': - monitorsModel.createNew(monitor, function (err, monitor) { + var saveobj = {}; + saveobj['orgId'] = monitorsObj['orgId']; + saveobj['type'] = monitorsObj['type']; + saveobj['name'] = monitorsObj['name']; + saveobj['parameters'] = { + + }; + saveobj['parameters']['url'] = monitorsObj['parameters']['url']; + saveobj['parameters']['transportProtocol'] = monitorsObj['parameters']['transportProtocol']; + saveobj['parameters']['transportProtocolParameters'] = {}; + saveobj['parameters']['transportProtocolParameters']['host'] = monitorsObj['parameters']['transportProtocolParameters']['host']; + saveobj['parameters']['transportProtocolParameters']['port'] = monitorsObj['parameters']['transportProtocolParameters']['port']; + saveobj['parameters']['transportProtocolParameters']['password'] = monitorsObj['parameters']['transportProtocolParameters']['password']; + if (monitorsObj['parameters']['transportProtocol'] === 'rabbitmq') { + saveobj['parameters']['transportProtocolParameters']['vhost'] = monitorsObj['parameters']['transportProtocolParameters']['vhost']; + saveobj['parameters']['transportProtocolParameters']['user'] = monitorsObj['parameters']['transportProtocolParameters']['user']; + saveobj['parameters']['transportProtocolParameters']['heartbeat'] = monitorsObj['parameters']['transportProtocolParameters']['heartbeat']; + saveobj['parameters']['transportProtocolParameters']['prefetch'] = monitorsObj['parameters']['transportProtocolParameters']['prefetch']; + if (monitorsObj['parameters']['transportProtocolParameters']['ssl']) { + saveobj['parameters']['transportProtocolParameters']['ssl']['certChainFileId'] = monitorsObj['parameters']['transportProtocolParameters']['ssl']['certChainFileId']; + saveobj['parameters']['transportProtocolParameters']['ssl']['privateKeyFileId'] = monitorsObj['parameters']['transportProtocolParameters']['ssl']['privateKeyFileId']; + } + } + monitorsModel.createNew(saveobj, function (err, monitor) { //@TODO To be generalized if (err && err.name === 'ValidationError') { var err = new Error('Bad Request'); @@ -90,10 +114,36 @@ monitorsService.createMonitor = function (monitor, callback) { }; -monitorsService.updateMonitor = function updateMonitor(monitorId, updateFields, callback) { - switch (updateFields.type) { +monitorsService.updateMonitor = function updateMonitor(monitorId, monitorsObj, callback) { + switch (monitorsObj.type) { case 'sensu': case 'Sensu': + var updateFields = {}; + updateFields['orgId'] = monitorsObj['orgId']; + updateFields['type'] = monitorsObj['type']; + updateFields['name'] = monitorsObj['name']; + updateFields['parameters.url'] = monitorsObj['parameters']['url']; + updateFields['parameters.transportProtocol'] = monitorsObj['parameters']['transportProtocol']; + updateFields['parameters.transportProtocolParameters.host'] = monitorsObj['parameters']['transportProtocolParameters']['host']; + updateFields['parameters.transportProtocolParameters.port'] = monitorsObj['parameters']['transportProtocolParameters']['port']; + if (monitorsObj['parameters']['transportProtocolParameters']['password']) { + updateFields['parameters.transportProtocolParameters.password'] = monitorsObj['parameters']['transportProtocolParameters']['password']; + } + if (monitorsObj['parameters']['transportProtocol'] === 'rabbitmq') { + updateFields['parameters.transportProtocolParameters.vhost'] = monitorsObj['parameters']['transportProtocolParameters']['vhost']; + updateFields['parameters.transportProtocolParameters.user'] = monitorsObj['parameters']['transportProtocolParameters']['user']; + updateFields['parameters.transportProtocolParameters.heartbeat'] = monitorsObj['parameters']['transportProtocolParameters']['heartbeat']; + updateFields['parameters.transportProtocolParameters.prefetch'] = monitorsObj['parameters']['transportProtocolParameters']['prefetch']; + if (monitorsObj['parameters']['transportProtocolParameters']['ssl']) { + if (monitorsObj['parameters']['transportProtocolParameters']['ssl']['certChainFileId']) { + updateFields['parameters.transportProtocolParameters.ssl.certChainFileId'] = monitorsObj['parameters']['transportProtocolParameters']['ssl']['certChainFileId']; + } + if (monitorsObj['parameters']['transportProtocolParameters']['ssl']['privateKeyFileId']) { + updateFields['parameters.transportProtocolParameters.ssl.privateKeyFileId'] = monitorsObj['parameters']['transportProtocolParameters']['ssl']['privateKeyFileId']; + } + + } + } monitorsModel.updateMonitors(monitorId, updateFields, function (err, monitor) { //@TODO To be generalized if (err && err.name === 'ValidationError') { diff --git a/server/app/validators/monitorsValidator.js b/server/app/validators/monitorsValidator.js index 86c159b91..88f46fe9c 100644 --- a/server/app/validators/monitorsValidator.js +++ b/server/app/validators/monitorsValidator.js @@ -21,6 +21,7 @@ var monitorsValidator = module.exports = {}; monitorsValidator.create = { body: { "orgId": Joi.string().max(40).required(), + "name": Joi.string().max(40).required(), "type": Joi.valid('sensu', 'other'), "parameters": Joi.object() .keys({ @@ -37,7 +38,7 @@ monitorsValidator.create = { "ssl": Joi.object().keys({ "certChainFileId": Joi.string().required(), "privateKeyFileId": Joi.string().required() - }), + }) }) .when('transportProtocol', { is: 'rabbitmq', @@ -55,6 +56,7 @@ monitorsValidator.create = { monitorsValidator.update = { body: { "orgId": Joi.string().max(40).required(), + "name": Joi.string().max(40).required(), "type": Joi.valid('sensu', 'other'), "parameters": Joi.object() .keys({ @@ -65,13 +67,13 @@ monitorsValidator.update = { "port": Joi.number().required(), "vhost": Joi.string(), "user": Joi.string(), - "password": Joi.string().required(), + "password": Joi.string(), "heartbeat": Joi.number(), "prefetch": Joi.number(), "ssl": Joi.object().keys({ - "certChainFileId": Joi.string().required(), - "privateKeyFileId": Joi.string().required() - }), + "certChainFileId": Joi.string(), + "privateKeyFileId": Joi.string() + }) }) .when('transportProtocol', { is: 'rabbitmq',