Skip to content

Commit

Permalink
Closes-bug: #1489296, Closes-Bug: #1490736, Partial-Bug: #1490734
Browse files Browse the repository at this point in the history
Bootstrap Modal keyup issue
1. Fixed condition where modal onEnter action were getting called on hit of space bar key

Look and Feel for web-storage
1. Fixed legends visibility for LineCharts
2. Enhanced rendering for DonutChart and other basic look and feel
3. Fixed Detail Expansion advancedOption logic

Wizard related issues
1. Added a function check if the knockout binding exist
2. Enhanced contrailWizard to make sure that load events are called after init events

Change-Id: Iadba89354aa604a540e2033e5e17cbccde1fc951
  • Loading branch information
sgrgala committed Aug 31, 2015
1 parent 14bc7d0 commit 8e7241c
Show file tree
Hide file tree
Showing 14 changed files with 506 additions and 132 deletions.
15 changes: 8 additions & 7 deletions webroot/css/contrail.custom.css
Expand Up @@ -2027,7 +2027,6 @@ p.error, p.error-text {
.control-panel-items {
font-size: 15px;
width: 35px;
background-color: #F5F5F5;
}
.control-panel-items .control-panel-item i {
color: #777;
Expand All @@ -2041,9 +2040,10 @@ p.error, p.error-text {
cursor: default;
}
.control-panel-items .control-panel-item {
padding: 5px 10px;
border-top: 2px solid #fff;
border-bottom: 1px solid #dedede;
padding: 5px 10px;
margin: 5px 0 0;
background-color: #f9f9f9;
border: 1px solid #efefef;
}
.control-panel-items .dropdown-menu {
right: 2px;
Expand Down Expand Up @@ -2326,8 +2326,8 @@ p.error, p.error-text {
font-weight: normal;
}
.chart-container text.nv-requestState {
font-size: 18px;
fill: #555;
font-size: 16px;
fill: #777;
}
/* Chart Control styles */

Expand Down Expand Up @@ -2824,8 +2824,9 @@ p.error, p.error-text {
.chart-control-panel-expanded-container {
position: absolute;
right: -10px;
top: 5px;
width: 280px;
height: 224px;
height: 245px;
background-color: #fff;
border: 1px solid #ccc;
overflow-y: auto;
Expand Down
19 changes: 10 additions & 9 deletions webroot/css/contrail.layout.css
Expand Up @@ -2353,16 +2353,17 @@ button.btn:active {
.margin-left-21 {margin-left:21px !important;}

/* padding framework */
.padding-2 {padding:2px !important;}
.padding-2-0 {padding:2px 0 !important;}
.padding-5 {padding:5px !important;}
.padding-5-0 {padding:5px 0 !important;}
.padding-6-0 {padding:6px 0 !important;}
.padding-2 {padding: 2px !important;}
.padding-2-0 {padding: 2px 0 !important;}
.padding-3-0 {padding: 3px 0 !important;}
.padding-5 {padding: 5px !important;}
.padding-5-0 {padding: 5px 0 !important;}
.padding-6-0 {padding: 6px 0 !important;}
.padding-0-0-5 {padding: 0 0 5px !important;}
.padding-10 {padding:10px !important;}
.padding-10-0 {padding:10px 0 !important;}
.padding-15 {padding:15px !important;}
.padding-top-5{padding-top:5px !important;}
.padding-10 {padding: 10px !important;}
.padding-10-0 {padding: 10px 0 !important;}
.padding-15 {padding: 15px !important;}
.padding-top-5{padding-top: 5px !important;}

/* height framework */
.height-20 {height: 20px !important;}
Expand Down
5 changes: 5 additions & 0 deletions webroot/js/contrail-common.js
Expand Up @@ -29,6 +29,7 @@ function Contrail() {
return templates[key];

};

this.checkIfExist = function(value) {
var exist = true;
if(value == null || typeof value == "undefined") {
Expand All @@ -37,6 +38,10 @@ function Contrail() {
return exist;
};

this.checkIfKnockoutBindingExist = function (id) {
return this.checkIfExist(ko.dataFor(document.getElementById(id)))
};

this.handleIfNull = function(value, defaultValue) {
if(value == null || typeof value == 'undefined') {
return defaultValue;
Expand Down
83 changes: 57 additions & 26 deletions webroot/js/contrail-elements.js
Expand Up @@ -557,35 +557,63 @@
}

config.onInit = function (event, currentIndex) {
var onInitCompleteCBCalled = false,
onInitCompleteCB = function(currentStep, config) {
if (contrail.checkIfFunction(currentStep.onLoadFromPrevious)) {
currentStep.onLoadFromPrevious(config.params);
}
if (contrail.checkIfFunction(currentStep.onLoadFromNext)) {
currentStep.onLoadFromNext(config.params);
}
configureButton(currentStep.buttons);
};

$.each(steps, function(stepKey, stepValue){
if(contrail.checkIfFunction(stepValue.onInitWizard)) {
stepValue.onInitWizard(config.params);
if (contrail.checkIfFunction(stepValue.onInitWizard)) {
stepValue.onInitWizard(config.params, function() {
onInitCompleteCB(stepValue, config);
});
onInitCompleteCBCalled = true;
stepsInitFlag[stepKey] = true;
}
});

if(!stepsInitFlag[currentIndex]){
if(contrail.checkIfFunction(steps[currentIndex].onInitFromPrevious)) {
steps[currentIndex].onInitFromPrevious(config.params);
if (!stepsInitFlag[currentIndex]) {
if (contrail.checkIfFunction(steps[currentIndex].onInitFromPrevious)) {
steps[currentIndex].onInitFromPrevious(config.params, function() {
onInitCompleteCB(steps[currentIndex], config);
});
onInitCompleteCBCalled = true;
}
if(contrail.checkIfFunction(steps[currentIndex].onInitFromNext)) {
steps[currentIndex].onInitFromNext(config.params);
else if(contrail.checkIfFunction(steps[currentIndex].onInitFromNext)) {
steps[currentIndex].onInitFromNext(config.params, function() {
onInitCompleteCB(steps[currentIndex], config);
});
onInitCompleteCBCalled = true;
}
stepsInitFlag[currentIndex] = true;
}

if(contrail.checkIfFunction(steps[currentIndex].onLoadFromPrevious)) {
steps[currentIndex].onLoadFromPrevious(config.params);
if (!onInitCompleteCBCalled) {
onInitCompleteCB(steps[currentIndex], config)
}
if(contrail.checkIfFunction(steps[currentIndex].onLoadFromNext)) {
steps[currentIndex].onLoadFromNext(config.params);
}
configureButton(steps[currentIndex].buttons);

};

config.onStepChanged = function(event, currentIndex, priorIndex) {
var currentStepLiElement = self.find('.steps').find('li:eq(' + currentIndex + ')');
if(currentIndex < priorIndex) {
var currentStepLiElement = self.find('.steps').find('li:eq(' + currentIndex + ')'),
onInitCompleteCBCalled = false,
onInitCompleteCB = function(currentStep, config) {
if (currentIndex > priorIndex && contrail.checkIfFunction(currentStep.onLoadFromNext)) {
currentStep.onLoadFromNext(config.params);
}
else if (currentIndex < priorIndex && contrail.checkIfFunction(currentStep.onLoadFromPrevious)) {
currentStep.onLoadFromPrevious(config.params);
}
configureButton(currentStep.buttons);
};

if (currentIndex < priorIndex) {
self.find('.steps').find('li:eq(' + priorIndex + ')').removeClass('done');
currentStepLiElement.removeClass('completed');
}
Expand All @@ -597,22 +625,25 @@
}

if(!stepsInitFlag[currentIndex]) {
if(currentIndex > priorIndex && contrail.checkIfFunction(steps[currentIndex].onInitFromNext)) {
steps[currentIndex].onInitFromNext(config.params);
if (currentIndex > priorIndex && contrail.checkIfFunction(steps[currentIndex].onInitFromNext)) {
steps[currentIndex].onInitFromNext(config.params, function() {
onInitCompleteCB(steps[currentIndex], config)
});
onInitCompleteCBCalled = true;
}
else if(currentIndex < priorIndex && contrail.checkIfFunction(steps[currentIndex].onInitFromPrevious)) {
steps[currentIndex].onInitFromPrevious(config.params);
steps[currentIndex].onInitFromPrevious(config.params, function() {
onInitCompleteCB(steps[currentIndex], config)
});
onInitCompleteCBCalled = true;
}
stepsInitFlag[currentIndex] = true;
}

if(currentIndex > priorIndex && contrail.checkIfFunction(steps[currentIndex].onLoadFromNext)) {
steps[currentIndex].onLoadFromNext(config.params);
if(!onInitCompleteCBCalled) {
onInitCompleteCB(steps[currentIndex], config)
}
else if(currentIndex < priorIndex && contrail.checkIfFunction(steps[currentIndex].onLoadFromPrevious)) {
steps[currentIndex].onLoadFromPrevious(config.params);
}
configureButton(steps[currentIndex].buttons);

};

config.onStepChanging = function (event, currentIndex, newIndex) {
Expand Down Expand Up @@ -942,9 +973,9 @@
if (code == 13) {
e.preventDefault();
}
if (contrail.checkIfFunction(keyupAction.onKeyupEnter) && (code == 32 || code == 13 || code == 188 || code == 186)) {
if (contrail.checkIfFunction(keyupAction.onKeyupEnter) && code == 13) {
keyupAction.onKeyupEnter();
} else if (contrail.checkIfFunction(keyupAction.onKeyupEsc) && (code == 27)) {
} else if (contrail.checkIfFunction(keyupAction.onKeyupEsc) && code == 27) {
keyupAction.onKeyupEsc();
}
});
Expand Down
21 changes: 20 additions & 1 deletion webroot/js/core-formatters.js
Expand Up @@ -7,7 +7,10 @@ define([
], function (_) {
var CoreFormatters = function () {
var self = this;
this.getTextGenerator = function (formatterKey, value, obj) {
this.getTextGenerator = function (templateGeneratorConfig, key, obj) {
var formatterKey = templateGeneratorConfig.formatter,
value = cowu.getJSONValueByPath(key, obj);

switch (formatterKey) {
case 'byte' :
return cowu.addUnits2Bytes(value);
Expand Down Expand Up @@ -50,6 +53,22 @@ define([

break;

case 'health-status-state' :
var iconHTML = (contrail.checkIfExist(templateGeneratorConfig.iconClass) ?
'<i class="' + templateGeneratorConfig.iconClass + ' pull-right padding-3-0"></i>' : '');

if(value === 'critical') {
return '<span class="red '+ key + '-value">'
+ value + iconHTML +
'</span>';
} else if(value === 'ok') {
return '<span class="green">' + value + '</span>';
} else {
return value
}

break;

case 'alert-percentage' :
try {
if (value != null && value > 90) {
Expand Down
2 changes: 1 addition & 1 deletion webroot/js/core-utils.js
Expand Up @@ -502,7 +502,7 @@ define(['underscore'], function (_) {
this.generateDetailTemplateHTML = function (config, app, jsonString) {
var template = contrail.getTemplate4Id(cowc.TMPL_DETAIL_FOUNDATION),
templateObj = $(template(config)),
jsonValueString = contrail.handleIfNull(jsonString, '{{{formatGridJSON2HTML this.data}}}');
jsonValueString ='{{{formatGridJSON2HTML this.data' + (contrail.checkIfExist(jsonString) ? '.' + jsonString : '') + '}}}';

templateObj.find('.detail-foundation-content-basic').append(self.generateInnerTemplate(config, app));
templateObj.find('.detail-foundation-content-advanced').append(jsonValueString);
Expand Down
3 changes: 1 addition & 2 deletions webroot/js/handlebars-utils.js
Expand Up @@ -221,8 +221,7 @@ Handlebars.registerHelper('getValueByConfig', function (obj, options) {
switch (templateGenerator) {
case 'TextGenerator':
if (contrail.checkIfExist(templateGeneratorConfig)) {
var formatterKey = templateGeneratorConfig.formatter;
return cowf.getTextGenerator(formatterKey, value, obj);
return cowf.getTextGenerator(templateGeneratorConfig, key, obj);
} else {
returnValue = $.isArray(value) ? value.join(', ') : value;
}
Expand Down

0 comments on commit 8e7241c

Please sign in to comment.