You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ea...@apache.org on 2019/05/21 10:48:02 UTC
[qpid-dispatch] branch master updated: DISPATCH-1339 Collapse
multiple clients of same time into a single icon
This is an automated email from the ASF dual-hosted git repository.
eallen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/master by this push:
new 1bcf0c3 DISPATCH-1339 Collapse multiple clients of same time into a single icon
1bcf0c3 is described below
commit 1bcf0c3c9bcf13078d9088329ec25609952562cf
Author: Ernest Allen <ea...@redhat.com>
AuthorDate: Tue May 21 06:47:14 2019 -0400
DISPATCH-1339 Collapse multiple clients of same time into a single icon
---
console/stand-alone/plugin/js/topology/links.js | 67 ++++++++++++++-----------
1 file changed, 38 insertions(+), 29 deletions(-)
diff --git a/console/stand-alone/plugin/js/topology/links.js b/console/stand-alone/plugin/js/topology/links.js
index 53cfe71..25e7525 100644
--- a/console/stand-alone/plugin/js/topology/links.js
+++ b/console/stand-alone/plugin/js/topology/links.js
@@ -17,9 +17,7 @@ specific language governing permissions and limitations
under the License.
*/
-import {
- utils
-} from "../amqp/utilities.js";
+import { utils } from "../amqp/utilities.js";
class Link {
constructor(source, target, dir, cls, uid) {
@@ -31,13 +29,15 @@ class Link {
this.uid = uid;
}
markerId(end) {
- let selhigh = this.highlighted ?
- "highlighted" :
- (this.selected ?
- "selected" :
- "");
+ let selhigh = this.highlighted
+ ? "highlighted"
+ : this.selected
+ ? "selected"
+ : "";
if (selhigh === "" && (!this.left && !this.right)) selhigh = "unknown";
- return `-${selhigh}-${end === "end" ? this.target.radius() : this.source.radius()}`;
+ return `-${selhigh}-${
+ end === "end" ? this.target.radius() : this.source.radius()
+ }`;
}
}
@@ -73,7 +73,7 @@ export class Links {
}
//this.logger.debug("creating new link (" + (links.length) + ") between " + nodes[_source].name + " and " + nodes[_target].name);
if (
- this.links.some(function (l) {
+ this.links.some(function(l) {
return l.uid === uid;
})
)
@@ -92,7 +92,9 @@ export class Links {
}
getPosition(name, nodes, source, client, height, localStorage) {
- let position = localStorage[name] ? JSON.parse(localStorage[name]) : undefined;
+ let position = localStorage[name]
+ ? JSON.parse(localStorage[name])
+ : undefined;
if (typeof position == "undefined") {
position = {
x: Math.round(
@@ -112,9 +114,11 @@ export class Links {
}
if (position.x === null || position.y === null) {
position.x = Math.round(
- nodes.get(source).x + 40 * Math.sin(client / (Math.PI * 2.0)));
+ nodes.get(source).x + 40 * Math.sin(client / (Math.PI * 2.0))
+ );
position.y = Math.round(
- nodes.get(source).y + 40 * Math.cos(client / (Math.PI * 2.0)));
+ nodes.get(source).y + 40 * Math.cos(client / (Math.PI * 2.0))
+ );
}
position.fixed = position.fixed ? true : false;
return position;
@@ -143,8 +147,10 @@ export class Links {
);
// we need a unique connection.container
- if (connection.container === '') {
- connection.container = connection.name.replace('/', '').replace(':', '-');
+ if (connection.container === "") {
+ connection.container = connection.name
+ .replace("/", "")
+ .replace(":", "-");
//utils.uuidv4();
}
// this is a connection to another interior router
@@ -172,10 +178,11 @@ export class Links {
// create map of type:id:dir to [containers]
for (let container in connectionsPerContainer) {
let key = getKey(connectionsPerContainer[container]);
- if (!unique[key]) unique[key] = {
- c: [],
- nodes: []
- };
+ if (!unique[key])
+ unique[key] = {
+ c: [],
+ nodes: []
+ };
unique[key].c.push(container);
}
for (let key in unique) {
@@ -213,7 +220,9 @@ export class Links {
node.user = container.connection.user;
node.isEncrypted = container.connection.isEncrypted;
node.connectionId = container.connection.identity;
- node.uuid = `${containerId}-${node.routerId}-${node.nodeType}-${node.cdir}`;
+ node.uuid = `${containerId}-${node.routerId}-${node.nodeType}-${
+ node.cdir
+ }`;
// in case a created node (or group) is connected to multiple
// routers, we need to remember all the routers for traffic animations
for (let c = 1; c < connections.length; c++) {
@@ -258,7 +267,7 @@ export class Links {
}
}
-var getContainerIndex = function (_id, nodeInfo) {
+var getContainerIndex = function(_id, nodeInfo) {
let nodeIndex = 0;
for (let id in nodeInfo) {
if (utils.nameFromId(id) === _id) return nodeIndex;
@@ -267,7 +276,7 @@ var getContainerIndex = function (_id, nodeInfo) {
return -1;
};
-var getLinkDir = function (connection, onode) {
+var getLinkDir = function(connection, onode) {
let links = onode["router.link"];
if (!links) {
return "unknown";
@@ -277,12 +286,12 @@ var getLinkDir = function (connection, onode) {
let typeIndex = links.attributeNames.indexOf("linkType");
let connectionIdIndex = links.attributeNames.indexOf("connectionId");
let dirIndex = links.attributeNames.indexOf("linkDir");
- links.results.forEach(function (linkResult) {
+ links.results.forEach(function(linkResult) {
if (
linkResult[typeIndex] === "endpoint" &&
linkResult[connectionIdIndex] === connection.identity
)
- if (linkResult[dirIndex] === "in")++inCount;
+ if (linkResult[dirIndex] === "in") ++inCount;
else ++outCount;
});
if (inCount > 0 && outCount > 0) return "both";
@@ -290,8 +299,8 @@ var getLinkDir = function (connection, onode) {
if (outCount > 0) return "out";
return "unknown";
};
-var getKey = function (containers) {
- let parts = [];
+var getKey = function(containers) {
+ let parts = {};
let connection = containers[0].connection;
let d = {
nodeType: connection.role,
@@ -304,7 +313,7 @@ var getKey = function (containers) {
else if (connection.role === "edge") connectionType = "edge";
for (let c = 0; c < containers.length; c++) {
let container = containers[c];
- parts.push(`${container.source}-${container.linksDir}`);
+ parts[`${container.source}-${container.linksDir}`] = true;
}
- return `${connectionType}:${parts.join(":")}`;
-};
\ No newline at end of file
+ return `${connectionType}:${Object.keys(parts).join(":")}`;
+};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org