Skip to content

Commit

Permalink
Merge PR #657 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by guewen
  • Loading branch information
OCA-git-bot committed Jun 9, 2024
2 parents 13fd91a + f0511aa commit e107eb3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
20 changes: 20 additions & 0 deletions queue_job/static/src/js/queue_job_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ odoo.define("queue_job.fields", function (require) {
init: function () {
this._super.apply(this, arguments);
this.network = null;
this.forceRender = false;
this.tabListenerInstalled = false;
},
start: function () {
Expand Down Expand Up @@ -88,6 +89,25 @@ odoo.define("queue_job.fields", function (require) {
});
});

if (nodes.length * edges.length > 5000 && !this.forceRender) {
const warningDiv = document.createElement("div");
warningDiv.className = "alert alert-warning";
warningDiv.innerText =
`This graph is big (${nodes.length} nodes, ` +
`${edges.length} edges), it may take a while to display.`;
const button = document.createElement("button");
button.innerText = "Display anyway";
button.className = "btn btn-secondary";
button.onclick = function () {
self.forceRender = true;
warningDiv.parentNode.removeChild(warningDiv);
self._render();
};
warningDiv.appendChild(button);
this.$el.append(warningDiv);
return;
}

var data = {
// eslint-disable-next-line no-undef
nodes: new vis.DataSet(nodes),
Expand Down
7 changes: 7 additions & 0 deletions queue_job/static/src/scss/queue_job_fields.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@
width: 600px;
height: 400px;
border: 1px solid lightgray;
.alert {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
}

0 comments on commit e107eb3

Please sign in to comment.