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/11/15 14:32:00 UTC
[51/51] [partial] qpid-dispatch git commit: DISPATCH-561 Added
program to return fake management data
DISPATCH-561 Added program to return fake management data
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/c24cddee
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/c24cddee
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/c24cddee
Branch: refs/heads/master
Commit: c24cddee3af49d85f7b12e565ebe0e0aa0cfc48f
Parents: 8b48b0e
Author: Ernest Allen <ea...@redhat.com>
Authored: Tue Nov 15 09:30:39 2016 -0500
Committer: Ernest Allen <ea...@redhat.com>
Committed: Tue Nov 15 09:30:39 2016 -0500
----------------------------------------------------------------------
console/test/css/brokers.ttf | 1 +
console/test/css/dispatch.css | 1 +
console/test/css/mock.css | 13 +
console/test/css/plugin.css | 1 +
console/test/css/site-base.css | 1 +
console/test/fake.py | 306 +
console/test/html/qdrConnect.html | 1 +
console/test/html/qdrLayout.html | 1 +
console/test/html/qdrTopology.html | 143 +
console/test/index.html | 114 +
console/test/js/dispatchPlugin.js | 259 +
console/test/js/navbar.js | 77 +
console/test/js/qdrService.js | 1 +
console/test/js/qdrSettings.js | 179 +
console/test/js/qdrTopology.js | 2140 ++
console/test/lib/rhea-min.js | 1 +
console/test/mock/__init__.py | 3 +
console/test/mock/entities.py | 358 +
console/test/mock/nexthop.py | 145 +
console/test/topologies/config-1/R.0.json | 1725 +
console/test/topologies/config-1/nodeslinks.dat | 398 +
console/test/topologies/config-160/R.0.json | 6665 ++++
console/test/topologies/config-160/R.1.json | 6663 ++++
console/test/topologies/config-160/R.10.json | 6663 ++++
console/test/topologies/config-160/R.100.json | 6640 ++++
console/test/topologies/config-160/R.101.json | 6640 ++++
console/test/topologies/config-160/R.102.json | 7144 ++++
console/test/topologies/config-160/R.103.json | 6640 ++++
console/test/topologies/config-160/R.104.json | 6688 ++++
console/test/topologies/config-160/R.105.json | 7282 ++++
console/test/topologies/config-160/R.106.json | 6640 ++++
console/test/topologies/config-160/R.107.json | 6711 ++++
console/test/topologies/config-160/R.108.json | 6688 ++++
console/test/topologies/config-160/R.11.json | 6688 ++++
console/test/topologies/config-160/R.111.json | 6665 ++++
console/test/topologies/config-160/R.113.json | 6663 ++++
console/test/topologies/config-160/R.114.json | 6640 ++++
console/test/topologies/config-160/R.115.json | 6663 ++++
console/test/topologies/config-160/R.116.json | 6665 ++++
console/test/topologies/config-160/R.118.json | 6663 ++++
console/test/topologies/config-160/R.119.json | 6663 ++++
console/test/topologies/config-160/R.12.json | 6640 ++++
console/test/topologies/config-160/R.120.json | 7144 ++++
console/test/topologies/config-160/R.121.json | 6688 ++++
console/test/topologies/config-160/R.123.json | 6640 ++++
console/test/topologies/config-160/R.124.json | 6711 ++++
console/test/topologies/config-160/R.125.json | 6711 ++++
console/test/topologies/config-160/R.126.json | 6640 ++++
console/test/topologies/config-160/R.127.json | 6558 ++++
console/test/topologies/config-160/R.128.json | 6711 ++++
console/test/topologies/config-160/R.129.json | 6640 ++++
console/test/topologies/config-160/R.13.json | 6665 ++++
console/test/topologies/config-160/R.130.json | 6640 ++++
console/test/topologies/config-160/R.131.json | 6688 ++++
console/test/topologies/config-160/R.132.json | 6711 ++++
console/test/topologies/config-160/R.134.json | 6711 ++++
console/test/topologies/config-160/R.135.json | 6711 ++++
console/test/topologies/config-160/R.136.json | 6640 ++++
console/test/topologies/config-160/R.137.json | 6663 ++++
console/test/topologies/config-160/R.138.json | 6640 ++++
console/test/topologies/config-160/R.139.json | 6688 ++++
console/test/topologies/config-160/R.14.json | 6663 ++++
console/test/topologies/config-160/R.140.json | 6558 ++++
console/test/topologies/config-160/R.141.json | 6665 ++++
console/test/topologies/config-160/R.142.json | 6640 ++++
console/test/topologies/config-160/R.145.json | 7190 ++++
console/test/topologies/config-160/R.146.json | 6663 ++++
console/test/topologies/config-160/R.147.json | 6665 ++++
console/test/topologies/config-160/R.148.json | 6665 ++++
console/test/topologies/config-160/R.149.json | 6711 ++++
console/test/topologies/config-160/R.15.json | 6665 ++++
console/test/topologies/config-160/R.150.json | 7259 ++++
console/test/topologies/config-160/R.151.json | 6688 ++++
console/test/topologies/config-160/R.152.json | 6581 ++++
console/test/topologies/config-160/R.153.json | 6665 ++++
console/test/topologies/config-160/R.154.json | 6640 ++++
console/test/topologies/config-160/R.155.json | 6907 ++++
console/test/topologies/config-160/R.157.json | 7121 ++++
console/test/topologies/config-160/R.159.json | 6663 ++++
console/test/topologies/config-160/R.16.json | 6663 ++++
console/test/topologies/config-160/R.17.json | 7282 ++++
console/test/topologies/config-160/R.18.json | 6581 ++++
console/test/topologies/config-160/R.19.json | 6688 ++++
console/test/topologies/config-160/R.2.json | 6688 ++++
console/test/topologies/config-160/R.20.json | 6665 ++++
console/test/topologies/config-160/R.21.json | 6581 ++++
console/test/topologies/config-160/R.22.json | 6711 ++++
console/test/topologies/config-160/R.23.json | 6558 ++++
console/test/topologies/config-160/R.24.json | 6711 ++++
console/test/topologies/config-160/R.25.json | 6558 ++++
console/test/topologies/config-160/R.26.json | 7063 ++++
console/test/topologies/config-160/R.27.json | 6665 ++++
console/test/topologies/config-160/R.28.json | 6663 ++++
console/test/topologies/config-160/R.29.json | 6665 ++++
console/test/topologies/config-160/R.3.json | 6663 ++++
console/test/topologies/config-160/R.30.json | 6663 ++++
console/test/topologies/config-160/R.31.json | 6665 ++++
console/test/topologies/config-160/R.32.json | 6663 ++++
console/test/topologies/config-160/R.33.json | 6711 ++++
console/test/topologies/config-160/R.34.json | 6640 ++++
console/test/topologies/config-160/R.35.json | 7213 ++++
console/test/topologies/config-160/R.36.json | 6688 ++++
console/test/topologies/config-160/R.37.json | 6581 ++++
console/test/topologies/config-160/R.38.json | 6665 ++++
console/test/topologies/config-160/R.39.json | 6581 ++++
console/test/topologies/config-160/R.4.json | 6665 ++++
console/test/topologies/config-160/R.40.json | 6688 ++++
console/test/topologies/config-160/R.41.json | 6688 ++++
console/test/topologies/config-160/R.42.json | 6711 ++++
console/test/topologies/config-160/R.43.json | 6663 ++++
console/test/topologies/config-160/R.44.json | 6688 ++++
console/test/topologies/config-160/R.45.json | 6665 ++++
console/test/topologies/config-160/R.46.json | 6665 ++++
console/test/topologies/config-160/R.47.json | 6665 ++++
console/test/topologies/config-160/R.48.json | 6663 ++++
console/test/topologies/config-160/R.49.json | 6688 ++++
console/test/topologies/config-160/R.5.json | 6663 ++++
console/test/topologies/config-160/R.50.json | 7097 ++++
console/test/topologies/config-160/R.51.json | 6663 ++++
console/test/topologies/config-160/R.52.json | 6640 ++++
console/test/topologies/config-160/R.53.json | 6640 ++++
console/test/topologies/config-160/R.54.json | 6558 ++++
console/test/topologies/config-160/R.55.json | 6583 ++++
console/test/topologies/config-160/R.56.json | 6711 ++++
console/test/topologies/config-160/R.57.json | 6663 ++++
console/test/topologies/config-160/R.58.json | 6663 ++++
console/test/topologies/config-160/R.59.json | 6665 ++++
console/test/topologies/config-160/R.6.json | 6665 ++++
console/test/topologies/config-160/R.60.json | 6665 ++++
console/test/topologies/config-160/R.61.json | 6663 ++++
console/test/topologies/config-160/R.62.json | 6476 ++++
console/test/topologies/config-160/R.63.json | 6581 ++++
console/test/topologies/config-160/R.64.json | 6640 ++++
console/test/topologies/config-160/R.65.json | 6663 ++++
console/test/topologies/config-160/R.66.json | 6711 ++++
console/test/topologies/config-160/R.67.json | 7282 ++++
console/test/topologies/config-160/R.69.json | 6665 ++++
console/test/topologies/config-160/R.7.json | 6663 ++++
console/test/topologies/config-160/R.70.json | 6665 ++++
console/test/topologies/config-160/R.71.json | 6640 ++++
console/test/topologies/config-160/R.74.json | 6663 ++++
console/test/topologies/config-160/R.75.json | 7236 ++++
console/test/topologies/config-160/R.78.json | 6953 ++++
console/test/topologies/config-160/R.8.json | 7167 ++++
console/test/topologies/config-160/R.82.json | 6711 ++++
console/test/topologies/config-160/R.83.json | 6640 ++++
console/test/topologies/config-160/R.85.json | 6953 ++++
console/test/topologies/config-160/R.87.json | 6663 ++++
console/test/topologies/config-160/R.88.json | 6665 ++++
console/test/topologies/config-160/R.9.json | 6665 ++++
console/test/topologies/config-160/R.91.json | 6663 ++++
console/test/topologies/config-160/R.92.json | 6665 ++++
console/test/topologies/config-160/R.93.json | 6688 ++++
console/test/topologies/config-160/R.95.json | 6688 ++++
console/test/topologies/config-160/R.96.json | 6688 ++++
console/test/topologies/config-160/R.97.json | 6688 ++++
console/test/topologies/config-160/R.99.json | 6663 ++++
.../test/topologies/config-160/nodeslinks.dat | 30551 +++++++++++++++++
console/test/topologies/config-4/R.0.json | 1692 +
console/test/topologies/config-4/R.1.json | 1820 +
console/test/topologies/config-4/R.2.json | 1779 +
console/test/topologies/config-4/R.3.json | 1826 +
console/test/topologies/config-4/nodeslinks.dat | 598 +
console/test/topologies/config-40/R.0.json | 3124 ++
console/test/topologies/config-40/R.1.json | 3122 ++
console/test/topologies/config-40/R.10.json | 3122 ++
console/test/topologies/config-40/R.11.json | 3147 ++
console/test/topologies/config-40/R.12.json | 3099 ++
console/test/topologies/config-40/R.13.json | 3334 ++
console/test/topologies/config-40/R.14.json | 3122 ++
console/test/topologies/config-40/R.15.json | 3124 ++
console/test/topologies/config-40/R.16.json | 3122 ++
console/test/topologies/config-40/R.17.json | 3741 ++
console/test/topologies/config-40/R.18.json | 3147 ++
console/test/topologies/config-40/R.19.json | 3099 ++
console/test/topologies/config-40/R.2.json | 3147 ++
console/test/topologies/config-40/R.20.json | 3124 ++
console/test/topologies/config-40/R.21.json | 3122 ++
console/test/topologies/config-40/R.22.json | 3147 ++
console/test/topologies/config-40/R.23.json | 3099 ++
console/test/topologies/config-40/R.24.json | 3147 ++
console/test/topologies/config-40/R.25.json | 3099 ++
console/test/topologies/config-40/R.26.json | 3718 ++
console/test/topologies/config-40/R.27.json | 3124 ++
console/test/topologies/config-40/R.28.json | 3122 ++
console/test/topologies/config-40/R.29.json | 3124 ++
console/test/topologies/config-40/R.3.json | 3122 ++
console/test/topologies/config-40/R.30.json | 3122 ++
console/test/topologies/config-40/R.31.json | 3124 ++
console/test/topologies/config-40/R.32.json | 3122 ++
console/test/topologies/config-40/R.33.json | 3170 ++
console/test/topologies/config-40/R.34.json | 3099 ++
console/test/topologies/config-40/R.35.json | 3542 ++
console/test/topologies/config-40/R.36.json | 3124 ++
console/test/topologies/config-40/R.37.json | 3040 ++
console/test/topologies/config-40/R.38.json | 3124 ++
console/test/topologies/config-40/R.39.json | 3040 ++
console/test/topologies/config-40/R.4.json | 3124 ++
console/test/topologies/config-40/R.5.json | 3122 ++
console/test/topologies/config-40/R.6.json | 3124 ++
console/test/topologies/config-40/R.7.json | 3122 ++
console/test/topologies/config-40/R.8.json | 3519 ++
console/test/topologies/config-40/R.9.json | 3124 ++
.../test/topologies/config-40/nodeslinks.dat | 9407 +++++
console/test/topologies/config-6/QDR.0.json | 1940 ++
console/test/topologies/config-6/QDR.1.json | 1870 +
console/test/topologies/config-6/QDR.2.json | 1940 ++
console/test/topologies/config-6/QDR.3.json | 1894 +
console/test/topologies/config-6/QDR.4.json | 1808 +
console/test/topologies/config-6/QDR.5.json | 1766 +
console/test/topologies/config-6/nodeslinks.dat | 750 +
console/test/topologies/config-80/R.0.json | 4601 +++
console/test/topologies/config-80/R.1.json | 4599 +++
console/test/topologies/config-80/R.10.json | 4599 +++
console/test/topologies/config-80/R.11.json | 4624 +++
console/test/topologies/config-80/R.12.json | 4576 +++
console/test/topologies/config-80/R.13.json | 4601 +++
console/test/topologies/config-80/R.14.json | 4599 +++
console/test/topologies/config-80/R.15.json | 4601 +++
console/test/topologies/config-80/R.16.json | 4599 +++
console/test/topologies/config-80/R.17.json | 5172 +++
console/test/topologies/config-80/R.18.json | 4624 +++
console/test/topologies/config-80/R.19.json | 4576 +++
console/test/topologies/config-80/R.2.json | 4601 +++
console/test/topologies/config-80/R.20.json | 4601 +++
console/test/topologies/config-80/R.21.json | 4599 +++
console/test/topologies/config-80/R.22.json | 4624 +++
console/test/topologies/config-80/R.23.json | 4576 +++
console/test/topologies/config-80/R.24.json | 4624 +++
console/test/topologies/config-80/R.25.json | 4576 +++
console/test/topologies/config-80/R.26.json | 5320 +++
console/test/topologies/config-80/R.27.json | 4601 +++
console/test/topologies/config-80/R.28.json | 4599 +++
console/test/topologies/config-80/R.29.json | 4601 +++
console/test/topologies/config-80/R.3.json | 4599 +++
console/test/topologies/config-80/R.30.json | 4599 +++
console/test/topologies/config-80/R.31.json | 4811 +++
console/test/topologies/config-80/R.32.json | 4599 +++
console/test/topologies/config-80/R.33.json | 4647 +++
console/test/topologies/config-80/R.34.json | 4576 +++
console/test/topologies/config-80/R.35.json | 5065 +++
console/test/topologies/config-80/R.36.json | 4624 +++
console/test/topologies/config-80/R.37.json | 4517 +++
console/test/topologies/config-80/R.38.json | 4834 +++
console/test/topologies/config-80/R.39.json | 4517 +++
console/test/topologies/config-80/R.4.json | 4601 +++
console/test/topologies/config-80/R.40.json | 4624 +++
console/test/topologies/config-80/R.41.json | 4601 +++
console/test/topologies/config-80/R.42.json | 4647 +++
console/test/topologies/config-80/R.43.json | 4599 +++
console/test/topologies/config-80/R.44.json | 4624 +++
console/test/topologies/config-80/R.45.json | 4601 +++
console/test/topologies/config-80/R.46.json | 4601 +++
console/test/topologies/config-80/R.47.json | 4601 +++
console/test/topologies/config-80/R.48.json | 4599 +++
console/test/topologies/config-80/R.49.json | 4624 +++
console/test/topologies/config-80/R.5.json | 4599 +++
console/test/topologies/config-80/R.50.json | 5057 +++
console/test/topologies/config-80/R.51.json | 4599 +++
console/test/topologies/config-80/R.52.json | 4576 +++
console/test/topologies/config-80/R.53.json | 4576 +++
console/test/topologies/config-80/R.54.json | 4624 +++
console/test/topologies/config-80/R.55.json | 4517 +++
console/test/topologies/config-80/R.56.json | 4647 +++
console/test/topologies/config-80/R.57.json | 4599 +++
console/test/topologies/config-80/R.58.json | 4599 +++
console/test/topologies/config-80/R.59.json | 4601 +++
console/test/topologies/config-80/R.6.json | 4601 +++
console/test/topologies/config-80/R.60.json | 4601 +++
console/test/topologies/config-80/R.61.json | 4599 +++
console/test/topologies/config-80/R.62.json | 4647 +++
console/test/topologies/config-80/R.63.json | 4517 +++
console/test/topologies/config-80/R.64.json | 4576 +++
console/test/topologies/config-80/R.65.json | 4599 +++
console/test/topologies/config-80/R.66.json | 4647 +++
console/test/topologies/config-80/R.67.json | 5088 +++
console/test/topologies/config-80/R.68.json | 4647 +++
console/test/topologies/config-80/R.69.json | 4601 +++
console/test/topologies/config-80/R.7.json | 4599 +++
console/test/topologies/config-80/R.70.json | 4601 +++
console/test/topologies/config-80/R.71.json | 4576 +++
console/test/topologies/config-80/R.72.json | 4576 +++
console/test/topologies/config-80/R.73.json | 4576 +++
console/test/topologies/config-80/R.74.json | 4599 +++
console/test/topologies/config-80/R.75.json | 5172 +++
console/test/topologies/config-80/R.76.json | 4576 +++
console/test/topologies/config-80/R.77.json | 4624 +++
console/test/topologies/config-80/R.78.json | 5126 +++
console/test/topologies/config-80/R.79.json | 4576 +++
console/test/topologies/config-80/R.8.json | 5019 +++
console/test/topologies/config-80/R.9.json | 4601 +++
.../test/topologies/config-80/nodeslinks.dat | 18869 ++++++++++
console/test/topologies/schema.json | 1528 +
293 files changed, 1498818 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c24cddee/console/test/css/brokers.ttf
----------------------------------------------------------------------
diff --git a/console/test/css/brokers.ttf b/console/test/css/brokers.ttf
new file mode 120000
index 0000000..b5894a5
--- /dev/null
+++ b/console/test/css/brokers.ttf
@@ -0,0 +1 @@
+../../stand-alone/plugin/css/brokers.ttf
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c24cddee/console/test/css/dispatch.css
----------------------------------------------------------------------
diff --git a/console/test/css/dispatch.css b/console/test/css/dispatch.css
new file mode 120000
index 0000000..26812a5
--- /dev/null
+++ b/console/test/css/dispatch.css
@@ -0,0 +1 @@
+../../stand-alone/plugin/css/dispatch.css
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c24cddee/console/test/css/mock.css
----------------------------------------------------------------------
diff --git a/console/test/css/mock.css b/console/test/css/mock.css
new file mode 100644
index 0000000..539b7a6
--- /dev/null
+++ b/console/test/css/mock.css
@@ -0,0 +1,13 @@
+#buttonBar {
+ margin-left: 2em;
+}
+
+#buttonBar select {
+ position: relative;
+ top: 6px;
+}
+
+path.more {
+ stroke-width: 1;
+ stroke: black;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c24cddee/console/test/css/plugin.css
----------------------------------------------------------------------
diff --git a/console/test/css/plugin.css b/console/test/css/plugin.css
new file mode 120000
index 0000000..207638e
--- /dev/null
+++ b/console/test/css/plugin.css
@@ -0,0 +1 @@
+../../stand-alone/plugin/css/plugin.css
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c24cddee/console/test/css/site-base.css
----------------------------------------------------------------------
diff --git a/console/test/css/site-base.css b/console/test/css/site-base.css
new file mode 120000
index 0000000..874fb05
--- /dev/null
+++ b/console/test/css/site-base.css
@@ -0,0 +1 @@
+../../stand-alone/plugin/css/site-base.css
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c24cddee/console/test/fake.py
----------------------------------------------------------------------
diff --git a/console/test/fake.py b/console/test/fake.py
new file mode 100755
index 0000000..8e5ff1b
--- /dev/null
+++ b/console/test/fake.py
@@ -0,0 +1,306 @@
+#!/usr/bin/env python
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+import optparse
+from proton import Endpoint, generate_uuid
+from proton import Message
+from proton.handlers import MessagingHandler
+from proton.reactor import Container
+import json
+from pprint import pprint
+import os
+import string
+import random
+import shutil
+from mock import Connection, RouterLink, Schema, Listener, RouterNode, Hopper, Router, Address, Policy, Connector, \
+ RouterAddresses, Allocators, Logs
+import pdb
+
+def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
+ return ''.join(random.choice(chars) for _ in range(size))
+
+class Manager(object):
+ def __init__(self, topology, verbose):
+ self.topology = topology
+ self.verbose = verbose
+ self.base = "topologies/"
+
+ def operation(self, op, request):
+ m = op.replace("-", "_")
+ try:
+ method = getattr(self, m)
+ except AttributeError:
+ print op + " is not implemented yet"
+ return []
+ if self.verbose:
+ print "Got request " + op
+ return method(request)
+
+ def GET_LOG(self, request):
+ return []
+
+ def GET_SCHEMA(self, request):
+ with open(self.base + "schema.json") as fp:
+ data = json.load(fp)
+ return data
+
+ def GET_MGMT_NODES(self, request):
+ onlyfiles = []
+ if not os.path.exists(self.base + self.topology):
+ os.makedirs(self.base + self.topology)
+
+ for f in os.listdir(self.base + self.topology):
+ if os.path.isfile(os.path.join(self.base + self.topology, f)):
+ if os.path.splitext(f)[1] == ".json":
+ onlyfiles.append(unicode("amqp:/_topo_/0/" + os.path.splitext(f)[0] + "/$management"))
+ '''
+ onlyfiles = [
+ unicode("amqp:/_topo/0/" + os.path.splitext(f)[0] + "/$management", "utf-8")
+ for f in os.listdir(self.topology)
+ if os.path.isfile(os.path.join(self.topology, f)) and os.path.splitext(f)[1] == ".json"
+ ]
+ '''
+ if self.verbose:
+ pprint (onlyfiles)
+ return onlyfiles
+
+ def QUERY(self, request):
+ node = request.address
+ nid = node.split('/')[2]
+ fullentity = request.properties["entityType"]
+ entity = fullentity[len("org.apache.qpid.dispatch"):]
+ if self.verbose:
+ pprint("nid is " + nid + " entity is " + entity)
+ requestedAttrs = request.body["attributeNames"]
+ if not os.path.isfile(self.base + self.topology + "/" + nid + ".json"):
+ return {"results": [], "attributeNames": requestedAttrs}
+ with open(self.base + self.topology + "/" + nid + ".json") as fp:
+ data = json.load(fp)
+ ent = data.get(entity, {'attributeNames': [], 'results': []})
+ attributeNames = ent['attributeNames']
+ allresults = ent['results']
+ if len(requestedAttrs) == 0:
+ requestedAttrs = attributeNames
+ results = []
+ for result in allresults:
+ newresult = []
+ for atr in requestedAttrs:
+ atrindex = attributeNames.index(atr)
+ if atrindex < 0 or atrindex >= len(result):
+ newresult.append('not found')
+ else:
+ newresult.append(result[atrindex])
+ results.append(newresult)
+ newdata = {"results": results, "attributeNames": requestedAttrs}
+
+ if self.verbose:
+ pprint(newdata)
+ return newdata
+
+ def LOAD(self, request):
+ topology = request.properties["topology"]
+ fname = self.base + topology + "/nodeslinks.dat"
+ if not os.path.isfile(fname):
+ if self.verbose:
+ print "returning empty topology for " + topology
+ return {"nodes": [], "links": [], "topology": topology}
+
+ with open(fname) as fp:
+ data = json.load(fp)
+ return data
+
+ def GET_TOPOLOGY(self, request):
+ if self.verbose:
+ pprint (self.topology)
+ return unicode(self.topology)
+
+ def GET_TOPOLOGY_LIST(self, request):
+ return [unicode(f) for f in os.listdir(self.base) if os.path.splitext(f)[1] != ".json"]
+
+ def SWITCH(self, request):
+ self.topology = request.properties["topology"]
+ return self.LOAD(request)
+
+ def PUBLISH(self, request):
+ nodes = request.properties["nodes"]
+ links = request.properties["links"]
+ topology = request.properties["topology"]
+ if self.verbose:
+ print("PUBLISHing to " + topology)
+ shutil.rmtree(self.base + topology)
+
+ if not os.path.exists(self.base + topology):
+ os.makedirs(self.base + topology)
+
+ with open(self.base + topology + "/nodeslinks.dat", "w+") as fp:
+ fp.write(json.dumps({"nodes": nodes, "links": links, "topology": topology}, indent=2))
+
+ port = 20001
+ clients = {}
+ connectionId = 1
+ # cache any connections and links for clients first
+ for node in nodes:
+ if node['nodeType'] != 'inter-router':
+ if not node['key'] in clients:
+ clients[node['key']] = {"connections": [], "links": [], "addresses": []}
+
+ for normal in node["normals"]:
+ clients[node['key']]["connections"].append(Connection(node, connectionId).vals())
+ ldir = "in" if node['cdir'] == "in" else "out"
+ owningAddr = "M0" + normal['addr'] if "console_identifier" not in node['properties'] else ""
+ clients[node['key']]["links"].append(RouterLink(node, str(len(clients[node['key']]["links"])),
+ ldir, owningAddr, "endpoint", connectionId).vals())
+ if node['cdir'] == "both":
+ otherAddr = "M0" + normal['addr'] if "console_identifier" not in node['properties'] \
+ else "Ltemp." + id_generator(15)
+ clients[node['key']]["links"].append(RouterLink(node,
+ str(len(clients[node['key']]["links"])), "in",
+ otherAddr, "endpoint", connectionId).vals())
+ connectionId += 1
+
+
+ hopper = Hopper(self.verbose)
+ for node in nodes:
+ if node['nodeType'] == 'inter-router':
+ nodeInfo = {}
+
+ # this should be driven by the schema and not hard coded like this
+ nname = node["name"]
+ entities = ("connection", "router", "router.link", "router.node", "allocator",
+ "sslProfile", "autoLink", "linkRoute", "address", "policy", "log",
+ "vhost", "vhostStats", "listener", "router.address", "connector")
+ for entity in entities:
+ savedAs = entity
+ if entity == "address":
+ savedAs = "router.config.address"
+ nodeInfo["."+savedAs] = {"results": [], "attributeNames": Schema.schema[entity]["attributeNames"]}
+
+ # find all the other nodes that are linked to this node
+ nodeCons = []
+ nodeLinks = []
+ # if the link source or target is this node's id
+ for link in links:
+ # only process links to other routers
+ if link['cls'] != "small":
+ toNode = None
+ if link['source']['name'] == node['name']:
+ toNode = link['target']
+ toNode["cdir"] = "in"
+ if link['target']['name'] == node['name']:
+ toNode = link['source']
+ toNode["cdir"] = "out"
+ if toNode:
+ toNode["container"] = toNode["name"]
+ nodeCons.append(Connection(toNode, connectionId).vals())
+
+ nodeLinks.append(RouterLink(toNode, str(len(nodeLinks)+1), "in",
+ '', "router-control", connectionId).vals())
+ nodeLinks.append(RouterLink(toNode, str(len(nodeLinks)+1), "out",
+ '', "router-control", connectionId).vals())
+ nodeLinks.append(RouterLink(toNode, str(len(nodeLinks)+1), "in",
+ '', "inter-router", connectionId).vals())
+ nodeLinks.append(RouterLink(toNode, str(len(nodeLinks)+1), "out",
+ '', "inter-router", connectionId).vals())
+ connectionId += 1
+
+ nodeInfo[".connection"]["results"] = nodeCons
+ nodeInfo[".router.link"]["results"] = nodeLinks
+
+ # add any connections and links for clients
+ if node['key'] in clients:
+ nodeInfo[".connection"]["results"].extend(clients[node['key']]["connections"])
+ nodeInfo[".router.link"]["results"].extend(clients[node['key']]["links"])
+
+ nodeInfo[".listener"]["results"].append(Listener(port).vals())
+ port += 1
+
+ nodeInfo[".router"]["results"].append(Router(node).vals())
+ nodeInfo[".router.config.address"]["results"].append(Address().vals())
+ nodeInfo[".policy"]["results"].append(Policy().vals())
+
+ for connection in nodeInfo[".connection"]["results"]:
+ dir = connection[Schema.i("connection", "dir")]
+ if dir == "out":
+ hostIndex = Schema.i("connection", "host")
+ connhost, connport = connection[hostIndex].split(":")
+ nodeInfo[".connector"]["results"].append(Connector(connhost, connport).vals())
+
+ for n in nodes:
+ if n['nodeType'] == 'inter-router':
+ nodeInfo[".router.node"]["results"].append(RouterNode(node['name'], n['name'], links, hopper).vals())
+
+ nodeInfo[".router.address"]["results"] = RouterAddresses(node, nodes).vals()
+ nodeInfo[".allocator"]["results"] = Allocators().vals()
+ nodeInfo[".log"]["results"] = Logs().vals()
+
+ with open(self.base + topology + "/" + nname + ".json", "w+") as fp:
+ fp.write(json.dumps(nodeInfo, indent=2, sort_keys=True))
+
+ return "published"
+
+class MockRouter(MessagingHandler):
+ def __init__(self, url, topology, verbose):
+ super(MockRouter, self).__init__()
+ self.url = url
+ self.manager = Manager(topology, verbose)
+ self.senders = {}
+ self.verbose = verbose
+
+ def on_start(self, event):
+ self.acceptor = event.container.listen(self.url)
+
+ def on_link_opening(self, event):
+ if event.link.is_sender:
+ if event.link.remote_source.dynamic:
+ if self.verbose:
+ print("opening dynamic sender")
+ address = str(generate_uuid())
+ event.link.source.address = address
+ elif event.link.remote_source.address:
+ if self.verbose:
+ print("opening remote_source address sender")
+ event.link.source.address = event.link.remote_source.address
+ else:
+ print("received unknown sender link")
+ self.senders[event.link.source.address] = event.link
+
+ elif event.link.is_receiver:
+ if self.verbose:
+ print "got a receiver link"
+ event.link.target.address = event.link.remote_target.address
+
+ def on_message(self, event):
+ ret = self.manager.operation(event.message.properties["operation"], event.message)
+ m = Message(address=event.message.reply_to, body=ret,
+ correlation_id=event.message.correlation_id)
+ self.senders[event.message.reply_to].send(m)
+
+parser = optparse.OptionParser(usage="usage: %prog [options]")
+parser.add_option("-a", "--address", default="localhost:5672",
+ help="address router listens on (default %default)")
+parser.add_option("-t", "--topology", default="config-80",
+ help="which topology directory to return (default %default)")
+parser.add_option("-v", "--verbose", default=False,
+ help="display requests and responses to stdout (default %default)")
+opts, args = parser.parse_args()
+
+try:
+ Container(MockRouter(opts.address, opts.topology, opts.verbose)).run()
+except KeyboardInterrupt: pass
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c24cddee/console/test/html/qdrConnect.html
----------------------------------------------------------------------
diff --git a/console/test/html/qdrConnect.html b/console/test/html/qdrConnect.html
new file mode 120000
index 0000000..6eec141
--- /dev/null
+++ b/console/test/html/qdrConnect.html
@@ -0,0 +1 @@
+../../stand-alone/plugin/html/qdrConnect.html
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c24cddee/console/test/html/qdrLayout.html
----------------------------------------------------------------------
diff --git a/console/test/html/qdrLayout.html b/console/test/html/qdrLayout.html
new file mode 120000
index 0000000..d27ffd4
--- /dev/null
+++ b/console/test/html/qdrLayout.html
@@ -0,0 +1 @@
+../../stand-alone/plugin/html/qdrLayout.html
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c24cddee/console/test/html/qdrTopology.html
----------------------------------------------------------------------
diff --git a/console/test/html/qdrTopology.html b/console/test/html/qdrTopology.html
new file mode 100644
index 0000000..403a66c
--- /dev/null
+++ b/console/test/html/qdrTopology.html
@@ -0,0 +1,143 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<div class="qdrTopology row-fluid" ng-controller="QDR.TopologyController">
+ <div class="qdr-topology pane left" ng-controller="QDR.TopologyFormController">
+ <div id="topologyForm" ng-class="{selected : isSelected()}">
+ <!-- <div ng-repeat="form in forms" ng-show="isVisible(form)" ng-class='{selected : isSelected(form)}'> -->
+ <div ng-show="form == 'router'">
+ <h4>Router Info</h4>
+ <div class="gridStyle" ng-grid="topoGridOptions"></div>
+ </div>
+ <div ng-show="form == 'connection'">
+ <h4>Connection Info</h4>
+ <div class="gridStyle" ng-grid="topoGridOptions"></div>
+ </div>
+ <div id="addNodeForm" ng-show="form == 'add'">
+ <h4>Add a new router</h4>
+ <ul>
+ <li>Click on an existing router to create a connection to the new router</li>
+ <li>Double-click on the new router to <button ng-click="editNewRouter()">edit</button> its properties</li>
+ <li ng-show="addingNode.hasLink" >Right-click on a new connection to edit its properties</li>
+ </ul>
+ <button ng-click="cancel()">Cancel</button>
+ </div>
+ </div>
+ <button ng-if="panelVisible" ng-click="hideLeftPane()" class="hideLeft" title="Hide"><i class="icon-step-backward"></i></button>
+ <button ng-if="!panelVisible" ng-click="showLeftPane()" class="hideLeft" title="Show"><i class="icon-step-forward"></i></button>
+ </div>
+ <div class="panel-adjacent">
+ <div id="buttonBar">
+ <button class="btn btn-primary" type="button" ng-click="Publish()">Publish</button>
+ <button class="btn btn-primary" type="button" ng-click="Duplicate()">Duplicate</button>
+ <button class="btn btn-primary" type="button" ng-click="Clear()">Clear</button>
+ <select ng-model="mockTopologyDir" ng-options="item for item in mockTopologies"></select>
+ <button class="btn btn-primary" type="button" ng-click="settings()">Settings</button>
+ </div>
+ <!--
+ <ul class="nav nav-tabs ng-scope qdrTopoModes">
+ <li ng-repeat="mode in modes" ng-class="{active : isModeActive(mode.name), 'pull-right' : isRight(mode)}" ng-click="selectMode('{{mode.name}}')" >
+ <a data-placement="bottom" class="ng-binding"> {{mode.name}} </a></li>
+ </ul>
+-->
+ <div id="topology" ng-show="mode == 'Diagram'"><!-- d3 toplogy here --></div>
+ <div id="geology" ng-show="mode == 'Globe'"><!-- d3 globe here --></div>
+ <div id="crosssection"><!-- d3 pack here --></div>
+ <!-- <div id="addRouter" ng-show="mode == 'Add Node'"></div> -->
+ <div id="node_context_menu" class="contextMenu">
+ <ul>
+ <li class="na" ng-class="{'force-display': !isFixed()}" ng-click="setFixed(true)">Freeze in place</li>
+ <li class="na" ng-class="{'force-display': isFixed()}" ng-click="setFixed(false)">Unfreeze</li>
+ <li ng-class="{'na': contextNode.nodeType !== 'inter-router'}" class="context-separator"></li>
+ <li ng-class="{'na': contextNode.nodeType !== 'inter-router'}" ng-click="addToNode('sender')">Add a sender</li>
+ <li ng-class="{'na': contextNode.nodeType !== 'inter-router'}" ng-click="addToNode('receiver')">Add a receiver</li>
+ <li ng-class="{'na': contextNode.nodeType !== 'inter-router'}" ng-click="addToNode('both')">Add a sender/receiver</li>
+ <li ng-class="{'na': contextNode.nodeType !== 'inter-router'}" ng-click="addToNode('console')">Add a console</li>
+ <li ng-class="{'na': contextNode.nodeType !== 'inter-router'}" class="context-separator"></li>
+ <li ng-class="{'na': contextNode.nodeType !== 'inter-router'}" ng-click="addToNode('Artemis')">Add an Artemis broker</li>
+ <li ng-class="{'na': contextNode.nodeType !== 'inter-router'}" ng-click="addToNode('Qpid')">Add a Qpid broker</li>
+ <li ng-class="{'na': contextNode.nodeType !== 'inter-router'}" class="context-separator"></li>
+ <li ng-click="delNode()">Delete this node</li>
+ </ul>
+ </div>
+ <div id="svg_context_menu" class="contextMenu">
+ <ul>
+ <li ng-click="addAnotherNode()">Add a new router</li>
+ </ul>
+ </div>
+ <div id="link_context_menu" class="contextMenu">
+ <ul>
+ <li ng-click="reverseLink()">Reverse connection direction</li>
+ <li ng-click="removeLink()">Remove connection</li>
+ </ul>
+ </div>
+ <div id="svg_legend"></div>
+ </div>
+</div>
+
+
+<script type="text/ng-template" id="titleHeaderCellTemplate.html">
+ <div title="{{col.displayName}}" class="ngHeaderSortColumn {{col.headerClass}}" ng-style="{'cursor': col.cursor}" ng-class="{ 'ngSorted': !noSortVisible }">
+ <div ng-click="col.sort($event)" ng-class="'colt' + col.index" class="ngHeaderText">{{col.displayName}}</div>
+ <div class="ngSortButtonDown" ng-show="col.showSortButtonDown()"></div>
+ <div class="ngSortButtonUp" ng-show="col.showSortButtonUp()"></div>
+ <div class="ngSortPriority">{{col.sortPriority}}</div>
+ </div>
+</script>
+<script type="text/ng-template" id="titleCellTemplate.html">
+ <div title="{{row.entity[col.field]}}" class="ngCellText">{{row.entity[col.field]}}</div>
+</script>
+
+<!--
+ This is the template for the node edit dialog that is displayed.
+-->
+<script type="text/ng-template" id="node-config-template.html">
+ <div class="modal-header">
+ <h3 class="modal-title">Configure new routers/clients</h3>
+ </div>
+ <div class="modal-body">
+ <form novalidate name="editForm">
+
+ <div class="entity-description">{{entity.description}}</div>
+ <fieldset>
+ <div ng-repeat="attribute in entity.attributes">
+ <label for="{{attribute.name}}">{{attribute.humanName}}</label>
+<!-- we can't do <input type="{angular expression}"> because... jquery throws an exception because... -->
+ <div ng-if="attribute.input == 'input'">
+ <!-- ng-pattern="testPattern(attribute)" -->
+ <input ng-if="attribute.type == 'number'" type="number" name="{{attribute.name}}" id="{{attribute.name}}" ng-model="attribute.value" ng-required="attribute.required" class="ui-widget-content ui-corner-all"/>
+ <input ng-if="attribute.type == 'text'" type="text" name="{{attribute.name}}" id="{{attribute.name}}" ng-model="attribute.value" ng-required="attribute.required" class="ui-widget-content ui-corner-all"/>
+ </div>
+ <div ng-if="attribute.input == 'select'">
+ <select id="{{attribute.name}}" ng-model="attribute.selected" ng-options="item for item in attribute.rawtype"></select>
+ </div>
+ <div ng-if="attribute.input == 'boolean'" class="boolean">
+ <label><input type="radio" ng-model="attribute.value" value="true"> True</label>
+ <label><input type="radio" ng-model="attribute.value" value="false"> False</label>
+ </div>
+ </div>
+ </fieldset>
+
+ </form>
+ </div>
+ <div class="modal-footer">
+ <button class="btn btn-primary" type="button" ng-click="setSettings()">OK</button>
+ <button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button>
+ </div>
+</script>
+
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c24cddee/console/test/index.html
----------------------------------------------------------------------
diff --git a/console/test/index.html b/console/test/index.html
new file mode 100644
index 0000000..0545aa7
--- /dev/null
+++ b/console/test/index.html
@@ -0,0 +1,114 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<html xmlns:ng="http://angularjs.org">
+
+<head>
+
+ <meta charset="utf-8"/>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+ <title>Qpid Dispatch Console</title>
+
+ <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery.tipsy/1.0.2/jquery.tipsy.css" type="text/css"/>
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ng-grid/2.0.11/ng-grid.min.css" type="text/css"/>
+ <link rel="stylesheet" href="https://cdn.rawgit.com/mar10/dynatree/master/dist/skin/ui.dynatree.css" type="text/css">
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" type="text/css">
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
+
+ <link rel="stylesheet" href="css/plugin.css" type="text/css"/>
+ <link rel="stylesheet" href="css/dispatch.css" type="text/css"/>
+ <link rel="stylesheet" href="css/site-base.css" type="text/css"/>
+ <link rel="stylesheet" href="css/mock.css" type="text/css"/>
+ <link rel="stylesheet" href="https://cdn.rawgit.com/mohsen1/json-formatter/master/dist/json-formatter.min.css" type="text/css"/>
+
+</head>
+
+<body ng-app="QDR">
+
+<div id="core" ng-controller="QDR.Core">
+ <div id="alerts">
+ <uib-alert ng-repeat="alert in alerts" type="{{alert.type}}">{{alert.msg}}</uib-alert>
+ </div>
+ <div id="main-nav" class="navbar navbar-fixed-top" ng-controller="QDR.MainController">
+ <div class="navbar-inner main-nav-lower">
+ <div class="container">
+ <div class="pull-left">
+ <ul class="nav">
+ <li ng-repeat="nav in topLevelTabs track by $index"
+ ng-class="{active : !nav.isActive()}"
+ ng-show="nav.isValid()">
+ <a ng-href="{{nav.href}}" title="{{nav.title}}" data-placement="bottom" ng-bind="nav.content">
+ </a>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div id="main-body" >
+ <div id="main" class="container-fluid ng-cloak qdr">
+ <div ng-include src="'html/qdrLayout.html'"></div>
+ </div>
+ </div>
+</div>
+
+<!-- <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>
+
+ <script src="https://maxcdn.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>
+
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular.min.js"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular-sanitize.min.js"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.1.5/angular-resource.min.js"></script>
+
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.4.0/ui-bootstrap-tpls.min.js"></script>
+
+ <script src="https://cdn.rawgit.com/jaz303/tipsy/master/src/javascripts/jquery.tipsy.js"></script>
+ <script src="https://cdn.rawgit.com/briancray/tooltipsy/master/tooltipsy.min.js"></script>
+ <script src="https://cdn.rawgit.com/angular-ui/ui-slider/master/src/slider.js"></script>
+ <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="js/dispatchPlugin.js"></script>
+ <script type="text/javascript" src="js/navbar.js"></script>
+ <script type="text/javascript" src="js/qdrService.js"></script>
+ <script type="text/javascript" src="js/qdrTopology.js"></script>
+ <script type="text/javascript" src="js/qdrSettings.js"></script>
+
+ <script type="text/javascript" src="lib/rhea-min.js"></script>
+
+ <script src="https://cdn.rawgit.com/mar10/dynatree/master/dist/jquery.dynatree.min.js"></script>
+
+ <script type="text/javascript">
+ angular.element(document.getElementsByTagName('head')).append(angular.element('<base href="' + window.location.pathname + '" />'));
+ </script>
+</body>
+</html>
+
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c24cddee/console/test/js/dispatchPlugin.js
----------------------------------------------------------------------
diff --git a/console/test/js/dispatchPlugin.js b/console/test/js/dispatchPlugin.js
new file mode 100644
index 0000000..b30d9c1
--- /dev/null
+++ b/console/test/js/dispatchPlugin.js
@@ -0,0 +1,259 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+/**
+ * @module QDR
+ * @main QDR
+ *
+ * The main entry point for the QDR module
+ *
+ */
+var QDR = (function(QDR) {
+
+ /**
+ * @property pluginName
+ * @type {string}
+ *
+ * The name of this plugin
+ */
+ QDR.pluginName = "QDR";
+ QDR.pluginRoot = "";
+ QDR.isStandalone = true;
+
+ /**
+ * @property log
+ * @type {Logging.Logger}
+ *
+ * This plugin's logger instance
+ */
+ //HIO QDR.log = Logger.get(QDR.pluginName);
+ /**
+ * @property templatePath
+ * @type {string}
+ *
+ * The top level path to this plugin's partials
+ */
+ QDR.srcBase = "";
+ QDR.templatePath = QDR.srcBase + "html/";
+ QDR.cssPath = QDR.srcBase + "css/";
+ /**
+ * @property SETTINGS_KEY
+ * @type {string}
+ *
+ * The key used to fetch our settings from local storage
+ */
+ QDR.SETTINGS_KEY = 'QDRSettings';
+ QDR.LAST_LOCATION = "QDRLastLocation";
+
+ /**
+ * @property module
+ * @type {object}
+ *
+ * This plugin's angularjs module instance
+ */
+ QDR.module = angular.module(QDR.pluginName, ['ngResource', 'ngGrid', 'ui.bootstrap', 'ui.slider'/*, 'minicolors' */]);
+
+ Core = {
+ notification: function (severity, msg) {
+ $.notify(msg, severity);
+ }
+ }
+
+ // set up the routing for this plugin
+ QDR.module.config(function($routeProvider) {
+ $routeProvider
+ .when('/', {
+ templateUrl: QDR.templatePath + 'qdrConnect.html'
+ })
+ .when('/topology', {
+ templateUrl: QDR.templatePath + 'qdrTopology.html'
+ })
+ .when('/connect', {
+ templateUrl: QDR.templatePath + 'qdrConnect.html'
+ })
+ .otherwise({
+ templateUrl: QDR.templatePath + 'qdrConnect.html'
+ })
+ });
+
+ QDR.module.config(function ($compileProvider) {
+ var cur = $compileProvider.urlSanitizationWhitelist();
+ $compileProvider.urlSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|blob):/);
+ cur = $compileProvider.urlSanitizationWhitelist();
+ })
+
+ QDR.module.filter('to_trusted', ['$sce', function($sce){
+ return function(text) {
+ return $sce.trustAsHtml(text);
+ };
+ }]);
+
+ QDR.module.filter('humanify', function (QDRService) {
+ return function (input) {
+ return QDRService.humanify(input);
+ };
+ });
+
+ QDR.module.filter('Pascalcase', function () {
+ return function (str) {
+ if (!str)
+ return "";
+ return str.replace(/(\w)(\w*)/g,
+ function(g0,g1,g2){return g1.toUpperCase() + g2.toLowerCase();});
+ }
+ })
+
+ QDR.module.filter('safePlural', function () {
+ return function (str) {
+ var es = ['x', 'ch', 'ss', 'sh']
+ for (var i=0; i<es.length; ++i) {
+ if (str.endsWith(es[i]))
+ return str + 'es'
+ }
+ if (str.endsWith('y'))
+ return str.substr(0, str.length-2) + 'ies'
+ if (str.endsWith('s'))
+ return str;
+ return str + 's'
+ }
+ })
+
+ QDR.logger = function ($log) {
+ var log = $log;
+
+ this.debug = function (msg) { msg = "QDR: " + msg; log.debug(msg)};
+ this.error = function (msg) {msg = "QDR: " + msg; log.error(msg)}
+ this.info = function (msg) {msg = "QDR: " + msg; log.info(msg)}
+ this.warn = function (msg) {msg = "QDR: " + msg; log.warn(msg)}
+
+ return this;
+ }
+ // one-time initialization happens in the run function
+ // of our module
+ QDR.module.run( ["$rootScope", '$route', '$timeout', "$location", "$log", "QDRService", function ($rootScope, $route, $timeout, $location, $log, QDRService) {
+ QDR.log = new QDR.logger($log);
+ QDR.log.info("*************creating Dispatch Console************");
+ var curPath = $location.path()
+ var org = curPath.substr(1)
+ if (org && org.length > 0 && org !== "connect") {
+ $location.search('org', org)
+ } else {
+ $location.search('org', null)
+ }
+ QDR.queue = d3.queue;
+
+ QDRService.initProton();
+ var settings = angular.fromJson(localStorage[QDR.SETTINGS_KEY]);
+ if (settings && settings.autostart) {
+ QDRService.addDisconnectAction( function () {
+ $timeout(function () {
+ var lastLocation = localStorage[QDR.LAST_LOCATION] || "/overview";
+ org = lastLocation.substr(1)
+ $location.path("/connect");
+ $location.search('org', org)
+ })
+ })
+ QDRService.addConnectAction(function() {
+ QDRService.getSchema(function () {
+ QDR.log.debug("got schema after connection")
+/*
+ QDRService.addUpdatedAction("initialized", function () {
+ QDRService.delUpdatedAction("initialized")
+ QDR.log.debug("got initial topology")
+ $timeout(function() {
+ if ($location.path().startsWith(QDR.pluginRoot)) {
+ var searchObject = $location.search();
+ var goto = "overview";
+ if (searchObject.org && searchObject.org !== "connect") {
+ goto = searchObject.org;
+ }
+ $location.search('org', null)
+ $location.path(QDR.pluginRoot + "/" + goto);
+ }
+ })
+ })
+ QDR.log.debug("requesting a topology")
+ QDRService.setUpdateEntities([])
+ QDRService.topology.get()
+*/
+ })
+ });
+ QDRService.connect(settings);
+ } else {
+ $timeout(function () {
+ $location.path('/connect')
+ $location.search('org', org)
+ })
+ }
+
+ $rootScope.$on('$routeChangeSuccess', function() {
+ var path = $location.path();
+ if (path !== "/connect") {
+ localStorage[QDR.LAST_LOCATION] = path;
+ }
+ });
+
+ }]);
+
+ QDR.module.controller ("QDR.MainController", ['$scope', '$location', function ($scope, $location) {
+ QDR.log.debug("started QDR.MainController with location.url: " + $location.url());
+ QDR.log.debug("started QDR.MainController with window.location.pathname : " + window.location.pathname);
+ $scope.topLevelTabs = [];
+ $scope.topLevelTabs.push({
+ id: "qdr",
+ content: "Qpid Dispatch Router Console Test Data Creator",
+ title: "Dispatch Router Console",
+ isValid: function() { return true; },
+ href: function() { return "#connect"; },
+ isActive: function() { return true; }
+ });
+ }])
+
+ QDR.module.controller ("QDR.Core", function ($scope, $rootScope) {
+ $scope.alerts = [];
+ $scope.closeAlert = function(index) {
+ $scope.alerts.splice(index, 1);
+ };
+ $scope.$on('newAlert', function(event, data) {
+ $scope.alerts.push(data);
+ $scope.$apply();
+ });
+ $scope.$on("clearAlerts", function () {
+ $scope.alerts = [];
+ $scope.$apply();
+ })
+
+ })
+
+ return QDR;
+}(QDR || {}));
+
+var Folder = (function () {
+ function Folder(title) {
+ this.title = title;
+ this.children = [];
+ this.folder = true;
+ }
+ return Folder;
+})();
+var Leaf = (function () {
+ function Leaf(title) {
+ this.title = title;
+ }
+ return Leaf;
+})();
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c24cddee/console/test/js/navbar.js
----------------------------------------------------------------------
diff --git a/console/test/js/navbar.js b/console/test/js/navbar.js
new file mode 100644
index 0000000..dba74ec
--- /dev/null
+++ b/console/test/js/navbar.js
@@ -0,0 +1,77 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+/**
+ * @module QDR
+ */
+var QDR = (function (QDR) {
+
+ /**
+ * @property breadcrumbs
+ * @type {{content: string, title: string, isValid: isValid, href: string}[]}
+ *
+ * Data structure that defines the sub-level tabs for
+ * our plugin, used by the navbar controller to show
+ * or hide tabs based on some criteria
+ */
+ QDR.breadcrumbs = [
+ {
+ content: '<i class="icon-cogs"></i> Connect',
+ title: "Connect to a router",
+ isValid: function () { return true; },
+ href: "#" + QDR.pluginRoot + "/connect"
+ },
+ {
+ content: '<i class="icon-star-empty"></i> Topology',
+ title: "View router network topology",
+ isValid: function (QDRService) { return QDRService.isConnected(); },
+ href: "#" + QDR.pluginRoot + "/topology"
+ },
+ ];
+ /**
+ * @function NavBarController
+ *
+ * @param $scope
+ * @param workspace
+ *
+ * The controller for this plugin's navigation bar
+ *
+ */
+ QDR.module.controller("QDR.NavBarController", ['$scope', 'QDRService', '$routeParams', '$location', function($scope, QDRService, $routeParams, $location) {
+ $scope.breadcrumbs = QDR.breadcrumbs;
+ $scope.isValid = function(link) {
+ return link.isValid(QDRService, $location);
+ };
+
+ $scope.isActive = function(href) {
+ // highlight the connect tab if we are on the root page
+ if (($location.path() === QDR.pluginRoot) && (href.split("#")[1] === QDR.pluginRoot + "/connect"))
+ return true
+ return href.split("#")[1] == $location.path();
+ };
+
+ $scope.isRight = function (link) {
+ return angular.isDefined(link.right);
+ };
+
+ }]);
+
+
+ return QDR;
+
+} (QDR || {}));
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c24cddee/console/test/js/qdrService.js
----------------------------------------------------------------------
diff --git a/console/test/js/qdrService.js b/console/test/js/qdrService.js
new file mode 120000
index 0000000..2717c3a
--- /dev/null
+++ b/console/test/js/qdrService.js
@@ -0,0 +1 @@
+../../stand-alone/plugin/js/qdrService.js
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/c24cddee/console/test/js/qdrSettings.js
----------------------------------------------------------------------
diff --git a/console/test/js/qdrSettings.js b/console/test/js/qdrSettings.js
new file mode 100644
index 0000000..5ee6be2
--- /dev/null
+++ b/console/test/js/qdrSettings.js
@@ -0,0 +1,179 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+/**
+ * @module QDR
+ */
+var QDR = (function(QDR) {
+
+ /**
+ * @method SettingsController
+ * @param $scope
+ * @param QDRServer
+ *
+ * Controller that handles the QDR settings page
+ */
+
+ QDR.module.controller("QDR.SettingsController", ['$scope', 'QDRService', '$timeout', '$location', function($scope, QDRService, $timeout, $location) {
+
+ $scope.connecting = false;
+ $scope.connectionError = false;
+ $scope.connectionErrorText = undefined;
+ $scope.forms = {};
+
+ $scope.formEntity = angular.fromJson(localStorage[QDR.SETTINGS_KEY]) || {
+ address: '',
+ port: '',
+ username: '',
+ password: '',
+ autostart: false
+ };
+
+ $scope.$watch('formEntity', function(newValue, oldValue) {
+ if (newValue !== oldValue) {
+ localStorage[QDR.SETTINGS_KEY] = angular.toJson(newValue);
+ }
+ }, true);
+
+ $scope.buttonText = function() {
+ if (QDRService.isConnected()) {
+ return "Disconnect";
+ } else {
+ return "Connect";
+ }
+ };
+
+ $scope.connect = function() {
+ if (QDRService.connected) {
+ QDRService.disconnect();
+ return;
+ }
+
+ if ($scope.settings.$valid) {
+ $scope.connectionError = false;
+ $scope.connecting = true;
+ $timeout(doConnect) // timeout so connecting animation can display
+ }
+ }
+
+ var doConnect = function() {
+ if (!$scope.formEntity.address)
+ $scope.formEntity.address = "localhost"
+
+ console.log("attempting to connect to " + $scope.formEntity.address + ':' + $scope.formEntity.port);
+ QDRService.addDisconnectAction(function() {
+ $timeout(function() {
+ QDR.log.debug("disconnect action called");
+ $scope.connecting = false;
+ $scope.connectionErrorText = QDRService.errorText;
+ $scope.connectionError = true;
+ })
+ });
+ QDRService.addConnectAction(function() {
+ QDRService.getSchema(function () {
+ QDR.log.debug("got schema after connection")
+
+ $timeout(function () {
+ $scope.connecting = false;
+ $location.search('org', null)
+ $location.path(QDR.pluginRoot + "/topology");
+ })
+
+/*
+
+ QDRService.addUpdatedAction("initialized", function () {
+ QDRService.delUpdatedAction("initialized")
+ QDR.log.debug("got initial topology")
+ $timeout(function() {
+QDR.log.debug("changing location to ")
+ $scope.connecting = false;
+ $location.search('org', null)
+ $location.path(QDR.pluginRoot + "/topology");
+ })
+ })
+ QDR.log.debug("requesting a topology")
+ QDRService.setUpdateEntities([])
+ QDRService.topology.get()
+*/
+ })
+ });
+ QDRService.connect($scope.formEntity);
+ }
+
+ }]);
+
+
+ QDR.module.directive('posint', function() {
+ return {
+ require: 'ngModel',
+
+ link: function(scope, elem, attr, ctrl) {
+ // input type number allows + and - but we don't want them so filter them out
+ elem.bind('keypress', function(event) {
+ var nkey = !event.charCode ? event.which : event.charCode;
+ var skey = String.fromCharCode(nkey);
+ var nono = "-+.,"
+ if (nono.indexOf(skey) >= 0) {
+ event.preventDefault();
+ return false;
+ }
+ // firefox doesn't filter out non-numeric input. it just sets the ctrl to invalid
+ if (/[\!\@\#\$\%^&*\(\)]/.test(skey) && event.shiftKey || // prevent shift numbers
+ !( // prevent all but the following
+ nkey <= 0 || // arrows
+ nkey == 8 || // delete|backspace
+ nkey == 13 || // enter
+ (nkey >= 37 && nkey <= 40) || // arrows
+ event.ctrlKey || event.altKey || // ctrl-v, etc.
+ /[0-9]/.test(skey)) // numbers
+ ) {
+ event.preventDefault();
+ return false;
+ }
+ })
+ // check the current value of input
+ var _isPortInvalid = function(value) {
+ var port = value + ''
+ var isErrRange = false;
+ // empty string is valid
+ if (port.length !== 0) {
+ var n = ~~Number(port);
+ if (n < 1 || n > 65535) {
+ isErrRange = true;
+ }
+ }
+ ctrl.$setValidity('range', !isErrRange)
+ return isErrRange;
+ }
+
+ //For DOM -> model validation
+ ctrl.$parsers.unshift(function(value) {
+ return _isPortInvalid(value) ? undefined : value;
+ });
+
+ //For model -> DOM validation
+ ctrl.$formatters.unshift(function(value) {
+ _isPortInvalid(value);
+ return value;
+ });
+ }
+ };
+ });
+
+ return QDR;
+}(QDR || {}));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org