Skip to content

Commit

Permalink
Related-Bug:#1581650
Browse files Browse the repository at this point in the history
Incorporated the review comments of last commit except common legend function for all charts.

Change-Id: I35a8dc18c424cdffc102ce3b0300740325ec57e2
  • Loading branch information
vishnuvv committed May 18, 2016
1 parent 0a98e63 commit d3f7d5f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 23 deletions.
6 changes: 0 additions & 6 deletions webroot/common/ui/js/controller.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,6 @@ define([
this.TRACEFLOW_INTERVAL = 5;
this.UNDERLAY_FLOW_INFO_TEMPLATE = "flow-info-template";

//Config Summary page Constants
this.CONFIGNODESTATS_BUCKET_DURATION = 240000000;
this.CONFIGNODE_COLORS = ['#b0c8c3', '#bf94e0', '#5d6e7e', '#b2a198', '#eccc9b'];
this.CONFIGNODE_FAILEDREQUESTS_TITLE = 'Failed Requests';
this.CONFIGNODE_FAILEDREQUESTS_COLOR = '#d95436';

this.getProjectsURL = function (domainObj, dropdownOptions) {
/* Default: get projects from keystone or API Server as specified in
* config.global.js, getDomainProjectsFromApiServer is true, then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ define([

this.HOST_DPDK = 'HOST_DPDK';

//Config Summary page Constants
this.CONFIGNODESTATS_BUCKET_DURATION = 240000000;
this.CONFIGNODE_COLORS = ['#b0c8c3', '#bf94e0', '#5d6e7e', '#b2a198', '#eccc9b'];
this.CONFIGNODE_FAILEDREQUESTS_TITLE = 'Failed Requests';
this.CONFIGNODE_FAILEDREQUESTS_COLOR = '#d95436';

this.monitorInfraUrls = {
TENANT_API_URL : "/api/tenant/get-data",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,16 +699,16 @@ define(
return retArr;

};

this.bucketizeConfigNodeStats = function (apiStats, bucketDuration) {
bucketDuration = ifNull(bucketDuration, ctwc.CONFIGNODESTATS_BUCKET_DURATION);
bucketDuration = ifNull(bucketDuration, monitorInfraConstants.CONFIGNODESTATS_BUCKET_DURATION);
var minMaxTS = d3.extent(apiStats,function(obj){
return obj['T'];
});
//If only 1 value extend the range by 10 mins on both sides
if(minMaxTS[0] == minMaxTS[1]) {
minMaxTS[0] -= ctwc.CONFIGNODESTATS_BUCKET_DURATION;
minMaxTS[1] += ctwc.CONFIGNODESTATS_BUCKET_DURATION;
minMaxTS[0] -= monitorInfraConstants.CONFIGNODESTATS_BUCKET_DURATION;
minMaxTS[1] += monitorInfraConstants.CONFIGNODESTATS_BUCKET_DURATION;
}
/* Bucketizes timestamp every 10 minutes */
var xBucketScale = d3.scale.quantize().domain(minMaxTS).range(d3.range(minMaxTS[0],minMaxTS[1], bucketDuration));
Expand All @@ -726,15 +726,15 @@ define(
});
return buckets;
};

this.parseConfigNodeRequestsStackChartData = function (apiStats) {
var cf =crossfilter(apiStats);
var parsedData = [];
var timeStampField = 'T';
var groupDim = cf.dimension(function(d) { return d["Source"];});
var tsDim = cf.dimension(function(d) { return d[timeStampField];});
var buckets = this.bucketizeConfigNodeStats(apiStats);
var colorCodes = ctwc.CONFIGNODE_COLORS;
var colorCodes = monitorInfraConstants.CONFIGNODE_COLORS;
colorCodes = colorCodes.slice(0, groupDim.group().all().length);
//Now parse this data to be usable in the chart
var parsedData = [];
Expand Down Expand Up @@ -778,10 +778,10 @@ define(
totalReqs += reqCntData[j]['value']
}
counts.push({
name: ctwc.CONFIGNODE_FAILEDREQUESTS_TITLE,
name: monitorInfraConstants.CONFIGNODE_FAILEDREQUESTS_TITLE,
totalReqs: totalReqs,
totalFailedReq: totalFailedReqs,
color: ctwc.CONFIGNODE_FAILEDREQUESTS_COLOR,
color: monitorInfraConstants.CONFIGNODE_FAILEDREQUESTS_COLOR,
y0: y0,
y1: y0 += totalFailedReqs
});
Expand All @@ -801,11 +801,15 @@ define(
failedReqPerNodePercent = Math.round((failedReqPerNode/nodeReqCnt) * 100);
}
var avgResTime = Math.round((ifNull(resTimeNodeMap[nodeName], 0)/nodeReqCnt)) / 1000; //Converting to millisecs
var toTime = new XDate(timestampExtent[0]/1000).toString('yyyy-MM-dd HH:mm');
var fromTime = new XDate(timestampExtent[1]/1000).toString('yyyy-MM-dd HH:mm');
counts.push({
name: nodeName,
color: colorCodes[j],
avgResTime: contrail.format('{0} {1}', avgResTime, 'ms'),
nodeReqCnt: nodeReqCnt,
reqFailPercent: failedReqPerNodePercent,
bucketDuration: contrail.format('{1} - {0}', fromTime, toTime),
y0:y0,
y1:y0 += nodeReqCnt
});
Expand All @@ -821,7 +825,7 @@ define(
};
this.parseConfigNodeResponseStackedChartData = function (apiStats) {
var buckets = this.bucketizeConfigNodeStats(apiStats, 600000000);
var colors = ctwc.CONFIGNODE_COLORS;
var colors = monitorInfraConstants.CONFIGNODE_COLORS;
var cf = crossfilter(apiStats);
var tsDim = cf.dimension(function (d) {return d.T});
var sourceDim = cf.dimension(function (d) {return d.Source});
Expand Down Expand Up @@ -889,7 +893,7 @@ define(
}
chartData.push(lineChartData);
return chartData;

};
this.parseConfigNodeRequestForDonutChart = function (apiStats, reqType) {
var cf = crossfilter(apiStats), parsedData = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,20 @@ define(['underscore', 'contrail-view',
right: 0,
bottom: 40
},
bucketSize: ctwc.CONFIGNODESTATS_BUCKET_DURATION/(1000 * 1000 * 60),//converting to minutes
bucketSize: monitorInfraConstants.CONFIGNODESTATS_BUCKET_DURATION/(1000 * 1000 * 60),//converting to minutes
sliceTooltipFn: function (data) {
var tooltipConfig = {};
if (data['name'] != ctwc.CONFIGNODE_FAILEDREQUESTS_TITLE) {
if (data['name'] != monitorInfraConstants.CONFIGNODE_FAILEDREQUESTS_TITLE) {
tooltipConfig['title'] = {
name : data['name'],
type : 'Config Node'
};
tooltipConfig['content'] = {
iconClass : false,
info : [{
label: 'Requests',
value: ifNull(data['nodeReqCnt'], '-')
}, {
label: 'Failed Requests (%)',
value: ifNull(data['reqFailPercent'], '-')
}, {
Expand Down Expand Up @@ -120,7 +123,7 @@ define(['underscore', 'contrail-view',
.attr('transform','translate('+(-10)+',0)')
.attr('class', 'contrail-legend')
.append('rect')
.style('fill', ctwc.CONFIGNODE_FAILEDREQUESTS_COLOR);
.style('fill', monitorInfraConstants.CONFIGNODE_FAILEDREQUESTS_COLOR);
legendWrap.append('g')
.attr('class', 'contrail-legend')
.attr('transform','translate('+(- 20)+',0)')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ define(['underscore', 'contrail-view'],function(_, ContrailView){
},
chartOptions: {
height: 160,
color: ctwc.CONFIGNODE_COLORS,
color: monitorInfraConstants.CONFIGNODE_COLORS,
margin: {
bottom: 10,
top: 10
Expand All @@ -51,7 +51,7 @@ define(['underscore', 'contrail-view'],function(_, ContrailView){
},
chartOptions: {
height: 160,
color: ctwc.CONFIGNODE_COLORS,
color: monitorInfraConstants.CONFIGNODE_COLORS,
margin: {
top: 10,
bottom: 10
Expand Down Expand Up @@ -81,7 +81,7 @@ define(['underscore', 'contrail-view'],function(_, ContrailView){
}).attr('class','contrail-legend')
.append('rect')
.attr('fill', function (d, i) {
return ctwc.CONFIGNODE_COLORS[i];
return monitorInfraConstants.CONFIGNODE_COLORS[i];
})
legendWrap.append('g')
.attr('transform', 'translate('+ (- ((data.length + 1) * 20 + 10))+',0)')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ define(
ctwl.MONITOR_INFRA_VIEW_PATH,
app : cowc.APP_CONTRAIL_CONTROLLER,
viewConfig: {

}
} ]
},{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ define(
var self = this,
viewConfig = this.attributes.viewConfig,
pagerOptions = viewConfig['pagerOptions'];
if (self.model == null) {
self.model = new ConfigNodeListModel();
}
this.renderView4Config(self.$el,
self.model,
getConfigNodeSummaryGridViewConfig(pagerOptions),
Expand Down

0 comments on commit d3f7d5f

Please sign in to comment.