From de15703d16a03122a22bfd9ba64d0bd9a26a44f4 Mon Sep 17 00:00:00 2001 From: Juri Leino Date: Tue, 8 Jun 2021 15:32:00 +0200 Subject: [PATCH 1/6] [feat] switch to new templating library --- pom.xml | 2 ++ src/main/xar-resources/error-page.html | 4 ++-- src/main/xar-resources/modules/app.xql | 2 +- src/main/xar-resources/modules/config.xqm | 2 +- src/main/xar-resources/modules/indexes.xqm | 2 +- src/main/xar-resources/modules/test-timeline-prof.xql | 2 +- src/main/xar-resources/modules/test-timeline.xql | 2 +- src/main/xar-resources/modules/update-timeline.xql | 2 +- src/main/xar-resources/modules/view.xql | 4 ++-- xar-assembly.xml | 3 ++- 10 files changed, 14 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index f15fef1..648b67f 100644 --- a/pom.xml +++ b/pom.xml @@ -68,6 +68,8 @@ 2.12.3 1.1 + 1.0.2 + 0.9.1 http://exist-db.org/apps/monex diff --git a/src/main/xar-resources/error-page.html b/src/main/xar-resources/error-page.html index 236071b..9ea8466 100644 --- a/src/main/xar-resources/error-page.html +++ b/src/main/xar-resources/error-page.html @@ -1,8 +1,8 @@ -
+

An error has occurred

An error has been generated by the application.

-
+    
     
diff --git a/src/main/xar-resources/modules/app.xql b/src/main/xar-resources/modules/app.xql
index 29eb66e..b719f09 100644
--- a/src/main/xar-resources/modules/app.xql
+++ b/src/main/xar-resources/modules/app.xql
@@ -11,7 +11,7 @@ declare namespace json="http://www.json.org";
 
 (: import module namespace console="http://exist-db.org/xquery/console" at "java:org.exist.console.xquery.ConsoleModule"; :)
 import module namespace scheduler="http://exist-db.org/xquery/scheduler" at "java:org.exist.xquery.modules.scheduler.SchedulerModule";
-import module namespace templates="http://exist-db.org/xquery/templates" ;
+import module namespace templates="http://exist-db.org/xquery/html-templating";
 import module namespace config="http://exist-db.org/apps/admin/config" at "config.xqm";
 
 declare variable $app:OPTIMIZATIONS :=
diff --git a/src/main/xar-resources/modules/config.xqm b/src/main/xar-resources/modules/config.xqm
index b936c35..122144c 100644
--- a/src/main/xar-resources/modules/config.xqm
+++ b/src/main/xar-resources/modules/config.xqm
@@ -6,7 +6,7 @@ xquery version "3.0";
  :)
 module namespace config="http://exist-db.org/apps/admin/config";
 
-declare namespace templates="http://exist-db.org/xquery/templates";
+import module namespace templates="http://exist-db.org/xquery/html-templating";
 
 declare namespace repo="http://exist-db.org/xquery/repo";
 declare namespace expath="http://expath.org/ns/pkg";
diff --git a/src/main/xar-resources/modules/indexes.xqm b/src/main/xar-resources/modules/indexes.xqm
index 430956e..c4e4553 100644
--- a/src/main/xar-resources/modules/indexes.xqm
+++ b/src/main/xar-resources/modules/indexes.xqm
@@ -13,7 +13,7 @@ declare namespace cc="http://exist-db.org/collection-config/1.0";
 declare namespace range="http://exist-db.org/xquery/range";
 
 (:import module namespace console="http://exist-db.org/xquery/console";:)
-import module namespace templates="http://exist-db.org/xquery/templates";
+import module namespace templates="http://exist-db.org/xquery/html-templating";
 
 (: 
     Global variables - derived from URL parameters
diff --git a/src/main/xar-resources/modules/test-timeline-prof.xql b/src/main/xar-resources/modules/test-timeline-prof.xql
index 34e6f36..e305006 100644
--- a/src/main/xar-resources/modules/test-timeline-prof.xql
+++ b/src/main/xar-resources/modules/test-timeline-prof.xql
@@ -4,7 +4,7 @@ import module namespace app="http://exist-db.org/apps/admin/templates" at "app.x
 
 declare namespace jmx="http://exist-db.org/jmx";
 
-import module namespace templates="http://exist-db.org/xquery/templates" ;
+import module namespace templates="http://exist-db.org/xquery/html-templating";
 import module namespace config="http://exist-db.org/apps/admin/config" at "config.xqm";
 import module namespace console="http://exist-db.org/xquery/console";
 
diff --git a/src/main/xar-resources/modules/test-timeline.xql b/src/main/xar-resources/modules/test-timeline.xql
index 1fd765e..54645c3 100644
--- a/src/main/xar-resources/modules/test-timeline.xql
+++ b/src/main/xar-resources/modules/test-timeline.xql
@@ -4,7 +4,7 @@ import module namespace app="http://exist-db.org/apps/admin/templates" at "app.x
 
 declare namespace jmx="http://exist-db.org/jmx";
 
-import module namespace templates="http://exist-db.org/xquery/templates" ;
+import module namespace templates="http://exist-db.org/xquery/html-templating";
 import module namespace config="http://exist-db.org/apps/admin/config" at "config.xqm";
 import module namespace console="http://exist-db.org/xquery/console";
 
diff --git a/src/main/xar-resources/modules/update-timeline.xql b/src/main/xar-resources/modules/update-timeline.xql
index 818943f..29c65c4 100644
--- a/src/main/xar-resources/modules/update-timeline.xql
+++ b/src/main/xar-resources/modules/update-timeline.xql
@@ -8,7 +8,7 @@ declare namespace json="http://www.json.org";
 
 import module namespace app="http://exist-db.org/apps/admin/templates" at "app.xql";
 import module namespace scheduler="http://exist-db.org/xquery/scheduler" at "java:org.exist.xquery.modules.scheduler.SchedulerModule";
-import module namespace templates="http://exist-db.org/xquery/templates" ;
+import module namespace templates="http://exist-db.org/xquery/html-templating";
 import module namespace config="http://exist-db.org/apps/admin/config" at "config.xqm";
 
 declare option exist:serialize "method=json media-type=text/javascript";
diff --git a/src/main/xar-resources/modules/view.xql b/src/main/xar-resources/modules/view.xql
index 955f58d..b05a2bc 100644
--- a/src/main/xar-resources/modules/view.xql
+++ b/src/main/xar-resources/modules/view.xql
@@ -5,8 +5,8 @@
  :)
 xquery version "3.0";
 
-import module namespace templates="http://exist-db.org/xquery/templates" ;
-
+import module namespace templates="http://exist-db.org/xquery/html-templating";
+import module namespace lib="http://exist-db.org/xquery/html-templating/lib";
 (: 
  : The following modules provide functions which will be called by the 
  : templating.
diff --git a/xar-assembly.xml b/xar-assembly.xml
index af9c11f..2f43868 100644
--- a/xar-assembly.xml
+++ b/xar-assembly.xml
@@ -19,7 +19,8 @@
     Applications
 
     
-    
+    
+    
 
     
     ${package-abbrev}

From a3c03f52b15ef585cae10f10fd75b5d0f05c1bd0 Mon Sep 17 00:00:00 2001
From: Juri Leino 
Date: Wed, 9 Jun 2021 20:52:36 +0200
Subject: [PATCH 2/6] [fix] eXide editing links

---
 src/main/xar-resources/error-page.html     | 2 +-
 src/main/xar-resources/modules/app.xql     | 2 +-
 src/main/xar-resources/modules/indexes.xqm | 2 +-
 src/main/xar-resources/templates/page.html | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/xar-resources/error-page.html b/src/main/xar-resources/error-page.html
index 9ea8466..76788c9 100644
--- a/src/main/xar-resources/error-page.html
+++ b/src/main/xar-resources/error-page.html
@@ -4,6 +4,6 @@ 

An error has occurred

An error has been generated by the application.

     
 
\ No newline at end of file diff --git a/src/main/xar-resources/modules/app.xql b/src/main/xar-resources/modules/app.xql index b719f09..7dafc26 100644 --- a/src/main/xar-resources/modules/app.xql +++ b/src/main/xar-resources/modules/app.xql @@ -626,7 +626,7 @@ declare function app:milliseconds-to-time($timestamp as xs:long) as xs:dateTime declare function app:edit-source($node as node(), $model as map(*), $instance as xs:string, $timestamp as xs:long) as node()* { let $date := app:milliseconds-to-time($timestamp) let $doc := collection($config:data-root || "/" || $instance)/jmx:jmx[jmx:timestamp = xs:dateTime($date)] - let $link := templates:link-to-app("http://exist-db.org/apps/eXide", "index.html?open=" || document-uri(root($doc))) + let $link := $model?eXide || "/index.html?open=" || document-uri(root($doc)) return element { node-name($node) } { attribute href { $link }, diff --git a/src/main/xar-resources/modules/indexes.xqm b/src/main/xar-resources/modules/indexes.xqm index c4e4553..36b6827 100644 --- a/src/main/xar-resources/modules/indexes.xqm +++ b/src/main/xar-resources/modules/indexes.xqm @@ -147,7 +147,7 @@ declare function indexes:xconf-to-table($node as node(), $model as map(*)) as it let $xconf-collection-name := concat('/db/system/config', $data-collection-name) let $xconf := collection('/db/system/config')/cc:collection[util:collection-name(.) = $xconf-collection-name] let $resource := $xconf-collection-name || '/' || xmldb:get-child-resources($xconf-collection-name)[ends-with(., '.xconf')] - let $link := templates:link-to-app("http://exist-db.org/apps/eXide", "index.html?open=" || $resource) + let $link := $model?eXide || "/index.html?open=" || $resource return

diff --git a/src/main/xar-resources/templates/page.html b/src/main/xar-resources/templates/page.html index c2a2864..ead173a 100644 --- a/src/main/xar-resources/templates/page.html +++ b/src/main/xar-resources/templates/page.html @@ -1,5 +1,5 @@ - + App Title From f594b31cea0295a2eec4ffce6b196a39784f59d3 Mon Sep 17 00:00:00 2001 From: Juri Leino Date: Tue, 8 Jun 2021 18:51:26 +0200 Subject: [PATCH 3/6] [ignore] fix formatting --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 648b67f..72415e3 100644 --- a/pom.xml +++ b/pom.xml @@ -35,8 +35,8 @@ https://github.com/eXist-db/monex.git scm:git:https://github.com/eXist-db/monex.git scm:git:https://github.com/eXist-db/monex.git - HEAD - + HEAD + GitHub From 81440decc8b8680c4459108925d8ee80cf799c14 Mon Sep 17 00:00:00 2001 From: Juri Leino Date: Tue, 8 Jun 2021 18:52:16 +0200 Subject: [PATCH 4/6] [ignore] align package version - match maven workflow (unreleased is a SNAPSHOT) - have the same version in package.json as well --- package.json | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ce4a382..62b166d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monex", - "version": "0.9.18", + "version": "3.0.3-SNAPSHOT", "description": "Monitoring Application for eXist-db", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", diff --git a/pom.xml b/pom.xml index 72415e3..64e861e 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.exist-db.apps monex - 3.0.4 + 3.0.3-SNAPSHOT Monex An application for monitoring, profiling and inspecting a running eXist-db instance. From 8d2974500d98c06cca4b7e99dd220e3c92a1084e Mon Sep 17 00:00:00 2001 From: Juri Leino Date: Wed, 9 Jun 2021 22:59:13 +0200 Subject: [PATCH 5/6] [fix] remove useless div on error page --- src/main/xar-resources/error-page.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/xar-resources/error-page.html b/src/main/xar-resources/error-page.html index 76788c9..658590a 100644 --- a/src/main/xar-resources/error-page.html +++ b/src/main/xar-resources/error-page.html @@ -3,7 +3,4 @@

An error has occurred

An error has been generated by the application.

-    
 
\ No newline at end of file From 7f7509bb69b69ff6a8a4e23750414c61ba1390e4 Mon Sep 17 00:00:00 2001 From: Juri Leino Date: Wed, 9 Jun 2021 23:00:52 +0200 Subject: [PATCH 6/6] [fix] edit links on remote monitoring template --- src/main/xar-resources/remotes.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/xar-resources/remotes.html b/src/main/xar-resources/remotes.html index f953232..c6c4eb5 100644 --- a/src/main/xar-resources/remotes.html +++ b/src/main/xar-resources/remotes.html @@ -70,9 +70,9 @@

Information

responsiveness of the system. Response Time is the elapsed time until the client received the response.

Configuration

-

To monitor remote eXist-db instances, edit the XML file instances.xml in the root collection of +

To monitor remote eXist-db instances, edit the XML file instances.xml in the root collection of the monex application. Monex pings each server at configurable times or - intervals. You can also set up email alerts in notifications.xml.

+ intervals. You can also set up email alerts in notifications.xml.

The configuration for monitoring a remote instance looks as follows:

<instance name="my.server.com" url="http://my.server.com" token="0ade4ba1-cebb-4085-b12c-0ef87f6f032b" cron="0 0/5 * * * ?">
     <poll cron="0 0/2 * * * ?" store="true">