Skip to content

Commit

Permalink
Fixed: wflow-core - Form Builder - ERD can't render for large app. T5…
Browse files Browse the repository at this point in the history
…107 @8.1-SNAPSHOT
  • Loading branch information
owen-joget committed Dec 19, 2024
1 parent a693a07 commit 28085e4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
#desc-tab .relations{padding: 0 0 20px 24px;}
.diagram-actions {text-align: right;}
.diagram-actions a {cursor: pointer;}
#diagram-grid {position: relative;}
#diagram-grid {position: relative;min-width: max-content;}
#diagram-grid .col:nth-child(even) {padding-top:150px;}
#diagram-grid .col .row {padding: 80px 100px;}
#diagram-grid .col .row:nth-child(even) {padding-left:50px;}
Expand Down
28 changes: 19 additions & 9 deletions wflow-consoleweb/src/main/webapp/js/fbuilder.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -939,11 +939,9 @@ FormBuilder = {
y = 0;
} else if (x+1 >= limit) {
y += 1; //find from next row
} else if (y+1 >= limit) {
x += 1; //find from next col
x = 0;
} else {
x += 1;
y += 1;
}
return findEmptyCell(x, y);
}
Expand Down Expand Up @@ -1189,14 +1187,21 @@ FormBuilder = {
});
}

setTimeout(function(){
jsPlumb.repaintEverything();
}, 5);
function repaintDiagram() {
setTimeout(function(){
jsPlumb.setSuspendDrawing(true);
jsPlumb.recalculateOffsets($("#diagram-grid"));
jsPlumb.setSuspendDrawing(false, true);
jsPlumb.repaintEverything();
}, 5);
};

repaintDiagram();

$(".entity-container h5").off("click")
$(".entity-container h5").on("click", function(){
$(this).parent().toggleClass("showDetails");
jsPlumb.repaintEverything();
repaintDiagram();
});

$(".entity-container .forms a").off("click");
Expand All @@ -1222,12 +1227,17 @@ FormBuilder = {
$('#diagram-tab a.expandAll').off("click");
$('#diagram-tab a.expandAll').on("click", function(){
$('#diagram-grid .entity-container').addClass("showDetails");
jsPlumb.repaintEverything();
repaintDiagram();
});
$('#diagram-tab a.collapseAll').off("click");
$('#diagram-tab a.collapseAll').on("click", function(){
$('#diagram-grid .entity-container').removeClass("showDetails");
jsPlumb.repaintEverything();
repaintDiagram();
});

$(window).off("resize.erd");
$(window).on("resize.erd", function (event) {
repaintDiagram();
});
} else {
$(view).find("#diagram-tab .usage_content, #desc-tab .usage_content").html('<p>'+get_cbuilder_msg('fbuilder.noData')+'</p>');
Expand Down
21 changes: 14 additions & 7 deletions wflow-core/src/main/java/org/joget/apps/form/service/FormERD.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,17 @@ protected void populateField(Element field, FormData formData, Entity entity) {
if (r != null) {
relations.add(r);
} else {
r = getTempRelationFromBinder(loadBinder.getProperties(), "", entity.getTableName(), entity.getPrimaryKey(), false);
if (r != null) {
relations.add(r);
if (loadBinder != null) {
r = getTempRelationFromBinder(loadBinder.getProperties(), "", entity.getTableName(), entity.getPrimaryKey(), false);
if (r != null) {
relations.add(r);
}
}
r = getTempRelationFromBinder(storeBinder.getProperties(), "", entity.getTableName(), entity.getPrimaryKey(), false);
if (r != null) {
relations.add(r);
if (storeBinder != null) {
r = getTempRelationFromBinder(storeBinder.getProperties(), "", entity.getTableName(), entity.getPrimaryKey(), false);
if (r != null) {
relations.add(r);
}
}
}
} else if (field instanceof AbstractSubForm) {
Expand Down Expand Up @@ -459,8 +463,11 @@ protected void processTempRelation(Relation r) {

List<String> limitedTempData = new ArrayList<String>();
int start = tempData.indexOf(tn) + 1;
if (start > end) {
end = tempData.size(); //reset the end, the foreignKey may set to hash variable instead of ?
}
limitedTempData = tempData.subList(start, end);

for (String fid : e.getFields().keySet()) {
int newIndex = -1;
if (limitedTempData.contains(fid)) {
Expand Down

0 comments on commit 28085e4

Please sign in to comment.