Slow operation of the [Connected to] detail of the [Accounts] section (dashboard view)

Symptoms

Slow operation of the [Connected to] detail of the [Accounts] section (dashboard view)

Cause

Internal implementation of the diagram.js component and the display mechanism of detail elements (RelationshipDiagramViewModel).

Solution

In version 7.7.0, the diagram.js component implementation has been considerably improved. To transfer the functionality to version 7.6., download the module from the UsrDiagram.md file to the Custom  package, which will fully override the "Terrasoft.Diagram" base class. Add the replacing client module for the AccountRelationshipDetailV2 detail and add connection with the UsrDiagram module and overriding of some view model methods of the diagram.

Example of a code:

define("AccountRelationshipDetailV2", ["UsrDiagram"], function() {
		return {
			methods: {
				getMinLevel: function(accounts) {
					return accounts[0].level;
				},
 
				getMaxLevel: function(accounts) {
					return accounts[accounts.length - 1].level;
				},
 
				buildDiagramNodes: function(accounts) {
					this.clearAllDiagramNodes();
					var nodes = this.get("Nodes");
					var accountConfigs = {};
					accounts.forEach(function(account) {
						accountConfigs[account.id] = this.getNodeConfig(account);
					}, this);
					nodes.loadAll(accountConfigs);
					this.createNodeConnections(accounts);
				},
 
				createNodeConnections: function(accounts) {
					var nodes = this.get("Nodes");
					var connectionConfigs = {};
					var maxLevel = this.getMaxLevel(accounts);
					var filteredAccounts = accounts.filter(function(item) {
						return item.level < maxLevel;
					});
					filteredAccounts.forEach(function(account) {
						account.children.forEach(function(child) {
							connectionConfigs[account.id + "/" + child.id] = this.getConnectionConfig(child, account);
						}, this);
					}, this);
					nodes.loadAll(connectionConfigs);
				}
			},
 
			diff: /**SCHEMA_DIFF*/ []/**SCHEMA_DIFF*/
		};
	}
);

For versions 7.7.0-7.8.0, it will be enough to override the view model methods. In later versions, we plan to optimize this detail further.

Necessary conditions and possible restrictions

When updating from version 7.6.0 to 7.7.0 and higher, delete the UsrDiagram schema described above as well as its links. 

 

File attachments
Like 0

Like

Share

0 comments
Show all comments