Skip to content

Commit

Permalink
Merge pull request #50 from desai827/patch-1
Browse files Browse the repository at this point in the history
Update static validator UI to more closely match ETT results
  • Loading branch information
drbgfc authored Jan 23, 2019
2 parents 60988df + c7f6eb8 commit 16563b4
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions src/main/webapp/static/js/validator_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,31 +168,47 @@ angular.module('referenceValidator').controller('ValidationController', function
function buildCcdaValidationResults(data){
var resultList = [];
var currentResultType;

var errorColor = '#d9534f';
var errorBG = 'rgba(217, 83, 79, 0.1)';
var warnColor = '#f0ad4e';
var warnBG = 'rgba(240, 173, 78, 0.1);'
var infoColor = '#5bc0de';
var infoBG = 'rgba(91, 192, 222, 0.1);';

$.each(data.ccdaValidationResults, function(ccdaValidationResults,result){
var resultColor = '';
var resultBG = '';
if(result.type.toLowerCase().indexOf("error") >= 0){
resultList.push('<font color="red">');
resultColor = errorColor;
resultBG = errorBG;
}else if(result.type.toLowerCase().indexOf("warn") >= 0){
resultList.push('<font color="orange">');
resultColor = warnColor;
resultBG = warnBG;
}else{
resultList.push('<font color="#5bc0de">');
resultColor = infoColor;
resultBG = infoBG;
}

resultList.push('<div style="border-style: none none none solid; border-color: ' + resultColor + '; border-width: 5px; padding: 5px 0px 0.5px 5px; background-color: ' + resultBG + '">');

if(currentResultType != result.type.toLowerCase()){
resultList.push('<a href="#" name="'+ result.type + '"></a>');
}

var errorDescription = ['<li>' + result.type + '<ul class="">',
'<li class="">Description: '+ result.description + '</li>',
'<li class="">xPath: '+ result.xPath + '</li>',
'<li class="">Document Line Number (approximate): '+ result.documentLineNumber + '</li>',
'</ul></li>'];
var errorDescription = ['<p><font style="font-weight:bold; color: ' + resultColor + '">' + result.type + '</font>',
' - ' + result.description + '<br/>',
'<font style="font-weight:bold">' + result.xPath + '</font><br/>',
'<u>Line Number:</u> <b>'+ result.documentLineNumber + '</b>',
'</p>'];
resultList = resultList.concat(errorDescription);
if(result.expectedValueSet != null){
var expectedValueSets = ['<a href=">' + result.expectedValueSet + '</a>'];
resultList = resultList.concat(expectedValueSets);
}
resultList.push('</font>');
resultList.push('<hr/><div class="pull-right"><a href="#validationResults" title="top">^</a></div>');
resultList.push('</div>');
resultList.push('<div style="height: 3px" />');
resultList.push('<div class="pull-right"><a href="#validationResults" title="top">^</a></div>');
currentResultType = result.type.toLowerCase();
});
return (resultList.join('\n'));
Expand Down Expand Up @@ -389,4 +405,4 @@ angular.module('referenceValidator').controller('ValidationController', function
});
}
}
});
});

0 comments on commit 16563b4

Please sign in to comment.