sunspot_solr 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,812 +1,812 @@
|
|
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 dataimport_timeout = 2000;
|
19
|
-
var cookie_dataimport_autorefresh = 'dataimport_autorefresh';
|
20
|
-
|
21
|
-
sammy.bind
|
22
|
-
(
|
23
|
-
'dataimport_queryhandler_load',
|
24
|
-
function( event, params )
|
25
|
-
{
|
26
|
-
var core_basepath = params.active_core.attr( 'data-basepath' );
|
27
|
-
|
28
|
-
$.ajax
|
29
|
-
(
|
30
|
-
{
|
31
|
-
url : core_basepath + '/admin/mbeans?cat=QUERYHANDLER&wt=json',
|
32
|
-
dataType : 'json',
|
33
|
-
beforeSend : function( xhr, settings )
|
34
|
-
{
|
35
|
-
},
|
36
|
-
success : function( response, text_status, xhr )
|
37
|
-
{
|
38
|
-
var handlers = response['solr-mbeans'][1];
|
39
|
-
var dataimport_handlers = [];
|
40
|
-
for( var key in handlers )
|
41
|
-
{
|
42
|
-
if( handlers[key]['class'] !== key &&
|
43
|
-
handlers[key]['class'] === 'org.apache.solr.handler.dataimport.DataImportHandler' )
|
44
|
-
{
|
45
|
-
dataimport_handlers.push( key );
|
46
|
-
}
|
47
|
-
}
|
48
|
-
params.callback( dataimport_handlers );
|
49
|
-
},
|
50
|
-
error : function( xhr, text_status, error_thrown)
|
51
|
-
{
|
52
|
-
},
|
53
|
-
complete : function( xhr, text_status )
|
54
|
-
{
|
55
|
-
}
|
56
|
-
}
|
57
|
-
);
|
58
|
-
}
|
59
|
-
);
|
60
|
-
|
61
|
-
// #/:core/dataimport
|
62
|
-
sammy.get
|
63
|
-
(
|
64
|
-
new RegExp( app.core_regex_base + '\\/(dataimport)$' ),
|
65
|
-
function( context )
|
66
|
-
{
|
67
|
-
sammy.trigger
|
68
|
-
(
|
69
|
-
'dataimport_queryhandler_load',
|
70
|
-
{
|
71
|
-
active_core : this.active_core,
|
72
|
-
callback : function( dataimport_handlers )
|
73
|
-
{
|
74
|
-
if( 0 === dataimport_handlers.length )
|
75
|
-
{
|
76
|
-
$( '#content' )
|
77
|
-
.html( 'sorry, no dataimport-handler defined!' );
|
78
|
-
|
79
|
-
return false;
|
80
|
-
}
|
81
|
-
|
82
|
-
context.redirect( context.path + '/' + dataimport_handlers[0] );
|
83
|
-
}
|
84
|
-
}
|
85
|
-
);
|
86
|
-
}
|
87
|
-
);
|
88
|
-
|
89
|
-
// #/:core/dataimport
|
90
|
-
sammy.get
|
91
|
-
(
|
92
|
-
new RegExp( app.core_regex_base + '\\/(dataimport)\\/' ),
|
93
|
-
function( context )
|
94
|
-
{
|
95
|
-
var core_basepath = this.active_core.attr( 'data-basepath' );
|
96
|
-
var content_element = $( '#content' );
|
97
|
-
|
98
|
-
var path_parts = this.path.match( /^(.+\/dataimport\/)(.*)$/ );
|
99
|
-
var handler_url = core_basepath + path_parts[2];
|
100
|
-
|
101
|
-
$( 'li.dataimport', this.active_core )
|
102
|
-
.addClass( 'active' );
|
103
|
-
|
104
|
-
$.get
|
105
|
-
(
|
106
|
-
'tpl/dataimport.html',
|
107
|
-
function( template )
|
108
|
-
{
|
109
|
-
content_element
|
110
|
-
.html( template );
|
111
|
-
|
112
|
-
var dataimport_element = $( '#dataimport', content_element );
|
113
|
-
var form_element = $( '#form', dataimport_element );
|
114
|
-
var config_element = $( '#config', dataimport_element );
|
115
|
-
var error_element = $( '#error', dataimport_element );
|
116
|
-
var debug_response_element = $( '#debug_response', dataimport_element );
|
117
|
-
|
118
|
-
var autorefresh_status = false;
|
119
|
-
var debug_mode = false;
|
120
|
-
|
121
|
-
// handler
|
122
|
-
|
123
|
-
sammy.trigger
|
124
|
-
(
|
125
|
-
'dataimport_queryhandler_load',
|
126
|
-
{
|
127
|
-
active_core : context.active_core,
|
128
|
-
callback : function( dataimport_handlers )
|
129
|
-
{
|
130
|
-
var handlers_element = $( '#navigation ul', form_element );
|
131
|
-
var handlers = [];
|
132
|
-
|
133
|
-
for( var i = 0; i < dataimport_handlers.length; i++ )
|
134
|
-
{
|
135
|
-
handlers.push
|
136
|
-
(
|
137
|
-
'<li><a href="' + path_parts[1] + dataimport_handlers[i] + '">' +
|
138
|
-
dataimport_handlers[i] +
|
139
|
-
'</a></li>'
|
140
|
-
);
|
141
|
-
}
|
142
|
-
|
143
|
-
$( handlers_element )
|
144
|
-
.html( handlers.join( "\n") ) ;
|
145
|
-
|
146
|
-
$( 'a[href="' + context.path + '"]', handlers_element ).closest( 'li' )
|
147
|
-
.addClass( 'current' );
|
148
|
-
|
149
|
-
$( 'form', form_element )
|
150
|
-
.show();
|
151
|
-
}
|
152
|
-
}
|
153
|
-
);
|
154
|
-
|
155
|
-
// config
|
156
|
-
|
157
|
-
function dataimport_fetch_config()
|
158
|
-
{
|
159
|
-
$.ajax
|
160
|
-
(
|
161
|
-
{
|
162
|
-
url : handler_url + '?command=show-config&indent=true',
|
163
|
-
dataType : 'xml',
|
164
|
-
context : $( '#dataimport_config', config_element ),
|
165
|
-
beforeSend : function( xhr, settings )
|
166
|
-
{
|
167
|
-
error_element
|
168
|
-
.empty()
|
169
|
-
.hide();
|
170
|
-
},
|
171
|
-
success : function( config, text_status, xhr )
|
172
|
-
{
|
173
|
-
dataimport_element
|
174
|
-
.removeClass( 'error' );
|
175
|
-
|
176
|
-
config_element
|
177
|
-
.addClass( 'hidden' );
|
178
|
-
|
179
|
-
var entities = [ '<option value=""></option>' ];
|
180
|
-
|
181
|
-
$( 'document > entity', config )
|
182
|
-
.each
|
183
|
-
(
|
184
|
-
function( i, element )
|
185
|
-
{
|
186
|
-
entities.push( '<option>' + $( element ).attr( 'name' ).esc() + '</option>' );
|
187
|
-
}
|
188
|
-
);
|
189
|
-
|
190
|
-
$( '#entity', form_element )
|
191
|
-
.html( entities.join( "\n" ) );
|
192
|
-
|
193
|
-
$( '.editable textarea', this )
|
194
|
-
.val( xhr.responseText.replace( /\n+$/, '' ) );
|
195
|
-
},
|
196
|
-
error : function( xhr, text_status, error_thrown )
|
197
|
-
{
|
198
|
-
if( 'parsererror' === error_thrown )
|
199
|
-
{
|
200
|
-
dataimport_element
|
201
|
-
.addClass( 'error' );
|
202
|
-
|
203
|
-
error_element
|
204
|
-
.text( 'Dataimport XML-Configuration is not valid' )
|
205
|
-
.show();
|
206
|
-
|
207
|
-
config_element
|
208
|
-
.removeClass( 'hidden' );
|
209
|
-
}
|
210
|
-
},
|
211
|
-
complete : function( xhr, text_status )
|
212
|
-
{
|
213
|
-
var code = $(
|
214
|
-
'<pre class="syntax language-xml"><code>' +
|
215
|
-
xhr.responseText.esc() +
|
216
|
-
'</code></pre>'
|
217
|
-
);
|
218
|
-
$( '.formatted', this ).html( code );
|
219
|
-
|
220
|
-
if( 'success' === text_status )
|
221
|
-
{
|
222
|
-
hljs.highlightBlock( code.get(0) );
|
223
|
-
}
|
224
|
-
}
|
225
|
-
}
|
226
|
-
);
|
227
|
-
}
|
228
|
-
dataimport_fetch_config();
|
229
|
-
|
230
|
-
$( '.block .toggle', dataimport_element )
|
231
|
-
.die( 'click' )
|
232
|
-
.live
|
233
|
-
(
|
234
|
-
'click',
|
235
|
-
function( event )
|
236
|
-
{
|
237
|
-
$( this ).parents( '.block' )
|
238
|
-
.toggleClass( 'hidden' );
|
239
|
-
|
240
|
-
return false;
|
241
|
-
}
|
242
|
-
)
|
243
|
-
|
244
|
-
var reload_config_element = $( '.reload_config', config_element );
|
245
|
-
reload_config_element
|
246
|
-
.die( 'click' )
|
247
|
-
.live
|
248
|
-
(
|
249
|
-
'click',
|
250
|
-
function( event )
|
251
|
-
{
|
252
|
-
$.ajax
|
253
|
-
(
|
254
|
-
{
|
255
|
-
url : handler_url + '?command=reload-config',
|
256
|
-
dataType : 'xml',
|
257
|
-
context: $( this ),
|
258
|
-
beforeSend : function( xhr, settings )
|
259
|
-
{
|
260
|
-
this
|
261
|
-
.removeClass( 'error' )
|
262
|
-
.addClass( 'loader' );
|
263
|
-
},
|
264
|
-
success : function( response, text_status, xhr )
|
265
|
-
{
|
266
|
-
this
|
267
|
-
.addClass( 'success' );
|
268
|
-
|
269
|
-
window.setTimeout
|
270
|
-
(
|
271
|
-
function()
|
272
|
-
{
|
273
|
-
reload_config_element
|
274
|
-
.removeClass( 'success' );
|
275
|
-
},
|
276
|
-
5000
|
277
|
-
);
|
278
|
-
},
|
279
|
-
error : function( xhr, text_status, error_thrown )
|
280
|
-
{
|
281
|
-
this
|
282
|
-
.addClass( 'error' );
|
283
|
-
},
|
284
|
-
complete : function( xhr, text_status )
|
285
|
-
{
|
286
|
-
this
|
287
|
-
.removeClass( 'loader' );
|
288
|
-
|
289
|
-
dataimport_fetch_config();
|
290
|
-
}
|
291
|
-
}
|
292
|
-
);
|
293
|
-
return false;
|
294
|
-
}
|
295
|
-
);
|
296
|
-
|
297
|
-
var debug_mode_element = $( '.debug_mode', config_element );
|
298
|
-
debug_mode_element
|
299
|
-
.die( 'click' )
|
300
|
-
.live
|
301
|
-
(
|
302
|
-
'click',
|
303
|
-
function( event )
|
304
|
-
{
|
305
|
-
var self = $( this );
|
306
|
-
var block = self.closest( '.block' )
|
307
|
-
|
308
|
-
var debug_checkbox = $( 'input[name="debug"]', form_element );
|
309
|
-
var submit_span = $( 'button[type="submit"] span', form_element );
|
310
|
-
|
311
|
-
debug_mode = !debug_mode;
|
312
|
-
|
313
|
-
block.toggleClass( 'debug_mode', debug_mode );
|
314
|
-
|
315
|
-
if( debug_mode )
|
316
|
-
{
|
317
|
-
block.removeClass( 'hidden' );
|
318
|
-
|
319
|
-
debug_checkbox
|
320
|
-
.attr( 'checked', 'checked' )
|
321
|
-
.trigger( 'change' );
|
322
|
-
|
323
|
-
submit_span
|
324
|
-
.data( 'original', submit_span.text() )
|
325
|
-
.text( submit_span.data( 'debugmode' ) );
|
326
|
-
}
|
327
|
-
else
|
328
|
-
{
|
329
|
-
submit_span
|
330
|
-
.text( submit_span.data( 'original' ) )
|
331
|
-
.removeData( 'original' );
|
332
|
-
}
|
333
|
-
}
|
334
|
-
);
|
335
|
-
|
336
|
-
// abort
|
337
|
-
|
338
|
-
var abort_import_element = $( '.abort-import', dataimport_element );
|
339
|
-
abort_import_element
|
340
|
-
.off( 'click' )
|
341
|
-
.on
|
342
|
-
(
|
343
|
-
'click',
|
344
|
-
function( event )
|
345
|
-
{
|
346
|
-
var span_element = $( 'span', this );
|
347
|
-
|
348
|
-
$.ajax
|
349
|
-
(
|
350
|
-
{
|
351
|
-
url : handler_url + '?command=abort&wt=json',
|
352
|
-
dataType : 'json',
|
353
|
-
type: 'GET',
|
354
|
-
context: $( this ),
|
355
|
-
beforeSend : function( xhr, settings )
|
356
|
-
{
|
357
|
-
span_element
|
358
|
-
.addClass( 'loader' );
|
359
|
-
},
|
360
|
-
success : function( response, text_status, xhr )
|
361
|
-
{
|
362
|
-
span_element
|
363
|
-
.data( 'original', span_element.text() )
|
364
|
-
.text( span_element.data( 'aborting' ) );
|
365
|
-
|
366
|
-
this
|
367
|
-
.removeClass( 'warn' )
|
368
|
-
.addClass( 'success' );
|
369
|
-
|
370
|
-
window.setTimeout
|
371
|
-
(
|
372
|
-
function()
|
373
|
-
{
|
374
|
-
$( 'span', abort_import_element )
|
375
|
-
.removeClass( 'loader' )
|
376
|
-
.text( span_element.data( 'original' ) )
|
377
|
-
.removeData( 'original' );
|
378
|
-
|
379
|
-
abort_import_element
|
380
|
-
.removeClass( 'success' )
|
381
|
-
.addClass( 'warn' );
|
382
|
-
},
|
383
|
-
dataimport_timeout * 2
|
384
|
-
);
|
385
|
-
|
386
|
-
dataimport_fetch_status();
|
387
|
-
}
|
388
|
-
}
|
389
|
-
);
|
390
|
-
return false;
|
391
|
-
}
|
392
|
-
);
|
393
|
-
|
394
|
-
// state
|
395
|
-
|
396
|
-
var status_button = $( 'form button.refresh-status', form_element );
|
397
|
-
|
398
|
-
status_button
|
399
|
-
.off( 'click' )
|
400
|
-
.on
|
401
|
-
(
|
402
|
-
'click',
|
403
|
-
function( event )
|
404
|
-
{
|
405
|
-
dataimport_fetch_status();
|
406
|
-
return false;
|
407
|
-
}
|
408
|
-
)
|
409
|
-
.trigger( 'click' );
|
410
|
-
|
411
|
-
function dataimport_fetch_status( clear_timeout )
|
412
|
-
{
|
413
|
-
if( clear_timeout )
|
414
|
-
{
|
415
|
-
app.clear_timeout();
|
416
|
-
}
|
417
|
-
|
418
|
-
$.ajax
|
419
|
-
(
|
420
|
-
{
|
421
|
-
url : handler_url + '?command=status&indent=true&wt=json',
|
422
|
-
dataType : 'json',
|
423
|
-
beforeSend : function( xhr, settings )
|
424
|
-
{
|
425
|
-
$( 'span', status_button )
|
426
|
-
.addClass( 'loader' );
|
427
|
-
},
|
428
|
-
success : function( response, text_status, xhr )
|
429
|
-
{
|
430
|
-
var state_element = $( '#current_state', content_element );
|
431
|
-
|
432
|
-
var status = response.status;
|
433
|
-
var rollback_time = response.statusMessages.Rolledback || null;
|
434
|
-
var abort_time = response.statusMessages.Aborted || null;
|
435
|
-
|
436
|
-
var messages = response.statusMessages;
|
437
|
-
var messages_count = 0;
|
438
|
-
for( var key in messages ) { messages_count++; }
|
439
|
-
|
440
|
-
function dataimport_compute_details( response, details_element, elapsed_seconds )
|
441
|
-
{
|
442
|
-
details_element
|
443
|
-
.show();
|
444
|
-
|
445
|
-
// --
|
446
|
-
|
447
|
-
var document_config = {
|
448
|
-
'Requests' : 'Total Requests made to DataSource',
|
449
|
-
'Fetched' : 'Total Rows Fetched',
|
450
|
-
'Skipped' : 'Total Documents Skipped',
|
451
|
-
'Processed' : 'Total Documents Processed'
|
452
|
-
};
|
453
|
-
|
454
|
-
var document_details = [];
|
455
|
-
for( var key in document_config )
|
456
|
-
{
|
457
|
-
var value = parseInt( response.statusMessages[document_config[key]], 10 );
|
458
|
-
|
459
|
-
var detail = '<abbr title="' + document_config[key].esc() + '">' + key.esc() + '</abbr>: ' + app.format_number( value ).esc();
|
460
|
-
if( elapsed_seconds && 'skipped' !== key.toLowerCase() )
|
461
|
-
{
|
462
|
-
detail += ' <span>(' + app.format_number( Math.round( value / elapsed_seconds ) ).esc() + '/s)</span>'
|
463
|
-
}
|
464
|
-
|
465
|
-
document_details.push( detail );
|
466
|
-
};
|
467
|
-
|
468
|
-
$( '.docs', details_element )
|
469
|
-
.html( document_details.join( ', ' ) );
|
470
|
-
|
471
|
-
// --
|
472
|
-
|
473
|
-
var dates_config = {
|
474
|
-
'Started' : 'Full Dump Started',
|
475
|
-
'Aborted' : 'Aborted',
|
476
|
-
'Rolledback' : 'Rolledback'
|
477
|
-
};
|
478
|
-
|
479
|
-
var dates_details = [];
|
480
|
-
for( var key in dates_config )
|
481
|
-
{
|
482
|
-
var value = response.statusMessages[dates_config[key]];
|
483
|
-
|
484
|
-
if( value )
|
485
|
-
{
|
486
|
-
var detail = '<abbr title="' + dates_config[key].esc() + '">' + key.esc() + '</abbr>: '
|
487
|
-
+ '<abbr class="time">' + value.esc() + '</abbr>';
|
488
|
-
dates_details.push( detail );
|
489
|
-
}
|
490
|
-
};
|
491
|
-
|
492
|
-
var dates_element = $( '.dates', details_element );
|
493
|
-
|
494
|
-
dates_element
|
495
|
-
.html( dates_details.join( ', ' ) );
|
496
|
-
|
497
|
-
$( '.time', dates_element )
|
498
|
-
.removeData( 'timeago' )
|
499
|
-
.timeago();
|
500
|
-
};
|
501
|
-
|
502
|
-
var get_time_taken = function get_default_time_taken()
|
503
|
-
{
|
504
|
-
var time_taken_text = response.statusMessages['Time taken'];
|
505
|
-
return app.convert_duration_to_seconds( time_taken_text );
|
506
|
-
};
|
507
|
-
|
508
|
-
var get_default_info_text = function default_info_text()
|
509
|
-
{
|
510
|
-
var info_text = response.statusMessages[''] || '';
|
511
|
-
|
512
|
-
// format numbers included in status nicely
|
513
|
-
info_text = info_text.replace
|
514
|
-
(
|
515
|
-
/\d{4,}/g,
|
516
|
-
function( match, position, string )
|
517
|
-
{
|
518
|
-
return app.format_number( parseInt( match, 10 ) );
|
519
|
-
}
|
520
|
-
);
|
521
|
-
|
522
|
-
var time_taken_text = app.convert_seconds_to_readable_time( get_time_taken() );
|
523
|
-
if( time_taken_text )
|
524
|
-
{
|
525
|
-
info_text += ' (Duration: ' + time_taken_text.esc() + ')';
|
526
|
-
}
|
527
|
-
|
528
|
-
return info_text;
|
529
|
-
};
|
530
|
-
|
531
|
-
var show_info = function show_info( info_text, elapsed_seconds )
|
532
|
-
{
|
533
|
-
$( '.info strong', state_element )
|
534
|
-
.text( info_text || get_default_info_text() );
|
535
|
-
|
536
|
-
$( '.info .details', state_element )
|
537
|
-
.hide();
|
538
|
-
};
|
539
|
-
|
540
|
-
var show_full_info = function show_full_info( info_text, elapsed_seconds )
|
541
|
-
{
|
542
|
-
show_info( info_text, elapsed_seconds );
|
543
|
-
|
544
|
-
dataimport_compute_details
|
545
|
-
(
|
546
|
-
response,
|
547
|
-
$( '.info .details', state_element ),
|
548
|
-
elapsed_seconds || get_time_taken()
|
549
|
-
);
|
550
|
-
};
|
551
|
-
|
552
|
-
state_element
|
553
|
-
.removeAttr( 'class' );
|
554
|
-
|
555
|
-
var current_time = new Date();
|
556
|
-
$( '.last_update abbr', state_element )
|
557
|
-
.text( current_time.toTimeString().split( ' ' ).shift() )
|
558
|
-
.attr( 'title', current_time.toUTCString() );
|
559
|
-
|
560
|
-
$( '.info', state_element )
|
561
|
-
.removeClass( 'loader' );
|
562
|
-
|
563
|
-
if( 'busy' === status )
|
564
|
-
{
|
565
|
-
state_element
|
566
|
-
.addClass( 'indexing' );
|
567
|
-
|
568
|
-
if( autorefresh_status )
|
569
|
-
{
|
570
|
-
$( '.info', state_element )
|
571
|
-
.addClass( 'loader' );
|
572
|
-
}
|
573
|
-
|
574
|
-
var time_elapsed_text = response.statusMessages['Time Elapsed'];
|
575
|
-
var elapsed_seconds = app.convert_duration_to_seconds( time_elapsed_text );
|
576
|
-
time_elapsed_text = app.convert_seconds_to_readable_time( elapsed_seconds );
|
577
|
-
|
578
|
-
var info_text = time_elapsed_text
|
579
|
-
? 'Indexing since ' + time_elapsed_text
|
580
|
-
: 'Indexing ...';
|
581
|
-
|
582
|
-
show_full_info( info_text, elapsed_seconds );
|
583
|
-
}
|
584
|
-
else if( rollback_time )
|
585
|
-
{
|
586
|
-
state_element
|
587
|
-
.addClass( 'failure' );
|
588
|
-
|
589
|
-
show_full_info();
|
590
|
-
}
|
591
|
-
else if( abort_time )
|
592
|
-
{
|
593
|
-
state_element
|
594
|
-
.addClass( 'aborted' );
|
595
|
-
|
596
|
-
show_full_info( 'Aborting current Import ...' );
|
597
|
-
}
|
598
|
-
else if( 'idle' === status && 0 !== messages_count )
|
599
|
-
{
|
600
|
-
state_element
|
601
|
-
.addClass( 'success' );
|
602
|
-
|
603
|
-
show_full_info();
|
604
|
-
}
|
605
|
-
else
|
606
|
-
{
|
607
|
-
state_element
|
608
|
-
.addClass( 'idle' );
|
609
|
-
|
610
|
-
show_info( 'No information available (idle)' );
|
611
|
-
}
|
612
|
-
|
613
|
-
// show raw status
|
614
|
-
|
615
|
-
var code = $(
|
616
|
-
'<pre class="syntax language-json"><code>' +
|
617
|
-
app.format_json( xhr.responseText ).esc() +
|
618
|
-
'</code></pre>'
|
619
|
-
);
|
620
|
-
|
621
|
-
$( '#raw_output_container', content_element ).html( code );
|
622
|
-
hljs.highlightBlock( code.get(0) );
|
623
|
-
|
624
|
-
if( !app.timeout && autorefresh_status )
|
625
|
-
{
|
626
|
-
app.timeout = window.setTimeout
|
627
|
-
(
|
628
|
-
function()
|
629
|
-
{
|
630
|
-
dataimport_fetch_status( true )
|
631
|
-
},
|
632
|
-
dataimport_timeout
|
633
|
-
);
|
634
|
-
}
|
635
|
-
},
|
636
|
-
error : function( xhr, text_status, error_thrown )
|
637
|
-
{
|
638
|
-
console.debug( arguments );
|
639
|
-
|
640
|
-
reload_config_element
|
641
|
-
.addClass( 'error' );
|
642
|
-
},
|
643
|
-
complete : function( xhr, text_status )
|
644
|
-
{
|
645
|
-
$( 'span', status_button )
|
646
|
-
.removeClass( 'loader' )
|
647
|
-
.addClass( 'success' );
|
648
|
-
|
649
|
-
window.setTimeout
|
650
|
-
(
|
651
|
-
function()
|
652
|
-
{
|
653
|
-
$( 'span', status_button )
|
654
|
-
.removeClass( 'success' );
|
655
|
-
},
|
656
|
-
dataimport_timeout / 2
|
657
|
-
);
|
658
|
-
}
|
659
|
-
}
|
660
|
-
);
|
661
|
-
}
|
662
|
-
|
663
|
-
// form
|
664
|
-
|
665
|
-
var form = $( 'form', form_element );
|
666
|
-
|
667
|
-
form
|
668
|
-
.ajaxForm
|
669
|
-
(
|
670
|
-
{
|
671
|
-
url : handler_url,
|
672
|
-
data : {
|
673
|
-
wt : 'json',
|
674
|
-
indent : 'true'
|
675
|
-
},
|
676
|
-
dataType : 'json',
|
677
|
-
type: 'POST',
|
678
|
-
beforeSend : function( xhr, settings )
|
679
|
-
{
|
680
|
-
$( 'button[type="submit"] span', form_element )
|
681
|
-
.addClass( 'loader' );
|
682
|
-
|
683
|
-
error_element
|
684
|
-
.empty()
|
685
|
-
.hide();
|
686
|
-
},
|
687
|
-
beforeSubmit : function( array, form, options )
|
688
|
-
{
|
689
|
-
var entity = $( '#entity', form ).val();
|
690
|
-
if( entity.length )
|
691
|
-
{
|
692
|
-
array.push( { name : 'entity', value: entity } );
|
693
|
-
}
|
694
|
-
|
695
|
-
var start = parseInt( $( '#start', form ).val(), 10 );
|
696
|
-
if( start )
|
697
|
-
{
|
698
|
-
array.push( { name : 'start', value: start } );
|
699
|
-
}
|
700
|
-
|
701
|
-
var rows = parseInt( $( '#rows', form ).val(), 10 );
|
702
|
-
if( rows )
|
703
|
-
{
|
704
|
-
array.push( { name : 'rows', value: rows } );
|
705
|
-
}
|
706
|
-
|
707
|
-
$( 'input:checkbox', form ).not( ':checked' )
|
708
|
-
.each( function( i, input )
|
709
|
-
{
|
710
|
-
array.push( { name: input.name, value: 'false' } );
|
711
|
-
}
|
712
|
-
);
|
713
|
-
|
714
|
-
var custom_parameters = $( '#custom_parameters', form ).val();
|
715
|
-
if( custom_parameters.length )
|
716
|
-
{
|
717
|
-
var params = custom_parameters.split( '&' );
|
718
|
-
for( var i in params )
|
719
|
-
{
|
720
|
-
var tmp = params[i].split( '=' );
|
721
|
-
array.push( { name : tmp[0], value: tmp[1] } );
|
722
|
-
}
|
723
|
-
}
|
724
|
-
|
725
|
-
if( debug_mode )
|
726
|
-
{
|
727
|
-
array.push( { name: 'dataConfig', value: $( '#dataimport_config .editable textarea' ).val() } );
|
728
|
-
}
|
729
|
-
},
|
730
|
-
success : function( response, text_status, xhr )
|
731
|
-
{
|
732
|
-
},
|
733
|
-
error : function( xhr, text_status, error_thrown )
|
734
|
-
{
|
735
|
-
var response = null;
|
736
|
-
try
|
737
|
-
{
|
738
|
-
eval( 'response = ' + xhr.responseText + ';' );
|
739
|
-
}
|
740
|
-
catch( e ){}
|
741
|
-
|
742
|
-
error_element
|
743
|
-
.text( response.error.msg || 'Unknown Error (Exception w/o Message)' )
|
744
|
-
.show();
|
745
|
-
},
|
746
|
-
complete : function( xhr, text_status )
|
747
|
-
{
|
748
|
-
$( 'button[type="submit"] span', form_element )
|
749
|
-
.removeClass( 'loader' );
|
750
|
-
|
751
|
-
var debug = $( 'input[name="debug"]:checked', form );
|
752
|
-
if( 0 !== debug.size() )
|
753
|
-
{
|
754
|
-
var code = $(
|
755
|
-
'<pre class="syntax language-json"><code>' +
|
756
|
-
app.format_json( xhr.responseText ).esc() +
|
757
|
-
'</code></pre>'
|
758
|
-
);
|
759
|
-
|
760
|
-
$( '.content', debug_response_element ).html( code );
|
761
|
-
hljs.highlightBlock( code.get(0) );
|
762
|
-
}
|
763
|
-
|
764
|
-
dataimport_fetch_status();
|
765
|
-
}
|
766
|
-
}
|
767
|
-
);
|
768
|
-
|
769
|
-
$( 'input[name="debug"]', form )
|
770
|
-
.off( 'change' )
|
771
|
-
.on
|
772
|
-
(
|
773
|
-
'change',
|
774
|
-
function( event )
|
775
|
-
{
|
776
|
-
debug_response_element.toggle( this.checked );
|
777
|
-
}
|
778
|
-
);
|
779
|
-
|
780
|
-
$( '#auto-refresh-status a', form_element )
|
781
|
-
.off( 'click' )
|
782
|
-
.on
|
783
|
-
(
|
784
|
-
'click',
|
785
|
-
function( event )
|
786
|
-
{
|
787
|
-
$.cookie( cookie_dataimport_autorefresh, $.cookie( cookie_dataimport_autorefresh ) ? null : true );
|
788
|
-
$( this ).trigger( 'state' );
|
789
|
-
|
790
|
-
dataimport_fetch_status();
|
791
|
-
|
792
|
-
return false;
|
793
|
-
}
|
794
|
-
)
|
795
|
-
.off( 'state' )
|
796
|
-
.on
|
797
|
-
(
|
798
|
-
'state',
|
799
|
-
function( event )
|
800
|
-
{
|
801
|
-
autorefresh_status = !!$.cookie( cookie_dataimport_autorefresh );
|
802
|
-
|
803
|
-
$.cookie( cookie_dataimport_autorefresh )
|
804
|
-
? $( this ).addClass( 'on' )
|
805
|
-
: $( this ).removeClass( 'on' );
|
806
|
-
}
|
807
|
-
)
|
808
|
-
.trigger( 'state' );
|
809
|
-
}
|
810
|
-
);
|
811
|
-
}
|
812
|
-
);
|
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 dataimport_timeout = 2000;
|
19
|
+
var cookie_dataimport_autorefresh = 'dataimport_autorefresh';
|
20
|
+
|
21
|
+
sammy.bind
|
22
|
+
(
|
23
|
+
'dataimport_queryhandler_load',
|
24
|
+
function( event, params )
|
25
|
+
{
|
26
|
+
var core_basepath = params.active_core.attr( 'data-basepath' );
|
27
|
+
|
28
|
+
$.ajax
|
29
|
+
(
|
30
|
+
{
|
31
|
+
url : core_basepath + '/admin/mbeans?cat=QUERYHANDLER&wt=json',
|
32
|
+
dataType : 'json',
|
33
|
+
beforeSend : function( xhr, settings )
|
34
|
+
{
|
35
|
+
},
|
36
|
+
success : function( response, text_status, xhr )
|
37
|
+
{
|
38
|
+
var handlers = response['solr-mbeans'][1];
|
39
|
+
var dataimport_handlers = [];
|
40
|
+
for( var key in handlers )
|
41
|
+
{
|
42
|
+
if( handlers[key]['class'] !== key &&
|
43
|
+
handlers[key]['class'] === 'org.apache.solr.handler.dataimport.DataImportHandler' )
|
44
|
+
{
|
45
|
+
dataimport_handlers.push( key );
|
46
|
+
}
|
47
|
+
}
|
48
|
+
params.callback( dataimport_handlers.sort(naturalSort) );
|
49
|
+
},
|
50
|
+
error : function( xhr, text_status, error_thrown)
|
51
|
+
{
|
52
|
+
},
|
53
|
+
complete : function( xhr, text_status )
|
54
|
+
{
|
55
|
+
}
|
56
|
+
}
|
57
|
+
);
|
58
|
+
}
|
59
|
+
);
|
60
|
+
|
61
|
+
// #/:core/dataimport
|
62
|
+
sammy.get
|
63
|
+
(
|
64
|
+
new RegExp( app.core_regex_base + '\\/(dataimport)$' ),
|
65
|
+
function( context )
|
66
|
+
{
|
67
|
+
sammy.trigger
|
68
|
+
(
|
69
|
+
'dataimport_queryhandler_load',
|
70
|
+
{
|
71
|
+
active_core : this.active_core,
|
72
|
+
callback : function( dataimport_handlers )
|
73
|
+
{
|
74
|
+
if( 0 === dataimport_handlers.length )
|
75
|
+
{
|
76
|
+
$( '#content' )
|
77
|
+
.html( 'sorry, no dataimport-handler defined!' );
|
78
|
+
|
79
|
+
return false;
|
80
|
+
}
|
81
|
+
|
82
|
+
context.redirect( context.path + '/' + dataimport_handlers[0] );
|
83
|
+
}
|
84
|
+
}
|
85
|
+
);
|
86
|
+
}
|
87
|
+
);
|
88
|
+
|
89
|
+
// #/:core/dataimport
|
90
|
+
sammy.get
|
91
|
+
(
|
92
|
+
new RegExp( app.core_regex_base + '\\/(dataimport)\\/' ),
|
93
|
+
function( context )
|
94
|
+
{
|
95
|
+
var core_basepath = this.active_core.attr( 'data-basepath' );
|
96
|
+
var content_element = $( '#content' );
|
97
|
+
|
98
|
+
var path_parts = this.path.match( /^(.+\/dataimport\/)(.*)$/ );
|
99
|
+
var handler_url = core_basepath + path_parts[2];
|
100
|
+
|
101
|
+
$( 'li.dataimport', this.active_core )
|
102
|
+
.addClass( 'active' );
|
103
|
+
|
104
|
+
$.get
|
105
|
+
(
|
106
|
+
'tpl/dataimport.html',
|
107
|
+
function( template )
|
108
|
+
{
|
109
|
+
content_element
|
110
|
+
.html( template );
|
111
|
+
|
112
|
+
var dataimport_element = $( '#dataimport', content_element );
|
113
|
+
var form_element = $( '#form', dataimport_element );
|
114
|
+
var config_element = $( '#config', dataimport_element );
|
115
|
+
var error_element = $( '#error', dataimport_element );
|
116
|
+
var debug_response_element = $( '#debug_response', dataimport_element );
|
117
|
+
|
118
|
+
var autorefresh_status = false;
|
119
|
+
var debug_mode = false;
|
120
|
+
|
121
|
+
// handler
|
122
|
+
|
123
|
+
sammy.trigger
|
124
|
+
(
|
125
|
+
'dataimport_queryhandler_load',
|
126
|
+
{
|
127
|
+
active_core : context.active_core,
|
128
|
+
callback : function( dataimport_handlers )
|
129
|
+
{
|
130
|
+
var handlers_element = $( '#navigation ul', form_element );
|
131
|
+
var handlers = [];
|
132
|
+
|
133
|
+
for( var i = 0; i < dataimport_handlers.length; i++ )
|
134
|
+
{
|
135
|
+
handlers.push
|
136
|
+
(
|
137
|
+
'<li><a href="' + path_parts[1] + dataimport_handlers[i] + '">' +
|
138
|
+
dataimport_handlers[i] +
|
139
|
+
'</a></li>'
|
140
|
+
);
|
141
|
+
}
|
142
|
+
|
143
|
+
$( handlers_element )
|
144
|
+
.html( handlers.join( "\n") ) ;
|
145
|
+
|
146
|
+
$( 'a[href="' + context.path + '"]', handlers_element ).closest( 'li' )
|
147
|
+
.addClass( 'current' );
|
148
|
+
|
149
|
+
$( 'form', form_element )
|
150
|
+
.show();
|
151
|
+
}
|
152
|
+
}
|
153
|
+
);
|
154
|
+
|
155
|
+
// config
|
156
|
+
|
157
|
+
function dataimport_fetch_config()
|
158
|
+
{
|
159
|
+
$.ajax
|
160
|
+
(
|
161
|
+
{
|
162
|
+
url : handler_url + '?command=show-config&indent=true',
|
163
|
+
dataType : 'xml',
|
164
|
+
context : $( '#dataimport_config', config_element ),
|
165
|
+
beforeSend : function( xhr, settings )
|
166
|
+
{
|
167
|
+
error_element
|
168
|
+
.empty()
|
169
|
+
.hide();
|
170
|
+
},
|
171
|
+
success : function( config, text_status, xhr )
|
172
|
+
{
|
173
|
+
dataimport_element
|
174
|
+
.removeClass( 'error' );
|
175
|
+
|
176
|
+
config_element
|
177
|
+
.addClass( 'hidden' );
|
178
|
+
|
179
|
+
var entities = [ '<option value=""></option>' ];
|
180
|
+
|
181
|
+
$( 'document > entity', config )
|
182
|
+
.each
|
183
|
+
(
|
184
|
+
function( i, element )
|
185
|
+
{
|
186
|
+
entities.push( '<option>' + $( element ).attr( 'name' ).esc() + '</option>' );
|
187
|
+
}
|
188
|
+
);
|
189
|
+
|
190
|
+
$( '#entity', form_element )
|
191
|
+
.html( entities.join( "\n" ) );
|
192
|
+
|
193
|
+
$( '.editable textarea', this )
|
194
|
+
.val( xhr.responseText.replace( /\n+$/, '' ) );
|
195
|
+
},
|
196
|
+
error : function( xhr, text_status, error_thrown )
|
197
|
+
{
|
198
|
+
if( 'parsererror' === error_thrown )
|
199
|
+
{
|
200
|
+
dataimport_element
|
201
|
+
.addClass( 'error' );
|
202
|
+
|
203
|
+
error_element
|
204
|
+
.text( 'Dataimport XML-Configuration is not valid' )
|
205
|
+
.show();
|
206
|
+
|
207
|
+
config_element
|
208
|
+
.removeClass( 'hidden' );
|
209
|
+
}
|
210
|
+
},
|
211
|
+
complete : function( xhr, text_status )
|
212
|
+
{
|
213
|
+
var code = $(
|
214
|
+
'<pre class="syntax language-xml"><code>' +
|
215
|
+
xhr.responseText.esc() +
|
216
|
+
'</code></pre>'
|
217
|
+
);
|
218
|
+
$( '.formatted', this ).html( code );
|
219
|
+
|
220
|
+
if( 'success' === text_status )
|
221
|
+
{
|
222
|
+
hljs.highlightBlock( code.get(0) );
|
223
|
+
}
|
224
|
+
}
|
225
|
+
}
|
226
|
+
);
|
227
|
+
}
|
228
|
+
dataimport_fetch_config();
|
229
|
+
|
230
|
+
$( '.block .toggle', dataimport_element )
|
231
|
+
.die( 'click' )
|
232
|
+
.live
|
233
|
+
(
|
234
|
+
'click',
|
235
|
+
function( event )
|
236
|
+
{
|
237
|
+
$( this ).parents( '.block' )
|
238
|
+
.toggleClass( 'hidden' );
|
239
|
+
|
240
|
+
return false;
|
241
|
+
}
|
242
|
+
)
|
243
|
+
|
244
|
+
var reload_config_element = $( '.reload_config', config_element );
|
245
|
+
reload_config_element
|
246
|
+
.die( 'click' )
|
247
|
+
.live
|
248
|
+
(
|
249
|
+
'click',
|
250
|
+
function( event )
|
251
|
+
{
|
252
|
+
$.ajax
|
253
|
+
(
|
254
|
+
{
|
255
|
+
url : handler_url + '?command=reload-config',
|
256
|
+
dataType : 'xml',
|
257
|
+
context: $( this ),
|
258
|
+
beforeSend : function( xhr, settings )
|
259
|
+
{
|
260
|
+
this
|
261
|
+
.removeClass( 'error' )
|
262
|
+
.addClass( 'loader' );
|
263
|
+
},
|
264
|
+
success : function( response, text_status, xhr )
|
265
|
+
{
|
266
|
+
this
|
267
|
+
.addClass( 'success' );
|
268
|
+
|
269
|
+
window.setTimeout
|
270
|
+
(
|
271
|
+
function()
|
272
|
+
{
|
273
|
+
reload_config_element
|
274
|
+
.removeClass( 'success' );
|
275
|
+
},
|
276
|
+
5000
|
277
|
+
);
|
278
|
+
},
|
279
|
+
error : function( xhr, text_status, error_thrown )
|
280
|
+
{
|
281
|
+
this
|
282
|
+
.addClass( 'error' );
|
283
|
+
},
|
284
|
+
complete : function( xhr, text_status )
|
285
|
+
{
|
286
|
+
this
|
287
|
+
.removeClass( 'loader' );
|
288
|
+
|
289
|
+
dataimport_fetch_config();
|
290
|
+
}
|
291
|
+
}
|
292
|
+
);
|
293
|
+
return false;
|
294
|
+
}
|
295
|
+
);
|
296
|
+
|
297
|
+
var debug_mode_element = $( '.debug_mode', config_element );
|
298
|
+
debug_mode_element
|
299
|
+
.die( 'click' )
|
300
|
+
.live
|
301
|
+
(
|
302
|
+
'click',
|
303
|
+
function( event )
|
304
|
+
{
|
305
|
+
var self = $( this );
|
306
|
+
var block = self.closest( '.block' )
|
307
|
+
|
308
|
+
var debug_checkbox = $( 'input[name="debug"]', form_element );
|
309
|
+
var submit_span = $( 'button[type="submit"] span', form_element );
|
310
|
+
|
311
|
+
debug_mode = !debug_mode;
|
312
|
+
|
313
|
+
block.toggleClass( 'debug_mode', debug_mode );
|
314
|
+
|
315
|
+
if( debug_mode )
|
316
|
+
{
|
317
|
+
block.removeClass( 'hidden' );
|
318
|
+
|
319
|
+
debug_checkbox
|
320
|
+
.attr( 'checked', 'checked' )
|
321
|
+
.trigger( 'change' );
|
322
|
+
|
323
|
+
submit_span
|
324
|
+
.data( 'original', submit_span.text() )
|
325
|
+
.text( submit_span.data( 'debugmode' ) );
|
326
|
+
}
|
327
|
+
else
|
328
|
+
{
|
329
|
+
submit_span
|
330
|
+
.text( submit_span.data( 'original' ) )
|
331
|
+
.removeData( 'original' );
|
332
|
+
}
|
333
|
+
}
|
334
|
+
);
|
335
|
+
|
336
|
+
// abort
|
337
|
+
|
338
|
+
var abort_import_element = $( '.abort-import', dataimport_element );
|
339
|
+
abort_import_element
|
340
|
+
.off( 'click' )
|
341
|
+
.on
|
342
|
+
(
|
343
|
+
'click',
|
344
|
+
function( event )
|
345
|
+
{
|
346
|
+
var span_element = $( 'span', this );
|
347
|
+
|
348
|
+
$.ajax
|
349
|
+
(
|
350
|
+
{
|
351
|
+
url : handler_url + '?command=abort&wt=json',
|
352
|
+
dataType : 'json',
|
353
|
+
type: 'GET',
|
354
|
+
context: $( this ),
|
355
|
+
beforeSend : function( xhr, settings )
|
356
|
+
{
|
357
|
+
span_element
|
358
|
+
.addClass( 'loader' );
|
359
|
+
},
|
360
|
+
success : function( response, text_status, xhr )
|
361
|
+
{
|
362
|
+
span_element
|
363
|
+
.data( 'original', span_element.text() )
|
364
|
+
.text( span_element.data( 'aborting' ) );
|
365
|
+
|
366
|
+
this
|
367
|
+
.removeClass( 'warn' )
|
368
|
+
.addClass( 'success' );
|
369
|
+
|
370
|
+
window.setTimeout
|
371
|
+
(
|
372
|
+
function()
|
373
|
+
{
|
374
|
+
$( 'span', abort_import_element )
|
375
|
+
.removeClass( 'loader' )
|
376
|
+
.text( span_element.data( 'original' ) )
|
377
|
+
.removeData( 'original' );
|
378
|
+
|
379
|
+
abort_import_element
|
380
|
+
.removeClass( 'success' )
|
381
|
+
.addClass( 'warn' );
|
382
|
+
},
|
383
|
+
dataimport_timeout * 2
|
384
|
+
);
|
385
|
+
|
386
|
+
dataimport_fetch_status();
|
387
|
+
}
|
388
|
+
}
|
389
|
+
);
|
390
|
+
return false;
|
391
|
+
}
|
392
|
+
);
|
393
|
+
|
394
|
+
// state
|
395
|
+
|
396
|
+
var status_button = $( 'form button.refresh-status', form_element );
|
397
|
+
|
398
|
+
status_button
|
399
|
+
.off( 'click' )
|
400
|
+
.on
|
401
|
+
(
|
402
|
+
'click',
|
403
|
+
function( event )
|
404
|
+
{
|
405
|
+
dataimport_fetch_status();
|
406
|
+
return false;
|
407
|
+
}
|
408
|
+
)
|
409
|
+
.trigger( 'click' );
|
410
|
+
|
411
|
+
function dataimport_fetch_status( clear_timeout )
|
412
|
+
{
|
413
|
+
if( clear_timeout )
|
414
|
+
{
|
415
|
+
app.clear_timeout();
|
416
|
+
}
|
417
|
+
|
418
|
+
$.ajax
|
419
|
+
(
|
420
|
+
{
|
421
|
+
url : handler_url + '?command=status&indent=true&wt=json',
|
422
|
+
dataType : 'json',
|
423
|
+
beforeSend : function( xhr, settings )
|
424
|
+
{
|
425
|
+
$( 'span', status_button )
|
426
|
+
.addClass( 'loader' );
|
427
|
+
},
|
428
|
+
success : function( response, text_status, xhr )
|
429
|
+
{
|
430
|
+
var state_element = $( '#current_state', content_element );
|
431
|
+
|
432
|
+
var status = response.status;
|
433
|
+
var rollback_time = response.statusMessages.Rolledback || null;
|
434
|
+
var abort_time = response.statusMessages.Aborted || null;
|
435
|
+
|
436
|
+
var messages = response.statusMessages;
|
437
|
+
var messages_count = 0;
|
438
|
+
for( var key in messages ) { messages_count++; }
|
439
|
+
|
440
|
+
function dataimport_compute_details( response, details_element, elapsed_seconds )
|
441
|
+
{
|
442
|
+
details_element
|
443
|
+
.show();
|
444
|
+
|
445
|
+
// --
|
446
|
+
|
447
|
+
var document_config = {
|
448
|
+
'Requests' : 'Total Requests made to DataSource',
|
449
|
+
'Fetched' : 'Total Rows Fetched',
|
450
|
+
'Skipped' : 'Total Documents Skipped',
|
451
|
+
'Processed' : 'Total Documents Processed'
|
452
|
+
};
|
453
|
+
|
454
|
+
var document_details = [];
|
455
|
+
for( var key in document_config )
|
456
|
+
{
|
457
|
+
var value = parseInt( response.statusMessages[document_config[key]], 10 );
|
458
|
+
|
459
|
+
var detail = '<abbr title="' + document_config[key].esc() + '">' + key.esc() + '</abbr>: ' + app.format_number( value ).esc();
|
460
|
+
if( elapsed_seconds && 'skipped' !== key.toLowerCase() )
|
461
|
+
{
|
462
|
+
detail += ' <span>(' + app.format_number( Math.round( value / elapsed_seconds ) ).esc() + '/s)</span>'
|
463
|
+
}
|
464
|
+
|
465
|
+
document_details.push( detail );
|
466
|
+
};
|
467
|
+
|
468
|
+
$( '.docs', details_element )
|
469
|
+
.html( document_details.join( ', ' ) );
|
470
|
+
|
471
|
+
// --
|
472
|
+
|
473
|
+
var dates_config = {
|
474
|
+
'Started' : 'Full Dump Started',
|
475
|
+
'Aborted' : 'Aborted',
|
476
|
+
'Rolledback' : 'Rolledback'
|
477
|
+
};
|
478
|
+
|
479
|
+
var dates_details = [];
|
480
|
+
for( var key in dates_config )
|
481
|
+
{
|
482
|
+
var value = response.statusMessages[dates_config[key]];
|
483
|
+
|
484
|
+
if( value )
|
485
|
+
{
|
486
|
+
var detail = '<abbr title="' + dates_config[key].esc() + '">' + key.esc() + '</abbr>: '
|
487
|
+
+ '<abbr class="time">' + value.esc() + '</abbr>';
|
488
|
+
dates_details.push( detail );
|
489
|
+
}
|
490
|
+
};
|
491
|
+
|
492
|
+
var dates_element = $( '.dates', details_element );
|
493
|
+
|
494
|
+
dates_element
|
495
|
+
.html( dates_details.join( ', ' ) );
|
496
|
+
|
497
|
+
$( '.time', dates_element )
|
498
|
+
.removeData( 'timeago' )
|
499
|
+
.timeago();
|
500
|
+
};
|
501
|
+
|
502
|
+
var get_time_taken = function get_default_time_taken()
|
503
|
+
{
|
504
|
+
var time_taken_text = response.statusMessages['Time taken'];
|
505
|
+
return app.convert_duration_to_seconds( time_taken_text );
|
506
|
+
};
|
507
|
+
|
508
|
+
var get_default_info_text = function default_info_text()
|
509
|
+
{
|
510
|
+
var info_text = response.statusMessages[''] || '';
|
511
|
+
|
512
|
+
// format numbers included in status nicely
|
513
|
+
info_text = info_text.replace
|
514
|
+
(
|
515
|
+
/\d{4,}/g,
|
516
|
+
function( match, position, string )
|
517
|
+
{
|
518
|
+
return app.format_number( parseInt( match, 10 ) );
|
519
|
+
}
|
520
|
+
);
|
521
|
+
|
522
|
+
var time_taken_text = app.convert_seconds_to_readable_time( get_time_taken() );
|
523
|
+
if( time_taken_text )
|
524
|
+
{
|
525
|
+
info_text += ' (Duration: ' + time_taken_text.esc() + ')';
|
526
|
+
}
|
527
|
+
|
528
|
+
return info_text;
|
529
|
+
};
|
530
|
+
|
531
|
+
var show_info = function show_info( info_text, elapsed_seconds )
|
532
|
+
{
|
533
|
+
$( '.info strong', state_element )
|
534
|
+
.text( info_text || get_default_info_text() );
|
535
|
+
|
536
|
+
$( '.info .details', state_element )
|
537
|
+
.hide();
|
538
|
+
};
|
539
|
+
|
540
|
+
var show_full_info = function show_full_info( info_text, elapsed_seconds )
|
541
|
+
{
|
542
|
+
show_info( info_text, elapsed_seconds );
|
543
|
+
|
544
|
+
dataimport_compute_details
|
545
|
+
(
|
546
|
+
response,
|
547
|
+
$( '.info .details', state_element ),
|
548
|
+
elapsed_seconds || get_time_taken()
|
549
|
+
);
|
550
|
+
};
|
551
|
+
|
552
|
+
state_element
|
553
|
+
.removeAttr( 'class' );
|
554
|
+
|
555
|
+
var current_time = new Date();
|
556
|
+
$( '.last_update abbr', state_element )
|
557
|
+
.text( current_time.toTimeString().split( ' ' ).shift() )
|
558
|
+
.attr( 'title', current_time.toUTCString() );
|
559
|
+
|
560
|
+
$( '.info', state_element )
|
561
|
+
.removeClass( 'loader' );
|
562
|
+
|
563
|
+
if( 'busy' === status )
|
564
|
+
{
|
565
|
+
state_element
|
566
|
+
.addClass( 'indexing' );
|
567
|
+
|
568
|
+
if( autorefresh_status )
|
569
|
+
{
|
570
|
+
$( '.info', state_element )
|
571
|
+
.addClass( 'loader' );
|
572
|
+
}
|
573
|
+
|
574
|
+
var time_elapsed_text = response.statusMessages['Time Elapsed'];
|
575
|
+
var elapsed_seconds = app.convert_duration_to_seconds( time_elapsed_text );
|
576
|
+
time_elapsed_text = app.convert_seconds_to_readable_time( elapsed_seconds );
|
577
|
+
|
578
|
+
var info_text = time_elapsed_text
|
579
|
+
? 'Indexing since ' + time_elapsed_text
|
580
|
+
: 'Indexing ...';
|
581
|
+
|
582
|
+
show_full_info( info_text, elapsed_seconds );
|
583
|
+
}
|
584
|
+
else if( rollback_time )
|
585
|
+
{
|
586
|
+
state_element
|
587
|
+
.addClass( 'failure' );
|
588
|
+
|
589
|
+
show_full_info();
|
590
|
+
}
|
591
|
+
else if( abort_time )
|
592
|
+
{
|
593
|
+
state_element
|
594
|
+
.addClass( 'aborted' );
|
595
|
+
|
596
|
+
show_full_info( 'Aborting current Import ...' );
|
597
|
+
}
|
598
|
+
else if( 'idle' === status && 0 !== messages_count )
|
599
|
+
{
|
600
|
+
state_element
|
601
|
+
.addClass( 'success' );
|
602
|
+
|
603
|
+
show_full_info();
|
604
|
+
}
|
605
|
+
else
|
606
|
+
{
|
607
|
+
state_element
|
608
|
+
.addClass( 'idle' );
|
609
|
+
|
610
|
+
show_info( 'No information available (idle)' );
|
611
|
+
}
|
612
|
+
|
613
|
+
// show raw status
|
614
|
+
|
615
|
+
var code = $(
|
616
|
+
'<pre class="syntax language-json"><code>' +
|
617
|
+
app.format_json( xhr.responseText ).esc() +
|
618
|
+
'</code></pre>'
|
619
|
+
);
|
620
|
+
|
621
|
+
$( '#raw_output_container', content_element ).html( code );
|
622
|
+
hljs.highlightBlock( code.get(0) );
|
623
|
+
|
624
|
+
if( !app.timeout && autorefresh_status )
|
625
|
+
{
|
626
|
+
app.timeout = window.setTimeout
|
627
|
+
(
|
628
|
+
function()
|
629
|
+
{
|
630
|
+
dataimport_fetch_status( true )
|
631
|
+
},
|
632
|
+
dataimport_timeout
|
633
|
+
);
|
634
|
+
}
|
635
|
+
},
|
636
|
+
error : function( xhr, text_status, error_thrown )
|
637
|
+
{
|
638
|
+
console.debug( arguments );
|
639
|
+
|
640
|
+
reload_config_element
|
641
|
+
.addClass( 'error' );
|
642
|
+
},
|
643
|
+
complete : function( xhr, text_status )
|
644
|
+
{
|
645
|
+
$( 'span', status_button )
|
646
|
+
.removeClass( 'loader' )
|
647
|
+
.addClass( 'success' );
|
648
|
+
|
649
|
+
window.setTimeout
|
650
|
+
(
|
651
|
+
function()
|
652
|
+
{
|
653
|
+
$( 'span', status_button )
|
654
|
+
.removeClass( 'success' );
|
655
|
+
},
|
656
|
+
dataimport_timeout / 2
|
657
|
+
);
|
658
|
+
}
|
659
|
+
}
|
660
|
+
);
|
661
|
+
}
|
662
|
+
|
663
|
+
// form
|
664
|
+
|
665
|
+
var form = $( 'form', form_element );
|
666
|
+
|
667
|
+
form
|
668
|
+
.ajaxForm
|
669
|
+
(
|
670
|
+
{
|
671
|
+
url : handler_url,
|
672
|
+
data : {
|
673
|
+
wt : 'json',
|
674
|
+
indent : 'true'
|
675
|
+
},
|
676
|
+
dataType : 'json',
|
677
|
+
type: 'POST',
|
678
|
+
beforeSend : function( xhr, settings )
|
679
|
+
{
|
680
|
+
$( 'button[type="submit"] span', form_element )
|
681
|
+
.addClass( 'loader' );
|
682
|
+
|
683
|
+
error_element
|
684
|
+
.empty()
|
685
|
+
.hide();
|
686
|
+
},
|
687
|
+
beforeSubmit : function( array, form, options )
|
688
|
+
{
|
689
|
+
var entity = $( '#entity', form ).val();
|
690
|
+
if( entity.length )
|
691
|
+
{
|
692
|
+
array.push( { name : 'entity', value: entity } );
|
693
|
+
}
|
694
|
+
|
695
|
+
var start = parseInt( $( '#start', form ).val(), 10 );
|
696
|
+
if( start )
|
697
|
+
{
|
698
|
+
array.push( { name : 'start', value: start } );
|
699
|
+
}
|
700
|
+
|
701
|
+
var rows = parseInt( $( '#rows', form ).val(), 10 );
|
702
|
+
if( rows )
|
703
|
+
{
|
704
|
+
array.push( { name : 'rows', value: rows } );
|
705
|
+
}
|
706
|
+
|
707
|
+
$( 'input:checkbox', form ).not( ':checked' )
|
708
|
+
.each( function( i, input )
|
709
|
+
{
|
710
|
+
array.push( { name: input.name, value: 'false' } );
|
711
|
+
}
|
712
|
+
);
|
713
|
+
|
714
|
+
var custom_parameters = $( '#custom_parameters', form ).val();
|
715
|
+
if( custom_parameters.length )
|
716
|
+
{
|
717
|
+
var params = custom_parameters.split( '&' );
|
718
|
+
for( var i in params )
|
719
|
+
{
|
720
|
+
var tmp = params[i].split( '=' );
|
721
|
+
array.push( { name : tmp[0], value: tmp[1] } );
|
722
|
+
}
|
723
|
+
}
|
724
|
+
|
725
|
+
if( debug_mode )
|
726
|
+
{
|
727
|
+
array.push( { name: 'dataConfig', value: $( '#dataimport_config .editable textarea' ).val() } );
|
728
|
+
}
|
729
|
+
},
|
730
|
+
success : function( response, text_status, xhr )
|
731
|
+
{
|
732
|
+
},
|
733
|
+
error : function( xhr, text_status, error_thrown )
|
734
|
+
{
|
735
|
+
var response = null;
|
736
|
+
try
|
737
|
+
{
|
738
|
+
eval( 'response = ' + xhr.responseText + ';' );
|
739
|
+
}
|
740
|
+
catch( e ){}
|
741
|
+
|
742
|
+
error_element
|
743
|
+
.text( response.error.msg || 'Unknown Error (Exception w/o Message)' )
|
744
|
+
.show();
|
745
|
+
},
|
746
|
+
complete : function( xhr, text_status )
|
747
|
+
{
|
748
|
+
$( 'button[type="submit"] span', form_element )
|
749
|
+
.removeClass( 'loader' );
|
750
|
+
|
751
|
+
var debug = $( 'input[name="debug"]:checked', form );
|
752
|
+
if( 0 !== debug.size() )
|
753
|
+
{
|
754
|
+
var code = $(
|
755
|
+
'<pre class="syntax language-json"><code>' +
|
756
|
+
app.format_json( xhr.responseText ).esc() +
|
757
|
+
'</code></pre>'
|
758
|
+
);
|
759
|
+
|
760
|
+
$( '.content', debug_response_element ).html( code );
|
761
|
+
hljs.highlightBlock( code.get(0) );
|
762
|
+
}
|
763
|
+
|
764
|
+
dataimport_fetch_status();
|
765
|
+
}
|
766
|
+
}
|
767
|
+
);
|
768
|
+
|
769
|
+
$( 'input[name="debug"]', form )
|
770
|
+
.off( 'change' )
|
771
|
+
.on
|
772
|
+
(
|
773
|
+
'change',
|
774
|
+
function( event )
|
775
|
+
{
|
776
|
+
debug_response_element.toggle( this.checked );
|
777
|
+
}
|
778
|
+
);
|
779
|
+
|
780
|
+
$( '#auto-refresh-status a', form_element )
|
781
|
+
.off( 'click' )
|
782
|
+
.on
|
783
|
+
(
|
784
|
+
'click',
|
785
|
+
function( event )
|
786
|
+
{
|
787
|
+
$.cookie( cookie_dataimport_autorefresh, $.cookie( cookie_dataimport_autorefresh ) ? null : true );
|
788
|
+
$( this ).trigger( 'state' );
|
789
|
+
|
790
|
+
dataimport_fetch_status();
|
791
|
+
|
792
|
+
return false;
|
793
|
+
}
|
794
|
+
)
|
795
|
+
.off( 'state' )
|
796
|
+
.on
|
797
|
+
(
|
798
|
+
'state',
|
799
|
+
function( event )
|
800
|
+
{
|
801
|
+
autorefresh_status = !!$.cookie( cookie_dataimport_autorefresh );
|
802
|
+
|
803
|
+
$.cookie( cookie_dataimport_autorefresh )
|
804
|
+
? $( this ).addClass( 'on' )
|
805
|
+
: $( this ).removeClass( 'on' );
|
806
|
+
}
|
807
|
+
)
|
808
|
+
.trigger( 'state' );
|
809
|
+
}
|
810
|
+
);
|
811
|
+
}
|
812
|
+
);
|