sunspot_solr 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/sunspot-solr +2 -6
- data/lib/sunspot/solr/server.rb +2 -3
- data/solr/README.txt +181 -181
- data/solr/bin/post +29 -19
- data/solr/bin/solr +247 -428
- data/solr/bin/solr.cmd +102 -256
- data/solr/bin/solr.in.cmd +15 -7
- data/solr/bin/solr.in.sh +26 -12
- data/solr/server/README.txt +110 -113
- data/solr/server/contexts/solr-jetty-context.xml +8 -8
- data/solr/server/etc/jetty-http.xml +47 -0
- data/solr/server/etc/jetty-https-ssl.xml +175 -159
- data/solr/server/etc/jetty-https.xml +53 -0
- data/solr/server/etc/jetty-ssl.xml +46 -0
- data/solr/server/etc/jetty.xml +189 -167
- data/solr/server/etc/webdefault.xml +527 -527
- data/solr/server/lib/javax.servlet-api-3.1.0.jar +0 -0
- data/solr/server/lib/jetty-continuation-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-deploy-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-http-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-io-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-jmx-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-rewrite-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-security-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-server-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-servlet-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-servlets-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-util-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-webapp-9.2.11.v20150529.jar +0 -0
- data/solr/server/lib/jetty-xml-9.2.11.v20150529.jar +0 -0
- data/solr/server/modules/http.mod +9 -0
- data/solr/server/modules/https.mod +9 -0
- data/solr/server/modules/server.mod +11 -0
- data/solr/server/modules/ssl.mod +9 -0
- data/solr/server/resources/jetty-logging.properties +1 -0
- data/solr/server/resources/log4j.properties +24 -24
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/commons-exec-1.3.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{hadoop-annotations-2.3.0.jar → hadoop-annotations-2.6.0.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.6.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.6.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.6.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/htrace-core-3.0.4.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.4.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.4.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.4.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-core-2.5.4.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/jackson-dataformat-smile-2.5.4.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-common-5.0.0.jar → lucene-analyzers-common-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-kuromoji-5.0.0.jar → lucene-analyzers-kuromoji-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-analyzers-phonetic-5.0.0.jar → lucene-analyzers-phonetic-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-expressions-5.0.0.jar → lucene-expressions-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-grouping-5.0.0.jar → lucene-grouping-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/{lucene-queryparser-5.0.0.jar → lucene-queryparser-5.3.1.jar} +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-sandbox-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/t-digest-3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/web.xml +169 -181
- data/solr/server/solr-webapp/webapp/WEB-INF/weblogic.xml +28 -28
- data/solr/server/solr-webapp/webapp/admin.html +164 -163
- data/solr/server/solr-webapp/webapp/css/angular/analysis.css +304 -0
- data/solr/server/solr-webapp/webapp/css/angular/chosen.css +465 -0
- data/solr/server/solr-webapp/webapp/css/angular/cloud.css +398 -0
- data/solr/server/solr-webapp/webapp/css/angular/common.css +724 -0
- data/solr/server/solr-webapp/webapp/css/angular/cores.css +233 -0
- data/solr/server/solr-webapp/webapp/css/angular/dataimport.css +370 -0
- data/solr/server/solr-webapp/webapp/css/angular/documents.css +179 -0
- data/solr/server/solr-webapp/webapp/css/angular/files.css +53 -0
- data/solr/server/solr-webapp/webapp/css/angular/index.css +206 -0
- data/solr/server/solr-webapp/webapp/css/angular/logging.css +376 -0
- data/solr/server/solr-webapp/webapp/css/angular/menu.css +321 -0
- data/solr/server/solr-webapp/webapp/css/angular/plugins.css +212 -0
- data/solr/server/solr-webapp/webapp/css/angular/query.css +162 -0
- data/solr/server/solr-webapp/webapp/css/angular/replication.css +500 -0
- data/solr/server/solr-webapp/webapp/css/angular/schema-browser.css +567 -0
- data/solr/server/solr-webapp/webapp/css/angular/segments.css +173 -0
- data/solr/server/solr-webapp/webapp/css/angular/threads.css +161 -0
- data/solr/server/solr-webapp/webapp/css/chosen.css +421 -421
- data/solr/server/solr-webapp/webapp/css/styles/analysis.css +311 -311
- data/solr/server/solr-webapp/webapp/css/styles/cloud.css +410 -410
- data/solr/server/solr-webapp/webapp/css/styles/common.css +701 -701
- data/solr/server/solr-webapp/webapp/css/styles/cores.css +244 -244
- data/solr/server/solr-webapp/webapp/css/styles/dashboard.css +155 -155
- data/solr/server/solr-webapp/webapp/css/styles/dataimport.css +403 -403
- data/solr/server/solr-webapp/webapp/css/styles/documents.css +197 -197
- data/solr/server/solr-webapp/webapp/css/styles/files.css +54 -54
- data/solr/server/solr-webapp/webapp/css/styles/index.css +207 -207
- data/solr/server/solr-webapp/webapp/css/styles/java-properties.css +52 -52
- data/solr/server/solr-webapp/webapp/css/styles/logging.css +391 -391
- data/solr/server/solr-webapp/webapp/css/styles/menu.css +329 -328
- data/solr/server/solr-webapp/webapp/css/styles/plugins.css +195 -195
- data/solr/server/solr-webapp/webapp/css/styles/query.css +173 -173
- data/solr/server/solr-webapp/webapp/css/styles/replication.css +515 -515
- data/solr/server/solr-webapp/webapp/css/styles/schema-browser.css +578 -578
- data/solr/server/solr-webapp/webapp/css/styles/segments.css +145 -0
- data/solr/server/solr-webapp/webapp/css/styles/threads.css +172 -172
- data/solr/server/solr-webapp/webapp/img/chosen-sprite-2x.png +0 -0
- data/solr/server/solr-webapp/webapp/img/filetypes/README +27 -27
- data/solr/server/solr-webapp/webapp/img/solr.svg +39 -39
- data/solr/server/solr-webapp/webapp/index.html +208 -0
- data/solr/server/solr-webapp/webapp/js/angular/app.js +713 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/analysis.js +199 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/cloud.js +528 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/core-overview.js +225 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/cores.js +465 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/dataimport.js +284 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/documents.js +139 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/files.js +92 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/index.js +95 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/java-properties.js +45 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/logging.js +146 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/plugins.js +166 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/query.js +99 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/replication.js +227 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/schema-browser.js +432 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/segments.js +94 -0
- data/solr/server/solr-webapp/webapp/js/angular/controllers/threads.js +51 -0
- data/solr/server/solr-webapp/webapp/js/angular/services.js +214 -0
- data/solr/server/solr-webapp/webapp/js/lib/ZeroClipboard.js +342 -342
- data/solr/server/solr-webapp/webapp/js/lib/chosen.js +982 -982
- data/solr/server/solr-webapp/webapp/js/lib/console.js +29 -29
- data/solr/server/solr-webapp/webapp/js/lib/d3.js +9373 -9373
- data/solr/server/solr-webapp/webapp/js/lib/highlight.js +31 -31
- data/solr/server/solr-webapp/webapp/js/lib/jquery-1.7.2.min.js +30 -30
- data/solr/server/solr-webapp/webapp/js/lib/jquery.ajaxfileupload.js +184 -184
- data/solr/server/solr-webapp/webapp/js/lib/jquery.blockUI.js +523 -523
- data/solr/server/solr-webapp/webapp/js/lib/jquery.cookie.js +71 -71
- data/solr/server/solr-webapp/webapp/js/lib/jquery.form.js +806 -806
- data/solr/server/solr-webapp/webapp/js/lib/jquery.jstree.js +3534 -3534
- data/solr/server/solr-webapp/webapp/js/lib/jquery.sammy.js +1863 -1863
- data/solr/server/solr-webapp/webapp/js/lib/jquery.timeago.js +189 -189
- data/solr/server/solr-webapp/webapp/js/lib/linker.js +48 -48
- data/solr/server/solr-webapp/webapp/js/lib/naturalSort.js +82 -0
- data/solr/server/solr-webapp/webapp/js/lib/order.js +216 -216
- data/solr/server/solr-webapp/webapp/js/main.js +60 -58
- data/solr/server/solr-webapp/webapp/js/require.js +11349 -11349
- data/solr/server/solr-webapp/webapp/js/scripts/analysis.js +545 -545
- data/solr/server/solr-webapp/webapp/js/scripts/app.js +680 -679
- data/solr/server/solr-webapp/webapp/js/scripts/cloud.js +877 -877
- data/solr/server/solr-webapp/webapp/js/scripts/cores.js +719 -719
- data/solr/server/solr-webapp/webapp/js/scripts/dashboard.js +562 -562
- data/solr/server/solr-webapp/webapp/js/scripts/dataimport.js +812 -812
- data/solr/server/solr-webapp/webapp/js/scripts/documents.js +370 -370
- data/solr/server/solr-webapp/webapp/js/scripts/files.js +265 -265
- data/solr/server/solr-webapp/webapp/js/scripts/index.js +340 -340
- data/solr/server/solr-webapp/webapp/js/scripts/java-properties.js +106 -106
- data/solr/server/solr-webapp/webapp/js/scripts/logging.js +578 -576
- data/solr/server/solr-webapp/webapp/js/scripts/ping.js +72 -72
- data/solr/server/solr-webapp/webapp/js/scripts/plugins.js +462 -462
- data/solr/server/solr-webapp/webapp/js/scripts/query.js +229 -229
- data/solr/server/solr-webapp/webapp/js/scripts/replication.js +527 -527
- data/solr/server/solr-webapp/webapp/js/scripts/schema-browser.js +1229 -1229
- data/solr/server/solr-webapp/webapp/js/scripts/segments.js +206 -0
- data/solr/server/solr-webapp/webapp/js/scripts/threads.js +158 -158
- data/solr/server/solr-webapp/webapp/libs/angular-chosen.js +139 -0
- data/solr/server/solr-webapp/webapp/libs/angular-cookies.js +229 -0
- data/solr/server/solr-webapp/webapp/libs/angular-cookies.min.js +31 -0
- data/solr/server/solr-webapp/webapp/libs/angular-resource.min.js +36 -0
- data/solr/server/solr-webapp/webapp/libs/angular-route.js +1018 -0
- data/solr/server/solr-webapp/webapp/libs/angular-route.min.js +38 -0
- data/solr/server/solr-webapp/webapp/libs/angular-sanitize.js +703 -0
- data/solr/server/solr-webapp/webapp/libs/angular-sanitize.min.js +39 -0
- data/solr/server/solr-webapp/webapp/libs/angular.js +26093 -0
- data/solr/server/solr-webapp/webapp/libs/angular.min.js +273 -0
- data/solr/server/solr-webapp/webapp/libs/chosen.jquery.js +1194 -0
- data/solr/server/solr-webapp/webapp/libs/chosen.jquery.min.js +30 -0
- data/solr/server/solr-webapp/webapp/libs/d3.js +9373 -0
- data/solr/server/solr-webapp/webapp/libs/highlight.js +31 -0
- data/solr/server/solr-webapp/webapp/libs/jquery-2.1.3.min.js +29 -0
- data/solr/server/solr-webapp/webapp/libs/jquery.jstree.js +3534 -0
- data/solr/server/solr-webapp/webapp/libs/ngtimeago.js +102 -0
- data/solr/server/solr-webapp/webapp/partials/analysis.html +128 -0
- data/solr/server/solr-webapp/webapp/partials/cloud.html +104 -0
- data/solr/server/solr-webapp/webapp/partials/core_overview.html +227 -0
- data/solr/server/solr-webapp/webapp/partials/cores.html +231 -0
- data/solr/server/solr-webapp/webapp/partials/dataimport.html +209 -0
- data/solr/server/solr-webapp/webapp/partials/documents.html +118 -0
- data/solr/server/solr-webapp/webapp/partials/files.html +47 -0
- data/solr/server/solr-webapp/webapp/partials/index.html +261 -0
- data/solr/server/solr-webapp/webapp/partials/java-properties.html +27 -0
- data/solr/server/solr-webapp/webapp/partials/logging-levels.html +56 -0
- data/solr/server/solr-webapp/webapp/partials/logging.html +56 -0
- data/solr/server/solr-webapp/webapp/partials/plugins.html +72 -0
- data/solr/server/solr-webapp/webapp/partials/query.html +356 -0
- data/solr/server/solr-webapp/webapp/partials/replication.html +239 -0
- data/solr/server/solr-webapp/webapp/partials/schema-browser.html +206 -0
- data/solr/server/solr-webapp/webapp/partials/segments.html +99 -0
- data/solr/server/solr-webapp/webapp/partials/threads.html +65 -0
- data/solr/server/solr-webapp/webapp/tpl/analysis.html +83 -83
- data/solr/server/solr-webapp/webapp/tpl/cloud.html +87 -87
- data/solr/server/solr-webapp/webapp/tpl/cores.html +226 -226
- data/solr/server/solr-webapp/webapp/tpl/dashboard.html +201 -201
- data/solr/server/solr-webapp/webapp/tpl/dataimport.html +183 -183
- data/solr/server/solr-webapp/webapp/tpl/documents.html +107 -107
- data/solr/server/solr-webapp/webapp/tpl/files.html +44 -44
- data/solr/server/solr-webapp/webapp/tpl/index.html +250 -250
- data/solr/server/solr-webapp/webapp/tpl/logging.html +23 -23
- data/solr/server/solr-webapp/webapp/tpl/plugins.html +39 -39
- data/solr/server/solr-webapp/webapp/tpl/query.html +361 -361
- data/solr/server/solr-webapp/webapp/tpl/replication.html +216 -216
- data/solr/server/solr-webapp/webapp/tpl/schema-browser.html +192 -192
- data/solr/server/solr-webapp/webapp/tpl/segments.html +49 -0
- data/solr/server/solr-webapp/webapp/tpl/threads.html +56 -56
- data/solr/server/solr/README.txt +77 -77
- data/solr/server/solr/solr.xml +51 -51
- data/solr/server/solr/zoo.cfg +17 -17
- data/solr/server/start.jar +0 -0
- data/spec/server_spec.rb +3 -8
- metadata +132 -43
- data/solr/server/lib/jetty-continuation-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-deploy-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-http-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-io-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-jmx-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-security-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-server-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-servlet-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-util-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-webapp-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/jetty-xml-8.1.10.v20130312.jar +0 -0
- data/solr/server/lib/servlet-api-3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/.gitignore +0 -1
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-auth-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-common-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/hadoop-hdfs-2.3.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpclient-4.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpcore-4.3.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/httpmime-4.3.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-backward-codecs-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-codecs-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-core-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-highlighter-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-join-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-memory-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-misc-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-queries-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-spatial-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/lucene-suggest-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet-2.1.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/org.restlet.ext.servlet-2.1.1.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-core-5.0.0.jar +0 -0
- data/solr/server/solr-webapp/webapp/WEB-INF/lib/solr-solrj-5.0.0.jar +0 -0
- data/solr/server/webapps/solr.war +0 -0
@@ -1,877 +1,877 @@
|
|
1
|
-
/*
|
2
|
-
Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
-
contributor license agreements. See the NOTICE file distributed with
|
4
|
-
this work for additional information regarding copyright ownership.
|
5
|
-
The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
-
(the "License"); you may not use this file except in compliance with
|
7
|
-
the License. You may obtain a copy of the License at
|
8
|
-
|
9
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
|
11
|
-
Unless required by applicable law or agreed to in writing, software
|
12
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
See the License for the specific language governing permissions and
|
15
|
-
limitations under the License.
|
16
|
-
*/
|
17
|
-
|
18
|
-
var zk_error = function zk_error( xhr, text_status, error_thrown )
|
19
|
-
{
|
20
|
-
var zk = null;
|
21
|
-
try
|
22
|
-
{
|
23
|
-
eval( 'zk = ' + xhr.responseText + ';' );
|
24
|
-
}
|
25
|
-
catch( e ) {}
|
26
|
-
|
27
|
-
var message = '<p class="txt">Loading of "<code>' + xhr.url + '</code>" '
|
28
|
-
+ 'failed (HTTP-Status <code>' + xhr.status + '</code>)</p>' + "\n";
|
29
|
-
|
30
|
-
if( zk.error )
|
31
|
-
{
|
32
|
-
message += '<p class="msg">"' + zk.error.esc() + '"</p>' + "\n";
|
33
|
-
}
|
34
|
-
|
35
|
-
this.closest( '#cloud' )
|
36
|
-
.html( '<div class="block" id="error">' + message + '</div>' );
|
37
|
-
};
|
38
|
-
|
39
|
-
var init_debug = function( cloud_element )
|
40
|
-
{
|
41
|
-
var debug_element = $( '#debug', cloud_element );
|
42
|
-
var debug_button = $( '#menu #cloud .dump a' );
|
43
|
-
|
44
|
-
var clipboard_element = $( '.clipboard', debug_element );
|
45
|
-
var clipboard_button = $( 'a', clipboard_element );
|
46
|
-
|
47
|
-
debug_button
|
48
|
-
.die( 'click' )
|
49
|
-
.live
|
50
|
-
(
|
51
|
-
'click',
|
52
|
-
function( event )
|
53
|
-
{
|
54
|
-
debug_element.trigger( 'show' );
|
55
|
-
return false;
|
56
|
-
}
|
57
|
-
);
|
58
|
-
|
59
|
-
$( '.close', debug_element )
|
60
|
-
.die( 'click' )
|
61
|
-
.live
|
62
|
-
(
|
63
|
-
'click',
|
64
|
-
function( event )
|
65
|
-
{
|
66
|
-
debug_element.trigger( 'hide' );
|
67
|
-
return false;
|
68
|
-
}
|
69
|
-
);
|
70
|
-
|
71
|
-
$( '.clipboard', debug_element )
|
72
|
-
.die( 'click' )
|
73
|
-
.live
|
74
|
-
(
|
75
|
-
'click',
|
76
|
-
function( event )
|
77
|
-
{
|
78
|
-
return false;
|
79
|
-
}
|
80
|
-
);
|
81
|
-
|
82
|
-
debug_element
|
83
|
-
.die( 'show' )
|
84
|
-
.live
|
85
|
-
(
|
86
|
-
'show',
|
87
|
-
function( event )
|
88
|
-
{
|
89
|
-
debug_element.show();
|
90
|
-
|
91
|
-
$.ajax
|
92
|
-
(
|
93
|
-
{
|
94
|
-
url : app.config.solr_path + '/zookeeper?wt=json&dump=true',
|
95
|
-
dataType : 'text',
|
96
|
-
context : debug_element,
|
97
|
-
beforeSend : function( xhr, settings )
|
98
|
-
{
|
99
|
-
$( '.debug', debug_element )
|
100
|
-
.html( '<span class="loader">Loading Dump ...</span>' );
|
101
|
-
|
102
|
-
ZeroClipboard.setMoviePath( 'img/ZeroClipboard.swf' );
|
103
|
-
|
104
|
-
clipboard_client = new ZeroClipboard.Client();
|
105
|
-
|
106
|
-
clipboard_client.addEventListener
|
107
|
-
(
|
108
|
-
'load',
|
109
|
-
function( client )
|
110
|
-
{
|
111
|
-
}
|
112
|
-
);
|
113
|
-
|
114
|
-
clipboard_client.addEventListener
|
115
|
-
(
|
116
|
-
'complete',
|
117
|
-
function( client, text )
|
118
|
-
{
|
119
|
-
clipboard_element
|
120
|
-
.addClass( 'copied' );
|
121
|
-
|
122
|
-
clipboard_button
|
123
|
-
.data( 'text', clipboard_button.text() )
|
124
|
-
.text( clipboard_button.data( 'copied' ) );
|
125
|
-
}
|
126
|
-
);
|
127
|
-
},
|
128
|
-
success : function( response, text_status, xhr )
|
129
|
-
{
|
130
|
-
clipboard_client.glue
|
131
|
-
(
|
132
|
-
clipboard_element.get(0),
|
133
|
-
clipboard_button.get(0)
|
134
|
-
);
|
135
|
-
|
136
|
-
clipboard_client.setText( response.replace( /\\/g, '\\\\' ) );
|
137
|
-
|
138
|
-
$( '.debug', debug_element )
|
139
|
-
.removeClass( 'loader' )
|
140
|
-
.text( response );
|
141
|
-
},
|
142
|
-
error : function( xhr, text_status, error_thrown )
|
143
|
-
{
|
144
|
-
},
|
145
|
-
complete : function( xhr, text_status )
|
146
|
-
{
|
147
|
-
}
|
148
|
-
}
|
149
|
-
);
|
150
|
-
}
|
151
|
-
)
|
152
|
-
.die( 'hide' )
|
153
|
-
.live
|
154
|
-
(
|
155
|
-
'hide',
|
156
|
-
function( event )
|
157
|
-
{
|
158
|
-
$( '.debug', debug_element )
|
159
|
-
.empty();
|
160
|
-
|
161
|
-
clipboard_element
|
162
|
-
.removeClass( 'copied' );
|
163
|
-
|
164
|
-
clipboard_button
|
165
|
-
.data( 'copied', clipboard_button.text() )
|
166
|
-
.text( clipboard_button.data( 'text' ) );
|
167
|
-
|
168
|
-
clipboard_client.destroy();
|
169
|
-
|
170
|
-
debug_element.hide();
|
171
|
-
}
|
172
|
-
);
|
173
|
-
};
|
174
|
-
|
175
|
-
var helper_path_class = function( p )
|
176
|
-
{
|
177
|
-
var classes = [ 'link' ];
|
178
|
-
classes.push( 'lvl-' + p.target.depth );
|
179
|
-
|
180
|
-
if( p.target.data && p.target.data.leader )
|
181
|
-
{
|
182
|
-
classes.push( 'leader' );
|
183
|
-
}
|
184
|
-
|
185
|
-
if( p.target.data && p.target.data.state )
|
186
|
-
{
|
187
|
-
classes.push( p.target.data.state );
|
188
|
-
}
|
189
|
-
|
190
|
-
return classes.join( ' ' );
|
191
|
-
};
|
192
|
-
|
193
|
-
var helper_node_class = function( d )
|
194
|
-
{
|
195
|
-
var classes = [ 'node' ];
|
196
|
-
classes.push( 'lvl-' + d.depth );
|
197
|
-
|
198
|
-
if( d.data && d.data.leader )
|
199
|
-
{
|
200
|
-
classes.push( 'leader' );
|
201
|
-
}
|
202
|
-
|
203
|
-
if( d.data && d.data.state )
|
204
|
-
{
|
205
|
-
classes.push( d.data.state );
|
206
|
-
}
|
207
|
-
|
208
|
-
return classes.join( ' ' );
|
209
|
-
};
|
210
|
-
|
211
|
-
var helper_data = {
|
212
|
-
protocol: [],
|
213
|
-
host: [],
|
214
|
-
hostname: [],
|
215
|
-
port: [],
|
216
|
-
pathname: []
|
217
|
-
};
|
218
|
-
|
219
|
-
var helper_node_text = function( d )
|
220
|
-
{
|
221
|
-
if( !d.data || !d.data.uri )
|
222
|
-
{
|
223
|
-
return d.name;
|
224
|
-
}
|
225
|
-
|
226
|
-
var name = d.data.uri.hostname;
|
227
|
-
|
228
|
-
if( 1 !== helper_data.protocol.length )
|
229
|
-
{
|
230
|
-
name = d.data.uri.protocol + '//' + name;
|
231
|
-
}
|
232
|
-
|
233
|
-
if( 1 !== helper_data.port.length )
|
234
|
-
{
|
235
|
-
name += ':' + d.data.uri.port;
|
236
|
-
}
|
237
|
-
|
238
|
-
if( 1 !== helper_data.pathname.length )
|
239
|
-
{
|
240
|
-
name += d.data.uri.pathname;
|
241
|
-
}
|
242
|
-
|
243
|
-
return name;
|
244
|
-
};
|
245
|
-
|
246
|
-
var generate_graph = function( graph_element, graph_data, leaf_count )
|
247
|
-
{
|
248
|
-
var w = graph_element.width(),
|
249
|
-
h = leaf_count * 20;
|
250
|
-
|
251
|
-
var tree = d3.layout.tree()
|
252
|
-
.size([h, w - 400]);
|
253
|
-
|
254
|
-
var diagonal = d3.svg.diagonal()
|
255
|
-
.projection(function(d) { return [d.y, d.x]; });
|
256
|
-
|
257
|
-
var vis = d3.select( '#canvas' ).append( 'svg' )
|
258
|
-
.attr( 'width', w )
|
259
|
-
.attr( 'height', h)
|
260
|
-
.append( 'g' )
|
261
|
-
.attr( 'transform', 'translate(100, 0)' );
|
262
|
-
|
263
|
-
var nodes = tree.nodes( graph_data );
|
264
|
-
|
265
|
-
var link = vis.selectAll( 'path.link' )
|
266
|
-
.data( tree.links( nodes ) )
|
267
|
-
.enter().append( 'path' )
|
268
|
-
.attr( 'class', helper_path_class )
|
269
|
-
.attr( 'd', diagonal );
|
270
|
-
|
271
|
-
var node = vis.selectAll( 'g.node' )
|
272
|
-
.data( nodes )
|
273
|
-
.enter().append( 'g' )
|
274
|
-
.attr( 'class', helper_node_class )
|
275
|
-
.attr( 'transform', function(d) { return 'translate(' + d.y + ',' + d.x + ')'; } )
|
276
|
-
|
277
|
-
node.append( 'circle' )
|
278
|
-
.attr( 'r', 4.5 );
|
279
|
-
|
280
|
-
node.append( 'text' )
|
281
|
-
.attr( 'dx', function( d ) { return 0 === d.depth ? -8 : 8; } )
|
282
|
-
.attr( 'dy', function( d ) { return 5; } )
|
283
|
-
.attr( 'text-anchor', function( d ) { return 0 === d.depth ? 'end' : 'start'; } )
|
284
|
-
.attr( 'data-href', function( d ) { return d.name; } )
|
285
|
-
.text( helper_node_text );
|
286
|
-
|
287
|
-
$( 'text[data-href*="//"]', graph_element )
|
288
|
-
.die( 'click' )
|
289
|
-
.live
|
290
|
-
(
|
291
|
-
'click',
|
292
|
-
function()
|
293
|
-
{
|
294
|
-
location.href = $( this ).data( 'href' );
|
295
|
-
}
|
296
|
-
);
|
297
|
-
};
|
298
|
-
|
299
|
-
var generate_rgraph = function( graph_element, graph_data, leaf_count )
|
300
|
-
{
|
301
|
-
var max_val = Math.min( graph_element.width(), $( 'body' ).height() )
|
302
|
-
var r = max_val / 2;
|
303
|
-
|
304
|
-
var cluster = d3.layout.cluster()
|
305
|
-
.size([360, r - 160]);
|
306
|
-
|
307
|
-
var diagonal = d3.svg.diagonal.radial()
|
308
|
-
.projection(function(d) { return [d.y, d.x / 180 * Math.PI]; });
|
309
|
-
|
310
|
-
var vis = d3.select( '#canvas' ).append( 'svg' )
|
311
|
-
.attr( 'width', r * 2 )
|
312
|
-
.attr( 'height', r * 2 )
|
313
|
-
.append( 'g' )
|
314
|
-
.attr( 'transform', 'translate(' + r + ',' + r + ')' );
|
315
|
-
|
316
|
-
var nodes = cluster.nodes( graph_data );
|
317
|
-
|
318
|
-
var link = vis.selectAll( 'path.link' )
|
319
|
-
.data( cluster.links( nodes ) )
|
320
|
-
.enter().append( 'path' )
|
321
|
-
.attr( 'class', helper_path_class )
|
322
|
-
.attr( 'd', diagonal );
|
323
|
-
|
324
|
-
var node = vis.selectAll( 'g.node' )
|
325
|
-
.data( nodes )
|
326
|
-
.enter().append( 'g' )
|
327
|
-
.attr( 'class', helper_node_class )
|
328
|
-
.attr( 'transform', function(d) { return 'rotate(' + (d.x - 90) + ')translate(' + d.y + ')'; } )
|
329
|
-
|
330
|
-
node.append( 'circle' )
|
331
|
-
.attr( 'r', 4.5 );
|
332
|
-
|
333
|
-
node.append( 'text' )
|
334
|
-
.attr( 'dx', function(d) { return d.x < 180 ? 8 : -8; } )
|
335
|
-
.attr( 'dy', '.31em' )
|
336
|
-
.attr( 'text-anchor', function(d) { return d.x < 180 ? 'start' : 'end'; } )
|
337
|
-
.attr( 'transform', function(d) { return d.x < 180 ? null : 'rotate(180)'; } )
|
338
|
-
.attr( 'data-href', function( d ) { return d.name; } )
|
339
|
-
.text( helper_node_text );
|
340
|
-
|
341
|
-
$( 'text[data-href*="//"]', graph_element )
|
342
|
-
.die( 'click' )
|
343
|
-
.live
|
344
|
-
(
|
345
|
-
'click',
|
346
|
-
function()
|
347
|
-
{
|
348
|
-
location.href = $( this ).data( 'href' );
|
349
|
-
}
|
350
|
-
);
|
351
|
-
};
|
352
|
-
|
353
|
-
var prepare_graph_data = function( response, graph_element, live_nodes, callback )
|
354
|
-
{
|
355
|
-
var state = null;
|
356
|
-
eval( 'state = ' + response.znode.data + ';' );
|
357
|
-
|
358
|
-
var leaf_count = 0;
|
359
|
-
var graph_data = {
|
360
|
-
name: null,
|
361
|
-
children : []
|
362
|
-
};
|
363
|
-
|
364
|
-
for( var c in state )
|
365
|
-
{
|
366
|
-
var shards = [];
|
367
|
-
for( var s in state[c].shards )
|
368
|
-
{
|
369
|
-
var nodes = [];
|
370
|
-
for( var n in state[c].shards[s].replicas )
|
371
|
-
{
|
372
|
-
leaf_count++;
|
373
|
-
var replica = state[c].shards[s].replicas[n]
|
374
|
-
|
375
|
-
var uri = replica.base_url;
|
376
|
-
var parts = uri.match( /^(\w+:)\/\/(([\w\d\.-]+)(:(\d+))?)(.+)$/ );
|
377
|
-
var uri_parts = {
|
378
|
-
protocol: parts[1],
|
379
|
-
host: parts[2],
|
380
|
-
hostname: parts[3],
|
381
|
-
port: parseInt( parts[5] || 80, 10 ),
|
382
|
-
pathname: parts[6]
|
383
|
-
};
|
384
|
-
|
385
|
-
helper_data.protocol.push( uri_parts.protocol );
|
386
|
-
helper_data.host.push( uri_parts.host );
|
387
|
-
helper_data.hostname.push( uri_parts.hostname );
|
388
|
-
helper_data.port.push( uri_parts.port );
|
389
|
-
helper_data.pathname.push( uri_parts.pathname );
|
390
|
-
|
391
|
-
var status = replica.state;
|
392
|
-
|
393
|
-
if( !live_nodes[replica.node_name] )
|
394
|
-
{
|
395
|
-
status = 'gone';
|
396
|
-
}
|
397
|
-
|
398
|
-
var node = {
|
399
|
-
name: uri,
|
400
|
-
data: {
|
401
|
-
type : 'node',
|
402
|
-
state : status,
|
403
|
-
leader : 'true' === replica.leader,
|
404
|
-
uri : uri_parts
|
405
|
-
}
|
406
|
-
};
|
407
|
-
nodes.push( node );
|
408
|
-
}
|
409
|
-
|
410
|
-
var shard = {
|
411
|
-
name: s,
|
412
|
-
data: {
|
413
|
-
type : 'shard'
|
414
|
-
},
|
415
|
-
children: nodes
|
416
|
-
};
|
417
|
-
shards.push( shard );
|
418
|
-
}
|
419
|
-
|
420
|
-
var collection = {
|
421
|
-
name: c,
|
422
|
-
data: {
|
423
|
-
type : 'collection'
|
424
|
-
},
|
425
|
-
children: shards
|
426
|
-
};
|
427
|
-
graph_data.children.push( collection );
|
428
|
-
}
|
429
|
-
|
430
|
-
helper_data.protocol = $.unique( helper_data.protocol );
|
431
|
-
helper_data.host = $.unique( helper_data.host );
|
432
|
-
helper_data.hostname = $.unique( helper_data.hostname );
|
433
|
-
helper_data.port = $.unique( helper_data.port );
|
434
|
-
helper_data.pathname = $.unique( helper_data.pathname );
|
435
|
-
|
436
|
-
callback( graph_element, graph_data, leaf_count );
|
437
|
-
}
|
438
|
-
|
439
|
-
var update_status_filter = function(filterType, filterVal) {
|
440
|
-
if (filterType == 'status') {
|
441
|
-
$( '#cloudGraphPagingStatusFilter' ).val(filterVal);
|
442
|
-
$( '#cloudGraphPagingStatusFilter' ).show();
|
443
|
-
$( '#cloudGraphPagingFilter' ).hide();
|
444
|
-
$( '#cloudGraphPagingFilter' ).val('');
|
445
|
-
} else {
|
446
|
-
$( '#cloudGraphPagingStatusFilter' ).hide();
|
447
|
-
$( '#cloudGraphPagingStatusFilter' ).val('');
|
448
|
-
$( '#cloudGraphPagingFilter' ).val(filterVal);
|
449
|
-
$( '#cloudGraphPagingFilter' ).show();
|
450
|
-
}
|
451
|
-
};
|
452
|
-
|
453
|
-
var prepare_graph = function( graph_element, callback )
|
454
|
-
{
|
455
|
-
$.ajax
|
456
|
-
(
|
457
|
-
{
|
458
|
-
url : app.config.solr_path + '/zookeeper?wt=json&path=%2Flive_nodes',
|
459
|
-
dataType : 'json',
|
460
|
-
success : function( response, text_status, xhr )
|
461
|
-
{
|
462
|
-
var live_nodes = {};
|
463
|
-
for( var c in response.tree[0].children )
|
464
|
-
{
|
465
|
-
live_nodes[response.tree[0].children[c].data.title] = true;
|
466
|
-
}
|
467
|
-
|
468
|
-
var start = $( '#cloudGraphPagingStart' ).val();
|
469
|
-
var rows = $( '#cloudGraphPagingRows' ).val();
|
470
|
-
var clusterStateUrl = app.config.solr_path + '/zookeeper?wt=json&detail=true&path=%2Fclusterstate.json&view=graph';
|
471
|
-
if (start && rows)
|
472
|
-
clusterStateUrl += ('&start='+start+'&rows='+rows);
|
473
|
-
|
474
|
-
var filterType = $( '#cloudGraphPagingFilterType' ).val();
|
475
|
-
if (filterType) {
|
476
|
-
var filter = (filterType == 'status')
|
477
|
-
? $( '#cloudGraphPagingStatusFilter' ).val()
|
478
|
-
: $( '#cloudGraphPagingFilter' ).val();
|
479
|
-
if (filter)
|
480
|
-
clusterStateUrl += ('&filterType='+filterType+'&filter='+filter);
|
481
|
-
}
|
482
|
-
|
483
|
-
$.ajax
|
484
|
-
(
|
485
|
-
{
|
486
|
-
url : clusterStateUrl,
|
487
|
-
dataType : 'json',
|
488
|
-
context : graph_element,
|
489
|
-
beforeSend : function( xhr, settings )
|
490
|
-
{
|
491
|
-
this.show();
|
492
|
-
},
|
493
|
-
success : function( response, text_status, xhr )
|
494
|
-
{
|
495
|
-
prepare_graph_data(response, graph_element, live_nodes, callback)
|
496
|
-
|
497
|
-
if (response.znode && response.znode.paging) {
|
498
|
-
var parr = response.znode.paging.split('|');
|
499
|
-
if (parr.length < 3) {
|
500
|
-
$( '#cloudGraphPaging' ).hide();
|
501
|
-
return;
|
502
|
-
}
|
503
|
-
|
504
|
-
var start = Math.max(parseInt(parr[0]),0);
|
505
|
-
var prevEnabled = (start > 0);
|
506
|
-
$('#cloudGraphPagingPrev').prop('disabled', !prevEnabled);
|
507
|
-
if (prevEnabled)
|
508
|
-
$('#cloudGraphPagingPrev').show();
|
509
|
-
else
|
510
|
-
$('#cloudGraphPagingPrev').hide();
|
511
|
-
|
512
|
-
var rows = parseInt(parr[1])
|
513
|
-
var total = parseInt(parr[2])
|
514
|
-
$( '#cloudGraphPagingStart' ).val(start);
|
515
|
-
$( '#cloudGraphPagingRows' ).val(rows);
|
516
|
-
if (rows == -1)
|
517
|
-
$( '#cloudGraphPaging' ).hide();
|
518
|
-
|
519
|
-
var filterType = parr.length > 3 ? parr[3] : '';
|
520
|
-
if (filterType == '' || filterType == 'none') filterType = 'status';
|
521
|
-
|
522
|
-
$( '#cloudGraphPagingFilterType' ).val(filterType);
|
523
|
-
var filter = parr.length > 4 ? parr[4] : '';
|
524
|
-
|
525
|
-
update_status_filter(filterType, filter);
|
526
|
-
|
527
|
-
var page = Math.floor(start/rows)+1;
|
528
|
-
var pages = Math.ceil(total/rows);
|
529
|
-
var last = Math.min(start+rows,total);
|
530
|
-
var nextEnabled = (last < total);
|
531
|
-
$('#cloudGraphPagingNext').prop('disabled', !nextEnabled);
|
532
|
-
if (nextEnabled)
|
533
|
-
$('#cloudGraphPagingNext').show();
|
534
|
-
else
|
535
|
-
$('#cloudGraphPagingNext').hide();
|
536
|
-
|
537
|
-
var status = (total > 0)
|
538
|
-
? 'Collections '+(start+1)+' - '+last+' of '+total+'. '
|
539
|
-
: 'No collections found.';
|
540
|
-
$( '#cloudGraphPagingStatus' ).html(status);
|
541
|
-
} else {
|
542
|
-
$( '#cloudGraphPaging' ).hide();
|
543
|
-
}
|
544
|
-
},
|
545
|
-
error : function( xhr, text_status, error_thrown)
|
546
|
-
{
|
547
|
-
},
|
548
|
-
complete : function( xhr, text_status )
|
549
|
-
{
|
550
|
-
}
|
551
|
-
}
|
552
|
-
);
|
553
|
-
},
|
554
|
-
error : function( xhr, text_status, error_thrown)
|
555
|
-
{
|
556
|
-
},
|
557
|
-
complete : function( xhr, text_status )
|
558
|
-
{
|
559
|
-
}
|
560
|
-
}
|
561
|
-
);
|
562
|
-
|
563
|
-
};
|
564
|
-
|
565
|
-
var init_graph = function( graph_element )
|
566
|
-
{
|
567
|
-
prepare_graph
|
568
|
-
(
|
569
|
-
graph_element,
|
570
|
-
function( graph_element, graph_data, leaf_count )
|
571
|
-
{
|
572
|
-
generate_graph( graph_element, graph_data, leaf_count );
|
573
|
-
}
|
574
|
-
);
|
575
|
-
}
|
576
|
-
|
577
|
-
var init_rgraph = function( graph_element )
|
578
|
-
{
|
579
|
-
prepare_graph
|
580
|
-
(
|
581
|
-
graph_element,
|
582
|
-
function( graph_element, graph_data, leaf_count )
|
583
|
-
{
|
584
|
-
generate_rgraph( graph_element, graph_data, leaf_count );
|
585
|
-
}
|
586
|
-
);
|
587
|
-
}
|
588
|
-
|
589
|
-
var init_tree = function( tree_element )
|
590
|
-
{
|
591
|
-
$.ajax
|
592
|
-
(
|
593
|
-
{
|
594
|
-
url : app.config.solr_path + '/zookeeper?wt=json',
|
595
|
-
dataType : 'json',
|
596
|
-
context : tree_element,
|
597
|
-
beforeSend : function( xhr, settings )
|
598
|
-
{
|
599
|
-
this
|
600
|
-
.show();
|
601
|
-
},
|
602
|
-
success : function( response, text_status, xhr )
|
603
|
-
{
|
604
|
-
var self = this;
|
605
|
-
|
606
|
-
$( '#tree', this )
|
607
|
-
.jstree
|
608
|
-
(
|
609
|
-
{
|
610
|
-
"plugins" : [ "json_data" ],
|
611
|
-
"json_data" : {
|
612
|
-
"data" : response.tree,
|
613
|
-
"progressive_render" : true
|
614
|
-
},
|
615
|
-
"core" : {
|
616
|
-
"animation" : 0
|
617
|
-
}
|
618
|
-
}
|
619
|
-
)
|
620
|
-
.jstree
|
621
|
-
(
|
622
|
-
'open_node',
|
623
|
-
'li:first'
|
624
|
-
);
|
625
|
-
|
626
|
-
var tree_links = $( '#tree a', this );
|
627
|
-
|
628
|
-
tree_links
|
629
|
-
.die( 'click' )
|
630
|
-
.live
|
631
|
-
(
|
632
|
-
'click',
|
633
|
-
function( event )
|
634
|
-
{
|
635
|
-
$( 'a.active', $( this ).parents( '#tree' ) )
|
636
|
-
.removeClass( 'active' );
|
637
|
-
|
638
|
-
$( this )
|
639
|
-
.addClass( 'active' );
|
640
|
-
|
641
|
-
tree_element
|
642
|
-
.addClass( 'show' );
|
643
|
-
|
644
|
-
var file_content = $( '#file-content' );
|
645
|
-
|
646
|
-
$( 'a.close', file_content )
|
647
|
-
.die( 'click' )
|
648
|
-
.live
|
649
|
-
(
|
650
|
-
'click',
|
651
|
-
function( event )
|
652
|
-
{
|
653
|
-
$( '#tree a.active' )
|
654
|
-
.removeClass( 'active' );
|
655
|
-
|
656
|
-
tree_element
|
657
|
-
.removeClass( 'show' );
|
658
|
-
|
659
|
-
return false;
|
660
|
-
}
|
661
|
-
);
|
662
|
-
|
663
|
-
$.ajax
|
664
|
-
(
|
665
|
-
{
|
666
|
-
url : this.href,
|
667
|
-
dataType : 'json',
|
668
|
-
context : file_content,
|
669
|
-
beforeSend : function( xhr, settings )
|
670
|
-
{
|
671
|
-
},
|
672
|
-
success : function( response, text_status, xhr )
|
673
|
-
{
|
674
|
-
var props = [];
|
675
|
-
for( var key in response.znode.prop )
|
676
|
-
{
|
677
|
-
props.push
|
678
|
-
(
|
679
|
-
'<li><dl class="clearfix">' + "\n" +
|
680
|
-
'<dt>' + key.esc() + '</dt>' + "\n" +
|
681
|
-
'<dd>' + response.znode.prop[key].esc() + '</dd>' + "\n" +
|
682
|
-
'</dl></li>'
|
683
|
-
);
|
684
|
-
}
|
685
|
-
|
686
|
-
$( '#prop ul', this )
|
687
|
-
.empty()
|
688
|
-
.html( props.join( "\n" ) );
|
689
|
-
|
690
|
-
$( '#prop ul li:odd', this )
|
691
|
-
.addClass( 'odd' );
|
692
|
-
|
693
|
-
var data_element = $( '#data', this );
|
694
|
-
|
695
|
-
var highlight = false;
|
696
|
-
var data = '<em>Node "' + response.znode.path + '" has no utf8 Content</em>';
|
697
|
-
|
698
|
-
if( response.znode.data )
|
699
|
-
{
|
700
|
-
var classes = '';
|
701
|
-
var path = response.znode.path.split( '.' );
|
702
|
-
|
703
|
-
if( 1 < path.length )
|
704
|
-
{
|
705
|
-
highlight = true;
|
706
|
-
classes = 'syntax language-' + path.pop().esc();
|
707
|
-
}
|
708
|
-
|
709
|
-
data = '<pre class="' + classes + '">'
|
710
|
-
+ response.znode.data.esc()
|
711
|
-
+ '</pre>';
|
712
|
-
}
|
713
|
-
|
714
|
-
|
715
|
-
data_element
|
716
|
-
.show()
|
717
|
-
.html( data );
|
718
|
-
|
719
|
-
if( highlight )
|
720
|
-
{
|
721
|
-
hljs.highlightBlock( data_element.get(0) );
|
722
|
-
}
|
723
|
-
|
724
|
-
},
|
725
|
-
error : function( xhr, text_status, error_thrown)
|
726
|
-
{
|
727
|
-
},
|
728
|
-
complete : function( xhr, text_status )
|
729
|
-
{
|
730
|
-
}
|
731
|
-
}
|
732
|
-
);
|
733
|
-
|
734
|
-
return false;
|
735
|
-
}
|
736
|
-
);
|
737
|
-
},
|
738
|
-
error : zk_error,
|
739
|
-
complete : function( xhr, text_status )
|
740
|
-
{
|
741
|
-
}
|
742
|
-
}
|
743
|
-
);
|
744
|
-
};
|
745
|
-
|
746
|
-
// updates the starting position for paged navigation
|
747
|
-
// and then rebuilds the graph based on the selected page
|
748
|
-
var update_start = function(direction, cloud_element) {
|
749
|
-
var start = $( '#cloudGraphPagingStart' ).val();
|
750
|
-
var rows = $( '#cloudGraphPagingRows' ).val();
|
751
|
-
var startAt = start ? parseInt(start) : 0;
|
752
|
-
var numRows = rows ? parseInt(rows) : 20;
|
753
|
-
var newStart = Math.max(startAt + (rows * direction),0);
|
754
|
-
$( '#cloudGraphPagingStart' ).val(newStart);
|
755
|
-
|
756
|
-
var graph_element = $( '#graph-content', cloud_element );
|
757
|
-
$( '#canvas', graph_element).empty();
|
758
|
-
init_graph( graph_element );
|
759
|
-
};
|
760
|
-
|
761
|
-
// #/~cloud
|
762
|
-
sammy.get
|
763
|
-
(
|
764
|
-
/^#\/(~cloud)$/,
|
765
|
-
function( context )
|
766
|
-
{
|
767
|
-
var content_element = $( '#content' );
|
768
|
-
|
769
|
-
$.get
|
770
|
-
(
|
771
|
-
'tpl/cloud.html',
|
772
|
-
function( template )
|
773
|
-
{
|
774
|
-
content_element
|
775
|
-
.html( template );
|
776
|
-
|
777
|
-
var cloud_element = $( '#cloud', content_element );
|
778
|
-
var navigation_element = $( '#menu #cloud' );
|
779
|
-
|
780
|
-
init_debug( cloud_element );
|
781
|
-
|
782
|
-
$( '.tree', navigation_element )
|
783
|
-
.die( 'activate' )
|
784
|
-
.live
|
785
|
-
(
|
786
|
-
'activate',
|
787
|
-
function( event )
|
788
|
-
{
|
789
|
-
$( this ).addClass( 'active' );
|
790
|
-
init_tree( $( '#tree-content', cloud_element ) );
|
791
|
-
}
|
792
|
-
);
|
793
|
-
|
794
|
-
$( '.graph', navigation_element )
|
795
|
-
.die( 'activate' )
|
796
|
-
.live
|
797
|
-
(
|
798
|
-
'activate',
|
799
|
-
function( event )
|
800
|
-
{
|
801
|
-
$( this ).addClass( 'active' );
|
802
|
-
init_graph( $( '#graph-content', cloud_element ) );
|
803
|
-
|
804
|
-
$('#cloudGraphPagingNext').click(function() {
|
805
|
-
update_start(1, cloud_element);
|
806
|
-
});
|
807
|
-
|
808
|
-
$('#cloudGraphPagingPrev').click(function() {
|
809
|
-
update_start(-1, cloud_element);
|
810
|
-
});
|
811
|
-
|
812
|
-
$('#cloudGraphPagingRows').change(function() {
|
813
|
-
var rows = $( this ).val();
|
814
|
-
if (!rows || rows == '')
|
815
|
-
$( this ).val("20");
|
816
|
-
|
817
|
-
// ? restart the start position when rows changes?
|
818
|
-
$( '#cloudGraphPagingStart' ).val(0);
|
819
|
-
update_start(-1, cloud_element);
|
820
|
-
});
|
821
|
-
|
822
|
-
$('#cloudGraphPagingFilter').change(function() {
|
823
|
-
var filter = $( this ).val();
|
824
|
-
// reset the start position when the filter changes
|
825
|
-
$( '#cloudGraphPagingStart' ).val(0);
|
826
|
-
update_start(-1, cloud_element);
|
827
|
-
});
|
828
|
-
|
829
|
-
$( '#cloudGraphPagingStatusFilter' ).show();
|
830
|
-
$( '#cloudGraphPagingFilter' ).hide();
|
831
|
-
|
832
|
-
$('#cloudGraphPagingFilterType').change(function() {
|
833
|
-
update_status_filter($( this ).val(), '');
|
834
|
-
});
|
835
|
-
|
836
|
-
$('#cloudGraphPagingStatusFilter').change(function() {
|
837
|
-
// just reset the paged navigation controls based on this update
|
838
|
-
$( '#cloudGraphPagingStart' ).val(0);
|
839
|
-
update_start(-1, cloud_element);
|
840
|
-
});
|
841
|
-
|
842
|
-
}
|
843
|
-
);
|
844
|
-
|
845
|
-
$( '.rgraph', navigation_element )
|
846
|
-
.die( 'activate' )
|
847
|
-
.live
|
848
|
-
(
|
849
|
-
'activate',
|
850
|
-
function( event )
|
851
|
-
{
|
852
|
-
$( "#cloudGraphPaging" ).hide(); // TODO: paging for rgraph too
|
853
|
-
|
854
|
-
$( this ).addClass( 'active' );
|
855
|
-
init_rgraph( $( '#graph-content', cloud_element ) );
|
856
|
-
}
|
857
|
-
);
|
858
|
-
|
859
|
-
$.ajax
|
860
|
-
(
|
861
|
-
{
|
862
|
-
url : app.config.solr_path + '/zookeeper?wt=json',
|
863
|
-
dataType : 'json',
|
864
|
-
context : cloud_element,
|
865
|
-
success : function( response, text_status, xhr )
|
866
|
-
{
|
867
|
-
$( 'a[href="' + context.path + '"]', navigation_element )
|
868
|
-
.trigger( 'activate' );
|
869
|
-
},
|
870
|
-
error : zk_error
|
871
|
-
}
|
872
|
-
);
|
873
|
-
|
874
|
-
}
|
875
|
-
);
|
876
|
-
}
|
877
|
-
);
|
1
|
+
/*
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
+
contributor license agreements. See the NOTICE file distributed with
|
4
|
+
this work for additional information regarding copyright ownership.
|
5
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
+
(the "License"); you may not use this file except in compliance with
|
7
|
+
the License. You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
*/
|
17
|
+
|
18
|
+
var zk_error = function zk_error( xhr, text_status, error_thrown )
|
19
|
+
{
|
20
|
+
var zk = null;
|
21
|
+
try
|
22
|
+
{
|
23
|
+
eval( 'zk = ' + xhr.responseText + ';' );
|
24
|
+
}
|
25
|
+
catch( e ) {}
|
26
|
+
|
27
|
+
var message = '<p class="txt">Loading of "<code>' + xhr.url + '</code>" '
|
28
|
+
+ 'failed (HTTP-Status <code>' + xhr.status + '</code>)</p>' + "\n";
|
29
|
+
|
30
|
+
if( zk.error )
|
31
|
+
{
|
32
|
+
message += '<p class="msg">"' + zk.error.esc() + '"</p>' + "\n";
|
33
|
+
}
|
34
|
+
|
35
|
+
this.closest( '#cloud' )
|
36
|
+
.html( '<div class="block" id="error">' + message + '</div>' );
|
37
|
+
};
|
38
|
+
|
39
|
+
var init_debug = function( cloud_element )
|
40
|
+
{
|
41
|
+
var debug_element = $( '#debug', cloud_element );
|
42
|
+
var debug_button = $( '#menu #cloud .dump a' );
|
43
|
+
|
44
|
+
var clipboard_element = $( '.clipboard', debug_element );
|
45
|
+
var clipboard_button = $( 'a', clipboard_element );
|
46
|
+
|
47
|
+
debug_button
|
48
|
+
.die( 'click' )
|
49
|
+
.live
|
50
|
+
(
|
51
|
+
'click',
|
52
|
+
function( event )
|
53
|
+
{
|
54
|
+
debug_element.trigger( 'show' );
|
55
|
+
return false;
|
56
|
+
}
|
57
|
+
);
|
58
|
+
|
59
|
+
$( '.close', debug_element )
|
60
|
+
.die( 'click' )
|
61
|
+
.live
|
62
|
+
(
|
63
|
+
'click',
|
64
|
+
function( event )
|
65
|
+
{
|
66
|
+
debug_element.trigger( 'hide' );
|
67
|
+
return false;
|
68
|
+
}
|
69
|
+
);
|
70
|
+
|
71
|
+
$( '.clipboard', debug_element )
|
72
|
+
.die( 'click' )
|
73
|
+
.live
|
74
|
+
(
|
75
|
+
'click',
|
76
|
+
function( event )
|
77
|
+
{
|
78
|
+
return false;
|
79
|
+
}
|
80
|
+
);
|
81
|
+
|
82
|
+
debug_element
|
83
|
+
.die( 'show' )
|
84
|
+
.live
|
85
|
+
(
|
86
|
+
'show',
|
87
|
+
function( event )
|
88
|
+
{
|
89
|
+
debug_element.show();
|
90
|
+
|
91
|
+
$.ajax
|
92
|
+
(
|
93
|
+
{
|
94
|
+
url : app.config.solr_path + '/zookeeper?wt=json&dump=true',
|
95
|
+
dataType : 'text',
|
96
|
+
context : debug_element,
|
97
|
+
beforeSend : function( xhr, settings )
|
98
|
+
{
|
99
|
+
$( '.debug', debug_element )
|
100
|
+
.html( '<span class="loader">Loading Dump ...</span>' );
|
101
|
+
|
102
|
+
ZeroClipboard.setMoviePath( 'img/ZeroClipboard.swf' );
|
103
|
+
|
104
|
+
clipboard_client = new ZeroClipboard.Client();
|
105
|
+
|
106
|
+
clipboard_client.addEventListener
|
107
|
+
(
|
108
|
+
'load',
|
109
|
+
function( client )
|
110
|
+
{
|
111
|
+
}
|
112
|
+
);
|
113
|
+
|
114
|
+
clipboard_client.addEventListener
|
115
|
+
(
|
116
|
+
'complete',
|
117
|
+
function( client, text )
|
118
|
+
{
|
119
|
+
clipboard_element
|
120
|
+
.addClass( 'copied' );
|
121
|
+
|
122
|
+
clipboard_button
|
123
|
+
.data( 'text', clipboard_button.text() )
|
124
|
+
.text( clipboard_button.data( 'copied' ) );
|
125
|
+
}
|
126
|
+
);
|
127
|
+
},
|
128
|
+
success : function( response, text_status, xhr )
|
129
|
+
{
|
130
|
+
clipboard_client.glue
|
131
|
+
(
|
132
|
+
clipboard_element.get(0),
|
133
|
+
clipboard_button.get(0)
|
134
|
+
);
|
135
|
+
|
136
|
+
clipboard_client.setText( response.replace( /\\/g, '\\\\' ) );
|
137
|
+
|
138
|
+
$( '.debug', debug_element )
|
139
|
+
.removeClass( 'loader' )
|
140
|
+
.text( response );
|
141
|
+
},
|
142
|
+
error : function( xhr, text_status, error_thrown )
|
143
|
+
{
|
144
|
+
},
|
145
|
+
complete : function( xhr, text_status )
|
146
|
+
{
|
147
|
+
}
|
148
|
+
}
|
149
|
+
);
|
150
|
+
}
|
151
|
+
)
|
152
|
+
.die( 'hide' )
|
153
|
+
.live
|
154
|
+
(
|
155
|
+
'hide',
|
156
|
+
function( event )
|
157
|
+
{
|
158
|
+
$( '.debug', debug_element )
|
159
|
+
.empty();
|
160
|
+
|
161
|
+
clipboard_element
|
162
|
+
.removeClass( 'copied' );
|
163
|
+
|
164
|
+
clipboard_button
|
165
|
+
.data( 'copied', clipboard_button.text() )
|
166
|
+
.text( clipboard_button.data( 'text' ) );
|
167
|
+
|
168
|
+
clipboard_client.destroy();
|
169
|
+
|
170
|
+
debug_element.hide();
|
171
|
+
}
|
172
|
+
);
|
173
|
+
};
|
174
|
+
|
175
|
+
var helper_path_class = function( p )
|
176
|
+
{
|
177
|
+
var classes = [ 'link' ];
|
178
|
+
classes.push( 'lvl-' + p.target.depth );
|
179
|
+
|
180
|
+
if( p.target.data && p.target.data.leader )
|
181
|
+
{
|
182
|
+
classes.push( 'leader' );
|
183
|
+
}
|
184
|
+
|
185
|
+
if( p.target.data && p.target.data.state )
|
186
|
+
{
|
187
|
+
classes.push( p.target.data.state );
|
188
|
+
}
|
189
|
+
|
190
|
+
return classes.join( ' ' );
|
191
|
+
};
|
192
|
+
|
193
|
+
var helper_node_class = function( d )
|
194
|
+
{
|
195
|
+
var classes = [ 'node' ];
|
196
|
+
classes.push( 'lvl-' + d.depth );
|
197
|
+
|
198
|
+
if( d.data && d.data.leader )
|
199
|
+
{
|
200
|
+
classes.push( 'leader' );
|
201
|
+
}
|
202
|
+
|
203
|
+
if( d.data && d.data.state )
|
204
|
+
{
|
205
|
+
classes.push( d.data.state );
|
206
|
+
}
|
207
|
+
|
208
|
+
return classes.join( ' ' );
|
209
|
+
};
|
210
|
+
|
211
|
+
var helper_data = {
|
212
|
+
protocol: [],
|
213
|
+
host: [],
|
214
|
+
hostname: [],
|
215
|
+
port: [],
|
216
|
+
pathname: []
|
217
|
+
};
|
218
|
+
|
219
|
+
var helper_node_text = function( d )
|
220
|
+
{
|
221
|
+
if( !d.data || !d.data.uri )
|
222
|
+
{
|
223
|
+
return d.name;
|
224
|
+
}
|
225
|
+
|
226
|
+
var name = d.data.uri.hostname;
|
227
|
+
|
228
|
+
if( 1 !== helper_data.protocol.length )
|
229
|
+
{
|
230
|
+
name = d.data.uri.protocol + '//' + name;
|
231
|
+
}
|
232
|
+
|
233
|
+
if( 1 !== helper_data.port.length )
|
234
|
+
{
|
235
|
+
name += ':' + d.data.uri.port;
|
236
|
+
}
|
237
|
+
|
238
|
+
if( 1 !== helper_data.pathname.length )
|
239
|
+
{
|
240
|
+
name += d.data.uri.pathname;
|
241
|
+
}
|
242
|
+
|
243
|
+
return name;
|
244
|
+
};
|
245
|
+
|
246
|
+
var generate_graph = function( graph_element, graph_data, leaf_count )
|
247
|
+
{
|
248
|
+
var w = graph_element.width(),
|
249
|
+
h = leaf_count * 20;
|
250
|
+
|
251
|
+
var tree = d3.layout.tree()
|
252
|
+
.size([h, w - 400]);
|
253
|
+
|
254
|
+
var diagonal = d3.svg.diagonal()
|
255
|
+
.projection(function(d) { return [d.y, d.x]; });
|
256
|
+
|
257
|
+
var vis = d3.select( '#canvas' ).append( 'svg' )
|
258
|
+
.attr( 'width', w )
|
259
|
+
.attr( 'height', h)
|
260
|
+
.append( 'g' )
|
261
|
+
.attr( 'transform', 'translate(100, 0)' );
|
262
|
+
|
263
|
+
var nodes = tree.nodes( graph_data );
|
264
|
+
|
265
|
+
var link = vis.selectAll( 'path.link' )
|
266
|
+
.data( tree.links( nodes ) )
|
267
|
+
.enter().append( 'path' )
|
268
|
+
.attr( 'class', helper_path_class )
|
269
|
+
.attr( 'd', diagonal );
|
270
|
+
|
271
|
+
var node = vis.selectAll( 'g.node' )
|
272
|
+
.data( nodes )
|
273
|
+
.enter().append( 'g' )
|
274
|
+
.attr( 'class', helper_node_class )
|
275
|
+
.attr( 'transform', function(d) { return 'translate(' + d.y + ',' + d.x + ')'; } )
|
276
|
+
|
277
|
+
node.append( 'circle' )
|
278
|
+
.attr( 'r', 4.5 );
|
279
|
+
|
280
|
+
node.append( 'text' )
|
281
|
+
.attr( 'dx', function( d ) { return 0 === d.depth ? -8 : 8; } )
|
282
|
+
.attr( 'dy', function( d ) { return 5; } )
|
283
|
+
.attr( 'text-anchor', function( d ) { return 0 === d.depth ? 'end' : 'start'; } )
|
284
|
+
.attr( 'data-href', function( d ) { return d.name; } )
|
285
|
+
.text( helper_node_text );
|
286
|
+
|
287
|
+
$( 'text[data-href*="//"]', graph_element )
|
288
|
+
.die( 'click' )
|
289
|
+
.live
|
290
|
+
(
|
291
|
+
'click',
|
292
|
+
function()
|
293
|
+
{
|
294
|
+
location.href = $( this ).data( 'href' );
|
295
|
+
}
|
296
|
+
);
|
297
|
+
};
|
298
|
+
|
299
|
+
var generate_rgraph = function( graph_element, graph_data, leaf_count )
|
300
|
+
{
|
301
|
+
var max_val = Math.min( graph_element.width(), $( 'body' ).height() )
|
302
|
+
var r = max_val / 2;
|
303
|
+
|
304
|
+
var cluster = d3.layout.cluster()
|
305
|
+
.size([360, r - 160]);
|
306
|
+
|
307
|
+
var diagonal = d3.svg.diagonal.radial()
|
308
|
+
.projection(function(d) { return [d.y, d.x / 180 * Math.PI]; });
|
309
|
+
|
310
|
+
var vis = d3.select( '#canvas' ).append( 'svg' )
|
311
|
+
.attr( 'width', r * 2 )
|
312
|
+
.attr( 'height', r * 2 )
|
313
|
+
.append( 'g' )
|
314
|
+
.attr( 'transform', 'translate(' + r + ',' + r + ')' );
|
315
|
+
|
316
|
+
var nodes = cluster.nodes( graph_data );
|
317
|
+
|
318
|
+
var link = vis.selectAll( 'path.link' )
|
319
|
+
.data( cluster.links( nodes ) )
|
320
|
+
.enter().append( 'path' )
|
321
|
+
.attr( 'class', helper_path_class )
|
322
|
+
.attr( 'd', diagonal );
|
323
|
+
|
324
|
+
var node = vis.selectAll( 'g.node' )
|
325
|
+
.data( nodes )
|
326
|
+
.enter().append( 'g' )
|
327
|
+
.attr( 'class', helper_node_class )
|
328
|
+
.attr( 'transform', function(d) { return 'rotate(' + (d.x - 90) + ')translate(' + d.y + ')'; } )
|
329
|
+
|
330
|
+
node.append( 'circle' )
|
331
|
+
.attr( 'r', 4.5 );
|
332
|
+
|
333
|
+
node.append( 'text' )
|
334
|
+
.attr( 'dx', function(d) { return d.x < 180 ? 8 : -8; } )
|
335
|
+
.attr( 'dy', '.31em' )
|
336
|
+
.attr( 'text-anchor', function(d) { return d.x < 180 ? 'start' : 'end'; } )
|
337
|
+
.attr( 'transform', function(d) { return d.x < 180 ? null : 'rotate(180)'; } )
|
338
|
+
.attr( 'data-href', function( d ) { return d.name; } )
|
339
|
+
.text( helper_node_text );
|
340
|
+
|
341
|
+
$( 'text[data-href*="//"]', graph_element )
|
342
|
+
.die( 'click' )
|
343
|
+
.live
|
344
|
+
(
|
345
|
+
'click',
|
346
|
+
function()
|
347
|
+
{
|
348
|
+
location.href = $( this ).data( 'href' );
|
349
|
+
}
|
350
|
+
);
|
351
|
+
};
|
352
|
+
|
353
|
+
var prepare_graph_data = function( response, graph_element, live_nodes, callback )
|
354
|
+
{
|
355
|
+
var state = null;
|
356
|
+
eval( 'state = ' + response.znode.data + ';' );
|
357
|
+
|
358
|
+
var leaf_count = 0;
|
359
|
+
var graph_data = {
|
360
|
+
name: null,
|
361
|
+
children : []
|
362
|
+
};
|
363
|
+
|
364
|
+
for( var c in state )
|
365
|
+
{
|
366
|
+
var shards = [];
|
367
|
+
for( var s in state[c].shards )
|
368
|
+
{
|
369
|
+
var nodes = [];
|
370
|
+
for( var n in state[c].shards[s].replicas )
|
371
|
+
{
|
372
|
+
leaf_count++;
|
373
|
+
var replica = state[c].shards[s].replicas[n]
|
374
|
+
|
375
|
+
var uri = replica.base_url;
|
376
|
+
var parts = uri.match( /^(\w+:)\/\/(([\w\d\.-]+)(:(\d+))?)(.+)$/ );
|
377
|
+
var uri_parts = {
|
378
|
+
protocol: parts[1],
|
379
|
+
host: parts[2],
|
380
|
+
hostname: parts[3],
|
381
|
+
port: parseInt( parts[5] || 80, 10 ),
|
382
|
+
pathname: parts[6]
|
383
|
+
};
|
384
|
+
|
385
|
+
helper_data.protocol.push( uri_parts.protocol );
|
386
|
+
helper_data.host.push( uri_parts.host );
|
387
|
+
helper_data.hostname.push( uri_parts.hostname );
|
388
|
+
helper_data.port.push( uri_parts.port );
|
389
|
+
helper_data.pathname.push( uri_parts.pathname );
|
390
|
+
|
391
|
+
var status = replica.state;
|
392
|
+
|
393
|
+
if( !live_nodes[replica.node_name] )
|
394
|
+
{
|
395
|
+
status = 'gone';
|
396
|
+
}
|
397
|
+
|
398
|
+
var node = {
|
399
|
+
name: uri,
|
400
|
+
data: {
|
401
|
+
type : 'node',
|
402
|
+
state : status,
|
403
|
+
leader : 'true' === replica.leader,
|
404
|
+
uri : uri_parts
|
405
|
+
}
|
406
|
+
};
|
407
|
+
nodes.push( node );
|
408
|
+
}
|
409
|
+
|
410
|
+
var shard = {
|
411
|
+
name: s,
|
412
|
+
data: {
|
413
|
+
type : 'shard'
|
414
|
+
},
|
415
|
+
children: nodes
|
416
|
+
};
|
417
|
+
shards.push( shard );
|
418
|
+
}
|
419
|
+
|
420
|
+
var collection = {
|
421
|
+
name: c,
|
422
|
+
data: {
|
423
|
+
type : 'collection'
|
424
|
+
},
|
425
|
+
children: shards
|
426
|
+
};
|
427
|
+
graph_data.children.push( collection );
|
428
|
+
}
|
429
|
+
|
430
|
+
helper_data.protocol = $.unique( helper_data.protocol );
|
431
|
+
helper_data.host = $.unique( helper_data.host );
|
432
|
+
helper_data.hostname = $.unique( helper_data.hostname );
|
433
|
+
helper_data.port = $.unique( helper_data.port );
|
434
|
+
helper_data.pathname = $.unique( helper_data.pathname );
|
435
|
+
|
436
|
+
callback( graph_element, graph_data, leaf_count );
|
437
|
+
}
|
438
|
+
|
439
|
+
var update_status_filter = function(filterType, filterVal) {
|
440
|
+
if (filterType == 'status') {
|
441
|
+
$( '#cloudGraphPagingStatusFilter' ).val(filterVal);
|
442
|
+
$( '#cloudGraphPagingStatusFilter' ).show();
|
443
|
+
$( '#cloudGraphPagingFilter' ).hide();
|
444
|
+
$( '#cloudGraphPagingFilter' ).val('');
|
445
|
+
} else {
|
446
|
+
$( '#cloudGraphPagingStatusFilter' ).hide();
|
447
|
+
$( '#cloudGraphPagingStatusFilter' ).val('');
|
448
|
+
$( '#cloudGraphPagingFilter' ).val(filterVal);
|
449
|
+
$( '#cloudGraphPagingFilter' ).show();
|
450
|
+
}
|
451
|
+
};
|
452
|
+
|
453
|
+
var prepare_graph = function( graph_element, callback )
|
454
|
+
{
|
455
|
+
$.ajax
|
456
|
+
(
|
457
|
+
{
|
458
|
+
url : app.config.solr_path + '/zookeeper?wt=json&path=%2Flive_nodes',
|
459
|
+
dataType : 'json',
|
460
|
+
success : function( response, text_status, xhr )
|
461
|
+
{
|
462
|
+
var live_nodes = {};
|
463
|
+
for( var c in response.tree[0].children )
|
464
|
+
{
|
465
|
+
live_nodes[response.tree[0].children[c].data.title] = true;
|
466
|
+
}
|
467
|
+
|
468
|
+
var start = $( '#cloudGraphPagingStart' ).val();
|
469
|
+
var rows = $( '#cloudGraphPagingRows' ).val();
|
470
|
+
var clusterStateUrl = app.config.solr_path + '/zookeeper?wt=json&detail=true&path=%2Fclusterstate.json&view=graph';
|
471
|
+
if (start && rows)
|
472
|
+
clusterStateUrl += ('&start='+start+'&rows='+rows);
|
473
|
+
|
474
|
+
var filterType = $( '#cloudGraphPagingFilterType' ).val();
|
475
|
+
if (filterType) {
|
476
|
+
var filter = (filterType == 'status')
|
477
|
+
? $( '#cloudGraphPagingStatusFilter' ).val()
|
478
|
+
: $( '#cloudGraphPagingFilter' ).val();
|
479
|
+
if (filter)
|
480
|
+
clusterStateUrl += ('&filterType='+filterType+'&filter='+filter);
|
481
|
+
}
|
482
|
+
|
483
|
+
$.ajax
|
484
|
+
(
|
485
|
+
{
|
486
|
+
url : clusterStateUrl,
|
487
|
+
dataType : 'json',
|
488
|
+
context : graph_element,
|
489
|
+
beforeSend : function( xhr, settings )
|
490
|
+
{
|
491
|
+
this.show();
|
492
|
+
},
|
493
|
+
success : function( response, text_status, xhr )
|
494
|
+
{
|
495
|
+
prepare_graph_data(response, graph_element, live_nodes, callback)
|
496
|
+
|
497
|
+
if (response.znode && response.znode.paging) {
|
498
|
+
var parr = response.znode.paging.split('|');
|
499
|
+
if (parr.length < 3) {
|
500
|
+
$( '#cloudGraphPaging' ).hide();
|
501
|
+
return;
|
502
|
+
}
|
503
|
+
|
504
|
+
var start = Math.max(parseInt(parr[0]),0);
|
505
|
+
var prevEnabled = (start > 0);
|
506
|
+
$('#cloudGraphPagingPrev').prop('disabled', !prevEnabled);
|
507
|
+
if (prevEnabled)
|
508
|
+
$('#cloudGraphPagingPrev').show();
|
509
|
+
else
|
510
|
+
$('#cloudGraphPagingPrev').hide();
|
511
|
+
|
512
|
+
var rows = parseInt(parr[1])
|
513
|
+
var total = parseInt(parr[2])
|
514
|
+
$( '#cloudGraphPagingStart' ).val(start);
|
515
|
+
$( '#cloudGraphPagingRows' ).val(rows);
|
516
|
+
if (rows == -1)
|
517
|
+
$( '#cloudGraphPaging' ).hide();
|
518
|
+
|
519
|
+
var filterType = parr.length > 3 ? parr[3] : '';
|
520
|
+
if (filterType == '' || filterType == 'none') filterType = 'status';
|
521
|
+
|
522
|
+
$( '#cloudGraphPagingFilterType' ).val(filterType);
|
523
|
+
var filter = parr.length > 4 ? parr[4] : '';
|
524
|
+
|
525
|
+
update_status_filter(filterType, filter);
|
526
|
+
|
527
|
+
var page = Math.floor(start/rows)+1;
|
528
|
+
var pages = Math.ceil(total/rows);
|
529
|
+
var last = Math.min(start+rows,total);
|
530
|
+
var nextEnabled = (last < total);
|
531
|
+
$('#cloudGraphPagingNext').prop('disabled', !nextEnabled);
|
532
|
+
if (nextEnabled)
|
533
|
+
$('#cloudGraphPagingNext').show();
|
534
|
+
else
|
535
|
+
$('#cloudGraphPagingNext').hide();
|
536
|
+
|
537
|
+
var status = (total > 0)
|
538
|
+
? 'Collections '+(start+1)+' - '+last+' of '+total+'. '
|
539
|
+
: 'No collections found.';
|
540
|
+
$( '#cloudGraphPagingStatus' ).html(status);
|
541
|
+
} else {
|
542
|
+
$( '#cloudGraphPaging' ).hide();
|
543
|
+
}
|
544
|
+
},
|
545
|
+
error : function( xhr, text_status, error_thrown)
|
546
|
+
{
|
547
|
+
},
|
548
|
+
complete : function( xhr, text_status )
|
549
|
+
{
|
550
|
+
}
|
551
|
+
}
|
552
|
+
);
|
553
|
+
},
|
554
|
+
error : function( xhr, text_status, error_thrown)
|
555
|
+
{
|
556
|
+
},
|
557
|
+
complete : function( xhr, text_status )
|
558
|
+
{
|
559
|
+
}
|
560
|
+
}
|
561
|
+
);
|
562
|
+
|
563
|
+
};
|
564
|
+
|
565
|
+
var init_graph = function( graph_element )
|
566
|
+
{
|
567
|
+
prepare_graph
|
568
|
+
(
|
569
|
+
graph_element,
|
570
|
+
function( graph_element, graph_data, leaf_count )
|
571
|
+
{
|
572
|
+
generate_graph( graph_element, graph_data, leaf_count );
|
573
|
+
}
|
574
|
+
);
|
575
|
+
}
|
576
|
+
|
577
|
+
var init_rgraph = function( graph_element )
|
578
|
+
{
|
579
|
+
prepare_graph
|
580
|
+
(
|
581
|
+
graph_element,
|
582
|
+
function( graph_element, graph_data, leaf_count )
|
583
|
+
{
|
584
|
+
generate_rgraph( graph_element, graph_data, leaf_count );
|
585
|
+
}
|
586
|
+
);
|
587
|
+
}
|
588
|
+
|
589
|
+
var init_tree = function( tree_element )
|
590
|
+
{
|
591
|
+
$.ajax
|
592
|
+
(
|
593
|
+
{
|
594
|
+
url : app.config.solr_path + '/zookeeper?wt=json',
|
595
|
+
dataType : 'json',
|
596
|
+
context : tree_element,
|
597
|
+
beforeSend : function( xhr, settings )
|
598
|
+
{
|
599
|
+
this
|
600
|
+
.show();
|
601
|
+
},
|
602
|
+
success : function( response, text_status, xhr )
|
603
|
+
{
|
604
|
+
var self = this;
|
605
|
+
|
606
|
+
$( '#tree', this )
|
607
|
+
.jstree
|
608
|
+
(
|
609
|
+
{
|
610
|
+
"plugins" : [ "json_data" ],
|
611
|
+
"json_data" : {
|
612
|
+
"data" : response.tree,
|
613
|
+
"progressive_render" : true
|
614
|
+
},
|
615
|
+
"core" : {
|
616
|
+
"animation" : 0
|
617
|
+
}
|
618
|
+
}
|
619
|
+
)
|
620
|
+
.jstree
|
621
|
+
(
|
622
|
+
'open_node',
|
623
|
+
'li:first'
|
624
|
+
);
|
625
|
+
|
626
|
+
var tree_links = $( '#tree a', this );
|
627
|
+
|
628
|
+
tree_links
|
629
|
+
.die( 'click' )
|
630
|
+
.live
|
631
|
+
(
|
632
|
+
'click',
|
633
|
+
function( event )
|
634
|
+
{
|
635
|
+
$( 'a.active', $( this ).parents( '#tree' ) )
|
636
|
+
.removeClass( 'active' );
|
637
|
+
|
638
|
+
$( this )
|
639
|
+
.addClass( 'active' );
|
640
|
+
|
641
|
+
tree_element
|
642
|
+
.addClass( 'show' );
|
643
|
+
|
644
|
+
var file_content = $( '#file-content' );
|
645
|
+
|
646
|
+
$( 'a.close', file_content )
|
647
|
+
.die( 'click' )
|
648
|
+
.live
|
649
|
+
(
|
650
|
+
'click',
|
651
|
+
function( event )
|
652
|
+
{
|
653
|
+
$( '#tree a.active' )
|
654
|
+
.removeClass( 'active' );
|
655
|
+
|
656
|
+
tree_element
|
657
|
+
.removeClass( 'show' );
|
658
|
+
|
659
|
+
return false;
|
660
|
+
}
|
661
|
+
);
|
662
|
+
|
663
|
+
$.ajax
|
664
|
+
(
|
665
|
+
{
|
666
|
+
url : this.href,
|
667
|
+
dataType : 'json',
|
668
|
+
context : file_content,
|
669
|
+
beforeSend : function( xhr, settings )
|
670
|
+
{
|
671
|
+
},
|
672
|
+
success : function( response, text_status, xhr )
|
673
|
+
{
|
674
|
+
var props = [];
|
675
|
+
for( var key in response.znode.prop )
|
676
|
+
{
|
677
|
+
props.push
|
678
|
+
(
|
679
|
+
'<li><dl class="clearfix">' + "\n" +
|
680
|
+
'<dt>' + key.esc() + '</dt>' + "\n" +
|
681
|
+
'<dd>' + response.znode.prop[key].esc() + '</dd>' + "\n" +
|
682
|
+
'</dl></li>'
|
683
|
+
);
|
684
|
+
}
|
685
|
+
|
686
|
+
$( '#prop ul', this )
|
687
|
+
.empty()
|
688
|
+
.html( props.join( "\n" ) );
|
689
|
+
|
690
|
+
$( '#prop ul li:odd', this )
|
691
|
+
.addClass( 'odd' );
|
692
|
+
|
693
|
+
var data_element = $( '#data', this );
|
694
|
+
|
695
|
+
var highlight = false;
|
696
|
+
var data = '<em>Node "' + response.znode.path + '" has no utf8 Content</em>';
|
697
|
+
|
698
|
+
if( response.znode.data )
|
699
|
+
{
|
700
|
+
var classes = '';
|
701
|
+
var path = response.znode.path.split( '.' );
|
702
|
+
|
703
|
+
if( 1 < path.length )
|
704
|
+
{
|
705
|
+
highlight = true;
|
706
|
+
classes = 'syntax language-' + path.pop().esc();
|
707
|
+
}
|
708
|
+
|
709
|
+
data = '<pre class="' + classes + '">'
|
710
|
+
+ response.znode.data.esc()
|
711
|
+
+ '</pre>';
|
712
|
+
}
|
713
|
+
|
714
|
+
|
715
|
+
data_element
|
716
|
+
.show()
|
717
|
+
.html( data );
|
718
|
+
|
719
|
+
if( highlight )
|
720
|
+
{
|
721
|
+
hljs.highlightBlock( data_element.get(0) );
|
722
|
+
}
|
723
|
+
|
724
|
+
},
|
725
|
+
error : function( xhr, text_status, error_thrown)
|
726
|
+
{
|
727
|
+
},
|
728
|
+
complete : function( xhr, text_status )
|
729
|
+
{
|
730
|
+
}
|
731
|
+
}
|
732
|
+
);
|
733
|
+
|
734
|
+
return false;
|
735
|
+
}
|
736
|
+
);
|
737
|
+
},
|
738
|
+
error : zk_error,
|
739
|
+
complete : function( xhr, text_status )
|
740
|
+
{
|
741
|
+
}
|
742
|
+
}
|
743
|
+
);
|
744
|
+
};
|
745
|
+
|
746
|
+
// updates the starting position for paged navigation
|
747
|
+
// and then rebuilds the graph based on the selected page
|
748
|
+
var update_start = function(direction, cloud_element) {
|
749
|
+
var start = $( '#cloudGraphPagingStart' ).val();
|
750
|
+
var rows = $( '#cloudGraphPagingRows' ).val();
|
751
|
+
var startAt = start ? parseInt(start) : 0;
|
752
|
+
var numRows = rows ? parseInt(rows) : 20;
|
753
|
+
var newStart = Math.max(startAt + (rows * direction),0);
|
754
|
+
$( '#cloudGraphPagingStart' ).val(newStart);
|
755
|
+
|
756
|
+
var graph_element = $( '#graph-content', cloud_element );
|
757
|
+
$( '#canvas', graph_element).empty();
|
758
|
+
init_graph( graph_element );
|
759
|
+
};
|
760
|
+
|
761
|
+
// #/~cloud
|
762
|
+
sammy.get
|
763
|
+
(
|
764
|
+
/^#\/(~cloud)$/,
|
765
|
+
function( context )
|
766
|
+
{
|
767
|
+
var content_element = $( '#content' );
|
768
|
+
|
769
|
+
$.get
|
770
|
+
(
|
771
|
+
'tpl/cloud.html',
|
772
|
+
function( template )
|
773
|
+
{
|
774
|
+
content_element
|
775
|
+
.html( template );
|
776
|
+
|
777
|
+
var cloud_element = $( '#cloud', content_element );
|
778
|
+
var navigation_element = $( '#menu #cloud' );
|
779
|
+
|
780
|
+
init_debug( cloud_element );
|
781
|
+
|
782
|
+
$( '.tree', navigation_element )
|
783
|
+
.die( 'activate' )
|
784
|
+
.live
|
785
|
+
(
|
786
|
+
'activate',
|
787
|
+
function( event )
|
788
|
+
{
|
789
|
+
$( this ).addClass( 'active' );
|
790
|
+
init_tree( $( '#tree-content', cloud_element ) );
|
791
|
+
}
|
792
|
+
);
|
793
|
+
|
794
|
+
$( '.graph', navigation_element )
|
795
|
+
.die( 'activate' )
|
796
|
+
.live
|
797
|
+
(
|
798
|
+
'activate',
|
799
|
+
function( event )
|
800
|
+
{
|
801
|
+
$( this ).addClass( 'active' );
|
802
|
+
init_graph( $( '#graph-content', cloud_element ) );
|
803
|
+
|
804
|
+
$('#cloudGraphPagingNext').click(function() {
|
805
|
+
update_start(1, cloud_element);
|
806
|
+
});
|
807
|
+
|
808
|
+
$('#cloudGraphPagingPrev').click(function() {
|
809
|
+
update_start(-1, cloud_element);
|
810
|
+
});
|
811
|
+
|
812
|
+
$('#cloudGraphPagingRows').change(function() {
|
813
|
+
var rows = $( this ).val();
|
814
|
+
if (!rows || rows == '')
|
815
|
+
$( this ).val("20");
|
816
|
+
|
817
|
+
// ? restart the start position when rows changes?
|
818
|
+
$( '#cloudGraphPagingStart' ).val(0);
|
819
|
+
update_start(-1, cloud_element);
|
820
|
+
});
|
821
|
+
|
822
|
+
$('#cloudGraphPagingFilter').change(function() {
|
823
|
+
var filter = $( this ).val();
|
824
|
+
// reset the start position when the filter changes
|
825
|
+
$( '#cloudGraphPagingStart' ).val(0);
|
826
|
+
update_start(-1, cloud_element);
|
827
|
+
});
|
828
|
+
|
829
|
+
$( '#cloudGraphPagingStatusFilter' ).show();
|
830
|
+
$( '#cloudGraphPagingFilter' ).hide();
|
831
|
+
|
832
|
+
$('#cloudGraphPagingFilterType').change(function() {
|
833
|
+
update_status_filter($( this ).val(), '');
|
834
|
+
});
|
835
|
+
|
836
|
+
$('#cloudGraphPagingStatusFilter').change(function() {
|
837
|
+
// just reset the paged navigation controls based on this update
|
838
|
+
$( '#cloudGraphPagingStart' ).val(0);
|
839
|
+
update_start(-1, cloud_element);
|
840
|
+
});
|
841
|
+
|
842
|
+
}
|
843
|
+
);
|
844
|
+
|
845
|
+
$( '.rgraph', navigation_element )
|
846
|
+
.die( 'activate' )
|
847
|
+
.live
|
848
|
+
(
|
849
|
+
'activate',
|
850
|
+
function( event )
|
851
|
+
{
|
852
|
+
$( "#cloudGraphPaging" ).hide(); // TODO: paging for rgraph too
|
853
|
+
|
854
|
+
$( this ).addClass( 'active' );
|
855
|
+
init_rgraph( $( '#graph-content', cloud_element ) );
|
856
|
+
}
|
857
|
+
);
|
858
|
+
|
859
|
+
$.ajax
|
860
|
+
(
|
861
|
+
{
|
862
|
+
url : app.config.solr_path + '/zookeeper?wt=json',
|
863
|
+
dataType : 'json',
|
864
|
+
context : cloud_element,
|
865
|
+
success : function( response, text_status, xhr )
|
866
|
+
{
|
867
|
+
$( 'a[href="' + context.path + '"]', navigation_element )
|
868
|
+
.trigger( 'activate' );
|
869
|
+
},
|
870
|
+
error : zk_error
|
871
|
+
}
|
872
|
+
);
|
873
|
+
|
874
|
+
}
|
875
|
+
);
|
876
|
+
}
|
877
|
+
);
|