Skip to content

Commit

Permalink
Merge pull request #153 from line-o/feat/new-templating
Browse files Browse the repository at this point in the history
[feat] switch to new templating library
  • Loading branch information
joewiz authored Jun 9, 2021
2 parents 2ea250a + 7f7509b commit 01959b1
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
8 changes: 5 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>org.exist-db.apps</groupId>
<artifactId>monex</artifactId>
<version>3.0.4</version>
<version>3.0.3-SNAPSHOT</version>

<name>Monex</name>
<description>An application for monitoring, profiling and inspecting a running eXist-db instance.</description>
Expand All @@ -35,8 +35,8 @@
<url>https://github.com/eXist-db/monex.git</url>
<connection>scm:git:https://github.com/eXist-db/monex.git</connection>
<developerConnection>scm:git:https://github.com/eXist-db/monex.git</developerConnection>
<tag>HEAD</tag>
</scm>
<tag>HEAD</tag>
</scm>

<issueManagement>
<system>GitHub</system>
Expand Down Expand Up @@ -68,6 +68,8 @@

<jackson.version>2.12.3</jackson.version>
<websocket.api.version>1.1</websocket.api.version>
<templating.version>1.0.2</templating.version>
<shared-resources.version>0.9.1</shared-resources.version>

<!-- used in the EXPath Package Descriptor -->
<package-name>http://exist-db.org/apps/monex</package-name>
Expand Down
7 changes: 2 additions & 5 deletions src/main/xar-resources/error-page.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<div xmlns="http://www.w3.org/1999/xhtml" class="templates:surround?with=templates/page.html&amp;at=content">
<div xmlns="http://www.w3.org/1999/xhtml" data-template="templates:surround" data-template-with="templates/page.html" data-template-at="content">
<h1>An error has occurred</h1>
<p>An error has been generated by the application.</p>
<pre class="error templates:error-description"/>
<div class="source-links">
<p>View source: <a href="login.html" class="templates:load-source">this page</a>.</p>
</div>
<pre class="error" data-template="templates:error-description" />
</div>
4 changes: 2 additions & 2 deletions src/main/xar-resources/modules/app.xql
Original file line number Diff line number Diff line change
Expand Up @@ -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 :=
Expand Down Expand Up @@ -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 },
Expand Down
2 changes: 1 addition & 1 deletion src/main/xar-resources/modules/config.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions src/main/xar-resources/modules/indexes.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
<div>
<p>
Expand Down
2 changes: 1 addition & 1 deletion src/main/xar-resources/modules/test-timeline-prof.xql
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion src/main/xar-resources/modules/test-timeline.xql
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion src/main/xar-resources/modules/update-timeline.xql
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
4 changes: 2 additions & 2 deletions src/main/xar-resources/modules/view.xql
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/main/xar-resources/remotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ <h3 class="box-title">Information</h3>
responsiveness of the system. <code>Response Time</code> is the elapsed time
until the client received the response. </p>
<h3>Configuration</h3>
<p>To monitor remote eXist-db instances, edit the XML file <a href="instances.xml" class="templates:load-source">instances.xml</a> in the root collection of
<p>To monitor remote eXist-db instances, edit the XML file <a href="instances.xml" target="eXide" class="eXide-open" data-exide-open="/db/apps/monex/instances.xml">instances.xml</a> 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 <a href="notifications.xml" class="templates:load-source">notifications.xml</a>.</p>
intervals. You can also set up email alerts in <a href="notifications.xml" target="eXide" class="eXide-open" data-exide-open="/db/apps/monex/notifications.xml">notifications.xml</a>.</p>
<p>The configuration for monitoring a remote instance looks as follows:</p>
<pre data-language="xml">&lt;instance name="my.server.com" url="http://my.server.com" token="0ade4ba1-cebb-4085-b12c-0ef87f6f032b" cron="0 0/5 * * * ?"&gt;
&lt;poll cron="0 0/2 * * * ?" store="true"&gt;
Expand Down
2 changes: 1 addition & 1 deletion src/main/xar-resources/templates/page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<html data-template="lib:resolve-apps" data-template-abbrev="eXide">
<head>
<title data-template="config:app-title">App Title</title>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
Expand Down
3 changes: 2 additions & 1 deletion xar-assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
<category id="apps">Applications</category>

<dependency processor="http://exist-db.org" semver-min="${exist.processor.version}" />
<dependency package="http://exist-db.org/apps/shared"/>
<dependency package="http://exist-db.org/apps/shared" semver-min="${shared-resources.version}"/>
<dependency package="http://exist-db.org/html-templating" semver-min="${templating.version}"/>

<!-- Collection inside /db/apps where xar-resources will be copied to -->
<target>${package-abbrev}</target>
Expand Down

0 comments on commit 01959b1

Please sign in to comment.