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 2016/10/26 13:45:32 UTC
[1/4] qpid-dispatch git commit: DISPATCH-543 Adding link info back
into initial load
Repository: qpid-dispatch
Updated Branches:
refs/heads/master d2c326ac3 -> 6506aa5c4
DISPATCH-543 Adding link info back into initial load
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/dcfe1012
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/dcfe1012
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/dcfe1012
Branch: refs/heads/master
Commit: dcfe10129da0589783636e7eae2ac68f0c65c08c
Parents: d2c326a
Author: Ernest Allen <ea...@redhat.com>
Authored: Tue Oct 25 18:41:20 2016 -0400
Committer: Ernest Allen <ea...@redhat.com>
Committed: Tue Oct 25 18:41:20 2016 -0400
----------------------------------------------------------------------
console/stand-alone/plugin/js/qdrTopology.js | 24 +++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/dcfe1012/console/stand-alone/plugin/js/qdrTopology.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/qdrTopology.js b/console/stand-alone/plugin/js/qdrTopology.js
index 36f9292..5877fc8 100644
--- a/console/stand-alone/plugin/js/qdrTopology.js
+++ b/console/stand-alone/plugin/js/qdrTopology.js
@@ -478,7 +478,7 @@ QDR.log.debug("showEntityForm")
var height = 0;
var getSizes = function() {
- var legendWidth = 196;
+ var legendWidth = 143;
var gap = 5;
var width = $('#topology').width() - gap - legendWidth;
var top = $('#topology').offset().top
@@ -760,15 +760,15 @@ QDR.log.debug("showEntityForm")
.size([width, height])
.linkDistance(function(d) {
if (d.target.nodeType === 'inter-router')
- return 80
+ return 70
if (d.target.cdir === 'both')
return 25
- return 15
+ return 25
})
.charge(function(d) {
- return (d.nodeType === 'inter-router') ? -3000 : -750
+ return (d.nodeType === 'inter-router') ? -800 : -900
})
- .friction(.50)
+ .friction(.10)
.gravity(0.0001)
.on('tick', tick)
.start()
@@ -851,10 +851,14 @@ QDR.log.debug("showEntityForm")
})
// if any clients don't yet have link directions, get the links for those nodes and restart the graph
- var unknownNodes = unknowns.map( function (un) {
- return un.key
- })
+ // collapse the unknown node.keys using an object
+ var unknownNodes = {}
+ for (var i=0; i<unknowns.length; ++i) {
+ unknownNodes[unknowns[i].key] = 1
+ }
+ unknownNodes = Object.keys(unknownNodes)
if (unknownNodes.length) {
+QDR.log.debug("there were " + unknownNodes.length + " connections with normal links")
QDRService.ensureEntities(unknownNodes, {entity: ".router.link"}, function () {
// now that all nodes with clients have link info, update the nodes
animate = true;
@@ -2008,8 +2012,8 @@ QDR.log.debug("showEntityForm")
function setupInitialUpdate() {
// make sure all router nodes have .connection info. if not then fetch any missing info
QDRService.ensureAllEntities(
- //[{entity: ".connection"}, {entity: ".router.link", attrs: ["linkType","connectionId","linkDir"]}],
- [{entity: ".connection"}],
+ [{entity: ".connection"}, {entity: ".router.link", attrs: ["linkType","connectionId","linkDir"]}],
+ //[{entity: ".connection"}],
handleInitialUpdate)
}
setupInitialUpdate();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/4] qpid-dispatch git commit: DISPATCH-536 Saving referece to
d3.queue for hawtio
Posted by ea...@apache.org.
DISPATCH-536 Saving referece to d3.queue for hawtio
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/f8443fbb
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/f8443fbb
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/f8443fbb
Branch: refs/heads/master
Commit: f8443fbb99af00167db96d06d24d294f2bcd4339
Parents: dcfe101
Author: Ernest Allen <ea...@redhat.com>
Authored: Wed Oct 26 08:36:11 2016 -0400
Committer: Ernest Allen <ea...@redhat.com>
Committed: Wed Oct 26 08:36:11 2016 -0400
----------------------------------------------------------------------
console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js | 4 ++++
console/stand-alone/index.html | 7 +++++--
console/stand-alone/plugin/js/dispatchPlugin.js | 1 +
console/stand-alone/plugin/js/qdrService.js | 6 +++---
4 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/f8443fbb/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js
----------------------------------------------------------------------
diff --git a/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js b/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js
index 5287885..2139625 100644
--- a/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js
+++ b/console/hawtio/src/main/webapp/plugin/js/dispatchPlugin.js
@@ -276,6 +276,10 @@ QDR.log.info("showing dispatch tab: going to page " + lastLocation)
// force an more modern version of d3 to load
$.getScript('https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.14/d3.min.js', function() {});
+$.getScript('https://cdnjs.cloudflare.com/ajax/libs/d3-queue/3.0.3/d3-queue.min.js', function() {
+ QDR.queue = d3.queue;
+});
+
// tooltips on the list page
$.getScript('https://cdn.rawgit.com/jaz303/tipsy/master/src/javascripts/jquery.tipsy.js', function() {});
// tooltips on the topology page
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/f8443fbb/console/stand-alone/index.html
----------------------------------------------------------------------
diff --git a/console/stand-alone/index.html b/console/stand-alone/index.html
index efb4eff..8609802 100644
--- a/console/stand-alone/index.html
+++ b/console/stand-alone/index.html
@@ -70,8 +70,11 @@ under the License.
</div>
</div>
- <script src="http://d3js.org/d3.v3.min.js"></script>
- <script src="http://d3js.org/queue.v1.min.js"></script>
+<!-- <script src="http://d3js.org/d3.v3.min.js"></script>
+ <script src="http://d3js.org/queue.v1.min.js"></script> -->
+ <script src='https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.14/d3.min.js'></script>
+ <script src='https://cdnjs.cloudflare.com/ajax/libs/d3-queue/3.0.3/d3-queue.min.js'></script>
+
<script src="http://d3js.org/topojson.v0.min.js"></script>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/f8443fbb/console/stand-alone/plugin/js/dispatchPlugin.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/dispatchPlugin.js b/console/stand-alone/plugin/js/dispatchPlugin.js
index f3168c3..9127d1b 100644
--- a/console/stand-alone/plugin/js/dispatchPlugin.js
+++ b/console/stand-alone/plugin/js/dispatchPlugin.js
@@ -167,6 +167,7 @@ var QDR = (function(QDR) {
} else {
$location.search('org', null)
}
+ QDR.queue = d3.queue;
QDRService.initProton();
var settings = angular.fromJson(localStorage[QDR.SETTINGS_KEY]);
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/f8443fbb/console/stand-alone/plugin/js/qdrService.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/qdrService.js b/console/stand-alone/plugin/js/qdrService.js
index ed1d2fc..2d0e6bf 100644
--- a/console/stand-alone/plugin/js/qdrService.js
+++ b/console/stand-alone/plugin/js/qdrService.js
@@ -369,7 +369,7 @@ console.dump(e)
if (Object.prototype.toString.call(entities) !== '[object Array]') {
entities = [entities]
}
- var q = queue(self.queueDepth())
+ var q = QDR.queue(self.queueDepth())
for (node in self.topology._nodeInfo) {
for (var i=0; i<entities.length; ++i) {
var entity = entities[i]
@@ -394,7 +394,7 @@ console.dump(e)
if (Object.prototype.toString.call(nodes) !== '[object Array]') {
nodes = [nodes]
}
- var q = queue(self.queueDepth())
+ var q = QDR.queue(self.queueDepth())
for (var n=0; n<nodes.length; ++n) {
for (var i=0; i<entityAttribs.length; ++i) {
var ea = entityAttribs[i]
@@ -485,7 +485,7 @@ console.dump(e)
}
// also refresh any entities that were requested
- self.topology.q = queue(self.queueDepth())
+ self.topology.q = QDR.queue(self.queueDepth())
for (var i=0; i<self.topology._autoUpdatedEntities.length; ++i) {
var entity = self.topology._autoUpdatedEntities[i]
//QDR.log.debug("queuing requests for all nodes for " + entity)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[4/4] qpid-dispatch git commit: DISPATCH-547 Adding FileSaver.js
library and splitting out config file edit/download controllers
Posted by ea...@apache.org.
DISPATCH-547 Adding FileSaver.js library and splitting out config file edit/download controllers
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/6506aa5c
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/6506aa5c
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/6506aa5c
Branch: refs/heads/master
Commit: 6506aa5c4d252fa19b0eb61ccef7e3124cbeb0c0
Parents: abadf5b
Author: Ernest Allen <ea...@redhat.com>
Authored: Wed Oct 26 09:44:54 2016 -0400
Committer: Ernest Allen <ea...@redhat.com>
Committed: Wed Oct 26 09:44:54 2016 -0400
----------------------------------------------------------------------
console/stand-alone/index.html | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6506aa5c/console/stand-alone/index.html
----------------------------------------------------------------------
diff --git a/console/stand-alone/index.html b/console/stand-alone/index.html
index d827f31..8f998ff 100644
--- a/console/stand-alone/index.html
+++ b/console/stand-alone/index.html
@@ -93,6 +93,7 @@ under the License.
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ng-grid/2.0.11/ng-grid.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/notify/0.4.2/notify.min.js"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2014-11-29/FileSaver.min.js"></script>
<script type="text/javascript" src="plugin/js/dispatchPlugin.js"></script>
<script type="text/javascript" src="plugin/js/qdrOverview.js"></script>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[3/4] qpid-dispatch git commit: DISPATCH-536 Fetch listener data
before showing Add Dialog
Posted by ea...@apache.org.
DISPATCH-536 Fetch listener data before showing Add Dialog
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/abadf5b1
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/abadf5b1
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/abadf5b1
Branch: refs/heads/master
Commit: abadf5b1535c8b1c5e3540449371a77b574e7422
Parents: f8443fb
Author: Ernest Allen <ea...@redhat.com>
Authored: Wed Oct 26 09:37:52 2016 -0400
Committer: Ernest Allen <ea...@redhat.com>
Committed: Wed Oct 26 09:37:52 2016 -0400
----------------------------------------------------------------------
console/stand-alone/index.html | 1 +
console/stand-alone/plugin/js/qdrService.js | 5 +-
console/stand-alone/plugin/js/qdrTopology.js | 472 ++--------------------
3 files changed, 34 insertions(+), 444 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/abadf5b1/console/stand-alone/index.html
----------------------------------------------------------------------
diff --git a/console/stand-alone/index.html b/console/stand-alone/index.html
index 8609802..d827f31 100644
--- a/console/stand-alone/index.html
+++ b/console/stand-alone/index.html
@@ -104,6 +104,7 @@ under the License.
<script type="text/javascript" src="plugin/js/qdrService.js"></script>
<script type="text/javascript" src="plugin/js/qdrChartService.js"></script>
<script type="text/javascript" src="plugin/js/qdrTopology.js"></script>
+ <script type="text/javascript" src="plugin/js/qdrNewNode.js"></script>
<script type="text/javascript" src="plugin/js/qdrSettings.js"></script>
<script type="text/javascript" src="plugin/lib/rhea-min.js"></script>
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/abadf5b1/console/stand-alone/plugin/js/qdrService.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/qdrService.js b/console/stand-alone/plugin/js/qdrService.js
index 2d0e6bf..8e1cf35 100644
--- a/console/stand-alone/plugin/js/qdrService.js
+++ b/console/stand-alone/plugin/js/qdrService.js
@@ -181,6 +181,7 @@ console.dump(e)
self.topology.get();
},
stopUpdating: function(silent) {
+ self.updating = false;
if (self.topology._getTimer) {
clearTimeout(self.topology._getTimer)
self.topology._getTimer = null;
@@ -189,9 +190,11 @@ console.dump(e)
clearTimeout(self.topology._waitTimer)
self.topology._waitTimer = null;
}
+ if (self.topology._gettingTopo) {
+ self.topology.q.abort()
+ }
if (!silent)
QDR.log.info("stopUpdating called")
- self.updating = false;
},
initProton: function() {
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/abadf5b1/console/stand-alone/plugin/js/qdrTopology.js
----------------------------------------------------------------------
diff --git a/console/stand-alone/plugin/js/qdrTopology.js b/console/stand-alone/plugin/js/qdrTopology.js
index 5877fc8..760ff15 100644
--- a/console/stand-alone/plugin/js/qdrTopology.js
+++ b/console/stand-alone/plugin/js/qdrTopology.js
@@ -365,12 +365,13 @@ QDR.log.debug("showEntityForm")
x = mouseX - offset.left + $(document).scrollLeft();
y = mouseY - offset.top + $(document).scrollTop();;
}
- NewRouterName = genNewName();
- nodes.push(aNode(id, NewRouterName, "inter-router", undefined, nodes.length, x, y, undefined, true));
- force.nodes(nodes).links(links).start();
- restart(false);
+ QDRService.ensureAllEntities({entity: ".router"}, function () {
+ NewRouterName = genNewName();
+ nodes.push(aNode(id, NewRouterName, "inter-router", undefined, nodes.length, x, y, undefined, true));
+ force.nodes(nodes).links(links).start();
+ restart(false);
+ })
}
-
})
$scope.isRight = function(mode) {
return mode.right;
@@ -710,6 +711,7 @@ QDR.log.debug("showEntityForm")
if (d3.event.defaultPrevented)
return;
d3.event.preventDefault();
+
if ($scope.addingNode.step != 0)
return;
if (d3.select('#svg_context_menu').style('display') !== 'block')
@@ -1356,7 +1358,7 @@ QDR.log.debug("there were " + unknownNodes.length + " connections with normal li
svgg.transition().attr("transform", "translate(2,2) scale(1)")
}
- QDRService.initEntity(".router.link", showCrosssection)
+ QDRService.ensureEntities(d.key, {entity: ".router.link", force: true}, showCrosssection)
})
// remove old links
@@ -1866,7 +1868,6 @@ QDR.log.debug("there were " + unknownNodes.length + " connections with normal li
}
}
var stopUpdateConnectionsGrid = function() {
- QDRService.delUpdateEntity([".router.link"])
QDRService.delUpdatedAction("normalsStats");
}
@@ -1973,6 +1974,7 @@ QDR.log.debug("there were " + unknownNodes.length + " connections with normal li
$scope.$on("$destroy", function(event) {
//QDR.log.debug("scope on destroy");
savePositions();
+ QDRService.setUpdateEntities([])
QDRService.stopUpdating();
QDRService.delUpdatedAction("normalsStats");
QDRService.delUpdatedAction("topology");
@@ -2020,23 +2022,27 @@ QDR.log.debug("there were " + unknownNodes.length + " connections with normal li
QDRService.startUpdating();
function doAddDialog(NewRouterName) {
- var d = $dialog.dialog({
- dialogClass: "modal dlg-large",
- backdrop: true,
- keyboard: true,
- backdropClick: true,
- controller: 'QDR.NodeDialogController',
- templateUrl: 'node-config-template.html',
- resolve: {
- newname: function() {
- return NewRouterName;
+ QDRService.ensureAllEntities({entity: ".listener"}, function () {
+ var d = $dialog.dialog({
+ dialogClass: "modal dlg-large",
+ backdrop: true,
+ keyboard: true,
+ backdropClick: true,
+ controller: 'QDR.NodeDialogController',
+ templateUrl: 'node-config-template.html',
+ resolve: {
+ newname: function() {
+ return NewRouterName;
+ }
}
- }
- });
- d.open().then(function(result) {
- if (result)
- doDownloadDialog(result);
- });
+ });
+ $timeout(function () {
+ d.open().then(function(result) {
+ if (result)
+ doDownloadDialog(result);
+ });
+ })
+ })
};
function doDownloadDialog(result) {
@@ -2060,425 +2066,5 @@ QDR.log.debug("there were " + unknownNodes.length + " connections with normal li
}
]);
- QDR.module.controller("QDR.NodeDialogController", function($scope, QDRService, dialog, newname) {
- var schema = QDRService.schema;
- var myEntities = ['router', 'log', 'listener'];
- var typeMap = {
- integer: 'number',
- string: 'text',
- path: 'text',
- boolean: 'boolean'
- };
- var newLinks = $('path.temp').toArray(); // jquery array of new links for the added router
- var nodeInfo = QDRService.topology.nodeInfo();
- var separatedEntities = []; // additional entities required if a link is reversed
- var myPort = 0,
- myAddr = '0.0.0.0'; // port and address for new router
- $scope.entities = [];
-
- // find max port number that is used in all the listeners
- var getMaxPort = function(nodeInfo) {
- var maxPort = 5674;
- for (var key in nodeInfo) {
- var node = nodeInfo[key];
- var listeners = node['.listener'];
- var attrs = listeners.attributeNames;
- for (var i = 0; i < listeners.results.length; ++i) {
- var res = listeners.results[i];
- var port = QDRService.valFor(attrs, res, 'port');
- if (parseInt(port, 10) > maxPort)
- maxPort = parseInt(port, 10);
- }
- }
- return maxPort;
- }
- var maxPort = getMaxPort(nodeInfo);
-
- // construct an object that contains all the info needed for a single tab's fields
- var entity = function(actualName, tabName, humanName, ent, icon, link) {
- var nameIndex = -1; // the index into attributes that the name field was placed
- var index = 0;
- var info = {
- actualName: actualName,
- tabName: tabName,
- humanName: humanName,
- description: ent.description,
- icon: angular.isDefined(icon) ? icon : '',
- references: ent.references,
- link: link,
-
- attributes: $.map(ent.attributes, function(value, key) {
- // skip identity and depricated fields
- if (key == 'identity' || value.description.startsWith('Deprecated'))
- return null;
- var val = value['default'];
- if (key == 'name')
- nameIndex = index;
- index++;
- return {
- name: key,
- humanName: QDRService.humanify(key),
- description: value.description,
- type: typeMap[value.type],
- rawtype: value.type,
- input: typeof value.type == 'string' ? value.type == 'boolean' ? 'boolean' : 'input' : 'select',
- selected: val ? val : undefined,
- 'default': value['default'],
- value: val,
- required: value.required,
- unique: value.unique
- };
- })
- }
- // move the 'name' attribute to the 1st position
- if (nameIndex > -1) {
- var tmp = info.attributes[0];
- info.attributes[0] = info.attributes[nameIndex];
- info.attributes[nameIndex] = tmp;
- }
- return info;
- }
-
- // remove the annotation fields
- var stripAnnotations = function(entityName, ent, annotations) {
- if (ent.references) {
- var newEnt = {
- attributes: {}
- };
- ent.references.forEach(function(annoKey) {
- if (!annotations[annoKey])
- annotations[annoKey] = {};
- annotations[annoKey][entityName] = true; // create the key/consolidate duplicates
- var keys = Object.keys(schema.annotations[annoKey].attributes);
- for (var attrib in ent.attributes) {
- if (keys.indexOf(attrib) == -1) {
- newEnt.attributes[attrib] = ent.attributes[attrib];
- }
- }
- // add a field for the reference name
- newEnt.attributes[annoKey] = {
- type: 'string',
- description: 'Name of the ' + annoKey + ' section.',
- 'default': annoKey,
- required: true
- };
- })
- newEnt.references = ent.references;
- newEnt.description = ent.description;
- return newEnt;
- }
- return ent;
- }
-
- var annotations = {};
- myEntities.forEach(function(entityName) {
- var ent = schema.entityTypes[entityName];
- var hName = QDRService.humanify(entityName);
- if (entityName == 'listener')
- hName = "Listener for clients";
- var noAnnotations = stripAnnotations(entityName, ent, annotations);
- var ediv = entity(entityName, entityName, hName, noAnnotations, undefined);
- if (ediv.actualName == 'router') {
- ediv.attributes.filter(function(attr) {
- return attr.name == 'name'
- })[0].value = newname;
- // if we have any new links (connectors), then the router's mode should be interior
- if (newLinks.length) {
- var roleAttr = ediv.attributes.filter(function(attr) {
- return attr.name == 'mode'
- })[0];
- roleAttr.value = roleAttr.selected = "interior";
- }
- }
- if (ediv.actualName == 'container') {
- ediv.attributes.filter(function(attr) {
- return attr.name == 'containerName'
- })[0].value = newname + "-container";
- }
- if (ediv.actualName == 'listener') {
- // find max port number that is used in all the listeners
- ediv.attributes.filter(function(attr) {
- return attr.name == 'port'
- })[0].value = ++maxPort;
- }
- // special case for required log.module since it doesn't have a default
- if (ediv.actualName == 'log') {
- var moduleAttr = ediv.attributes.filter(function(attr) {
- return attr.name == 'module'
- })[0];
- moduleAttr.value = moduleAttr.selected = "DEFAULT";
- }
- $scope.entities.push(ediv);
- })
-
- // add a tab for each annotation that was found
- var annotationEnts = [];
- for (var key in annotations) {
- ent = angular.copy(schema.annotations[key]);
- ent.attributes.name = {
- type: "string",
- unique: true,
- description: "Unique name that is used to refer to this set of attributes."
- }
- var ediv = entity(key, key + 'tab', QDRService.humanify(key), ent, undefined);
- ediv.attributes.filter(function(attr) {
- return attr.name == 'name'
- })[0].value = key;
- $scope.entities.push(ediv);
- annotationEnts.push(ediv);
- }
-
- // add an additional listener tab if any links are reversed
- ent = schema.entityTypes['listener'];
- newLinks.some(function(link) {
- if (link.__data__.right) {
- var noAnnotations = stripAnnotations('listener', ent, annotations);
- var ediv = entity("listener", "listener0", "Listener (internal)", noAnnotations, undefined);
- ediv.attributes.filter(function(attr) {
- return attr.name == 'port'
- })[0].value = ++maxPort;
- // connectors from other routers need to connect to this addr:port
- myPort = maxPort;
- myAddr = ediv.attributes.filter(function(attr) {
- return attr.name == 'host'
- })[0].value
-
- // override the role. 'normal' is the default, but we want inter-router
- ediv.attributes.filter(function(attr) {
- return attr.name == 'role'
- })[0].selected = 'inter-router';
- separatedEntities.push(ediv);
- return true; // stop looping
- }
- return false; // continue looping
- })
-
- // Add connector tabs for each new link on the topology graph
- ent = schema.entityTypes['connector'];
- newLinks.forEach(function(link, i) {
- var noAnnotations = stripAnnotations('connector', ent, annotations);
- var ediv = entity('connector', 'connector' + i, " " + link.__data__.source.name, noAnnotations, link.__data__.right, link)
-
- // override the connector role. 'normal' is the default, but we want inter-router
- ediv.attributes.filter(function(attr) {
- return attr.name == 'role'
- })[0].selected = 'inter-router';
-
- // find the addr:port of the inter-router listener to use
- var listener = nodeInfo[link.__data__.source.key]['.listener'];
- var attrs = listener.attributeNames;
- for (var i = 0; i < listener.results.length; ++i) {
- var res = listener.results[i];
- var role = QDRService.valFor(attrs, res, 'role');
- if (role == 'inter-router') {
- ediv.attributes.filter(function(attr) {
- return attr.name == 'host'
- })[0].value =
- QDRService.valFor(attrs, res, 'host')
- ediv.attributes.filter(function(attr) {
- return attr.name == 'port'
- })[0].value =
- QDRService.valFor(attrs, res, 'port')
- break;
- }
- }
- if (link.__data__.right) {
- // connectors from other nodes need to connect to the new router's listener addr:port
- ediv.attributes.filter(function(attr) {
- return attr.name == 'port'
- })[0].value = myPort;
- ediv.attributes.filter(function(attr) {
- return attr.name == 'host'
- })[0].value = myAddr;
-
- separatedEntities.push(ediv)
- } else
- $scope.entities.push(ediv);
- })
- Array.prototype.push.apply($scope.entities, separatedEntities);
-
- // update the description on all the annotation tabs
- annotationEnts.forEach(function(ent) {
- var shared = Object.keys(annotations[ent.actualName]);
- ent.description += " These fields are shared by " + shared.join(" and ") + ".";
-
- })
-
- $scope.testPattern = function(attr) {
- if (attr.rawtype == 'path')
- return /^(\/)?([^/\0]+(\/)?)+$/;
- //return /^(.*\/)([^/]*)$/;
- return /(.*?)/;
- }
-
- $scope.attributeDescription = '';
- $scope.attributeType = '';
- $scope.attributeRequired = '';
- $scope.attributeUnique = '';
- $scope.active = 'router'
- $scope.fieldsetDivs = "/fieldsetDivs.html"
- $scope.setActive = function(tabName) {
- $scope.active = tabName
- }
- $scope.isActive = function(tabName) {
- return $scope.active === tabName
- }
- $scope.showDescription = function(attr, e) {
- $scope.attributeDescription = attr.description;
- var offset = jQuery(e.currentTarget).offset()
- jQuery('.attr-description').offset({
- top: offset.top
- })
-
- $scope.attributeType = "Type: " + JSON.stringify(attr.rawtype);
- $scope.attributeRequired = attr.required ? 'required' : '';
- $scope.attributeUnique = attr.unique ? 'Must be unique' : '';
- }
- // handle the download button click
- // copy the dialog's values to the original node
- $scope.download = function() {
- dialog.close({
- entities: $scope.entities,
- annotations: annotations
- });
- }
- $scope.cancel = function() {
- dialog.close()
- };
-
- $scope.selectAnnotationTab = function(tabName) {
- var tabs = $("#tabs").tabs();
- tabs.tabs("select", tabName);
- }
-
- var initTabs = function() {
- var div = angular.element("#tabs");
- if (!div.width()) {
- setTimeout(initTabs, 100);
- return;
- }
- $("#tabs")
- .tabs()
- .addClass('ui-tabs-vertical ui-helper-clearfix');
- }
- // start the update loop
- initTabs();
-
- });
-
- QDR.module.controller("QDR.DownloadDialogController", function($scope, QDRService, $templateCache, $window, dialog, results) {
- var result = results.entities;
- var annotations = results.annotations;
- var annotationKeys = Object.keys(annotations);
- var annotationSections = {};
-
- // use the router's name as the file name if present
- $scope.newRouterName = 'router';
- result.forEach(function(e) {
- if (e.actualName == 'router') {
- e.attributes.forEach(function(a) {
- if (a.name == 'name') {
- $scope.newRouterName = a.value;
- }
- })
- }
- })
- $scope.newRouterName = $scope.newRouterName + ".conf";
-
- var template = $templateCache.get('config-file-header.html');
- $scope.verbose = true;
- $scope.$watch('verbose', function(newVal) {
- if (newVal !== undefined) {
- // recreate output using current verbose setting
- getOutput();
- }
- })
-
- var getOutput = function() {
- $scope.output = template + '\n';
- $scope.parts = [];
- var commentChar = '#'
- result.forEach(function(entity) {
- // don't output a section for annotations, they get flattened into the entities
- var section = "";
- if (entity.icon) {
- section += "##\n## Add to " + entity.link.__data__.source.name + "'s configuration file\n##\n";
- }
- section += "##\n## " + QDRService.humanify(entity.actualName) + " - " + entity.description + "\n##\n";
- section += entity.actualName + " {\n";
- entity.attributes.forEach(function(attribute) {
- if (attribute.input == 'select')
- attribute.value = attribute.selected;
-
- // treat values with all spaces and empty strings as undefined
- attribute.value = String(attribute.value).trim();
- if (attribute.value === 'undefined' || attribute.value === '')
- attribute.value = undefined;
-
- if ($scope.verbose) {
- commentChar = attribute.required || attribute.value != attribute['default'] ? ' ' : '#';
- if (!attribute.value) {
- commentChar = '#';
- attribute.value = '';
- }
- section += commentChar + " " + attribute.name + ":" + Array(Math.max(20 - attribute.name.length, 1)).join(" ") + attribute.value + Array(Math.max(20 - ((attribute.value) + "").length, 1)).join(" ") + '# ' + attribute.description + "\n";
- } else {
- if (attribute.value) {
- if (attribute.value != attribute['default'] || attribute.required)
- section += " " + attribute.name + ":" + Array(20 - attribute.name.length).join(" ") + attribute.value + "\n";
-
- }
- }
- })
- section += "}\n\n";
- // if entity.icon is true, this is a connector intended for another router
- if (entity.icon)
- $scope.parts.push({
- output: section,
- link: entity.link,
- name: entity.link.__data__.source.name,
- references: entity.references
- });
- else
- $scope.output += section;
-
- // if this section is actually an annotation
- if (annotationKeys.indexOf(entity.actualName) > -1) {
- annotationSections[entity.actualName] = section;
- }
- })
- // go back and add annotation sections to the parts
- $scope.parts.forEach(function(part) {
- for (var section in annotationSections) {
- if (part.references.indexOf(section) > -1) {
- part.output += annotationSections[section];
- }
- }
- })
- QDR.log.debug($scope.output);
- }
-
- // handle the download button click
- $scope.download = function() {
- var output = $scope.output + "\n\n"
- var blob = new Blob([output], {
- type: 'text/plain;charset=utf-16'
- });
- saveAs(blob, $scope.newRouterName);
- }
-
- $scope.downloadPart = function(part) {
- var linkName = part.link.__data__.source.name + 'additional.conf';
- var blob = new Blob([part.output], {
- type: 'text/plain;charset=utf-16'
- });
- saveAs(blob, linkName);
- }
-
- $scope.done = function() {
- dialog.close();
- }
- });
-
return QDR;
}(QDR || {}));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org