Skip to content

Commit

Permalink
#11 Issue with rendering the matched count for import source - fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
spuliaiev-sfdc committed Aug 5, 2018
1 parent 2bd5ac8 commit 82ecee9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
10 changes: 8 additions & 2 deletions ui/web/src/main/resources/static/js/cmp/sourceBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,14 @@ var SourceBlock = {
FormHelper.populate(this.sourceBlockElement , this.dataObject);

if (this.dataObject.matchReport) {
var matchPicCount = Object.keys(this.dataObject.matchReport.pictures).length;
var matchImpCount = Object.keys(this.dataObject.matchReport.currentImport).length;
var matchPicCount = 0;
$.each(this.dataObject.matchReport.pictures, function (indexSource, importIds) {
matchPicCount += importIds.length;
});
var matchImpCount = 0;
$.each(this.dataObject.matchReport.currentImport, function (indexSource, importIds) {
matchImpCount += importIds.length;
});
FormHelper.populateFromObject(this.sourceBlockElement, {
matchPicCount: matchPicCount,
matchImpCount: matchImpCount
Expand Down
2 changes: 1 addition & 1 deletion ui/web/src/main/resources/static/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function formatDate(value) {
if (!validValue(value)) {
return value;
}
if (/^\d+$/.test(value)) {
if (/^[+-]?\d+$/.test(value)) {
// means this is number only - treat it as milliseconds epoc
value = new Date(value);
value = serverDate(value);
Expand Down
14 changes: 9 additions & 5 deletions ui/web/src/main/resources/static/js/importRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,21 @@ var ImportRequestsTree = {
var reportImports = report.currentImport;
var reportPicture = report.pictures;

$.each(reportImports, function (indexSource, source) {

$.each(reportImports, function (indexSource, importIds) {
var matches = populateTemplate(ImportRequestsTree.matchesBlockTemplate,{ title: indexSource}, ImportRequestsTree.matchesBlock);
$.each(importIds, function (index, id) {
console.log("preloading id="+id+" grade=IMPORT");
var matchSources = matches.find(".SourceBlockContainer");
var blockMapped = SourceBlock.create({ id: id, grade: "IMPORT"}, matchSources, false, null, null, null).hideDecisionButtons();
});
});
$.each(reportPicture, function (indexSource, matchIds) {
$.each(reportPicture, function (indexSource, pictureIds) {
var matches = populateTemplate(ImportRequestsTree.matchesBlockTemplate,{ title: indexSource}, ImportRequestsTree.matchesBlock);
$.each(matchIds, function (index, id) {
$.each(pictureIds, function (index, id) {
console.log("preloading id="+id+" grade=GALLERY");
var matchSources = matches.find(".SourceBlockContainer");
var blockMapped = SourceBlock.create({ id: id, grade: "GALLERY"}, matchSources, false, null, null, null).hideDecisionButtons();
});

});


Expand Down
4 changes: 2 additions & 2 deletions ui/web/src/main/resources/templates/support/sourceBlock.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
<span class="decisionButton btn_DUPLICATE glyphicon glyphicon-remove" value="duplicate" grade="IMPORT"></span>
</div>
<div class="matchInfoBlock">
<span class="matchCount matchPicCount" name="matchPicCount">12</span>
<span class="matchCount matchImpCount" name="matchImpCount">12</span>
<span class="matchCount matchPicCount" name="matchPicCount">X3</span>
<span class="matchCount matchImpCount" name="matchImpCount">X3</span>
</div>
</div>
</div>

0 comments on commit 82ecee9

Please sign in to comment.