Merge branch 'master' of ssh://git.indexdata.com/home/git/private/mkws
authorMike Taylor <mike@indexdata.com>
Tue, 14 Jan 2014 13:13:54 +0000 (13:13 +0000)
committerMike Taylor <mike@indexdata.com>
Tue, 14 Jan 2014 13:13:54 +0000 (13:13 +0000)
examples/htdocs/jasmine-popup.html
examples/htdocs/wolfram.html
test/spec/mkws-pazpar2.js
tools/bin/nagios-service-proxy.sh [new file with mode: 0755]
tools/htdocs/mkws.js

index 6ca6304..d1c2bba 100644 (file)
 
   <body>
     <script type="text/javascript">
+    var mkws_config = { show_lang: true };
+
     jQuery.pazpar2({
         "layout": "popup",               /* "table" [default], "div", "popup" */
         "id_button": "input#mkwsButton", /* submit button id in search field */
         "id_popup": "#mkwsPopup",        /* internal id of popup window */
-        "width": 880,                    /* popup width, should be at least 800 */
+        "width": 990,                    /* popup width, should be at least 800 */
         "height": 760                    /* popup height, should be at least 600 */
     });
     </script>
index 9c79171..b2983dd 100644 (file)
@@ -8,6 +8,10 @@
     <script type="text/javascript">
       var mkws_config = {
          pazpar2_url : "/service-proxy/",
+         show_perpage: false,
+         show_sort: false,
+         perpage_default: 10,
+         sort_default: "title:1",
          service_proxy_auth : "/service-proxy-auth"
       };
     </script>
index e017213..67e6f84 100644 (file)
@@ -161,14 +161,20 @@ describe("Check Termlist", function () {
 
     it("limit search to first author", function () {
         var hits_all_targets = get_hit_counter();
+        var author_number = 2; // 2=first author
+        var author_name = $("div#mkwsFacetAuthors div.term:nth-child(" + author_number + ") a").text();
+        // do not click on author with numbers, e.g.: Bower, James M. Beeman, David, 1938-
+        if (author_name.match(/[0-9].+[0-9]/)) {
+            author_number++;
+        }
 
-        var click = $("div#mkwsFacetAuthors div.term:nth-child(2) a").trigger("click");
+        var click = $("div#mkwsFacetAuthors div.term:nth-child(" + author_number + ") a").trigger("click");
         debug("limit author click is success: " + click.length);
         expect(click.length).toBe(1);
 
         waitsFor(function () {
             return get_hit_counter() < hits_all_targets ? true : false;
-        }, "Limited author search for less than " + hits_all_targets + " hits", 8 * 1000);
+        }, "Limited author search for less than " + hits_all_targets + " hits", 6 * 1000);
 
         runs(function () {
             var hits_single_target = get_hit_counter();
@@ -198,8 +204,8 @@ describe("Check Termlist", function () {
             }
         }, "Search for source in navi bar", 1000);
 
-       // Note: it may happens that limited source search returns the same number of hits
-       // as before. Thats not really an error, but unfortunate
+        // Note: it may happens that limited source search returns the same number of hits
+        // as before. Thats not really an error, but unfortunate
         waitsFor(function () {
             return get_hit_counter() <= hits_all_targets ? true : false;
         }, "Limited source search for less than " + hits_all_targets + " hits", 5 * 1000);
diff --git a/tools/bin/nagios-service-proxy.sh b/tools/bin/nagios-service-proxy.sh
new file mode 100755 (executable)
index 0000000..2904e85
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Copyright (c) 2014 Index Data ApS, http://indexdata.com
+#
+# nagios test if the the service proxy is up and running
+
+set -e
+: ${mkws_host="http://mkws.indexdata.com/service-proxy/"}
+: ${mkws_username="mkws"}
+: ${mkws_password="mkws"}
+: ${user_agent="nagios service-proxy v0.9"}
+
+tempfile=$(mktemp)
+exit=0
+
+url="$mkws_host?command=auth&action=login&username=$mkws_username&password=$mkws_password"
+if curl -sSf -A "$user_agent" "$url" > $tempfile; then
+    if ! egrep -q '<status>OK</status>' $tempfile; then
+       echo "status not OK"
+       exit=1
+    fi
+    if ! egrep -q '<response jsessionId="[0-9A-F]+"' $tempfile; then
+       echo "response jsessionId missing"
+       exit=1
+    fi
+else
+    echo "URL: $url failed"
+    exit=1
+fi
+
+if [ $exit -gt 0 ]; then
+    cat $tempfile
+fi
+
+rm -f $tempfile
+exit $exit
+
index cacc8d0..2c9b89f 100644 (file)
@@ -207,6 +207,7 @@ Handlebars.registerHelper('commaList', function(items, options) {
     }
 }
 
+
 mkws.sort = mkws_config.sort_default;
 debug("copied mkws_config.sort_default '" + mkws_config.sort_default + "' to mkws.sort");
 
@@ -257,6 +258,10 @@ var SourceMax = 16;
 var SubjectMax = 10;
 var AuthorMax = 10;
 
+if (!isNaN(parseInt(mkws_config.perpage_default))) {
+    recPerPage = parseInt(mkws_config.perpage_default);
+}
+
 //
 // pz2.js event handlers:
 //