From bb92a100efef5f8a8f74fb4344a8113a2c35a347 Mon Sep 17 00:00:00 2001 From: Divakar Konakalla Date: Thu, 13 Oct 2016 16:19:51 +0530 Subject: [PATCH 01/32] Added usage icon for instannces which are not imported by ip, added graph to show usages for selected instance. --- client/cat3/main.html | 1 + .../dashboard/workzone/instance/instance.html | 49 ++++----- .../dashboard/workzone/instance/instance.scss | 13 +++ .../workzone/instance/instanceCtrl.js | 16 +++ .../instance/popups/instanceUsage.html | 36 +++++++ .../instance/popups/instanceUsageCtrl.js | 100 ++++++++++++++++++ .../dashboard/workzone/workzoneCtrl.js | 2 +- 7 files changed, 192 insertions(+), 25 deletions(-) create mode 100644 client/cat3/src/partials/sections/dashboard/workzone/instance/popups/instanceUsage.html create mode 100644 client/cat3/src/partials/sections/dashboard/workzone/instance/popups/instanceUsageCtrl.js diff --git a/client/cat3/main.html b/client/cat3/main.html index 310ebd6b4..ff6eeaad7 100644 --- a/client/cat3/main.html +++ b/client/cat3/main.html @@ -144,6 +144,7 @@ + diff --git a/client/cat3/src/partials/sections/dashboard/workzone/instance/instance.html b/client/cat3/src/partials/sections/dashboard/workzone/instance/instance.html index 0efd2985a..c458a75ae 100644 --- a/client/cat3/src/partials/sections/dashboard/workzone/instance/instance.html +++ b/client/cat3/src/partials/sections/dashboard/workzone/instance/instance.html @@ -48,14 +48,14 @@

Filter By

-
- -
- -
-
+
+ +
+ +
+
@@ -64,13 +64,13 @@

Filter By

- -
- -
-
+ +
+ +
+
@@ -79,18 +79,18 @@

Filter By

- -
- -
-
+ +
+ +
+
+ +
@@ -129,6 +129,7 @@

Filter By

{{getPlatformId(inst.providerType,inst.platformId)}} +
diff --git a/client/cat3/src/partials/sections/dashboard/workzone/instance/instance.scss b/client/cat3/src/partials/sections/dashboard/workzone/instance/instance.scss index 756d953b2..0e8eda4c1 100644 --- a/client/cat3/src/partials/sections/dashboard/workzone/instance/instance.scss +++ b/client/cat3/src/partials/sections/dashboard/workzone/instance/instance.scss @@ -680,6 +680,12 @@ $imagePath: "../../../../../../images"; font-size: 13px; vertical-align: top; } + .marginleft5 { + margin-left: 5px; + } + .instanceSelection { + margin-left: 28%; + } #tableView { width: 100%; padding: 0px 0px 42px 0px; @@ -768,6 +774,13 @@ $imagePath: "../../../../../../images"; /*Common CSS which is used for all devices ends here*/ /*CSS for all Popups starts here*/ +#instanceUsagePage { + .usage-dropdown { + width: auto; + height: 31px; + display: table-cell; + } +} #deleteInstancePage { .font-normal { font-weight: normal; diff --git a/client/cat3/src/partials/sections/dashboard/workzone/instance/instanceCtrl.js b/client/cat3/src/partials/sections/dashboard/workzone/instance/instanceCtrl.js index 916f886f4..feb725056 100644 --- a/client/cat3/src/partials/sections/dashboard/workzone/instance/instanceCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/workzone/instance/instanceCtrl.js @@ -217,6 +217,7 @@ so that it gets replaced with instanceIP*/ helper.setHostToIp(result.data.instances); $scope.tabData = $scope.instanceList; + console.log($scope.instanceList); if ($scope.totalCards > $scope.paginationParams.pageSize) { $scope.cardsAvailable = true; } else { @@ -515,6 +516,21 @@ console.log('Modal dismissed at: ' + new Date()); }); }; + $scope.showInstanceUsage = function(inst) { + var modalInstance = $modal.open({ + animation: true, + templateUrl: 'src/partials/sections/dashboard/workzone/instance/popups/instanceUsage.html', + controller: 'instanceUsageCtrl', + size: 'lg', + backdrop: 'static', + keyboard: false, + resolve: { + items: function() { + return inst; + } + } + }); + } $scope.rdpFileLink = function(instanceObj) { var fileLink = '/instances/rdp/' + instanceObj.instanceIP + '/3389'; return fileLink; diff --git a/client/cat3/src/partials/sections/dashboard/workzone/instance/popups/instanceUsage.html b/client/cat3/src/partials/sections/dashboard/workzone/instance/popups/instanceUsage.html new file mode 100644 index 000000000..f3ea5da58 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/workzone/instance/popups/instanceUsage.html @@ -0,0 +1,36 @@ +
+ + + + + +
\ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/workzone/instance/popups/instanceUsageCtrl.js b/client/cat3/src/partials/sections/dashboard/workzone/instance/popups/instanceUsageCtrl.js new file mode 100644 index 000000000..148734eea --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/workzone/instance/popups/instanceUsageCtrl.js @@ -0,0 +1,100 @@ +/* Copyright (C) Relevance Lab Private Limited- All Rights Reserved + * Unauthorized copying of this file, via any medium is strictly prohibited + * Proprietary and confidential + * Written by Relevance UI Team, + * Oct 2016 + */ + +(function(angular){ + "use strict"; + angular.module('workzone.instance') + .controller('instanceUsageCtrl', ['$scope', '$rootScope', '$modalInstance', 'items', '$state','analyticsServices', 'genericServices','$timeout', function($scope, $rootScope, $modalInstance, items, $state,analyticsServices,genSevs,$timeout) { + console.log(items); + $scope.instanceName = items.name; + var resId = items.platformId; + $scope.trendLineChart={ + data:[] + }; + $scope.trendsChart=function(){ + $scope.trendLineChart.options = { + chart: { + type: 'lineChart', + height: 400, + margin: { + top: 20, + right: 20, + bottom:70, + left: 40 + }, + x: function (d) { + return d[0]; + }, + y: function (d) { + return d[1]; + }, + useVoronoi: false, + clipEdge: true, + duration: 10, + useInteractiveGuideline: true, + xAxis: { + axisLabel: 'Date', + showMaxMin: false, + tickFormat: function (d) { + return d3.time.format('%d/%m %H:%M')(new Date(d)) + } + }, + yAxis: { + tickFormat: function (d) { + return d3.format(',.2f')(d); + } + }, + zoom: { + enabled: true, + scaleExtent: [1, 10], + useFixedDomain: false, + useNiceScale: false, + horizontalOff: true, + verticalOff: true, + unzoomEventType: 'dblclick.zoom' + } + } + }; + $scope.trendLineChart.data = []; + $scope.legends=[]; + $scope.getData(); + }; + $scope.getData=function(){ + $scope.trendLineChart.data = []; + var $today = new Date(); + var $yesterday = new Date($today); + $yesterday.setDate($today.getDate() - 1); + var param = { + url: '/analytics/trend/usage?resource='+'resId'+'&fromTimeStamp='+$yesterday+'&toTimeStamp='+ $today+'&interval=3600' + }; + genSevs.promiseGet(param).then(function (result) { + var va = []; + if(result) { + angular.forEach(result[$scope.splitUp].dataPoints, function (value) { + va.push([Date.parse(value.fromTime), value.average]); + }); + $scope.trendLineChart.data.push({ + "key":resId, + "values": va + }); + } + }); + }; + $scope.trendsChart($rootScope.filterNewEnt); + $scope.splitChange=function() { + $scope.getData($rootScope.filterNewEnt); + }; + $scope.init =function(){ + $scope.splitUp='CPUUtilization'; + }; + $scope.init(); + $scope.cancel = function() { + $modalInstance.dismiss('cancel'); + }; + } + ]); +})(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/workzone/workzoneCtrl.js b/client/cat3/src/partials/sections/dashboard/workzone/workzoneCtrl.js index 6764c38e7..44ae82106 100644 --- a/client/cat3/src/partials/sections/dashboard/workzone/workzoneCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/workzone/workzoneCtrl.js @@ -85,7 +85,7 @@ function workzoneFunct($scope, $rootScope) { }; }; } -angular.module('dashboard.workzone', ['angularTreeview', 'mgcrea.ngStrap', 'workzone.instance', 'workzone.blueprint', 'workzone.orchestration', 'workzone.container', 'workzone.cloudFormation', 'workzone.azureARM', 'workzone.application', 'apis.workzone', 'workzone.factories']) +angular.module('dashboard.workzone', ['angularTreeview', 'mgcrea.ngStrap', 'workzone.instance', 'workzone.blueprint', 'workzone.orchestration', 'workzone.container', 'workzone.cloudFormation', 'workzone.azureARM', 'workzone.application', 'apis.workzone', 'workzone.factories', 'nvd3']) .controller('workzoneCtrl', ['$scope', '$rootScope', workzoneFunct]) .controller('workzoneTreeCtrl', ['$rootScope', '$scope', 'workzoneServices', 'workzoneEnvironment', '$timeout', 'modulePermission', '$window', function ($rootScope, $scope, workzoneServices, workzoneEnvironment, $timeout, modulePerms, $window) { 'use strict'; From 8231ca4c7abec3f5934dfc4d1768016b88b8a317 Mon Sep 17 00:00:00 2001 From: Karthik K N Date: Fri, 14 Oct 2016 12:04:22 +0530 Subject: [PATCH 02/32] code update to generate weekly aggregate cost --- server/app/lib/utils/dateUtil.js | 13 +++++++++++++ server/app/services/analyticsService.js | 4 ++++ server/install.js | 23 +++++++++++++++-------- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/server/app/lib/utils/dateUtil.js b/server/app/lib/utils/dateUtil.js index 41a78fc3f..c685efd95 100644 --- a/server/app/lib/utils/dateUtil.js +++ b/server/app/lib/utils/dateUtil.js @@ -49,6 +49,18 @@ function getStartOfAMonthInUTC(date) { } } +function getStartOfAWeekInUTC(date) { + if( typeof date === 'undefined' || date === null ) { + return null; + }else{ + var dateStartOfWeek = moment.utc(date).seconds(0); + dateStartOfWeek = moment.utc(dateStartOfWeek).minute(0); + dateStartOfWeek = moment.utc(dateStartOfWeek).hour(0); + dateStartOfWeek = moment.utc(dateStartOfWeek).day(0); + return dateStartOfWeek.format(); + } +} + function getStartOfADayInUTC(date) { if( typeof date === 'undefined' || date === null ){ var err = new Error("Invalid date"); @@ -186,3 +198,4 @@ momentDateUtil.getStartOfAYearInUTCAsync = getStartOfAYearInUTCAsync; momentDateUtil.getStartOfAMonthInUTC = getStartOfAMonthInUTC; momentDateUtil.getDateDifferenceInDays = getDateDifferenceInDays; momentDateUtil.getStartOfADayInUTC = getStartOfADayInUTC; +momentDateUtil.getStartOfAWeekInUTC = getStartOfAWeekInUTC; diff --git a/server/app/services/analyticsService.js b/server/app/services/analyticsService.js index fe9651ac5..22621d70a 100644 --- a/server/app/services/analyticsService.js +++ b/server/app/services/analyticsService.js @@ -42,6 +42,10 @@ analyticsService.aggregateEntityCosts startTime = dateUtil.getStartOfAMonthInUTC(endTime) interval = costAggregationPeriods.month.intervalInSeconds break + case 'week': + startTime = dateUtil.getStartOfAWeekInUTC(endTime) + interval = costAggregationPeriods.week.intervalInSeconds + break case 'day': startTime = dateUtil.getStartOfADayInUTC(endTime) interval = costAggregationPeriods.day.intervalInSeconds diff --git a/server/install.js b/server/install.js index 0596ff667..eeb4c37fe 100755 --- a/server/install.js +++ b/server/install.js @@ -443,7 +443,7 @@ function getDefaultsConfig() { catalystEntityHierarchy: { organization: { key: 'organizationId', - children: ['organization', 'businessGroup', 'provider', 'environment', 'region'] + children: ['organization', 'businessGroup', 'provider', 'environment', 'region', 'resource'] }, businessGroup: { key: 'businessGroupId', @@ -462,30 +462,37 @@ function getDefaultsConfig() { }, region: { key: 'platformDetails.region' + }, + resource: { + key: 'resourceId' } }, costAggregationPeriods: { - 'year': { + /*'year': { intervalInSeconds: null, childInterval: { name: 'monthly', intervalInSeconds: 2592000 } - }, + },*/ 'month': { intervalInSeconds: 2592000, childInterval: { - name: 'daily', + name: 'week', intervalInSeconds: 86400 } }, - day: { - intervalInSeconds: 86400, + week: { + intervalInSeconds: 604800, childInterval: { - name: 'hourly', - intervalInSeconds: 3600 + name: 'day', + intervalInSeconds: 86400 } }, + day: { + intervalInSeconds: 86400, + childInterval: null + }, }, costDefaultIds: { businessGroupId: 'Unassigned', From bbdec65f3239a39e2eddf8df2aff0bc835f228c0 Mon Sep 17 00:00:00 2001 From: VIJAYKUMARNINGANURE Date: Fri, 14 Oct 2016 13:26:15 +0530 Subject: [PATCH 03/32] Implemented serviceDeliveryCheck --- server/app/routes/v1.0/routes_blueprints.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/app/routes/v1.0/routes_blueprints.js b/server/app/routes/v1.0/routes_blueprints.js index d0d80b81d..4a28cd542 100755 --- a/server/app/routes/v1.0/routes_blueprints.js +++ b/server/app/routes/v1.0/routes_blueprints.js @@ -527,14 +527,25 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { var orgId = req.params.orgId; var bgId = req.params.bgId; var projectId = req.params.projectId; + var serviceDeliveryCheck = false; + if(req.query.serviceDeliveryCheck){ + serviceDeliveryCheck = req.query.serviceDeliveryCheck; + } if (!orgId || !bgId || !projectId) { res.status(400).send("Either orgId or bgId or projectId missing."); return; } + var jsonData = {}; jsonData['orgId'] = orgId; jsonData['bgId'] = bgId; jsonData['projectId'] = projectId; + + if(serviceDeliveryCheck === 'true' || serviceDeliveryCheck === true){ + jsonData['botType'] = {$ne:null}; + jsonData['shortDesc'] = {$ne:null}; + } + Blueprints.getBlueprintsByOrgBgProject(jsonData, function(err, blueprints) { if (err) { res.status(500).send({ From f6d6d833e37ba913a6ad2187eebf74a16324fb1a Mon Sep 17 00:00:00 2001 From: Karthik K N Date: Fri, 14 Oct 2016 16:11:48 +0530 Subject: [PATCH 04/32] entity cost aggregation optimization --- .../model/resource-costs/resource-costs.js | 6 +- server/app/services/analyticsService.js | 61 +++++++++---------- server/app/services/resourceService.js | 6 +- server/install.js | 12 ++-- 4 files changed, 45 insertions(+), 40 deletions(-) diff --git a/server/app/model/resource-costs/resource-costs.js b/server/app/model/resource-costs/resource-costs.js index bcf24bdd5..1d6151d7c 100644 --- a/server/app/model/resource-costs/resource-costs.js +++ b/server/app/model/resource-costs/resource-costs.js @@ -71,7 +71,7 @@ var ResourceCostsSchema = new Schema({ trim: true }, billLineItemId: { - type: String, + type: Number, required: true, trim: true }, @@ -131,7 +131,8 @@ var ResourceCostsSchema = new Schema({ } }) -ResourceCostsSchema.index({'organizationId': 1, 'billLineItemId': 1, +ResourceCostsSchema.index({'platformDetails.serviceId' : 1}) +ResourceCostsSchema.index({'organizationId': 1, 'providerId': 1, 'billLineItemId': 1, 'startTime': 1, 'interval': 1}, {'unique': true}) ResourceCostsSchema.statics.saveResourceCost = function saveResourceCost(resourceCostData, callback) { @@ -148,6 +149,7 @@ ResourceCostsSchema.statics.saveResourceCost = function saveResourceCost(resourc ResourceCostsSchema.statics.upsertResourceCost = function upsertResourceCost(resourceCostData, callback) { var query = { organizationId: resourceCostData.organizationId, + providerId: resourceCostData.providerId, billLineItemId: resourceCostData.billLineItemId, startTime: resourceCostData.startTime, interval: resourceCostData.interval diff --git a/server/app/services/analyticsService.js b/server/app/services/analyticsService.js index 22621d70a..254d99c3f 100644 --- a/server/app/services/analyticsService.js +++ b/server/app/services/analyticsService.js @@ -66,36 +66,28 @@ analyticsService.aggregateEntityCosts ], next1) }, function(totalCosts, next1) { - var serviceCosts = [] - async.forEach(platformServices, - function(service, next2) { - query['platformDetails.serviceId'] = service - - resourceCostsModel.aggregate([ - {$match: query}, - {$group: {_id: "$" + catalystEntityHierarchy[childEntity].key, - totalCost: {$sum: "$cost"}, - service: {$first: "$platformDetails.serviceId"}}} - ], function(err, serviceCost) { - if(err) { - next2(err) - } else { - serviceCosts.push(serviceCost) - next2() - } - }) - }, - function(err) { - if(err) { - return next1(err) - } else { - var aggregatedCosts = {totalCosts: totalCosts} - aggregatedCosts.serviceCosts = serviceCosts - - next1(null, aggregatedCosts) + resourceCostsModel.aggregate([ + {$match: query}, + { + $group: { + _id: { + "entityId": "$" + catalystEntityHierarchy[childEntity].key, + "service": "$platformDetails.serviceId" + }, + totalCost: {$sum: "$cost"}, + service: {$first: "$platformDetails.serviceId"} } } - ) + ], function (err, serviceCosts) { + if (err) { + return next1(err) + } else { + var aggregatedCosts = {totalCosts: totalCosts} + aggregatedCosts.serviceCosts = serviceCosts + + next1(null, aggregatedCosts) + } + }) } ], function(err, aggregateCosts) { @@ -104,7 +96,6 @@ analyticsService.aggregateEntityCosts } else { //@TODO Blocking call to be avoided var entityCosts = {} - for(var i = 0; i < aggregateCosts.totalCosts.length; i++) { entityCosts[aggregateCosts.totalCosts[i]._id] = { entity: { @@ -129,8 +120,7 @@ analyticsService.aggregateEntityCosts } } - // @TODO Blocking call to be avoided - for(var i = 0; i < aggregateCosts.serviceCosts.length; i++) { + /*for(var i = 0; i < aggregateCosts.serviceCosts.length; i++) { for(var j = 0; j < aggregateCosts.serviceCosts[i].length; j++) { if(aggregateCosts.serviceCosts[i][j]._id in entityCosts) { entityCosts[aggregateCosts.serviceCosts[i][j]._id] @@ -138,6 +128,15 @@ analyticsService.aggregateEntityCosts = Math.round(aggregateCosts.serviceCosts[i][j].totalCost * 100) / 100 } } + }*/ + + // @TODO Blocking call to be avoided + for(var i = 0; i < aggregateCosts.serviceCosts.length; i++) { + if(aggregateCosts.serviceCosts[i]._id.entityId in entityCosts) { + entityCosts[aggregateCosts.serviceCosts[i]._id.entityId] + .costs.AWS.serviceCosts[aggregateCosts.serviceCosts[i]._id.service] + = aggregateCosts.serviceCosts[i].totalCost + } } if(Object.keys(entityCosts).length > 0) diff --git a/server/app/services/resourceService.js b/server/app/services/resourceService.js index 7c2e5851b..7feddace3 100644 --- a/server/app/services/resourceService.js +++ b/server/app/services/resourceService.js @@ -108,9 +108,9 @@ function updateAWSResourceCostsFromCSV(provider, resources, downlaodedCSVPath, u resourceCostEntry.billLineItemId = ++lineNumber resourceCostEntry.platformDetails.billRecordId = data[awsBillIndexes.recordId] - if (data[awsBillIndexes.prod] in awsServices) { - resourceCostEntry.platformDetails.serviceId = awsServices[data[awsBillIndexes.prod]] - } + resourceCostEntry.platformDetails.serviceId + = (data[awsBillIndexes.prod] in awsServices)?awsServices[data[awsBillIndexes.prod]] + :resourceCostEntry.platformDetails.serviceId = 'Other' resourceCostEntry.platformDetails.zone = (data[awsBillIndexes.zone] == null) ? 'Global' : data[awsBillIndexes.zone] diff --git a/server/install.js b/server/install.js index eeb4c37fe..33995c1bd 100755 --- a/server/install.js +++ b/server/install.js @@ -404,7 +404,8 @@ function getDefaultsConfig() { 'Amazon Route 53': 'R53', 'Amazon Redshift': 'RedShift', 'Amazon ElastiCache': 'ElastiCache', - 'Amazon CloudFront': 'CloudFront' + 'Amazon CloudFront': 'CloudFront', + 'Other': 'Other' }, billIndexes: { @@ -443,7 +444,7 @@ function getDefaultsConfig() { catalystEntityHierarchy: { organization: { key: 'organizationId', - children: ['organization', 'businessGroup', 'provider', 'environment', 'region', 'resource'] + children: ['organization', 'businessGroup', 'provider', 'environment', 'region'] }, businessGroup: { key: 'businessGroupId', @@ -491,8 +492,11 @@ function getDefaultsConfig() { }, day: { intervalInSeconds: 86400, - childInterval: null - }, + childInterval: { + name: 'hour', + intervalInSeconds: 3600 + } + } }, costDefaultIds: { businessGroupId: 'Unassigned', From 8c6a1e79372ec7f94aeaa3c4e86c6fb1ad20d5ef Mon Sep 17 00:00:00 2001 From: VIJAYKUMARNINGANURE Date: Fri, 14 Oct 2016 17:40:07 +0530 Subject: [PATCH 05/32] Implementation of Tag servers --- .../arm-template-blueprint/arm-template-blueprint.js | 1 + .../instance-blueprint/aws-blueprint/aws-blueprint.js | 1 + .../instance-blueprint/azure-blueprint/azure-blueprint.js | 1 + .../openstack-blueprint/openstack-blueprint.js | 1 + .../instance-blueprint/vmware-blueprint/vmware-blueprint.js | 1 + server/app/model/classes/instance/instance.js | 5 +++++ server/app/routes/v1.0/routes_chef.js | 1 + server/app/routes/v1.0/routes_organizations.js | 1 + server/app/routes/v1.0/routes_providercommon.js | 1 + 9 files changed, 13 insertions(+) diff --git a/server/app/model/blueprint/blueprint-types/arm-template-blueprint/arm-template-blueprint.js b/server/app/model/blueprint/blueprint-types/arm-template-blueprint/arm-template-blueprint.js index fd668004f..54908803d 100755 --- a/server/app/model/blueprint/blueprint-types/arm-template-blueprint/arm-template-blueprint.js +++ b/server/app/model/blueprint/blueprint-types/arm-template-blueprint/arm-template-blueprint.js @@ -165,6 +165,7 @@ ARMTemplateBlueprintSchema.methods.launch = function(launchParams, callback) { environmentName: launchParams.envName, providerId: self.cloudProviderId, providerType: 'azure', + tagServer: launchParams.tagServer, keyPairId: 'azure', region: self.region, chefNodeName: instanceData.name, diff --git a/server/app/model/blueprint/blueprint-types/instance-blueprint/aws-blueprint/aws-blueprint.js b/server/app/model/blueprint/blueprint-types/instance-blueprint/aws-blueprint/aws-blueprint.js index 97493a7da..cd8aa5c0a 100755 --- a/server/app/model/blueprint/blueprint-types/instance-blueprint/aws-blueprint/aws-blueprint.js +++ b/server/app/model/blueprint/blueprint-types/instance-blueprint/aws-blueprint/aws-blueprint.js @@ -221,6 +221,7 @@ AWSInstanceBlueprintSchema.methods.launch = function(launchParams, callback) { keyPairId: self.keyPairId, region: aKeyPair.region, chefNodeName: instanceData.InstanceId, + tagServer: launchParams.tagServer, runlist: paramRunList, attributes: paramAttributes, platformId: instanceData.InstanceId, diff --git a/server/app/model/blueprint/blueprint-types/instance-blueprint/azure-blueprint/azure-blueprint.js b/server/app/model/blueprint/blueprint-types/instance-blueprint/azure-blueprint/azure-blueprint.js index 6bf1d2bdc..3b56d2414 100755 --- a/server/app/model/blueprint/blueprint-types/instance-blueprint/azure-blueprint/azure-blueprint.js +++ b/server/app/model/blueprint/blueprint-types/instance-blueprint/azure-blueprint/azure-blueprint.js @@ -276,6 +276,7 @@ azureInstanceBlueprintSchema.methods.launch = function(launchParams, callback) { environmentName: launchParams.envName, providerId: self.cloudProviderId, providerType: self.cloudProviderType, + tagServer: launchParams.tagServer, keyPairId: 'azure', region: self.region, chefNodeName: launchparamsazure.VMName, diff --git a/server/app/model/blueprint/blueprint-types/instance-blueprint/openstack-blueprint/openstack-blueprint.js b/server/app/model/blueprint/blueprint-types/instance-blueprint/openstack-blueprint/openstack-blueprint.js index 0f8c91402..65b26083a 100755 --- a/server/app/model/blueprint/blueprint-types/instance-blueprint/openstack-blueprint/openstack-blueprint.js +++ b/server/app/model/blueprint/blueprint-types/instance-blueprint/openstack-blueprint/openstack-blueprint.js @@ -223,6 +223,7 @@ openstackInstanceBlueprintSchema.methods.launch = function(launchParams, callbac environmentName: launchParams.envName, providerId: self.cloudProviderId, providerType: self.cloudProviderType, + tagServer: launchParams.tagServer, keyPairId: 'unknown', region: self.region, chefNodeName: instanceData.server.id, diff --git a/server/app/model/blueprint/blueprint-types/instance-blueprint/vmware-blueprint/vmware-blueprint.js b/server/app/model/blueprint/blueprint-types/instance-blueprint/vmware-blueprint/vmware-blueprint.js index 98db8101c..969017ab2 100755 --- a/server/app/model/blueprint/blueprint-types/instance-blueprint/vmware-blueprint/vmware-blueprint.js +++ b/server/app/model/blueprint/blueprint-types/instance-blueprint/vmware-blueprint/vmware-blueprint.js @@ -212,6 +212,7 @@ vmwareInstanceBlueprintSchema.methods.launch = function(launchParams, callback) environmentName: launchParams.envName, providerId: self.cloudProviderId, providerType: self.cloudProviderType, + tagServer: launchParams.tagServer, keyPairId: 'unknown', region: self.region, chefNodeName: createserverdata["vm_name"], diff --git a/server/app/model/classes/instance/instance.js b/server/app/model/classes/instance/instance.js index de7e3b9c0..f536505f7 100755 --- a/server/app/model/classes/instance/instance.js +++ b/server/app/model/classes/instance/instance.js @@ -341,6 +341,11 @@ var InstanceSchema = new Schema({ type: Boolean, required: false, default: false + }, + tagServer:{ + type: String, + required: false, + trim: true } }); diff --git a/server/app/routes/v1.0/routes_chef.js b/server/app/routes/v1.0/routes_chef.js index 9b89407e2..6ba19b57c 100755 --- a/server/app/routes/v1.0/routes_chef.js +++ b/server/app/routes/v1.0/routes_chef.js @@ -319,6 +319,7 @@ module.exports.setRoutes = function(app, verificationFunc) { instanceState: 'running', bootStrapStatus: 'success', hardware: hardwareData, + tagServer: reqBody.tagServer, credentials: encryptedCredentials, users: users, chef: { diff --git a/server/app/routes/v1.0/routes_organizations.js b/server/app/routes/v1.0/routes_organizations.js index 625c37286..8a1f32f80 100755 --- a/server/app/routes/v1.0/routes_organizations.js +++ b/server/app/routes/v1.0/routes_organizations.js @@ -1739,6 +1739,7 @@ module.exports.setRoutes = function(app, sessionVerification) { instanceIP: req.body.fqdn, instanceState: nodeAlive, bootStrapStatus: 'waiting', + tagServer: req.body.tagServer, runlist: [], appUrls: appUrls, users: [req.session.user.cn], //need to change this diff --git a/server/app/routes/v1.0/routes_providercommon.js b/server/app/routes/v1.0/routes_providercommon.js index 1396ae901..5317034c1 100644 --- a/server/app/routes/v1.0/routes_providercommon.js +++ b/server/app/routes/v1.0/routes_providercommon.js @@ -413,6 +413,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { projectId: req.body.projectId, projectName: req.body.projectName, envId: req.body.envId, + tagServer: req.body.tagServer, providerId: provider._id, providerType: 'aws', providerData: { From dceb444e695397aa41f432f107416619a652861c Mon Sep 17 00:00:00 2001 From: Karthik K N Date: Mon, 17 Oct 2016 12:13:25 +0530 Subject: [PATCH 06/32] service cost precision and dateUtil changes --- server/app/lib/utils/dateUtil.js | 18 +++++++ server/app/services/analyticsService.js | 62 +++++-------------------- 2 files changed, 30 insertions(+), 50 deletions(-) diff --git a/server/app/lib/utils/dateUtil.js b/server/app/lib/utils/dateUtil.js index c685efd95..724d68b09 100644 --- a/server/app/lib/utils/dateUtil.js +++ b/server/app/lib/utils/dateUtil.js @@ -73,6 +73,23 @@ function getStartOfADayInUTC(date) { } } +function getStartOfPeriod(period, date) { + var startTime = null + switch(period) { + case 'month': + startTime = getStartOfAMonthInUTC(date); + break; + case 'week': + startTime = getStartOfAWeekInUTC(date); + break; + case 'day': + startTime = getStartOfADayInUTC(date); + break; + } + + return startTime; +} + /* * Get Date in UTC Format * date - JavaScript Date @@ -199,3 +216,4 @@ momentDateUtil.getStartOfAMonthInUTC = getStartOfAMonthInUTC; momentDateUtil.getDateDifferenceInDays = getDateDifferenceInDays; momentDateUtil.getStartOfADayInUTC = getStartOfADayInUTC; momentDateUtil.getStartOfAWeekInUTC = getStartOfAWeekInUTC; +momentDateUtil.getStartOfPeriod = getStartOfPeriod; diff --git a/server/app/services/analyticsService.js b/server/app/services/analyticsService.js index 254d99c3f..ae55cc55a 100644 --- a/server/app/services/analyticsService.js +++ b/server/app/services/analyticsService.js @@ -35,22 +35,8 @@ analyticsService.aggregateEntityCosts }) var offset = (new Date()).getTimezoneOffset()*60000 - var startTime - var interval - switch (period) { - case 'month': - startTime = dateUtil.getStartOfAMonthInUTC(endTime) - interval = costAggregationPeriods.month.intervalInSeconds - break - case 'week': - startTime = dateUtil.getStartOfAWeekInUTC(endTime) - interval = costAggregationPeriods.week.intervalInSeconds - break - case 'day': - startTime = dateUtil.getStartOfADayInUTC(endTime) - interval = costAggregationPeriods.day.intervalInSeconds - break - } + var interval = costAggregationPeriods[period].intervalInSeconds + var startTime = dateUtil.getStartOfPeriod(period, endTime) async.forEach(catalystEntityHierarchy[parentEntity].children, function (childEntity, next0) { var query = parentEntityQuery @@ -98,14 +84,8 @@ analyticsService.aggregateEntityCosts var entityCosts = {} for(var i = 0; i < aggregateCosts.totalCosts.length; i++) { entityCosts[aggregateCosts.totalCosts[i]._id] = { - entity: { - id: aggregateCosts.totalCosts[i]._id, - type: childEntity - }, - parentEntity: { - id: parentEntityId, - type: parentEntity - }, + entity: { id: aggregateCosts.totalCosts[i]._id, type: childEntity}, + parentEntity: {id: parentEntityId, type: parentEntity}, costs: { totalCost: Math.round(aggregateCosts.totalCosts[i].totalCost * 100) / 100, AWS: { @@ -120,22 +100,12 @@ analyticsService.aggregateEntityCosts } } - /*for(var i = 0; i < aggregateCosts.serviceCosts.length; i++) { - for(var j = 0; j < aggregateCosts.serviceCosts[i].length; j++) { - if(aggregateCosts.serviceCosts[i][j]._id in entityCosts) { - entityCosts[aggregateCosts.serviceCosts[i][j]._id] - .costs.AWS.serviceCosts[aggregateCosts.serviceCosts[i][j].service] - = Math.round(aggregateCosts.serviceCosts[i][j].totalCost * 100) / 100 - } - } - }*/ - // @TODO Blocking call to be avoided for(var i = 0; i < aggregateCosts.serviceCosts.length; i++) { if(aggregateCosts.serviceCosts[i]._id.entityId in entityCosts) { entityCosts[aggregateCosts.serviceCosts[i]._id.entityId] .costs.AWS.serviceCosts[aggregateCosts.serviceCosts[i]._id.service] - = aggregateCosts.serviceCosts[i].totalCost + = Math.round(aggregateCosts.serviceCosts[i].totalCost * 100) / 100 } } @@ -179,23 +149,15 @@ analyticsService.validateAndParseCostQuery var err = new Error('Invalid request') err.errors = [{messages: 'Mandatory fields missing'}] err.status = 400 - callback(err) + return callback(err) } - var startTime - switch (requestQuery.period) { - case 'month': - startTime = dateUtil.getStartOfAMonthInUTC(requestQuery.toTimeStamp) - break - /*case 'year': - startTime = dateUtil.getStartOfAMonthInUTC(requestQuery.toTimeStamp) - break*/ - default: - var err = new Error('Invalid request') - err.errors = [{messages: 'Period is invalid'}] - err.status = 400 - return callback(err) - break + var startTime = dateUtil.getStartOfPeriod(requestQuery.period, requestQuery.toTimeStamp) + if(startTime == null) { + var err = new Error('Invalid request') + err.errors = [{messages: 'Period is invalid'}] + err.status = 400 + return callback(err) } //@TODO Query object format to be changed From 9d04ab009496f62387676969e3addcd9dc94e5ca Mon Sep 17 00:00:00 2001 From: Divakar Konakalla Date: Mon, 17 Oct 2016 15:38:31 +0530 Subject: [PATCH 07/32] Added Service Delivery check while creating new blueprint. --- client/htmls/private/ajax/Aws-Production.html | 41 ++++++++++++++++++- client/htmls/private/js/dev/awsProduction.js | 13 ++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/client/htmls/private/ajax/Aws-Production.html b/client/htmls/private/ajax/Aws-Production.html index 510cca879..7d926a582 100644 --- a/client/htmls/private/ajax/Aws-Production.html +++ b/client/htmls/private/ajax/Aws-Production.html @@ -236,6 +236,35 @@

+
+
+ + +
+
+ + +
+ + + +
+
+ +
+ + + +
+
- \ No newline at end of file + + + \ No newline at end of file diff --git a/client/htmls/private/js/dev/awsProduction.js b/client/htmls/private/js/dev/awsProduction.js index eba798d0b..623bc56f2 100644 --- a/client/htmls/private/js/dev/awsProduction.js +++ b/client/htmls/private/js/dev/awsProduction.js @@ -12,6 +12,7 @@ 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 checkandupdateRunlistTable = function() { if (!$.fn.dataTable.isDataTable('#tableRunlistForBlueprint')) { $tasksRunlist = $('#tableRunlistForBlueprint').DataTable({ @@ -1554,6 +1555,8 @@ var saveblueprint = function(tempType) { reqBody.orgId = $('#orgnameSelect').val(); reqBody.bgId = $('#bgListInput').val(); reqBody.projectId = $('#projectListInput').val(); + reqBody.botType = $('#botType').val(); + reqBody.shortDesc = $('#shortDesc').val(); var imageIdentifier = $('#imageId').val(); var imageId = $('#imageId').find('option:selected').attr('_id'); var securityGroupIds = getSecurityCheckedList(); @@ -3450,4 +3453,14 @@ $(".repoTypeSelectorRadioBtn").click(function() { var val = $(this).attr('data-repotype'); $('.repoTypeClass').hide(); $('#' + val).show(); +}); + +$(document).ready(function() { + $('#serviceDeliveryCheck').click(function() { + if ($('#serviceDeliveryCheck').prop("checked")) { + $('.sevice-delivery-section').addClass('showservice'); + } else { + $('.sevice-delivery-section').removeClass('showservice'); + } + }); }); \ No newline at end of file From 3e2b4fb6d847df504e6093b1402cf4a51693496a Mon Sep 17 00:00:00 2001 From: Divakar Konakalla Date: Mon, 17 Oct 2016 23:26:53 +0530 Subject: [PATCH 08/32] Added check before send bot type & description to API. --- client/htmls/private/js/dev/awsProduction.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/htmls/private/js/dev/awsProduction.js b/client/htmls/private/js/dev/awsProduction.js index 623bc56f2..a3df1df9e 100644 --- a/client/htmls/private/js/dev/awsProduction.js +++ b/client/htmls/private/js/dev/awsProduction.js @@ -1555,8 +1555,10 @@ var saveblueprint = function(tempType) { reqBody.orgId = $('#orgnameSelect').val(); reqBody.bgId = $('#bgListInput').val(); reqBody.projectId = $('#projectListInput').val(); - reqBody.botType = $('#botType').val(); - reqBody.shortDesc = $('#shortDesc').val(); + if ($('#serviceDeliveryCheck').prop("checked")) { + reqBody.botType = $('#botType').val(); + reqBody.shortDesc = $('#shortDesc').val(); + } var imageIdentifier = $('#imageId').val(); var imageId = $('#imageId').find('option:selected').attr('_id'); var securityGroupIds = getSecurityCheckedList(); From f15505e755e2ef603fb9e86f0720c9f71bda0a4a Mon Sep 17 00:00:00 2001 From: Divakar Konakalla Date: Tue, 18 Oct 2016 08:43:06 +0530 Subject: [PATCH 09/32] Added tag server check in chef import, import by ip pages. --- .../instance/popups/InstanceImportByIpCtrl.js | 1 + .../workzone/instance/popups/instanceImportByIp.html | 4 ++++ client/htmls/private/ajax/Settings/chefSync.html | 12 ++++++++++++ 3 files changed, 17 insertions(+) diff --git a/client/cat3/src/partials/sections/dashboard/workzone/instance/popups/InstanceImportByIpCtrl.js b/client/cat3/src/partials/sections/dashboard/workzone/instance/popups/InstanceImportByIpCtrl.js index 8538dd5c6..266f79611 100644 --- a/client/cat3/src/partials/sections/dashboard/workzone/instance/popups/InstanceImportByIpCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/workzone/instance/popups/InstanceImportByIpCtrl.js @@ -48,6 +48,7 @@ reqBody.fqdn = $scope.ipAddress; reqBody.os = $scope.os; reqBody.configManagmentId = $scope.selectedConfig; + reqBody.tagServer = $scope.tagServer; reqBody.credentials = { username: $scope.username }; diff --git a/client/cat3/src/partials/sections/dashboard/workzone/instance/popups/instanceImportByIp.html b/client/cat3/src/partials/sections/dashboard/workzone/instance/popups/instanceImportByIp.html index ea91f0a2f..eafafb8d2 100644 --- a/client/cat3/src/partials/sections/dashboard/workzone/instance/popups/instanceImportByIp.html +++ b/client/cat3/src/partials/sections/dashboard/workzone/instance/popups/instanceImportByIp.html @@ -133,6 +133,10 @@ + +
+ + +
diff --git a/client/htmls/private/ajax/Settings/chefSync.html b/client/htmls/private/ajax/Settings/chefSync.html index 10236f3b7..35d07e690 100755 --- a/client/htmls/private/ajax/Settings/chefSync.html +++ b/client/htmls/private/ajax/Settings/chefSync.html @@ -232,9 +232,24 @@ -
+
+
- + +
+
+ + +
+ + + +
+
  • +
    + SERVICE +
    +
  • +
  • + +
  • @@ -46,18 +58,26 @@ {{appDetails.cn | uppercase}} [{{appDetails.roleId}}]
    - - -
    - +
  • From 04c83d4862449945196f9655e2e59828c11d7c74 Mon Sep 17 00:00:00 2001 From: Divakar Konakalla Date: Tue, 18 Oct 2016 21:41:42 +0530 Subject: [PATCH 16/32] UI changes. --- client/cat3/src/partials/globals/header/headerDashboard.html | 5 ----- 1 file changed, 5 deletions(-) diff --git a/client/cat3/src/partials/globals/header/headerDashboard.html b/client/cat3/src/partials/globals/header/headerDashboard.html index fecd8808b..12f3720b7 100644 --- a/client/cat3/src/partials/globals/header/headerDashboard.html +++ b/client/cat3/src/partials/globals/header/headerDashboard.html @@ -39,11 +39,6 @@ ANALYTICS -
  • -
    - SERVICE -
    -
  • From 63bb599871f7c6f27624c6d620100631dadb54c6 Mon Sep 17 00:00:00 2001 From: Divakar Konakalla Date: Tue, 18 Oct 2016 23:55:47 +0530 Subject: [PATCH 17/32] Created basic folder structure for service delivery, added menu item in header, added htmls & controllers, added left tree menu, added left tree menu items clicks for navigation. --- client/cat3/Gruntfile.js | 1 + client/cat3/main.html | 1 + client/cat3/src/clientRoutes.js | 17 + .../cat3/src/factory/appPermissionServices.js | 5 + client/cat3/src/main.js | 6 +- .../globals/header/headerDashboard.html | 5 + .../sections/dashboard/dashboardCtrl.js | 46 +-- .../sections/dashboard/service/service.html | 13 + .../sections/dashboard/service/service.js | 7 + .../sections/dashboard/service/service.scss | 311 ++++++++++++++++++ .../service/view/serviceTreeMenu.html | 59 ++++ 11 files changed, 448 insertions(+), 23 deletions(-) create mode 100644 client/cat3/src/partials/sections/dashboard/service/service.html create mode 100644 client/cat3/src/partials/sections/dashboard/service/service.js create mode 100644 client/cat3/src/partials/sections/dashboard/service/service.scss create mode 100644 client/cat3/src/partials/sections/dashboard/service/view/serviceTreeMenu.html diff --git a/client/cat3/Gruntfile.js b/client/cat3/Gruntfile.js index 8619729ba..8028c9b59 100644 --- a/client/cat3/Gruntfile.js +++ b/client/cat3/Gruntfile.js @@ -89,6 +89,7 @@ module.exports = function(grunt) { {'catalyst/partials/sections/dashboard/workzone/orchestration/orchestration.css':'src/partials/sections/dashboard/workzone/orchestration/orchestration.scss'}, {'catalyst/partials/sections/dashboard/workzone/application/application.css':'src/partials/sections/dashboard/workzone/application/application.scss'}, {'catalyst/partials/sections/dashboard/analytics/analytics.css':'src/partials/sections/dashboard/analytics/analytics.scss'}, + {'catalyst/partials/sections/dashboard/service/service.css':'src/partials/sections/dashboard/service/service.scss'}, {'catalyst/partials/sections/dashboard/setting/setting.css':'src/partials/sections/dashboard/setting/setting.scss'} ] } diff --git a/client/cat3/main.html b/client/cat3/main.html index ff6eeaad7..928f4c73a 100644 --- a/client/cat3/main.html +++ b/client/cat3/main.html @@ -102,6 +102,7 @@ + diff --git a/client/cat3/src/clientRoutes.js b/client/cat3/src/clientRoutes.js index 131f202c3..9d2e187d3 100644 --- a/client/cat3/src/clientRoutes.js +++ b/client/cat3/src/clientRoutes.js @@ -88,6 +88,23 @@ function routeConfig($stateProvider, $urlRouterProvider, $httpProvider, modulePe }] } + }).state('dashboard.service', { + url: "/service/", + templateUrl: "src/partials/sections/dashboard/service/service.html", + controller: "serviceCtrl", + resolve: { + auth: ["$q", function ($q) { + var deferred = $q.defer(); + // instead, go to a different page + if (modulePerms.serviceBool()) { + // everything is fine, proceed + deferred.resolve(); + } else { + deferred.reject({redirectTo: 'dashboard'}); + } + return deferred.promise; + }] + } }).state('dashboard.settings', { url: "/settings", templateUrl: "src/partials/sections/dashboard/setting/setting.html", diff --git a/client/cat3/src/factory/appPermissionServices.js b/client/cat3/src/factory/appPermissionServices.js index f7430023e..747b9e66c 100755 --- a/client/cat3/src/factory/appPermissionServices.js +++ b/client/cat3/src/factory/appPermissionServices.js @@ -27,5 +27,10 @@ //return uac.hasPermission('track','read','module'); return true; }; + this.serviceBool = function() { + //permission response not available in the api response. + //return uac.hasPermission('track','read','module'); + return true; + }; }]); })(angular); \ No newline at end of file diff --git a/client/cat3/src/main.js b/client/cat3/src/main.js index e8a2bf542..d1ee21288 100644 --- a/client/cat3/src/main.js +++ b/client/cat3/src/main.js @@ -84,13 +84,15 @@ angularApp.controller('HeadNavigatorCtrl', ['$scope', '$rootScope', '$http', '$l design: modulePerms.designAccess(), settings: modulePerms.settingsAccess(), track: modulePerms.trackAccess(), - analyticsBool: modulePerms.analyticsBool() + analyticsBool: modulePerms.analyticsBool(), + serviceBool: modulePerms.serviceBool() }; $rootScope.workZoneBool = _permSet.workzone; $rootScope.designBool = _permSet.design; $rootScope.settingsBool = _permSet.settings; $rootScope.trackBool = _permSet.track; $rootScope.analyticsBool = _permSet.analyticsBool; + $rootScope.serviceBool = _permSet.serviceBool; }); $rootScope.$emit('SET_HEADER', $rootScope.appDetails); $scope.showLogoutConfirmationSection = false; @@ -111,4 +113,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/globals/header/headerDashboard.html b/client/cat3/src/partials/globals/header/headerDashboard.html index 382f778c3..d6244e8d5 100644 --- a/client/cat3/src/partials/globals/header/headerDashboard.html +++ b/client/cat3/src/partials/globals/header/headerDashboard.html @@ -39,6 +39,11 @@ ANALYTICS
  • +
  • +
    + BOTS +
    +
  • diff --git a/client/cat3/src/partials/sections/dashboard/dashboardCtrl.js b/client/cat3/src/partials/sections/dashboard/dashboardCtrl.js index 5b9d187e9..bca69a726 100644 --- a/client/cat3/src/partials/sections/dashboard/dashboardCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/dashboardCtrl.js @@ -8,28 +8,32 @@ 'dashboard.track', 'dashboard.settings', 'dashboard.design', + 'dashboard.service', 'apis.workzone','dashboard.genericServices']) .controller('dashboardCtrl', ['$rootScope', '$scope', '$http', 'uac', '$location', '$state', function ($rootScope, $scope, $http, uac, $location, $state) { - $rootScope.isBreadCrumbAvailable = true; - $rootScope.app.isDashboard = true; - if($state.current && $state.current.data && $state.current.data.menuName){ - $rootScope.dashboardChild = $state.current.data.menuName; - } else { - $rootScope.dashboardChild =''; - } - $rootScope.showTreeMenu = true; - /*State will be dashboard if coming via login flow. So check permission and do default landing logic*/ - /*Otherwise dont enable default landing logic. This is so that user can land on url directly*/ - if ($state.current.name === 'dashboard') { - if ($rootScope.workZoneBool) { - $state.go('dashboard.workzone'); - } else if ($rootScope.designBool) { - $state.go('dashboard.design'); - } else if ($rootScope.trackBool) { - $state.go('dashboard.track'); - } else if ($rootScope.settingsBool) { - $state.go('dashboard.settings'); + $rootScope.isBreadCrumbAvailable = true; + $rootScope.app.isDashboard = true; + if($state.current && $state.current.data && $state.current.data.menuName){ + $rootScope.dashboardChild = $state.current.data.menuName; + } else { + $rootScope.dashboardChild =''; + } + $rootScope.showTreeMenu = true; + /*State will be dashboard if coming via login flow. So check permission and do default landing logic*/ + /*Otherwise dont enable default landing logic. This is so that user can land on url directly*/ + if ($state.current.name === 'dashboard') { + if ($rootScope.workZoneBool) { + $state.go('dashboard.workzone'); + } else if ($rootScope.designBool) { + $state.go('dashboard.design'); + } else if ($rootScope.trackBool) { + $state.go('dashboard.track'); + } else if ($rootScope.settingsBool) { + $state.go('dashboard.settings'); + } else if ($rootScope.serviceBool) { + $state.go('dashboard.service'); + } + } } - } -}]); + ]); })(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/service/service.html b/client/cat3/src/partials/sections/dashboard/service/service.html new file mode 100644 index 000000000..31e898ca6 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/service/service.html @@ -0,0 +1,13 @@ + + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/service/service.js b/client/cat3/src/partials/sections/dashboard/service/service.js new file mode 100644 index 000000000..929e302a1 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/service/service.js @@ -0,0 +1,7 @@ +(function (angular) { + "use strict"; + angular.module('dashboard.service', ['ngTouch', 'ui.grid']) + .controller('serviceCtrl',['$scope', '$rootScope', 'uiGridOptionsClient', 'uiGridConstants', 'workzoneServices', function ($scope, $rootScope, uiGridOptionsClient, uiGridConstants, workzoneServices) { + + }]); +})(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/service/service.scss b/client/cat3/src/partials/sections/dashboard/service/service.scss new file mode 100644 index 000000000..cf8c2d7cf --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/service/service.scss @@ -0,0 +1,311 @@ +@import '../../../theme'; + +/*==== OVERRIDINGS (angular-strap-docs.css) ===========*/ +@media (max-width: 320px) { + #analyticsPage { + .panelRight { + padding-left: 1px; + + #rightPanel { + padding-top: 2px; + + .nav-tabs { + font-size: 10px; + } + + .nav>li>a { + padding: 10px 8px; + } + } + } + } +} + +@media (min-width: 321px) and (max-width : 480px) { + #analyticsPage { + .panelRight { + #rightPanel { + padding-top: 2px; + + .nav-tabs { + font-size: 12px; + } + + .nav>li>a { + padding: 4px 8px; + } + } + } + } +} + +@media (min-width : 0px) and (max-width: 767px) { + #analyticsPage { + .panelLeft { + width: 100%; + padding-left: 0px; + position: absolute; + } + + .panelRight { + width: 100%; + padding-left: 5px; + padding-right: 0px; + } + } +} + +@media (min-width : 767px) { + .panelRight { + padding-left: 5px; + } +} + +@media (min-width : 768px) and (max-width: 991px) { + #analyticsPage { + .panelLeft { + width: 254px; + } + + .panelRight { + padding-left: 5px; + padding-right: 0px; + float: right; + } + } +} + +@media (min-width:1500px){ + #section-name { + width: 11.2%; + } +} +#analyticsPage .nvd3 .nv-groups path.nv-line { + stroke-width: 3px !important; +} +.usage{ + .top-stats{ + text-align: right; + } +} + +.top-stats{ + margin: 0px 0px 15px; + .box-title{ + font-size: 16px; + .red{ + font-size: 22px; + } + } + .badge{ + margin-right: 2px; + background: #40baf1; + padding: 3px 10px; + margin-top: -5px; + } + .select2{ + width: auto; + height: 31px; + display: table-cell; + } +} + +#analyticsPage { + background: #fff; + .panelLeft { + width: 100%; + padding-left: 0px; + } + + .panelRight { + width: 100%; + background: linear-gradient(to right, #ffffff 99%, #ffffff 100%) repeat scroll 0 0 rgba(0, 0, 0, 0); + padding-right: 10px; + height: 571px; + overflow-y: auto; + } + + #rightPanel { + padding-top: 0px; + + .nav-tabs { + .dropdown-menu { + li { + a:hover { + background: #3276b1; + color: #fff; + } + } + li.active { + a { + background: #3276b1; + } + } + .active>a>.fa { + color: #fff; + } + li>a>.fa { + color: #333; + } + } + } + } + + #myTab3, .dropdown-menu { + font-size: 12px; + } + + .nav-tabs .dropdown-menu { + left: 0px; + } + + #mytab3 .InfrastructureLocalStorage .dropdown-menu .nav-tabs>li.active>a { + margin-bottom: -1px; + cursor: pointer; + background: #40BAF1; + } + + .nav-tabs>li.active>a:first-child { + color: #337ab7; + } + + .nav-tabs { + border-bottom-width: 1px; + @include theme-border-color; + + li { + margin-bottom: -1px; + cursor: pointer; + } + + li.active { + a, a:hover { + border-bottom-width: 0px; + border-top-width: 3px; + @include theme-border-color; + background: #fcfcfc; + } + } + } + + /*===== end of overridings =====*/ + .tab-pane { + .am-fade { + animation-duration: .3s; + animation-timing-function: ease; + animation-fill-mode: backwards; + opacity: 1; + + .active-remove { + display: none; + } + + .active-add { + animation-name: fadeIn; + } + } + } +} + + +#analyticsPage { + .filter-btn { + margin: 9px 10px 0 0; + } + + #sidebar-wrapper { + padding: 10px 7px 0 7px; + min-height: 80%; + top: 121px; + + .repo-job-details-wrapper { + padding: 0.05em 0.625em 0.25em; + } + + .marginbottom5 { + margin-bottom: 5px; + } + + .search { + width: 100%; + position: relative; + font-size: 18px; + padding-top: 0px; + label { + position: absolute; + left: 10px; + top: 4px; + } + } + + .search .search-input, .search .hint { + padding-left: 23px; + padding-right: -5px; + border-radius: 23px; + height: 28px; + outline: none; + font-size: 11px; + } + + .bp-select { + font-size: 11px; + height: 28px; + display: inline; + width: auto; + } + + .bp-panel-body { + max-height: 105px; + min-height: 80px; + overflow-y: auto; + } + + .activeLi { + background: #E2E2E2; + } + + .list-resources{ + padding: 0px; + ul li { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + padding: 3px 15px; + } + } + + .panel-heading { + height: 40px; + } + } + + .nav>li>a { + padding: 10px 7px; + font-size: 13px; + } + + .filter-title { + margin-top: -13px; + font-size: 12px; + } + + .filter-name { + margin-top: -21px; + } + + .selected { + background: #E49C25; + } +} +.nv-axislabel{ + font-size: 14px !important; +} +.nvd3 text { + font: normal 10px Arial; +} +.font-size-15{ + font-size: 15px !important; +} +.marginbottom10{ + margin-bottom: 10px !important; +} \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/service/view/serviceTreeMenu.html b/client/cat3/src/partials/sections/dashboard/service/view/serviceTreeMenu.html new file mode 100644 index 000000000..3d1f51af9 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/service/view/serviceTreeMenu.html @@ -0,0 +1,59 @@ + + + +
    + +
    + + + From a078c20433d8c4a0ffef3e0fde2f5c8bc70fe342 Mon Sep 17 00:00:00 2001 From: VIJAYKUMARNINGANURE Date: Wed, 19 Oct 2016 15:26:36 +0530 Subject: [PATCH 18/32] Implemnetd the Bot type lists and Tagging server list --- client/cat3/src/factory/workzoneServices.js | 4 +++ .../orchestration/popups/newTaskCtrl.js | 34 +++++++++++------- client/htmls/private/js/dev/awsProduction.js | 1 + server/app/model/blueprint/blueprint.js | 20 ++++++++++- server/app/model/classes/tasks/tasks.js | 17 +++++++++ server/app/routes/v1.0/routes.js | 3 ++ server/app/routes/v1.0/routes_blueprints.js | 31 ++++++++++------ server/app/routes/v1.0/routes_config_data.js | 36 +++++++++++++++++++ server/app/routes/v1.0/routes_d4dMasters.js | 7 ---- .../app/routes/v1.0/routes_organizations.js | 2 ++ server/app/routes/v1.0/routes_tasks.js | 22 ++++++++++++ server/install.js | 1 + 12 files changed, 148 insertions(+), 30 deletions(-) create mode 100644 server/app/routes/v1.0/routes_config_data.js diff --git a/client/cat3/src/factory/workzoneServices.js b/client/cat3/src/factory/workzoneServices.js index c3bca326a..5c4f01bcb 100644 --- a/client/cat3/src/factory/workzoneServices.js +++ b/client/cat3/src/factory/workzoneServices.js @@ -527,6 +527,10 @@ getUnassignedInstances:function (providerId) { var url ='/providers/'+providerId+'/unassigned-instances'; return $http.get(fullUrl(url),Auth.getHeaderObject()); + }, + getBotTypeList:function () { + var url ='/config-data/bot-type'; + return $http.get(fullUrl(url),Auth.getHeaderObject()); } }; return serviceInterface; diff --git a/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTaskCtrl.js b/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTaskCtrl.js index 2c1b5ddec..88d673ae0 100644 --- a/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTaskCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/workzone/orchestration/popups/newTaskCtrl.js @@ -176,6 +176,11 @@ var idx = $scope.jenkinsParamsList.indexOf(params); $scope.jenkinsParamsList.splice(idx,1); }, + botTypeList : function() { + workzoneServices.getBotTypeList().then(function (response) { + $scope.botTypeList = response; + }); + }, removeScriptParams: function (scriptObject,params) { var idx = $scope.scriptParamsObj[scriptObject].indexOf(params); $scope.scriptParamsObj[scriptObject].splice(idx,1); @@ -253,18 +258,23 @@ }, ok: function () { //these values are common across all task types - var taskJSON = { - taskType: $scope.taskType, - name: $scope.name, - botType: $scope.botType, - shortDesc: $scope.shortDesc, - description: $scope.description - }; + var taskJSON={} if($scope.checkBotType){ - taskJSON.botType = $scope.botType; - taskJSON.shortDesc= $scope.shortDesc; + taskJSON = { + taskType: $scope.taskType, + name: $scope.name, + description: $scope.description, + botType:$scope.botType, + shortDesc:$scope.shortDesc, + serviceDeliveryCheck:$scope.checkBotType + }; $scope.taskSaving = true; }else{ + taskJSON = { + taskType: $scope.taskType, + name: $scope.name, + description: $scope.description + }; $scope.taskSaving = true; } //checking for name of the task @@ -580,12 +590,12 @@ $scope.description = items.description; $scope.taskType = items.taskType; $scope.name = items.name; - if(items.shortDesc && (items.shortDesc !== '' || items.shortDesc !== null)){ + if(items.serviceDeliveryCheck && items.serviceDeliveryCheck === true){ $scope.checkBotStatus = true; $scope.checkBotType = true; + $scope.botType = items.botType; + $scope.shortDesc = items.shortDesc; } - $scope.botType = items.botType; - $scope.shortDesc = items.shortDesc; //properties specific to jenkins if (items.taskType === "jenkins") { $scope.jobUrl = items.taskConfig.jobURL; diff --git a/client/htmls/private/js/dev/awsProduction.js b/client/htmls/private/js/dev/awsProduction.js index a3df1df9e..9105be6ae 100644 --- a/client/htmls/private/js/dev/awsProduction.js +++ b/client/htmls/private/js/dev/awsProduction.js @@ -1558,6 +1558,7 @@ var saveblueprint = function(tempType) { if ($('#serviceDeliveryCheck').prop("checked")) { reqBody.botType = $('#botType').val(); reqBody.shortDesc = $('#shortDesc').val(); + reqBody.serviceDeliveryCheck = true; } var imageIdentifier = $('#imageId').val(); var imageId = $('#imageId').find('option:selected').attr('_id'); diff --git a/server/app/model/blueprint/blueprint.js b/server/app/model/blueprint/blueprint.js index f894cd8c2..bb068a25f 100755 --- a/server/app/model/blueprint/blueprint.js +++ b/server/app/model/blueprint/blueprint.js @@ -161,6 +161,10 @@ var BlueprintSchema = new Schema({ }, botType: { type: String + }, + serviceDeliveryCheck: { + type: Boolean, + default:false } }); @@ -442,7 +446,8 @@ BlueprintSchema.statics.createNew = function(blueprintData, callback) { parentId: blueprintData.id, domainNameCheck: blueprintData.domainNameCheck, shortDesc:blueprintData.shortDesc, - botType:blueprintData.botType + botType:blueprintData.botType, + serviceDeliveryCheck:blueprintData.serviceDeliveryCheck }; var blueprint = new Blueprints(blueprintObj); logger.debug(blueprint); @@ -974,6 +979,19 @@ BlueprintSchema.statics.getBlueprintsByOrgBgProject = function(jsonData, callbac }; + +BlueprintSchema.statics.getBlueprintsServiceDeliveryCheck = function(serviceDeliveryCheck, callback) { + this.find({serviceDeliveryCheck:serviceDeliveryCheck}, function(err, blueprints) { + if (err) { + callback(err, null); + return; + } + callback(null, blueprints); + return; + }); + +}; + BlueprintSchema.statics.getBlueprintsByOrgBgProjectProvider = function(jsonData, callback) { var queryObj = { orgId: jsonData.orgId, diff --git a/server/app/model/classes/tasks/tasks.js b/server/app/model/classes/tasks/tasks.js index 829c08d20..85ded6e7b 100755 --- a/server/app/model/classes/tasks/tasks.js +++ b/server/app/model/classes/tasks/tasks.js @@ -91,6 +91,10 @@ var taskSchema = new Schema({ description: { type: String }, + serviceDeliveryCheck: { + type: Boolean, + default:false + }, jobResultURLPattern: { type: [String] }, @@ -565,6 +569,18 @@ taskSchema.statics.getScriptTypeTask = function(callback){ }); }; +taskSchema.statics.getTasksServiceDeliveryCheck = function(serviceDeliveryCheck, callback) { + this.find({serviceDeliveryCheck:serviceDeliveryCheck}, function(err, tasks) { + if (err) { + callback(err, null); + return; + } + callback(null, tasks); + return; + }); +}; + + taskSchema.statics.getTaskById = function(taskId, callback) { this.find({ "_id": new ObjectId(taskId) @@ -680,6 +696,7 @@ taskSchema.statics.updateTaskById = function(taskId, taskData, callback) { taskType: taskData.taskType, shortDesc: taskData.shortDesc, botType: taskData.botType, + serviceDeliveryCheck:taskData.serviceDeliveryCheck, description: taskData.description, jobResultURLPattern: taskData.jobResultURL, blueprintIds: taskData.blueprintIds diff --git a/server/app/routes/v1.0/routes.js b/server/app/routes/v1.0/routes.js index ee2f00cd0..7b8bf7057 100755 --- a/server/app/routes/v1.0/routes.js +++ b/server/app/routes/v1.0/routes.js @@ -73,6 +73,7 @@ var auditTrail = require('./routes_audit_trails'); var scripts = require('./routes_scripts'); var fileUpload = require('./routes_fileUpload'); var settingWizard = require('./routes_setting_wizard'); +var configData = require('./routes_config_data'); /* * @TODO * Change app to router in internal routes files @@ -181,6 +182,8 @@ module.exports.setRoutes = function(app) { settingWizard.setRoutes(app, sessionVerificationFunc); + configData.setRoutes(app, sessionVerificationFunc); + app.get('/', function(req, res) { res.redirect('/cat3'); diff --git a/server/app/routes/v1.0/routes_blueprints.js b/server/app/routes/v1.0/routes_blueprints.js index 4a28cd542..ef193cb6d 100755 --- a/server/app/routes/v1.0/routes_blueprints.js +++ b/server/app/routes/v1.0/routes_blueprints.js @@ -55,6 +55,25 @@ var blueprintService = require('_pr/services/blueprintService.js'); module.exports.setRoutes = function(app, sessionVerificationFunc) { app.all('/blueprints/*', sessionVerificationFunc); + app.get('/blueprints/serviceDelivery', function(req, res) { + var serviceDeliveryCheck = false; + if(req.query.serviceDeliveryCheck && + (req.query.serviceDeliveryCheck === 'true' || req.query.serviceDeliveryCheck === true)) { + serviceDeliveryCheck = true; + } + + Blueprints.getBlueprintsServiceDeliveryCheck(serviceDeliveryCheck, function(err, blueprints) { + if (err) { + res.status(500).send({ + code: 500, + errMessage: "Blueprints fetch failed." + }); + return; + } + res.status(200).send(blueprints); + }); + }); + // This post() Not in use app.post('/blueprints', function(req, res) { logger.debug("Enter post() for /blueprints"); @@ -527,10 +546,7 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { var orgId = req.params.orgId; var bgId = req.params.bgId; var projectId = req.params.projectId; - var serviceDeliveryCheck = false; - if(req.query.serviceDeliveryCheck){ - serviceDeliveryCheck = req.query.serviceDeliveryCheck; - } + if (!orgId || !bgId || !projectId) { res.status(400).send("Either orgId or bgId or projectId missing."); return; @@ -541,11 +557,6 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { jsonData['bgId'] = bgId; jsonData['projectId'] = projectId; - if(serviceDeliveryCheck === 'true' || serviceDeliveryCheck === true){ - jsonData['botType'] = {$ne:null}; - jsonData['shortDesc'] = {$ne:null}; - } - Blueprints.getBlueprintsByOrgBgProject(jsonData, function(err, blueprints) { if (err) { res.status(500).send({ @@ -557,4 +568,4 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) { res.status(200).send(blueprints); }); }); -}; \ No newline at end of file +}; diff --git a/server/app/routes/v1.0/routes_config_data.js b/server/app/routes/v1.0/routes_config_data.js new file mode 100644 index 000000000..8c09d31b1 --- /dev/null +++ b/server/app/routes/v1.0/routes_config_data.js @@ -0,0 +1,36 @@ +/* + 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 appConfig = require('_pr/config'); +var logger = require('_pr/logger')(module); + + +module.exports.setRoutes = function(app, sessionVerification) { + + app.all('/config-data/*', sessionVerification); + + // Tagging Server List + app.get('/config-data/tagging-server', function(req, res) { + var serverList = appConfig.taggingServerList; + res.send(serverList); + }); + + // Bot Type List + app.get('/config-data/bot-type', function(req, res) { + var botTypeList = appConfig.botTypeList; + res.send(botTypeList); + }); +} \ No newline at end of file diff --git a/server/app/routes/v1.0/routes_d4dMasters.js b/server/app/routes/v1.0/routes_d4dMasters.js index 6a28e0fb6..c31e50ef2 100755 --- a/server/app/routes/v1.0/routes_d4dMasters.js +++ b/server/app/routes/v1.0/routes_d4dMasters.js @@ -4019,11 +4019,4 @@ module.exports.setRoutes = function(app, sessionVerification) { } }); }); - - // Tagging Server List - app.get('/d4dMasters/taggingServerList', function(req, res) { - var serverList = appConfig.taggingServerList; - res.send(serverList); - }); - } \ No newline at end of file diff --git a/server/app/routes/v1.0/routes_organizations.js b/server/app/routes/v1.0/routes_organizations.js index 8a1f32f80..9492bd8a5 100755 --- a/server/app/routes/v1.0/routes_organizations.js +++ b/server/app/routes/v1.0/routes_organizations.js @@ -681,6 +681,7 @@ module.exports.setRoutes = function(app, sessionVerification) { var blueprintId = req.body.blueprintData.blueprintId; var shortDesc = req.body.blueprintData.shortDesc; var botType = req.body.blueprintData.botType; + var serviceDeliveryCheck = req.body.blueprintData.serviceDeliveryCheck; if(req.body.blueprintData.domainNameCheck === 'true'){ domainNameCheck = true; } @@ -729,6 +730,7 @@ module.exports.setRoutes = function(app, sessionVerification) { docker: docker, shortDesc:shortDesc, botType:botType, + serviceDeliveryCheck:serviceDeliveryCheck, domainNameCheck:domainNameCheck }; //adding bluerpintID if present (edit mode) diff --git a/server/app/routes/v1.0/routes_tasks.js b/server/app/routes/v1.0/routes_tasks.js index bb1eab464..ed43ab567 100755 --- a/server/app/routes/v1.0/routes_tasks.js +++ b/server/app/routes/v1.0/routes_tasks.js @@ -38,6 +38,24 @@ var fileIo = require('_pr/lib/utils/fileio'); module.exports.setRoutes = function(app, sessionVerification) { app.all('/tasks/*', sessionVerification); + app.get('/tasks/serviceDelivery', function(req, res) { + var serviceDeliveryCheck = false; + if(req.query.serviceDeliveryCheck && + (req.query.serviceDeliveryCheck === 'true' || req.query.serviceDeliveryCheck === true)) { + serviceDeliveryCheck = true; + } + Tasks.getTasksServiceDeliveryCheck(serviceDeliveryCheck, function(err, tasks) { + if (err) { + res.status(500).send({ + code: 500, + errMessage: "Task fetch failed." + }); + return; + } + res.status(200).send(tasks); + }); + }); + app.get('/tasks/history/list/all', function(req, res) { logger.debug("------------------ ",JSON.stringify(TaskHistory)); TaskHistory.listHistory(function(err, tHistories) { @@ -574,6 +592,8 @@ module.exports.setRoutes = function(app, sessionVerification) { }); }); + + }; function encryptedParam(paramDetails,existingParams,callback){ @@ -612,3 +632,5 @@ function encryptedParam(paramDetails,existingParams,callback){ })(paramDetails[i]); } } + + diff --git a/server/install.js b/server/install.js index 446fc3e16..3096afe21 100755 --- a/server/install.js +++ b/server/install.js @@ -129,6 +129,7 @@ function getDefaultsConfig() { } }, taggingServerList: ['Sensu Server','LDAP Server','AD Server'], + botTypeList: ['Task','Check','Learning', 'Composite','Built with other'], aws: { pemFileLocation: __dirname + '/app/config/', s3BucketDownloadFileLocation: currentDirectory + '/catdata/catalyst/temp/', From 9f484276821bb846e5295a63065336bb7ffc43f5 Mon Sep 17 00:00:00 2001 From: hrushikesh07 Date: Wed, 19 Oct 2016 18:05:17 +0530 Subject: [PATCH 19/32] New base and pages for bots --- client/cat3/Gruntfile.js | 2 +- client/cat3/main.html | 3 +- client/cat3/src/clientRoutes.js | 8 ++-- client/cat3/src/partials/global.scss | 2 + .../sections/dashboard/bots/bots.html | 14 +++++++ .../{service/service.scss => bots/bots.scss} | 0 .../sections/dashboard/bots/botsCtrl.js | 29 ++++++++++++++ .../dashboard/bots/controller/libraryCtrl.js | 38 ++++++++++++++++++ .../view/botsTreeMenu.html} | 40 +++++-------------- .../sections/dashboard/bots/view/library.html | 2 + .../sections/dashboard/dashboardCtrl.js | 2 +- .../sections/dashboard/service/service.html | 13 ------ .../sections/dashboard/service/service.js | 7 ---- client/htmls/private/index.html | 25 +++++++++++- 14 files changed, 128 insertions(+), 57 deletions(-) create mode 100644 client/cat3/src/partials/sections/dashboard/bots/bots.html rename client/cat3/src/partials/sections/dashboard/{service/service.scss => bots/bots.scss} (100%) create mode 100644 client/cat3/src/partials/sections/dashboard/bots/botsCtrl.js create mode 100644 client/cat3/src/partials/sections/dashboard/bots/controller/libraryCtrl.js rename client/cat3/src/partials/sections/dashboard/{service/view/serviceTreeMenu.html => bots/view/botsTreeMenu.html} (50%) create mode 100644 client/cat3/src/partials/sections/dashboard/bots/view/library.html delete mode 100644 client/cat3/src/partials/sections/dashboard/service/service.html delete mode 100644 client/cat3/src/partials/sections/dashboard/service/service.js diff --git a/client/cat3/Gruntfile.js b/client/cat3/Gruntfile.js index 8028c9b59..06a759423 100644 --- a/client/cat3/Gruntfile.js +++ b/client/cat3/Gruntfile.js @@ -89,7 +89,7 @@ module.exports = function(grunt) { {'catalyst/partials/sections/dashboard/workzone/orchestration/orchestration.css':'src/partials/sections/dashboard/workzone/orchestration/orchestration.scss'}, {'catalyst/partials/sections/dashboard/workzone/application/application.css':'src/partials/sections/dashboard/workzone/application/application.scss'}, {'catalyst/partials/sections/dashboard/analytics/analytics.css':'src/partials/sections/dashboard/analytics/analytics.scss'}, - {'catalyst/partials/sections/dashboard/service/service.css':'src/partials/sections/dashboard/service/service.scss'}, + {'catalyst/partials/sections/dashboard/bots/bots.css':'src/partials/sections/dashboard/bots/bots.scss'}, {'catalyst/partials/sections/dashboard/setting/setting.css':'src/partials/sections/dashboard/setting/setting.scss'} ] } diff --git a/client/cat3/main.html b/client/cat3/main.html index 928f4c73a..476a55985 100644 --- a/client/cat3/main.html +++ b/client/cat3/main.html @@ -102,7 +102,8 @@ - + + diff --git a/client/cat3/src/clientRoutes.js b/client/cat3/src/clientRoutes.js index 9d2e187d3..d9a6198b2 100644 --- a/client/cat3/src/clientRoutes.js +++ b/client/cat3/src/clientRoutes.js @@ -88,10 +88,10 @@ function routeConfig($stateProvider, $urlRouterProvider, $httpProvider, modulePe }] } - }).state('dashboard.service', { - url: "/service/", - templateUrl: "src/partials/sections/dashboard/service/service.html", - controller: "serviceCtrl", + }).state('dashboard.bots', { + url: "/bots", + templateUrl: "src/partials/sections/dashboard/bots/bots.html", + controller: "botsCtrl as bts", resolve: { auth: ["$q", function ($q) { var deferred = $q.defer(); diff --git a/client/cat3/src/partials/global.scss b/client/cat3/src/partials/global.scss index 7a29b39c0..d5b0a1221 100644 --- a/client/cat3/src/partials/global.scss +++ b/client/cat3/src/partials/global.scss @@ -112,6 +112,7 @@ $imagePath : "../../../../../../cat3/images"; z-index: 10; transition: all .4s ease 0s; left: -254px; + height: 100%; &.show-left-tree { left: 0px; @@ -121,6 +122,7 @@ $imagePath : "../../../../../../cat3/images"; background: linear-gradient(to right, #2c3638 99%, #2c3638 100%); color: #fff; overflow-y: auto; + height: 100%; } div[data-angular-treeview] { diff --git a/client/cat3/src/partials/sections/dashboard/bots/bots.html b/client/cat3/src/partials/sections/dashboard/bots/bots.html new file mode 100644 index 000000000..f2dec4d06 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/bots/bots.html @@ -0,0 +1,14 @@ + + +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/service/service.scss b/client/cat3/src/partials/sections/dashboard/bots/bots.scss similarity index 100% rename from client/cat3/src/partials/sections/dashboard/service/service.scss rename to client/cat3/src/partials/sections/dashboard/bots/bots.scss diff --git a/client/cat3/src/partials/sections/dashboard/bots/botsCtrl.js b/client/cat3/src/partials/sections/dashboard/bots/botsCtrl.js new file mode 100644 index 000000000..fb1542003 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/bots/botsCtrl.js @@ -0,0 +1,29 @@ +(function (angular) { + "use strict"; + angular.module('dashboard.bots', ['library.bots']).config(['$stateProvider', '$urlRouterProvider', '$httpProvider', 'modulePermissionProvider', function($stateProvider, $urlRouterProvider, $httpProvider, modulePermissionProvider) { + var modulePerms = modulePermissionProvider.$get(); + $stateProvider.state('dashboard.bots.library', { + url: "/library", + templateUrl: "src/partials/sections/dashboard/bots/view/library.html", + controller: "libraryCtrl as libr", + 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; + }] + } + }) + }]) + .controller('botsCtrl',['$scope', '$rootScope','$state', function ($scope, $rootScope,$state) { + var treeNames = ['Bots']; + $rootScope.$emit('treeNameUpdate', treeNames); + $state.go('dashboard.bots.library'); + }]); +})(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/bots/controller/libraryCtrl.js b/client/cat3/src/partials/sections/dashboard/bots/controller/libraryCtrl.js new file mode 100644 index 000000000..e28d40b6d --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/bots/controller/libraryCtrl.js @@ -0,0 +1,38 @@ +(function (angular) { + "use strict"; + angular.module('library.bots', []) + .controller('libraryCtrl',['$scope', '$rootScope','$state','genericServices', function ($scope, $rootScope,$state,genSevs) { + var treeNames = ['Bots','Library']; + $rootScope.$emit('treeNameUpdate', treeNames); + var lib=this; + lib.gridOptions={ + gridOption:{ + paginationPageSizes: [25, 50, 75], + paginationPageSize: 25, + enableColumnMenus:false, + multiSelect :false, + }, + columnDefs: [ + { name: 'type'}, + { name: 'name'}, + { name: 'description'}, + { name: 'run Bot' }, + { name: 'history' }, + { name: 'last run'}, + { name: 'bot Action'} + ], + data:[{},{}] + }; + + lib.int =function(){ + var param={ + url:'/config-data/bot-type' + }; + genSevs.promiseGet(param).then(function (result) { + + }); + }; + lib.int(); + + }]); +})(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/service/view/serviceTreeMenu.html b/client/cat3/src/partials/sections/dashboard/bots/view/botsTreeMenu.html similarity index 50% rename from client/cat3/src/partials/sections/dashboard/service/view/serviceTreeMenu.html rename to client/cat3/src/partials/sections/dashboard/bots/view/botsTreeMenu.html index 3d1f51af9..b796404bd 100644 --- a/client/cat3/src/partials/sections/dashboard/service/view/serviceTreeMenu.html +++ b/client/cat3/src/partials/sections/dashboard/bots/view/botsTreeMenu.html @@ -1,7 +1,7 @@ -
    +
    - - - diff --git a/client/cat3/src/partials/sections/dashboard/bots/view/library.html b/client/cat3/src/partials/sections/dashboard/bots/view/library.html new file mode 100644 index 000000000..32fc54891 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/bots/view/library.html @@ -0,0 +1,2 @@ +
    +
    \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/dashboardCtrl.js b/client/cat3/src/partials/sections/dashboard/dashboardCtrl.js index bca69a726..972322e1a 100644 --- a/client/cat3/src/partials/sections/dashboard/dashboardCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/dashboardCtrl.js @@ -8,7 +8,7 @@ 'dashboard.track', 'dashboard.settings', 'dashboard.design', - 'dashboard.service', + 'dashboard.bots', 'apis.workzone','dashboard.genericServices']) .controller('dashboardCtrl', ['$rootScope', '$scope', '$http', 'uac', '$location', '$state', function ($rootScope, $scope, $http, uac, $location, $state) { $rootScope.isBreadCrumbAvailable = true; diff --git a/client/cat3/src/partials/sections/dashboard/service/service.html b/client/cat3/src/partials/sections/dashboard/service/service.html deleted file mode 100644 index 31e898ca6..000000000 --- a/client/cat3/src/partials/sections/dashboard/service/service.html +++ /dev/null @@ -1,13 +0,0 @@ - - -
    -
    -
    -
    - -
    -
    - -
    -
    -
    \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/service/service.js b/client/cat3/src/partials/sections/dashboard/service/service.js deleted file mode 100644 index 929e302a1..000000000 --- a/client/cat3/src/partials/sections/dashboard/service/service.js +++ /dev/null @@ -1,7 +0,0 @@ -(function (angular) { - "use strict"; - angular.module('dashboard.service', ['ngTouch', 'ui.grid']) - .controller('serviceCtrl',['$scope', '$rootScope', 'uiGridOptionsClient', 'uiGridConstants', 'workzoneServices', function ($scope, $rootScope, uiGridOptionsClient, uiGridConstants, workzoneServices) { - - }]); -})(angular); \ No newline at end of file diff --git a/client/htmls/private/index.html b/client/htmls/private/index.html index 6844429b9..c6ef0f064 100644 --- a/client/htmls/private/index.html +++ b/client/htmls/private/index.html @@ -53,6 +53,13 @@   ANALYTICS
  • + + + @@ -799,7 +806,23 @@