Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A8AC0200BC0 for ; Tue, 15 Nov 2016 15:31:19 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A733A160B02; Tue, 15 Nov 2016 14:31:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DD1AD160B40 for ; Tue, 15 Nov 2016 15:31:14 +0100 (CET) Received: (qmail 87618 invoked by uid 500); 15 Nov 2016 14:31:13 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 85787 invoked by uid 99); 15 Nov 2016 14:31:12 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Nov 2016 14:31:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 524D3E0C0A; Tue, 15 Nov 2016 14:31:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: eallen@apache.org To: commits@qpid.apache.org Date: Tue, 15 Nov 2016 14:32:00 -0000 Message-Id: In-Reply-To: <7f206face20c4075a0e951430aac738e@git.apache.org> References: <7f206face20c4075a0e951430aac738e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [51/51] [partial] qpid-dispatch git commit: DISPATCH-561 Added program to return fake management data archived-at: Tue, 15 Nov 2016 14:31:19 -0000 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 Authored: Tue Nov 15 09:30:39 2016 -0500 Committer: Ernest Allen 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 @@ + +
+
+
+ +
+

Router Info

+
+
+
+

Connection Info

+
+
+
+

Add a new router

+
    +
  • Click on an existing router to create a connection to the new router
  • +
  • Double-click on the new router to its properties
  • +
  • Right-click on a new connection to edit its properties
  • +
+ +
+
+ + +
+
+
+ + + + + +
+ +
+
+
+ +
+
    +
  • Freeze in place
  • +
  • Unfreeze
  • +
  • +
  • Add a sender
  • +
  • Add a receiver
  • +
  • Add a sender/receiver
  • +
  • Add a console
  • +
  • +
  • Add an Artemis broker
  • +
  • Add a Qpid broker
  • +
  • +
  • Delete this node
  • +
+
+
+
    +
  • Add a new router
  • +
+
+ +
+
+
+ + + + + + + + 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 @@ + + + + + + + + + Qpid Dispatch Console + + + + + + + + + + + + + + + + + + + +
+
+ {{alert.msg}} +
+ + +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 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: ' Connect', + title: "Connect to a router", + isValid: function () { return true; }, + href: "#" + QDR.pluginRoot + "/connect" + }, + { + content: ' 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