rjack-solr 3.6.2.0-java → 4.0.0.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +5 -0
- data/Manifest.txt +268 -33
- data/NOTICE.txt +1 -1
- data/README.rdoc +6 -6
- data/assembly.xml +2 -2
- data/bin/rjack-solr-fg +1 -1
- data/init/rjack-solr +2 -2
- data/lib/rjack-solr.rb +7 -2
- data/lib/rjack-solr/base.rb +2 -2
- data/lib/rjack-solr/commons-cli-1.2.jar +0 -0
- data/lib/rjack-solr/config.rb +1 -1
- data/lib/rjack-solr/server.rb +1 -1
- data/lib/rjack-solr/solr-core-4.0.0.jar +0 -0
- data/lib/rjack-solr/solr-solrj-4.0.0.jar +0 -0
- data/pom.xml +19 -6
- data/test/test_solr.rb +7 -5
- data/webapp/META-INF/LICENSE.txt +0 -940
- data/webapp/META-INF/MANIFEST.MF +5 -5
- data/webapp/META-INF/NOTICE.txt +160 -93
- data/webapp/WEB-INF/web.xml +57 -43
- data/webapp/admin.html +140 -0
- data/webapp/css/chosen.css +392 -0
- data/webapp/css/styles/analysis.css +293 -0
- data/webapp/css/styles/cloud.css +331 -0
- data/webapp/css/styles/common.css +593 -0
- data/webapp/css/styles/cores.css +203 -0
- data/webapp/css/styles/dashboard.css +127 -0
- data/webapp/css/styles/dataimport.css +222 -0
- data/webapp/css/styles/index.css +195 -0
- data/webapp/css/styles/java-properties.css +33 -0
- data/webapp/css/styles/logging.css +323 -0
- data/webapp/css/styles/menu.css +272 -0
- data/webapp/css/styles/plugins.css +175 -0
- data/webapp/css/styles/query.css +137 -0
- data/webapp/css/styles/replication.css +494 -0
- data/webapp/css/styles/schema-browser.css +476 -0
- data/webapp/css/styles/threads.css +153 -0
- data/webapp/img/ZeroClipboard.swf +0 -0
- data/webapp/img/chosen-sprite.png +0 -0
- data/webapp/img/div.gif +0 -0
- data/webapp/{admin → img}/favicon.ico +0 -0
- data/webapp/img/filetypes/7z.png +0 -0
- data/webapp/img/filetypes/README +27 -0
- data/webapp/img/filetypes/ai.png +0 -0
- data/webapp/img/filetypes/aiff.png +0 -0
- data/webapp/img/filetypes/asc.png +0 -0
- data/webapp/img/filetypes/audio.png +0 -0
- data/webapp/img/filetypes/bin.png +0 -0
- data/webapp/img/filetypes/bz2.png +0 -0
- data/webapp/img/filetypes/c.png +0 -0
- data/webapp/img/filetypes/cfc.png +0 -0
- data/webapp/img/filetypes/cfm.png +0 -0
- data/webapp/img/filetypes/chm.png +0 -0
- data/webapp/img/filetypes/class.png +0 -0
- data/webapp/img/filetypes/conf.png +0 -0
- data/webapp/img/filetypes/cpp.png +0 -0
- data/webapp/img/filetypes/cs.png +0 -0
- data/webapp/img/filetypes/css.png +0 -0
- data/webapp/img/filetypes/csv.png +0 -0
- data/webapp/img/filetypes/deb.png +0 -0
- data/webapp/img/filetypes/divx.png +0 -0
- data/webapp/img/filetypes/doc.png +0 -0
- data/webapp/img/filetypes/dot.png +0 -0
- data/webapp/img/filetypes/eml.png +0 -0
- data/webapp/img/filetypes/enc.png +0 -0
- data/webapp/img/filetypes/file.png +0 -0
- data/webapp/img/filetypes/gif.png +0 -0
- data/webapp/img/filetypes/gz.png +0 -0
- data/webapp/img/filetypes/hlp.png +0 -0
- data/webapp/img/filetypes/htm.png +0 -0
- data/webapp/img/filetypes/html.png +0 -0
- data/webapp/img/filetypes/image.png +0 -0
- data/webapp/img/filetypes/iso.png +0 -0
- data/webapp/img/filetypes/jar.png +0 -0
- data/webapp/img/filetypes/java.png +0 -0
- data/webapp/img/filetypes/jpeg.png +0 -0
- data/webapp/img/filetypes/jpg.png +0 -0
- data/webapp/img/filetypes/js.png +0 -0
- data/webapp/img/filetypes/lua.png +0 -0
- data/webapp/img/filetypes/m.png +0 -0
- data/webapp/img/filetypes/mm.png +0 -0
- data/webapp/img/filetypes/mov.png +0 -0
- data/webapp/img/filetypes/mp3.png +0 -0
- data/webapp/img/filetypes/mpg.png +0 -0
- data/webapp/img/filetypes/odc.png +0 -0
- data/webapp/img/filetypes/odf.png +0 -0
- data/webapp/img/filetypes/odg.png +0 -0
- data/webapp/img/filetypes/odi.png +0 -0
- data/webapp/img/filetypes/odp.png +0 -0
- data/webapp/img/filetypes/ods.png +0 -0
- data/webapp/img/filetypes/odt.png +0 -0
- data/webapp/img/filetypes/ogg.png +0 -0
- data/webapp/img/filetypes/pdf.png +0 -0
- data/webapp/img/filetypes/pgp.png +0 -0
- data/webapp/img/filetypes/php.png +0 -0
- data/webapp/img/filetypes/pl.png +0 -0
- data/webapp/img/filetypes/png.png +0 -0
- data/webapp/img/filetypes/ppt.png +0 -0
- data/webapp/img/filetypes/ps.png +0 -0
- data/webapp/img/filetypes/py.png +0 -0
- data/webapp/img/filetypes/ram.png +0 -0
- data/webapp/img/filetypes/rar.png +0 -0
- data/webapp/img/filetypes/rb.png +0 -0
- data/webapp/img/filetypes/rm.png +0 -0
- data/webapp/img/filetypes/rpm.png +0 -0
- data/webapp/img/filetypes/rtf.png +0 -0
- data/webapp/img/filetypes/sig.png +0 -0
- data/webapp/img/filetypes/sql.png +0 -0
- data/webapp/img/filetypes/swf.png +0 -0
- data/webapp/img/filetypes/sxc.png +0 -0
- data/webapp/img/filetypes/sxd.png +0 -0
- data/webapp/img/filetypes/sxi.png +0 -0
- data/webapp/img/filetypes/sxw.png +0 -0
- data/webapp/img/filetypes/tar.png +0 -0
- data/webapp/img/filetypes/tex.png +0 -0
- data/webapp/img/filetypes/tgz.png +0 -0
- data/webapp/img/filetypes/txt.png +0 -0
- data/webapp/img/filetypes/vcf.png +0 -0
- data/webapp/img/filetypes/video.png +0 -0
- data/webapp/img/filetypes/vsd.png +0 -0
- data/webapp/img/filetypes/wav.png +0 -0
- data/webapp/img/filetypes/wma.png +0 -0
- data/webapp/img/filetypes/wmv.png +0 -0
- data/webapp/img/filetypes/xls.png +0 -0
- data/webapp/img/filetypes/xml.png +0 -0
- data/webapp/img/filetypes/xpi.png +0 -0
- data/webapp/img/filetypes/xvid.png +0 -0
- data/webapp/img/filetypes/zip.png +0 -0
- data/webapp/img/ico/arrow-000-small.png +0 -0
- data/webapp/img/ico/arrow-circle.png +0 -0
- data/webapp/img/ico/arrow-switch.png +0 -0
- data/webapp/img/ico/asterisk.png +0 -0
- data/webapp/img/ico/battery.png +0 -0
- data/webapp/img/ico/block-small.png +0 -0
- data/webapp/img/ico/block.png +0 -0
- data/webapp/img/ico/book-open-text.png +0 -0
- data/webapp/img/ico/box.png +0 -0
- data/webapp/img/ico/bug.png +0 -0
- data/webapp/img/ico/chart.png +0 -0
- data/webapp/img/ico/chevron-small-expand.png +0 -0
- data/webapp/img/ico/chevron-small.png +0 -0
- data/webapp/img/ico/clipboard-list.png +0 -0
- data/webapp/img/ico/clipboard-paste-document-text.png +0 -0
- data/webapp/img/ico/clipboard-paste.png +0 -0
- data/webapp/img/ico/clock-select-remain.png +0 -0
- data/webapp/img/ico/clock-select.png +0 -0
- data/webapp/img/ico/construction.png +0 -0
- data/webapp/img/ico/cross-0.png +0 -0
- data/webapp/img/ico/cross-1.png +0 -0
- data/webapp/img/ico/cross.png +0 -0
- data/webapp/img/ico/dashboard.png +0 -0
- data/webapp/img/ico/database.png +0 -0
- data/webapp/img/ico/databases.png +0 -0
- data/webapp/img/ico/disk-black.png +0 -0
- data/webapp/img/ico/document-convert.png +0 -0
- data/webapp/img/ico/document-import.png +0 -0
- data/webapp/img/ico/document-list.png +0 -0
- data/webapp/img/ico/document-text.png +0 -0
- data/webapp/img/ico/download-cloud.png +0 -0
- data/webapp/img/ico/exclamation-button.png +0 -0
- data/webapp/img/ico/eye.png +0 -0
- data/webapp/img/ico/folder-export.png +0 -0
- data/webapp/img/ico/folder-tree.png +0 -0
- data/webapp/img/ico/folder.png +0 -0
- data/webapp/img/ico/funnel-small.png +0 -0
- data/webapp/img/ico/funnel.png +0 -0
- data/webapp/img/ico/gear.png +0 -0
- data/webapp/img/ico/globe-network.png +0 -0
- data/webapp/img/ico/globe.png +0 -0
- data/webapp/img/ico/hammer-screwdriver.png +0 -0
- data/webapp/img/ico/hand.png +0 -0
- data/webapp/img/ico/highlighter-text.png +0 -0
- data/webapp/img/ico/hourglass--exclamation.png +0 -0
- data/webapp/img/ico/hourglass.png +0 -0
- data/webapp/img/ico/inbox-document-text.png +0 -0
- data/webapp/img/ico/information-button.png +0 -0
- data/webapp/img/ico/information-small.png +0 -0
- data/webapp/img/ico/information-white.png +0 -0
- data/webapp/img/ico/information.png +0 -0
- data/webapp/img/ico/jar.png +0 -0
- data/webapp/img/ico/magnifier.png +0 -0
- data/webapp/img/ico/mail.png +0 -0
- data/webapp/img/ico/memory.png +0 -0
- data/webapp/img/ico/molecule.png +0 -0
- data/webapp/img/ico/network-cloud.png +0 -0
- data/webapp/img/ico/network-status-away.png +0 -0
- data/webapp/img/ico/network-status-busy.png +0 -0
- data/webapp/img/ico/network-status-offline.png +0 -0
- data/webapp/img/ico/network-status.png +0 -0
- data/webapp/img/ico/network.png +0 -0
- data/webapp/img/ico/node-design.png +0 -0
- data/webapp/img/ico/node-master.png +0 -0
- data/webapp/img/ico/node-select.png +0 -0
- data/webapp/img/ico/node-slave.png +0 -0
- data/webapp/img/ico/node.png +0 -0
- data/webapp/img/ico/pencil-small.png +0 -0
- data/webapp/img/ico/plus-button.png +0 -0
- data/webapp/img/ico/processor.png +0 -0
- data/webapp/img/ico/prohibition.png +0 -0
- data/webapp/img/ico/property.png +0 -0
- data/webapp/img/ico/question-small-white.png +0 -0
- data/webapp/img/ico/question-white.png +0 -0
- data/webapp/img/ico/question.png +0 -0
- data/webapp/img/ico/receipt-invoice.png +0 -0
- data/webapp/img/ico/receipt.png +0 -0
- data/webapp/img/ico/script-code.png +0 -0
- data/webapp/img/ico/server-cast.png +0 -0
- data/webapp/img/ico/server.png +0 -0
- data/webapp/img/ico/sitemap.png +0 -0
- data/webapp/img/ico/slash.png +0 -0
- data/webapp/img/ico/status-away.png +0 -0
- data/webapp/img/ico/status-busy.png +0 -0
- data/webapp/img/ico/status-offline.png +0 -0
- data/webapp/img/ico/status.png +0 -0
- data/webapp/img/ico/system-monitor--exclamation.png +0 -0
- data/webapp/img/ico/system-monitor.png +0 -0
- data/webapp/img/ico/table.png +0 -0
- data/webapp/img/ico/terminal.png +0 -0
- data/webapp/img/ico/tick-circle.png +0 -0
- data/webapp/img/ico/tick-red.png +0 -0
- data/webapp/img/ico/tick.png +0 -0
- data/webapp/img/ico/toggle-small-expand.png +0 -0
- data/webapp/img/ico/toggle-small.png +0 -0
- data/webapp/img/ico/toolbox.png +0 -0
- data/webapp/img/ico/ui-accordion.png +0 -0
- data/webapp/img/ico/ui-address-bar.png +0 -0
- data/webapp/img/ico/ui-check-box-uncheck.png +0 -0
- data/webapp/img/ico/ui-check-box.png +0 -0
- data/webapp/img/ico/ui-radio-button-uncheck.png +0 -0
- data/webapp/img/ico/ui-radio-button.png +0 -0
- data/webapp/img/ico/ui-text-field-select.png +0 -0
- data/webapp/img/ico/users.png +0 -0
- data/webapp/img/ico/wooden-box.png +0 -0
- data/webapp/img/ico/zone.png +0 -0
- data/webapp/img/loader-light.gif +0 -0
- data/webapp/img/loader.gif +0 -0
- data/webapp/img/lucene-ico.png +0 -0
- data/webapp/img/solr-ico.png +0 -0
- data/webapp/{admin/solr_small.png → img/solr.png} +0 -0
- data/webapp/img/tree.png +0 -0
- data/webapp/js/lib/ZeroClipboard.js +317 -0
- data/webapp/js/lib/chosen.js +953 -0
- data/webapp/{admin/get-properties.jsp → js/lib/console.js} +13 -10
- data/webapp/js/lib/d3.js +9342 -0
- data/webapp/js/lib/highlight.js +1 -0
- data/webapp/{admin/jquery-1.4.3.min.js → js/lib/jquery-1.7.2.min.js} +0 -0
- data/webapp/js/lib/jquery.blockUI.js +499 -0
- data/webapp/js/lib/jquery.cookie.js +47 -0
- data/webapp/js/lib/jquery.form.js +782 -0
- data/webapp/js/lib/jquery.jstree.js +3510 -0
- data/webapp/js/lib/jquery.sammy.js +1856 -0
- data/webapp/js/lib/jquery.sparkline.js +1271 -0
- data/webapp/js/lib/jquery.timeago.js +165 -0
- data/webapp/js/lib/linker.js +48 -0
- data/webapp/js/lib/order.js +189 -0
- data/webapp/js/main.js +57 -0
- data/webapp/js/require.js +11319 -0
- data/webapp/js/scripts/analysis.js +549 -0
- data/webapp/js/scripts/app.js +368 -0
- data/webapp/js/scripts/cloud.js +719 -0
- data/webapp/js/scripts/cores.js +540 -0
- data/webapp/js/scripts/dashboard.js +540 -0
- data/webapp/js/scripts/dataimport.js +567 -0
- data/webapp/js/scripts/file.js +56 -0
- data/webapp/js/scripts/index.js +344 -0
- data/webapp/js/scripts/java-properties.js +107 -0
- data/webapp/js/scripts/logging.js +519 -0
- data/webapp/js/scripts/ping.js +72 -0
- data/webapp/js/scripts/plugins.js +426 -0
- data/webapp/js/scripts/query.js +170 -0
- data/webapp/js/scripts/replication.js +557 -0
- data/webapp/js/scripts/schema-browser.js +1206 -0
- data/webapp/js/scripts/threads.js +159 -0
- data/webapp/tpl/analysis.html +83 -0
- data/webapp/tpl/cloud.html +54 -0
- data/webapp/tpl/cores.html +215 -0
- data/webapp/tpl/dashboard.html +164 -0
- data/webapp/tpl/dataimport.html +123 -0
- data/webapp/tpl/index.html +250 -0
- data/webapp/tpl/logging.html +23 -0
- data/webapp/tpl/plugins.html +39 -0
- data/webapp/tpl/query.html +318 -0
- data/webapp/tpl/replication.html +207 -0
- data/webapp/tpl/schema-browser.html +178 -0
- data/webapp/tpl/threads.html +56 -0
- metadata +307 -40
- data/lib/rjack-solr/solr-core-3.6.2.jar +0 -0
- data/lib/rjack-solr/solr-solrj-3.6.2.jar +0 -0
- data/webapp/admin/_info.jsp +0 -120
- data/webapp/admin/action.jsp +0 -94
- data/webapp/admin/analysis.jsp +0 -496
- data/webapp/admin/analysis.xsl +0 -179
- data/webapp/admin/dataimport.jsp +0 -53
- data/webapp/admin/debug.jsp +0 -103
- data/webapp/admin/distributiondump.jsp +0 -160
- data/webapp/admin/form.jsp +0 -152
- data/webapp/admin/get-file.jsp +0 -72
- data/webapp/admin/header.jsp +0 -44
- data/webapp/admin/index.jsp +0 -162
- data/webapp/admin/meta.xsl +0 -34
- data/webapp/admin/ping.jsp +0 -52
- data/webapp/admin/ping.xsl +0 -71
- data/webapp/admin/raw-schema.jsp +0 -38
- data/webapp/admin/registry.jsp +0 -107
- data/webapp/admin/registry.xsl +0 -321
- data/webapp/admin/replication/header.jsp +0 -89
- data/webapp/admin/replication/index.jsp +0 -378
- data/webapp/admin/schema.jsp +0 -690
- data/webapp/admin/solr-admin.css +0 -215
- data/webapp/admin/stats.jsp +0 -92
- data/webapp/admin/stats.xsl +0 -220
- data/webapp/admin/tabular.xsl +0 -141
- data/webapp/admin/threaddump.jsp +0 -110
- data/webapp/admin/threaddump.xsl +0 -103
- data/webapp/index.jsp +0 -49
@@ -0,0 +1,368 @@
|
|
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 loader = {
|
19
|
+
|
20
|
+
show : function( element )
|
21
|
+
{
|
22
|
+
$( element )
|
23
|
+
.addClass( 'loader' );
|
24
|
+
},
|
25
|
+
|
26
|
+
hide : function( element )
|
27
|
+
{
|
28
|
+
$( element )
|
29
|
+
.removeClass( 'loader' );
|
30
|
+
}
|
31
|
+
|
32
|
+
};
|
33
|
+
|
34
|
+
Number.prototype.esc = function()
|
35
|
+
{
|
36
|
+
return new String( this ).esc();
|
37
|
+
}
|
38
|
+
|
39
|
+
String.prototype.esc = function()
|
40
|
+
{
|
41
|
+
return this.replace( /</g, '<' ).replace( />/g, '>' );
|
42
|
+
}
|
43
|
+
|
44
|
+
SolrDate = function( date )
|
45
|
+
{
|
46
|
+
// ["Sat Mar 03 11:00:00 CET 2012", "Sat", "Mar", "03", "11:00:00", "CET", "2012"]
|
47
|
+
var parts = date.match( /^(\w+)\s+(\w+)\s+(\d+)\s+(\d+\:\d+\:\d+)\s+(\w+)\s+(\d+)$/ );
|
48
|
+
|
49
|
+
// "Sat Mar 03 2012 10:37:33"
|
50
|
+
return new Date( parts[1] + ' ' + parts[2] + ' ' + parts[3] + ' ' + parts[6] + ' ' + parts[4] );
|
51
|
+
}
|
52
|
+
|
53
|
+
var sammy = $.sammy
|
54
|
+
(
|
55
|
+
function()
|
56
|
+
{
|
57
|
+
this.bind
|
58
|
+
(
|
59
|
+
'run',
|
60
|
+
function( event, config )
|
61
|
+
{
|
62
|
+
if( 0 === config.start_url.length )
|
63
|
+
{
|
64
|
+
location.href = '#/';
|
65
|
+
return false;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
);
|
69
|
+
|
70
|
+
this.bind
|
71
|
+
(
|
72
|
+
'error',
|
73
|
+
function( message, original_error )
|
74
|
+
{
|
75
|
+
alert( original_error.message );
|
76
|
+
}
|
77
|
+
);
|
78
|
+
|
79
|
+
// activate_core
|
80
|
+
this.before
|
81
|
+
(
|
82
|
+
{},
|
83
|
+
function( context )
|
84
|
+
{
|
85
|
+
if( app.timeout )
|
86
|
+
{
|
87
|
+
console.debug( 'Clearing Timeout #' + app.timeout );
|
88
|
+
clearTimeout( app.timeout );
|
89
|
+
}
|
90
|
+
|
91
|
+
var menu_wrapper = $( '#menu-wrapper' );
|
92
|
+
|
93
|
+
$( 'li[id].active', menu_wrapper )
|
94
|
+
.removeClass( 'active' );
|
95
|
+
|
96
|
+
$( 'li.active', menu_wrapper )
|
97
|
+
.removeClass( 'active' );
|
98
|
+
|
99
|
+
if( this.params.splat )
|
100
|
+
{
|
101
|
+
var selector = '~' === this.params.splat[0][0]
|
102
|
+
? '#' + this.params.splat[0].replace( /^~/, '' ) + '.global'
|
103
|
+
: '#menu-selector #' + this.params.splat[0];
|
104
|
+
|
105
|
+
var active_element = $( selector, menu_wrapper );
|
106
|
+
|
107
|
+
if( 0 === active_element.size() )
|
108
|
+
{
|
109
|
+
this.app.error( 'There exists no core with name "' + this.params.splat[0] + '"' );
|
110
|
+
return false;
|
111
|
+
}
|
112
|
+
|
113
|
+
active_element
|
114
|
+
.addClass( 'active' );
|
115
|
+
|
116
|
+
if( this.params.splat[1] )
|
117
|
+
{
|
118
|
+
$( '.' + this.params.splat[1], active_element )
|
119
|
+
.addClass( 'active' );
|
120
|
+
}
|
121
|
+
|
122
|
+
if( !active_element.hasClass( 'global' ) )
|
123
|
+
{
|
124
|
+
this.active_core = active_element;
|
125
|
+
}
|
126
|
+
}
|
127
|
+
}
|
128
|
+
);
|
129
|
+
}
|
130
|
+
);
|
131
|
+
|
132
|
+
var solr_admin = function( app_config )
|
133
|
+
{
|
134
|
+
self = this,
|
135
|
+
|
136
|
+
menu_element = null,
|
137
|
+
|
138
|
+
is_multicore = null,
|
139
|
+
cores_data = null,
|
140
|
+
active_core = null,
|
141
|
+
environment_basepath = null,
|
142
|
+
|
143
|
+
config = app_config,
|
144
|
+
params = null,
|
145
|
+
dashboard_values = null,
|
146
|
+
schema_browser_data = null,
|
147
|
+
|
148
|
+
plugin_data = null,
|
149
|
+
|
150
|
+
this.menu_element = $( '#menu-selector' );
|
151
|
+
this.config = config;
|
152
|
+
|
153
|
+
this.timeout = null;
|
154
|
+
|
155
|
+
show_global_error = function( error )
|
156
|
+
{
|
157
|
+
var main = $( '#main' );
|
158
|
+
|
159
|
+
$( 'div[id$="-wrapper"]', main )
|
160
|
+
.remove();
|
161
|
+
|
162
|
+
main
|
163
|
+
.addClass( 'error' )
|
164
|
+
.append( error );
|
165
|
+
|
166
|
+
var pre_tags = $( 'pre', main );
|
167
|
+
if( 0 !== pre_tags.size() )
|
168
|
+
{
|
169
|
+
hljs.highlightBlock( pre_tags.get(0) );
|
170
|
+
}
|
171
|
+
};
|
172
|
+
|
173
|
+
this.run = function()
|
174
|
+
{
|
175
|
+
$.ajax
|
176
|
+
(
|
177
|
+
{
|
178
|
+
url : config.solr_path + config.core_admin_path + '?wt=json',
|
179
|
+
dataType : 'json',
|
180
|
+
beforeSend : function( arr, form, options )
|
181
|
+
{
|
182
|
+
$( '#content' )
|
183
|
+
.html( '<div id="index"><div class="loader">Loading ...</div></div>' );
|
184
|
+
},
|
185
|
+
success : function( response )
|
186
|
+
{
|
187
|
+
self.cores_data = response.status;
|
188
|
+
var core_count = 0;
|
189
|
+
|
190
|
+
for( var core_name in response.status )
|
191
|
+
{
|
192
|
+
core_count++;
|
193
|
+
var core_path = config.solr_path + '/' + core_name;
|
194
|
+
var schema = response['status'][core_name]['schema'];
|
195
|
+
var solrconfig = response['status'][core_name]['config'];
|
196
|
+
var classes = [];
|
197
|
+
|
198
|
+
if( !environment_basepath )
|
199
|
+
{
|
200
|
+
environment_basepath = core_path;
|
201
|
+
}
|
202
|
+
|
203
|
+
if( response['status'][core_name]['isDefaultCore'] )
|
204
|
+
{
|
205
|
+
classes.push( 'default' );
|
206
|
+
}
|
207
|
+
|
208
|
+
var core_tpl = '<li id="' + core_name + '" '
|
209
|
+
+ ' class="' + classes.join( ' ' ) + '"'
|
210
|
+
+ ' data-basepath="' + core_path + '"'
|
211
|
+
+ ' schema="' + schema + '"'
|
212
|
+
+ ' config="' + solrconfig + '"'
|
213
|
+
+ '>' + "\n"
|
214
|
+
+ ' <p><a href="#/' + core_name + '">' + core_name + '</a></p>' + "\n"
|
215
|
+
+ ' <ul>' + "\n"
|
216
|
+
|
217
|
+
+ ' <li class="ping"><a rel="' + core_path + '/admin/ping"><span>Ping</span></a></li>' + "\n"
|
218
|
+
+ ' <li class="query"><a href="#/' + core_name + '/query"><span>Query</span></a></li>' + "\n"
|
219
|
+
+ ' <li class="schema"><a href="#/' + core_name + '/schema"><span>Schema</span></a></li>' + "\n"
|
220
|
+
+ ' <li class="config"><a href="#/' + core_name + '/config"><span>Config</span></a></li>' + "\n"
|
221
|
+
+ ' <li class="replication"><a href="#/' + core_name + '/replication"><span>Replication</span></a></li>' + "\n"
|
222
|
+
+ ' <li class="analysis"><a href="#/' + core_name + '/analysis"><span>Analysis</span></a></li>' + "\n"
|
223
|
+
+ ' <li class="schema-browser"><a href="#/' + core_name + '/schema-browser"><span>Schema Browser</span></a></li>' + "\n"
|
224
|
+
+ ' <li class="plugins"><a href="#/' + core_name + '/plugins"><span>Plugins / Stats</span></a></li>' + "\n"
|
225
|
+
+ ' <li class="dataimport"><a href="#/' + core_name + '/dataimport"><span>Dataimport</span></a></li>' + "\n"
|
226
|
+
|
227
|
+
+ ' </ul>' + "\n"
|
228
|
+
+ '</li>';
|
229
|
+
|
230
|
+
self.menu_element
|
231
|
+
.append( core_tpl );
|
232
|
+
}
|
233
|
+
|
234
|
+
if( response.initFailures )
|
235
|
+
{
|
236
|
+
var failures = [];
|
237
|
+
for( var core_name in response.initFailures )
|
238
|
+
{
|
239
|
+
failures.push
|
240
|
+
(
|
241
|
+
'<li>' +
|
242
|
+
'<strong>' + core_name.esc() + ':</strong>' + "\n" +
|
243
|
+
response.initFailures[core_name].esc() + "\n" +
|
244
|
+
'</li>'
|
245
|
+
);
|
246
|
+
}
|
247
|
+
|
248
|
+
if( 0 !== failures.length )
|
249
|
+
{
|
250
|
+
var init_failures = $( '#init-failures' );
|
251
|
+
|
252
|
+
init_failures.show();
|
253
|
+
$( 'ul', init_failures ).html( failures.join( "\n" ) );
|
254
|
+
}
|
255
|
+
}
|
256
|
+
|
257
|
+
if( 0 === core_count )
|
258
|
+
{
|
259
|
+
show_global_error
|
260
|
+
(
|
261
|
+
'<div class="message">There are no SolrCores running. <br/> Using the Solr Admin UI currently requires at least one SolrCore.</div>'
|
262
|
+
);
|
263
|
+
return;
|
264
|
+
} // else: we have at least one core....
|
265
|
+
|
266
|
+
var system_url = environment_basepath + '/admin/system?wt=json';
|
267
|
+
$.ajax
|
268
|
+
(
|
269
|
+
{
|
270
|
+
url : system_url,
|
271
|
+
dataType : 'json',
|
272
|
+
beforeSend : function( arr, form, options )
|
273
|
+
{
|
274
|
+
},
|
275
|
+
success : function( response )
|
276
|
+
{
|
277
|
+
self.dashboard_values = response;
|
278
|
+
|
279
|
+
var environment_args = null;
|
280
|
+
var cloud_args = null;
|
281
|
+
|
282
|
+
if( response.jvm && response.jvm.jmx && response.jvm.jmx.commandLineArgs )
|
283
|
+
{
|
284
|
+
var command_line_args = response.jvm.jmx.commandLineArgs.join( ' | ' );
|
285
|
+
|
286
|
+
environment_args = command_line_args.match( /-Dsolr.environment=((dev|test|prod)?[\w\d]*)/i );
|
287
|
+
cloud_args = command_line_args.match( /-Dzk/i );
|
288
|
+
}
|
289
|
+
|
290
|
+
// title
|
291
|
+
|
292
|
+
$( 'title', document )
|
293
|
+
.append( ' (' + response.core.host + ')' );
|
294
|
+
|
295
|
+
// environment
|
296
|
+
|
297
|
+
var wrapper = $( '#wrapper' );
|
298
|
+
var environment_element = $( '#environment' );
|
299
|
+
if( environment_args )
|
300
|
+
{
|
301
|
+
wrapper
|
302
|
+
.addClass( 'has-environment' );
|
303
|
+
|
304
|
+
if( environment_args[1] )
|
305
|
+
{
|
306
|
+
environment_element
|
307
|
+
.html( environment_args[1] );
|
308
|
+
}
|
309
|
+
|
310
|
+
if( environment_args[2] )
|
311
|
+
{
|
312
|
+
environment_element
|
313
|
+
.addClass( environment_args[2] );
|
314
|
+
}
|
315
|
+
}
|
316
|
+
else
|
317
|
+
{
|
318
|
+
wrapper
|
319
|
+
.removeClass( 'has-environment' );
|
320
|
+
}
|
321
|
+
|
322
|
+
// cloud
|
323
|
+
|
324
|
+
var cloud_nav_element = $( '#menu #cloud' );
|
325
|
+
if( cloud_args )
|
326
|
+
{
|
327
|
+
cloud_nav_element
|
328
|
+
.show();
|
329
|
+
}
|
330
|
+
|
331
|
+
// sammy
|
332
|
+
|
333
|
+
sammy.run( location.hash );
|
334
|
+
},
|
335
|
+
error : function()
|
336
|
+
{
|
337
|
+
show_global_error
|
338
|
+
(
|
339
|
+
'<div class="message"><p>Unable to load environment info from <code>' + system_url.esc() + '</code>.</p>' +
|
340
|
+
'<p>This interface requires that you activate the admin request handlers in all SolrCores by adding the ' +
|
341
|
+
'following configuration to your <code>solrconfig.xml</code>:</p></div>' + "\n" +
|
342
|
+
|
343
|
+
'<div class="code"><pre class="syntax language-xml"><code>' +
|
344
|
+
'<!-- Admin Handlers - This will register all the standard admin RequestHandlers. -->'.esc() + "\n" +
|
345
|
+
'<requestHandler name="/admin/" class="solr.admin.AdminHandlers" />'.esc() +
|
346
|
+
'</code></pre></div>'
|
347
|
+
);
|
348
|
+
},
|
349
|
+
complete : function()
|
350
|
+
{
|
351
|
+
loader.hide( this );
|
352
|
+
}
|
353
|
+
}
|
354
|
+
);
|
355
|
+
},
|
356
|
+
error : function()
|
357
|
+
{
|
358
|
+
},
|
359
|
+
complete : function()
|
360
|
+
{
|
361
|
+
}
|
362
|
+
}
|
363
|
+
);
|
364
|
+
}
|
365
|
+
|
366
|
+
};
|
367
|
+
|
368
|
+
var app = new solr_admin( app_config );
|
@@ -0,0 +1,719 @@
|
|
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 init_debug = function( cloud_element )
|
19
|
+
{
|
20
|
+
var debug_element = $( '#debug', cloud_element );
|
21
|
+
var debug_button = $( '#menu #cloud .dump a' );
|
22
|
+
|
23
|
+
var clipboard_element = $( '.clipboard', debug_element );
|
24
|
+
var clipboard_button = $( 'a', clipboard_element );
|
25
|
+
|
26
|
+
debug_button
|
27
|
+
.die( 'click' )
|
28
|
+
.live
|
29
|
+
(
|
30
|
+
'click',
|
31
|
+
function( event )
|
32
|
+
{
|
33
|
+
debug_element.trigger( 'show' );
|
34
|
+
return false;
|
35
|
+
}
|
36
|
+
);
|
37
|
+
|
38
|
+
$( '.close', debug_element )
|
39
|
+
.die( 'click' )
|
40
|
+
.live
|
41
|
+
(
|
42
|
+
'click',
|
43
|
+
function( event )
|
44
|
+
{
|
45
|
+
debug_element.trigger( 'hide' );
|
46
|
+
return false;
|
47
|
+
}
|
48
|
+
);
|
49
|
+
|
50
|
+
$( '.clipboard', debug_element )
|
51
|
+
.die( 'click' )
|
52
|
+
.live
|
53
|
+
(
|
54
|
+
'click',
|
55
|
+
function( event )
|
56
|
+
{
|
57
|
+
return false;
|
58
|
+
}
|
59
|
+
);
|
60
|
+
|
61
|
+
debug_element
|
62
|
+
.die( 'show' )
|
63
|
+
.live
|
64
|
+
(
|
65
|
+
'show',
|
66
|
+
function( event )
|
67
|
+
{
|
68
|
+
debug_element.show();
|
69
|
+
|
70
|
+
$.ajax
|
71
|
+
(
|
72
|
+
{
|
73
|
+
url : app.config.solr_path + '/zookeeper?wt=json&dump=true',
|
74
|
+
dataType : 'text',
|
75
|
+
context : debug_element,
|
76
|
+
beforeSend : function( xhr, settings )
|
77
|
+
{
|
78
|
+
$( '.debug', debug_element )
|
79
|
+
.html( '<span class="loader">Loading Dump ...</span>' );
|
80
|
+
|
81
|
+
ZeroClipboard.setMoviePath( 'img/ZeroClipboard.swf' );
|
82
|
+
|
83
|
+
clipboard_client = new ZeroClipboard.Client();
|
84
|
+
|
85
|
+
clipboard_client.addEventListener
|
86
|
+
(
|
87
|
+
'load',
|
88
|
+
function( client )
|
89
|
+
{
|
90
|
+
}
|
91
|
+
);
|
92
|
+
|
93
|
+
clipboard_client.addEventListener
|
94
|
+
(
|
95
|
+
'complete',
|
96
|
+
function( client, text )
|
97
|
+
{
|
98
|
+
clipboard_element
|
99
|
+
.addClass( 'copied' );
|
100
|
+
|
101
|
+
clipboard_button
|
102
|
+
.data( 'text', clipboard_button.text() )
|
103
|
+
.text( clipboard_button.data( 'copied' ) );
|
104
|
+
}
|
105
|
+
);
|
106
|
+
},
|
107
|
+
success : function( response, text_status, xhr )
|
108
|
+
{
|
109
|
+
clipboard_client.glue
|
110
|
+
(
|
111
|
+
clipboard_element.get(0),
|
112
|
+
clipboard_button.get(0)
|
113
|
+
);
|
114
|
+
|
115
|
+
clipboard_client.setText( response.replace( /\\/g, '\\\\' ) );
|
116
|
+
|
117
|
+
$( '.debug', debug_element )
|
118
|
+
.removeClass( 'loader' )
|
119
|
+
.text( response );
|
120
|
+
},
|
121
|
+
error : function( xhr, text_status, error_thrown )
|
122
|
+
{
|
123
|
+
},
|
124
|
+
complete : function( xhr, text_status )
|
125
|
+
{
|
126
|
+
}
|
127
|
+
}
|
128
|
+
);
|
129
|
+
}
|
130
|
+
)
|
131
|
+
.die( 'hide' )
|
132
|
+
.live
|
133
|
+
(
|
134
|
+
'hide',
|
135
|
+
function( event )
|
136
|
+
{
|
137
|
+
$( '.debug', debug_element )
|
138
|
+
.empty();
|
139
|
+
|
140
|
+
clipboard_element
|
141
|
+
.removeClass( 'copied' );
|
142
|
+
|
143
|
+
clipboard_button
|
144
|
+
.data( 'copied', clipboard_button.text() )
|
145
|
+
.text( clipboard_button.data( 'text' ) );
|
146
|
+
|
147
|
+
clipboard_client.destroy();
|
148
|
+
|
149
|
+
debug_element.hide();
|
150
|
+
}
|
151
|
+
);
|
152
|
+
};
|
153
|
+
|
154
|
+
var helper_path_class = function( p )
|
155
|
+
{
|
156
|
+
var classes = [ 'link' ];
|
157
|
+
classes.push( 'lvl-' + p.target.depth );
|
158
|
+
|
159
|
+
if( p.target.data && p.target.data.leader )
|
160
|
+
{
|
161
|
+
classes.push( 'leader' );
|
162
|
+
}
|
163
|
+
|
164
|
+
if( p.target.data && p.target.data.state )
|
165
|
+
{
|
166
|
+
classes.push( p.target.data.state );
|
167
|
+
}
|
168
|
+
|
169
|
+
return classes.join( ' ' );
|
170
|
+
};
|
171
|
+
|
172
|
+
var helper_node_class = function( d )
|
173
|
+
{
|
174
|
+
var classes = [ 'node' ];
|
175
|
+
classes.push( 'lvl-' + d.depth );
|
176
|
+
|
177
|
+
if( d.data && d.data.leader )
|
178
|
+
{
|
179
|
+
classes.push( 'leader' );
|
180
|
+
}
|
181
|
+
|
182
|
+
if( d.data && d.data.state )
|
183
|
+
{
|
184
|
+
classes.push( d.data.state );
|
185
|
+
}
|
186
|
+
|
187
|
+
return classes.join( ' ' );
|
188
|
+
};
|
189
|
+
|
190
|
+
var helper_data = {
|
191
|
+
protocol: [],
|
192
|
+
host: [],
|
193
|
+
hostname: [],
|
194
|
+
port: [],
|
195
|
+
pathname: []
|
196
|
+
};
|
197
|
+
|
198
|
+
var helper_node_text = function( d )
|
199
|
+
{
|
200
|
+
if( !d.data || !d.data.uri )
|
201
|
+
{
|
202
|
+
return d.name;
|
203
|
+
}
|
204
|
+
|
205
|
+
var name = d.data.uri.hostname;
|
206
|
+
|
207
|
+
if( 1 !== helper_data.protocol.length )
|
208
|
+
{
|
209
|
+
name = d.data.uri.protocol + '//' + name;
|
210
|
+
}
|
211
|
+
|
212
|
+
if( 1 !== helper_data.port.length )
|
213
|
+
{
|
214
|
+
name += ':' + d.data.uri.port;
|
215
|
+
}
|
216
|
+
|
217
|
+
if( 1 !== helper_data.pathname.length )
|
218
|
+
{
|
219
|
+
name += d.data.uri.pathname;
|
220
|
+
}
|
221
|
+
|
222
|
+
return name;
|
223
|
+
};
|
224
|
+
|
225
|
+
var generate_graph = function( graph_element, graph_data, leaf_count )
|
226
|
+
{
|
227
|
+
var w = graph_element.width(),
|
228
|
+
h = leaf_count * 20;
|
229
|
+
|
230
|
+
var tree = d3.layout.tree()
|
231
|
+
.size([h, w - 400]);
|
232
|
+
|
233
|
+
var diagonal = d3.svg.diagonal()
|
234
|
+
.projection(function(d) { return [d.y, d.x]; });
|
235
|
+
|
236
|
+
var vis = d3.select( '#canvas' ).append( 'svg' )
|
237
|
+
.attr( 'width', w )
|
238
|
+
.attr( 'height', h)
|
239
|
+
.append( 'g' )
|
240
|
+
.attr( 'transform', 'translate(100, 0)' );
|
241
|
+
|
242
|
+
var nodes = tree.nodes( graph_data );
|
243
|
+
|
244
|
+
var link = vis.selectAll( 'path.link' )
|
245
|
+
.data( tree.links( nodes ) )
|
246
|
+
.enter().append( 'path' )
|
247
|
+
.attr( 'class', helper_path_class )
|
248
|
+
.attr( 'd', diagonal );
|
249
|
+
|
250
|
+
var node = vis.selectAll( 'g.node' )
|
251
|
+
.data( nodes )
|
252
|
+
.enter().append( 'g' )
|
253
|
+
.attr( 'class', helper_node_class )
|
254
|
+
.attr( 'transform', function(d) { return 'translate(' + d.y + ',' + d.x + ')'; } )
|
255
|
+
|
256
|
+
node.append( 'circle' )
|
257
|
+
.attr( 'r', 4.5 );
|
258
|
+
|
259
|
+
node.append( 'text' )
|
260
|
+
.attr( 'dx', function( d ) { return 0 === d.depth ? -8 : 8; } )
|
261
|
+
.attr( 'dy', function( d ) { return 5; } )
|
262
|
+
.attr( 'text-anchor', function( d ) { return 0 === d.depth ? 'end' : 'start'; } )
|
263
|
+
.attr( 'data-href', function( d ) { return d.name; } )
|
264
|
+
.text( helper_node_text );
|
265
|
+
|
266
|
+
$( 'text[data-href*="//"]', graph_element )
|
267
|
+
.die( 'click' )
|
268
|
+
.live
|
269
|
+
(
|
270
|
+
'click',
|
271
|
+
function()
|
272
|
+
{
|
273
|
+
location.href = $( this ).data( 'href' );
|
274
|
+
}
|
275
|
+
);
|
276
|
+
};
|
277
|
+
|
278
|
+
var generate_rgraph = function( graph_element, graph_data, leaf_count )
|
279
|
+
{
|
280
|
+
var max_val = Math.min( graph_element.width(), $( 'body' ).height() )
|
281
|
+
var r = max_val / 2;
|
282
|
+
|
283
|
+
var cluster = d3.layout.cluster()
|
284
|
+
.size([360, r - 160]);
|
285
|
+
|
286
|
+
var diagonal = d3.svg.diagonal.radial()
|
287
|
+
.projection(function(d) { return [d.y, d.x / 180 * Math.PI]; });
|
288
|
+
|
289
|
+
var vis = d3.select( '#canvas' ).append( 'svg' )
|
290
|
+
.attr( 'width', r * 2 )
|
291
|
+
.attr( 'height', r * 2 )
|
292
|
+
.append( 'g' )
|
293
|
+
.attr( 'transform', 'translate(' + r + ',' + r + ')' );
|
294
|
+
|
295
|
+
var nodes = cluster.nodes( graph_data );
|
296
|
+
|
297
|
+
var link = vis.selectAll( 'path.link' )
|
298
|
+
.data( cluster.links( nodes ) )
|
299
|
+
.enter().append( 'path' )
|
300
|
+
.attr( 'class', helper_path_class )
|
301
|
+
.attr( 'd', diagonal );
|
302
|
+
|
303
|
+
var node = vis.selectAll( 'g.node' )
|
304
|
+
.data( nodes )
|
305
|
+
.enter().append( 'g' )
|
306
|
+
.attr( 'class', helper_node_class )
|
307
|
+
.attr( 'transform', function(d) { return 'rotate(' + (d.x - 90) + ')translate(' + d.y + ')'; } )
|
308
|
+
|
309
|
+
node.append( 'circle' )
|
310
|
+
.attr( 'r', 4.5 );
|
311
|
+
|
312
|
+
node.append( 'text' )
|
313
|
+
.attr( 'dx', function(d) { return d.x < 180 ? 8 : -8; } )
|
314
|
+
.attr( 'dy', '.31em' )
|
315
|
+
.attr( 'text-anchor', function(d) { return d.x < 180 ? 'start' : 'end'; } )
|
316
|
+
.attr( 'transform', function(d) { return d.x < 180 ? null : 'rotate(180)'; } )
|
317
|
+
.attr( 'data-href', function( d ) { return d.name; } )
|
318
|
+
.text( helper_node_text );
|
319
|
+
|
320
|
+
$( 'text[data-href*="//"]', graph_element )
|
321
|
+
.die( 'click' )
|
322
|
+
.live
|
323
|
+
(
|
324
|
+
'click',
|
325
|
+
function()
|
326
|
+
{
|
327
|
+
location.href = $( this ).data( 'href' );
|
328
|
+
}
|
329
|
+
);
|
330
|
+
};
|
331
|
+
|
332
|
+
var prepare_graph = function( graph_element, callback )
|
333
|
+
{
|
334
|
+
$.ajax
|
335
|
+
(
|
336
|
+
{
|
337
|
+
url : app.config.solr_path + '/zookeeper?wt=json&path=%2Flive_nodes',
|
338
|
+
dataType : 'json',
|
339
|
+
success : function( response, text_status, xhr )
|
340
|
+
{
|
341
|
+
var live_nodes = {};
|
342
|
+
for( var c in response.tree[0].children )
|
343
|
+
{
|
344
|
+
live_nodes[response.tree[0].children[c].data.title] = true;
|
345
|
+
}
|
346
|
+
|
347
|
+
$.ajax
|
348
|
+
(
|
349
|
+
{
|
350
|
+
url : app.config.solr_path + '/zookeeper?wt=json&detail=true&path=%2Fclusterstate.json',
|
351
|
+
dataType : 'json',
|
352
|
+
context : graph_element,
|
353
|
+
beforeSend : function( xhr, settings )
|
354
|
+
{
|
355
|
+
this
|
356
|
+
.show();
|
357
|
+
},
|
358
|
+
success : function( response, text_status, xhr )
|
359
|
+
{
|
360
|
+
var state = null;
|
361
|
+
eval( 'state = ' + response.znode.data + ';' );
|
362
|
+
|
363
|
+
var leaf_count = 0;
|
364
|
+
var graph_data = {
|
365
|
+
name: null,
|
366
|
+
children : []
|
367
|
+
};
|
368
|
+
|
369
|
+
for( var c in state )
|
370
|
+
{
|
371
|
+
var shards = [];
|
372
|
+
for( var s in state[c] )
|
373
|
+
{
|
374
|
+
var nodes = [];
|
375
|
+
for( var n in state[c][s].replicas )
|
376
|
+
{
|
377
|
+
leaf_count++;
|
378
|
+
var replica = state[c][s].replicas[n]
|
379
|
+
|
380
|
+
var uri = replica.base_url;
|
381
|
+
var parts = uri.match( /^(\w+:)\/\/(([\w\d\.-]+)(:(\d+))?)(.+)$/ );
|
382
|
+
var uri_parts = {
|
383
|
+
protocol: parts[1],
|
384
|
+
host: parts[2],
|
385
|
+
hostname: parts[3],
|
386
|
+
port: parseInt( parts[5] || 80, 10 ),
|
387
|
+
pathname: parts[6]
|
388
|
+
};
|
389
|
+
|
390
|
+
helper_data.protocol.push( uri_parts.protocol );
|
391
|
+
helper_data.host.push( uri_parts.host );
|
392
|
+
helper_data.hostname.push( uri_parts.hostname );
|
393
|
+
helper_data.port.push( uri_parts.port );
|
394
|
+
helper_data.pathname.push( uri_parts.pathname );
|
395
|
+
|
396
|
+
var status = replica.state;
|
397
|
+
|
398
|
+
if( !live_nodes[replica.node_name] )
|
399
|
+
{
|
400
|
+
status = 'gone';
|
401
|
+
}
|
402
|
+
|
403
|
+
var node = {
|
404
|
+
name: uri,
|
405
|
+
data: {
|
406
|
+
type : 'node',
|
407
|
+
state : status,
|
408
|
+
leader : 'true' === replica.leader,
|
409
|
+
uri : uri_parts
|
410
|
+
}
|
411
|
+
};
|
412
|
+
nodes.push( node );
|
413
|
+
}
|
414
|
+
|
415
|
+
var shard = {
|
416
|
+
name: s,
|
417
|
+
data: {
|
418
|
+
type : 'shard',
|
419
|
+
},
|
420
|
+
children: nodes
|
421
|
+
};
|
422
|
+
shards.push( shard );
|
423
|
+
}
|
424
|
+
|
425
|
+
var collection = {
|
426
|
+
name: c,
|
427
|
+
data: {
|
428
|
+
type : 'collection',
|
429
|
+
},
|
430
|
+
children: shards
|
431
|
+
};
|
432
|
+
graph_data.children.push( collection );
|
433
|
+
}
|
434
|
+
|
435
|
+
helper_data.protocol = $.unique( helper_data.protocol );
|
436
|
+
helper_data.host = $.unique( helper_data.host );
|
437
|
+
helper_data.hostname = $.unique( helper_data.hostname );
|
438
|
+
helper_data.port = $.unique( helper_data.port );
|
439
|
+
helper_data.pathname = $.unique( helper_data.pathname );
|
440
|
+
|
441
|
+
callback( graph_element, graph_data, leaf_count );
|
442
|
+
},
|
443
|
+
error : function( xhr, text_status, error_thrown)
|
444
|
+
{
|
445
|
+
},
|
446
|
+
complete : function( xhr, text_status )
|
447
|
+
{
|
448
|
+
}
|
449
|
+
}
|
450
|
+
);
|
451
|
+
},
|
452
|
+
error : function( xhr, text_status, error_thrown)
|
453
|
+
{
|
454
|
+
},
|
455
|
+
complete : function( xhr, text_status )
|
456
|
+
{
|
457
|
+
}
|
458
|
+
}
|
459
|
+
);
|
460
|
+
|
461
|
+
};
|
462
|
+
|
463
|
+
var init_graph = function( graph_element )
|
464
|
+
{
|
465
|
+
prepare_graph
|
466
|
+
(
|
467
|
+
graph_element,
|
468
|
+
function( graph_element, graph_data, leaf_count )
|
469
|
+
{
|
470
|
+
generate_graph( graph_element, graph_data, leaf_count );
|
471
|
+
}
|
472
|
+
);
|
473
|
+
}
|
474
|
+
|
475
|
+
var init_rgraph = function( graph_element )
|
476
|
+
{
|
477
|
+
prepare_graph
|
478
|
+
(
|
479
|
+
graph_element,
|
480
|
+
function( graph_element, graph_data, leaf_count )
|
481
|
+
{
|
482
|
+
generate_rgraph( graph_element, graph_data, leaf_count );
|
483
|
+
}
|
484
|
+
);
|
485
|
+
}
|
486
|
+
|
487
|
+
var init_tree = function( tree_element )
|
488
|
+
{
|
489
|
+
$.ajax
|
490
|
+
(
|
491
|
+
{
|
492
|
+
url : app.config.solr_path + '/zookeeper?wt=json',
|
493
|
+
dataType : 'json',
|
494
|
+
context : tree_element,
|
495
|
+
beforeSend : function( xhr, settings )
|
496
|
+
{
|
497
|
+
this
|
498
|
+
.show();
|
499
|
+
},
|
500
|
+
success : function( response, text_status, xhr )
|
501
|
+
{
|
502
|
+
var self = this;
|
503
|
+
|
504
|
+
$( '#tree', this )
|
505
|
+
.jstree
|
506
|
+
(
|
507
|
+
{
|
508
|
+
"plugins" : [ "json_data" ],
|
509
|
+
"json_data" : {
|
510
|
+
"data" : response.tree,
|
511
|
+
"progressive_render" : true
|
512
|
+
},
|
513
|
+
"core" : {
|
514
|
+
"animation" : 0
|
515
|
+
}
|
516
|
+
}
|
517
|
+
)
|
518
|
+
.jstree
|
519
|
+
(
|
520
|
+
'open_node',
|
521
|
+
'li:first'
|
522
|
+
);
|
523
|
+
|
524
|
+
var tree_links = $( '#tree a', this );
|
525
|
+
|
526
|
+
tree_links
|
527
|
+
.die( 'click' )
|
528
|
+
.live
|
529
|
+
(
|
530
|
+
'click',
|
531
|
+
function( event )
|
532
|
+
{
|
533
|
+
$( 'a.active', $( this ).parents( '#tree' ) )
|
534
|
+
.removeClass( 'active' );
|
535
|
+
|
536
|
+
$( this )
|
537
|
+
.addClass( 'active' );
|
538
|
+
|
539
|
+
tree_element
|
540
|
+
.addClass( 'show' );
|
541
|
+
|
542
|
+
var file_content = $( '#file-content' );
|
543
|
+
|
544
|
+
$( 'a.close', file_content )
|
545
|
+
.die( 'click' )
|
546
|
+
.live
|
547
|
+
(
|
548
|
+
'click',
|
549
|
+
function( event )
|
550
|
+
{
|
551
|
+
$( '#tree a.active' )
|
552
|
+
.removeClass( 'active' );
|
553
|
+
|
554
|
+
tree_element
|
555
|
+
.removeClass( 'show' );
|
556
|
+
|
557
|
+
return false;
|
558
|
+
}
|
559
|
+
);
|
560
|
+
|
561
|
+
$.ajax
|
562
|
+
(
|
563
|
+
{
|
564
|
+
url : this.href,
|
565
|
+
dataType : 'json',
|
566
|
+
context : file_content,
|
567
|
+
beforeSend : function( xhr, settings )
|
568
|
+
{
|
569
|
+
},
|
570
|
+
success : function( response, text_status, xhr )
|
571
|
+
{
|
572
|
+
var props = [];
|
573
|
+
for( var key in response.znode.prop )
|
574
|
+
{
|
575
|
+
props.push
|
576
|
+
(
|
577
|
+
'<li><dl class="clearfix">' + "\n" +
|
578
|
+
'<dt>' + key.esc() + '</dt>' + "\n" +
|
579
|
+
'<dd>' + response.znode.prop[key].esc() + '</dd>' + "\n" +
|
580
|
+
'</dl></li>'
|
581
|
+
);
|
582
|
+
}
|
583
|
+
|
584
|
+
$( '#prop ul', this )
|
585
|
+
.empty()
|
586
|
+
.html( props.join( "\n" ) );
|
587
|
+
|
588
|
+
$( '#prop ul li:odd', this )
|
589
|
+
.addClass( 'odd' );
|
590
|
+
|
591
|
+
var data_element = $( '#data', this );
|
592
|
+
|
593
|
+
var highlight = false;
|
594
|
+
var data = '<em>File "' + response.znode.path + '" has no Content</em>';
|
595
|
+
|
596
|
+
if( response.znode.data )
|
597
|
+
{
|
598
|
+
var classes = '';
|
599
|
+
var path = response.znode.path.split( '.' );
|
600
|
+
|
601
|
+
if( 1 < path.length )
|
602
|
+
{
|
603
|
+
highlight = true;
|
604
|
+
classes = 'syntax language-' + path.pop().esc();
|
605
|
+
}
|
606
|
+
|
607
|
+
data = '<pre class="' + classes + '">'
|
608
|
+
+ response.znode.data.esc()
|
609
|
+
+ '</pre>';
|
610
|
+
}
|
611
|
+
|
612
|
+
|
613
|
+
data_element
|
614
|
+
.show()
|
615
|
+
.html( data );
|
616
|
+
|
617
|
+
if( highlight )
|
618
|
+
{
|
619
|
+
hljs.highlightBlock( data_element.get(0) );
|
620
|
+
}
|
621
|
+
|
622
|
+
},
|
623
|
+
error : function( xhr, text_status, error_thrown)
|
624
|
+
{
|
625
|
+
},
|
626
|
+
complete : function( xhr, text_status )
|
627
|
+
{
|
628
|
+
}
|
629
|
+
}
|
630
|
+
);
|
631
|
+
|
632
|
+
return false;
|
633
|
+
}
|
634
|
+
);
|
635
|
+
},
|
636
|
+
error : function( xhr, text_status, error_thrown )
|
637
|
+
{
|
638
|
+
var message = 'Loading of <code>' + app.config.zookeeper_path + '</code> failed with "' + text_status + '" '
|
639
|
+
+ '(<code>' + error_thrown.message + '</code>)';
|
640
|
+
|
641
|
+
if( 200 !== xhr.status )
|
642
|
+
{
|
643
|
+
message = 'Loading of <code>' + app.config.zookeeper_path + '</code> failed with HTTP-Status ' + xhr.status + ' ';
|
644
|
+
}
|
645
|
+
|
646
|
+
this
|
647
|
+
.html( '<div class="block" id="error">' + message + '</div>' );
|
648
|
+
},
|
649
|
+
complete : function( xhr, text_status )
|
650
|
+
{
|
651
|
+
}
|
652
|
+
}
|
653
|
+
);
|
654
|
+
};
|
655
|
+
|
656
|
+
// #/~cloud
|
657
|
+
sammy.get
|
658
|
+
(
|
659
|
+
/^#\/(~cloud)$/,
|
660
|
+
function( context )
|
661
|
+
{
|
662
|
+
var content_element = $( '#content' );
|
663
|
+
|
664
|
+
$.get
|
665
|
+
(
|
666
|
+
'tpl/cloud.html',
|
667
|
+
function( template )
|
668
|
+
{
|
669
|
+
content_element
|
670
|
+
.html( template );
|
671
|
+
|
672
|
+
var cloud_element = $( '#cloud', content_element );
|
673
|
+
var navigation_element = $( '#menu #cloud' );
|
674
|
+
|
675
|
+
init_debug( cloud_element );
|
676
|
+
|
677
|
+
$( '.tree', navigation_element )
|
678
|
+
.die( 'activate' )
|
679
|
+
.live
|
680
|
+
(
|
681
|
+
'activate',
|
682
|
+
function( event )
|
683
|
+
{
|
684
|
+
$( this ).addClass( 'active' );
|
685
|
+
init_tree( $( '#tree-content', cloud_element ) );
|
686
|
+
}
|
687
|
+
);
|
688
|
+
|
689
|
+
$( '.graph', navigation_element )
|
690
|
+
.die( 'activate' )
|
691
|
+
.live
|
692
|
+
(
|
693
|
+
'activate',
|
694
|
+
function( event )
|
695
|
+
{
|
696
|
+
$( this ).addClass( 'active' );
|
697
|
+
init_graph( $( '#graph-content', cloud_element ) );
|
698
|
+
}
|
699
|
+
);
|
700
|
+
|
701
|
+
$( '.rgraph', navigation_element )
|
702
|
+
.die( 'activate' )
|
703
|
+
.live
|
704
|
+
(
|
705
|
+
'activate',
|
706
|
+
function( event )
|
707
|
+
{
|
708
|
+
$( this ).addClass( 'active' );
|
709
|
+
init_rgraph( $( '#graph-content', cloud_element ) );
|
710
|
+
}
|
711
|
+
);
|
712
|
+
|
713
|
+
$( 'a[href="' + context.path + '"]', navigation_element )
|
714
|
+
.trigger( 'activate' );
|
715
|
+
|
716
|
+
}
|
717
|
+
);
|
718
|
+
}
|
719
|
+
);
|