[fix] xslt

This commit is contained in:
Andy Bunce 2018-06-24 22:47:13 +01:00
parent 45c736df15
commit e78818abfb
23 changed files with 233 additions and 136 deletions

View file

@ -4,6 +4,8 @@
: @author Andy Bunce may-2017 : @author Andy Bunce may-2017
:) :)
module namespace vue-poc = 'quodatum:vue.poc'; module namespace vue-poc = 'quodatum:vue.poc';
import module namespace rest = "http://exquery.org/ns/restxq";
declare variable $vue-poc:index:=resolve-uri ('static/' || "app.html",fn:static-base-uri() ); declare variable $vue-poc:index:=resolve-uri ('static/' || "app.html",fn:static-base-uri() );
(:~ (:~
@ -14,6 +16,8 @@ declare
function vue-poc:redirect() function vue-poc:redirect()
as element(rest:response) as element(rest:response)
{ {
admin:write-log("Start","VUEPOC"),
rest:init(),
web:redirect("/vue-poc/ui") web:redirect("/vue-poc/ui")
}; };

View file

@ -3,9 +3,10 @@
size contents to fit bottom to track window size contents to fit bottom to track window
--> -->
<template id="qd-autoheight"> <template id="qd-autoheight">
<v-flex style="height:200px;overflow:hidden;" ref="auto" v-resize="onResize" class="green"> <v-layout style="height:200px;overflow:hidden;" row wrap
ref="auto" v-resize="onResize" class="green">
<slot >i will auto2</slot> <slot >i will auto2</slot>
</v-flex> </v-layout>
</template> </template>
<script>{ <script>{

View file

@ -20,10 +20,10 @@
<v-container fluid> <v-container fluid>
<v-form ref="form" v-model="valid" lazy-validation> <v-form ref="form" v-model="valid" lazy-validation>
<v-text-field <v-text-field
v-model="name" v-model="message"
:rules="nameRules" :rules="[v => !!v || 'message is required']"
:counter="10" :counter="10"
label="Name" label="Message"
required required
></v-text-field> ></v-text-field>
@ -51,10 +51,9 @@
<script>{ <script>{
data: () => ({ data: () => ({
valid: true, valid: true,
name: '', message: '',
nameRules: [ nameRules: [
v => !!v || 'Name is required', v => !!v || 'Message is required'
v => (v && v.length <= 10) || 'Name must be less than 10 characters'
], ],
type: "INFO", type: "INFO",
@ -68,16 +67,20 @@
methods: { methods: {
submit () { submit () {
if (this.$refs.form.validate()) { if (this.$refs.form.validate()) {
// Native form submission is not yet supported
HTTP.post("log/add",{ var data={message: this.message,
name: this.name, type: this.type,
type: this.type, checkbox: this.checkbox};
checkbox: this.checkbox HTTP.post("log/add",Qs.stringify(data))
})
.then(r=>{ .then(r=>{
alert("ok") console.log("submit: ",data);
}) if(this.checkbox){
} this.clear()
}else{
router.push({ name: 'logs'});
}
})
}
}, },
clear () { clear () {
this.$refs.form.reset() this.$refs.form.reset()

View file

@ -4,20 +4,13 @@
<v-card > <v-card >
<v-toolbar > <v-toolbar >
<v-btn
icon
:loading="loading"
@click="getItems()"
:disabled="loading"
>
<v-icon>refresh</v-icon>
</v-btn>
<v-btn icon to="add" append> <v-btn icon to="add" append>
<v-icon>add_circle</v-icon> <v-icon>add_circle</v-icon>
</v-btn> </v-btn>
<v-spacer></v-spacer>
<v-text-field <v-text-field
append-icon="search" append-icon="search"
label="Filter logs" label="Filter logs"
@ -26,6 +19,27 @@
v-model="search" v-model="search"
></v-text-field> ></v-text-field>
<v-btn
icon :color="autorefresh?'red':'green'"
:loading="loading"
@click="getItems"
@dblclick="toggle"
:disabled="loading"
>
<v-icon>refresh</v-icon>
</v-btn>
<v-spacer></v-spacer>
<v-menu offset-y left>
<v-btn icon slot="activator"><v-icon>settings</v-icon></v-btn>
<v-card >
<v-toolbar class="green">
<v-card-title >Settings TODO</v-card-title>
</v-toolbar>
<v-card-text>
<v-btn @click="autorefresh= ! autorefresh">Autorefresh</v-btn>
</v-card-text>
</v-card>
</v-menu>
</v-toolbar> </v-toolbar>
<v-data-table <v-data-table
:headers="headers" :headers="headers"
@ -69,7 +83,8 @@
selected:[], selected:[],
search:"", search:"",
loading:false, loading:false,
timer:null timer:null,
autorefresh: true
} }
}, },
methods:{ methods:{
@ -81,14 +96,21 @@
//console.log(r.data) //console.log(r.data)
//var items=r.data.items.filter(item=>{return item.text!="[GET] http://localhost:8984/vue-poc/api/log"}) //var items=r.data.items.filter(item=>{return item.text!="[GET] http://localhost:8984/vue-poc/api/log"})
this.items=r.data.items this.items=r.data.items
this.timer=setTimeout(()=>{ this.getItems() }, 5000); if(this.autorefresh){
this.timer=setTimeout(()=>{ this.getItems() }, 5000);
}
}) })
},
toggle(){
alert("toggle auto");
this.autorefresh= !this.autorefresh;
} }
}, },
created:function(){ created:function(){
this.getItems() this.getItems()
}, },
beforeRouteLeave(to, from, next){ beforeRouteLeave(to, from, next){
this.autorefresh=false;
if(this.timer) clearTimeout(this.timer); if(this.timer) clearTimeout(this.timer);
return next() return next()
} }

View file

@ -18,14 +18,20 @@ as element(json)
return dice:response($items,$entity,web:dice()) return dice:response($items,$entity,web:dice())
}; };
(:~
: create a log entry
:)
declare declare
%rest:POST %rest:path("/vue-poc/api/log/add") %rest:POST %rest:path("/vue-poc/api/log/add")
%rest:form-param("type", "{$type}")
%rest:form-param("message", "{$message}")
%output:method("text") %output:method("text")
function j:add() function j:add($type as xs:string,
$message as xs:string)
{ {
let $type:="INFO" let $_:=trace(($type,$message),"post")
let $text:="A log message" return (
return ("AAAA", "AAAA",
admin:write-log($text, $type ) admin:write-log($message, $type )
) )
}; };

View file

@ -4,7 +4,7 @@
: @author Andy Bunce may-2017 : @author Andy Bunce may-2017
:) :)
module namespace vue-api = 'quodatum:vue.api.images'; module namespace vue-api = 'quodatum:vue.api.images';
import module namespace cfg = "quodatum:media.image.configure" at "config.xqm"; import module namespace cfg = "quodatum:media.image.configure" at "../../config.xqm";
import module namespace fw="quodatum:file.walker"; import module namespace fw="quodatum:file.walker";
import module namespace entity = 'quodatum.models.generated' at "../../models.gen.xqm"; import module namespace entity = 'quodatum.models.generated' at "../../models.gen.xqm";
declare namespace c="http://www.w3.org/ns/xproc-step"; declare namespace c="http://www.w3.org/ns/xproc-step";

View file

@ -1,7 +1,7 @@
(:~ (:~
: create xml file list by scanning $SRC and write to vue-poc : create xml file list by scanning $SRC and write to vue-poc
:) :)
import module namespace cfg = "quodatum:media.image.configure" at "../config.xqm"; import module namespace cfg = "quodatum:media.image.configure" at "../../../config.xqm";
import module namespace fw="quodatum:file.walker"; import module namespace fw="quodatum:file.walker";
declare namespace c="http://www.w3.org/ns/xproc-step"; declare namespace c="http://www.w3.org/ns/xproc-step";

View file

@ -3,7 +3,7 @@
: done in batches of 1000 : done in batches of 1000
: @return initial number of missing docs : @return initial number of missing docs
:) :)
import module namespace cfg = "quodatum:media.image.configure" at "../config.xqm"; import module namespace cfg = "quodatum:media.image.configure" at "../../../config.xqm";
import module namespace imgmeta = "expkg-zone58:image.metadata" ; import module namespace imgmeta = "expkg-zone58:image.metadata" ;
declare namespace c="http://www.w3.org/ns/xproc-step"; declare namespace c="http://www.w3.org/ns/xproc-step";

View file

@ -3,7 +3,7 @@
: <metadata/> -> <image/> : <metadata/> -> <image/>
:) :)
import module namespace metadata = 'expkg-zone58:image.metadata'; import module namespace metadata = 'expkg-zone58:image.metadata';
import module namespace cfg = "quodatum:media.image.configure" at "../config.xqm"; import module namespace cfg = "quodatum:media.image.configure" at "../../../config.xqm";
for $meta in collection($cfg:DB-IMAGE || "/meta")/metadata for $meta in collection($cfg:DB-IMAGE || "/meta")/metadata
let $loc:=db:path($meta)=>tokenize("/") let $loc:=db:path($meta)=>tokenize("/")
let $name:=$loc[count($loc)-1] let $name:=$loc[count($loc)-1]

View file

@ -3,7 +3,7 @@
: @return initial number of missing docs : @return initial number of missing docs
:) :)
import module namespace t="expkg-zone58:image.thumbnailator"; import module namespace t="expkg-zone58:image.thumbnailator";
import module namespace cfg = "quodatum:media.image.configure" at "../config.xqm"; import module namespace cfg = "quodatum:media.image.configure" at "../../../config.xqm";
declare namespace c="http://www.w3.org/ns/xproc-step"; declare namespace c="http://www.w3.org/ns/xproc-step";
declare variable $CHUNK:=1000; declare variable $CHUNK:=1000;

View file

@ -1,5 +1,5 @@
(:~ set original:) (:~ set original:)
import module namespace cfg = "quodatum:media.image.configure" at "../config.xqm"; import module namespace cfg = "quodatum:media.image.configure" at "../../../config.xqm";
for $i in collection($cfg:DB-IMAGE || "/image")/image for $i in collection($cfg:DB-IMAGE || "/image")/image
where $i[file/@path=>contains('original')] where $i[file/@path=>contains('original')]

View file

@ -4,7 +4,7 @@
: <idref>14569796 14569818 </idref> : <idref>14569796 14569818 </idref>
: </keyword> : </keyword>
:) :)
import module namespace cfg = "quodatum:media.image.configure" at "../config.xqm"; import module namespace cfg = "quodatum:media.image.configure" at "../../../config.xqm";
declare %updating function local:put($data,$path){ declare %updating function local:put($data,$path){
db:replace($cfg:DB-IMAGE,$path,$data) db:replace($cfg:DB-IMAGE,$path,$data)
}; };

View file

@ -4,7 +4,7 @@
: <idref>14569796 14569818 </idref> : <idref>14569796 14569818 </idref>
: </keyword> : </keyword>
:) :)
import module namespace cfg = "quodatum:media.image.configure" at "../config.xqm"; import module namespace cfg = "quodatum:media.image.configure" at "../../../config.xqm";
declare %updating function local:put($data,$path){ declare %updating function local:put($data,$path){
db:replace($cfg:DB-IMAGE,$path,$data) db:replace($cfg:DB-IMAGE,$path,$data)
}; };

View file

@ -1,18 +1,20 @@
import module namespace qipe='http://quodatum.com/ns/pipeline' at "../../lib/pipeline.xqm" ; import module namespace qipe='http://quodatum.com/ns/pipeline' at "../../lib/pipeline.xqm" ;
declare namespace docinfo="http://www.lexis-nexis.com/glp/docinfo"; declare namespace docinfo="http://www.lexis-nexis.com/glp/docinfo";
declare variable $src:="C:\Users\BUNCEAX\Desktop\08s3\data\"; declare variable $base:="C:\Users\andy\Dropbox\job\lexisnexis.2\data\";
declare variable $src:="C:\Users\andy\Desktop\basex.versions\data\08s3\raw\";
declare function local:resolve($path,$base){
file:resolve-path($path,$base)
};
let $ip:=file:list($src,false(), "*.xml") let $ip:=file:list($src,false(), "*.xml")
let $ip:=subsequence($ip,1,100)!doc(concat($src,.)) let $ip:=subsequence($ip,1,10)!doc(concat($src,.))
let $d:= let $d:=
<root xmlns="http://quodatum.com/ns/pipeline"> <root xmlns="http://quodatum.com/ns/pipeline">
<!-- <xslt href="{ local:resolve('08S3-to-rosetta-legdoc.xsl',$base) }"/>
<validate href="{ local:resolve('legdoc-norm.dtd',$base) }" type="dtd" failOnError="true"/>
<xslt href="file:/C:/apb-git/sources/rosetta/EU/Regulatory/08S3/08S3-to-rosetta-legdoc.xsl"/> <store base="c:\tmp\" fileExpression="'a' || $position || '.xml'" dated="true"/>
<validate href="C:\Users\BUNCEAX\Desktop\08s3\legdoc-norm.dtd" type="dtd" failOnError="true"/>
-->
</root> </root>
return qipe:run($d,$ip) =>count() return qipe:run($d,$ip)

View file

@ -1,13 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<template id="thumbnail"> <template id="thumbnail">
<v-container fluid> <v-container fluid>
<v-stepper v-model="step" non-linear> <v-stepper v-model="step" non-linear >
<v-stepper-header> <v-stepper-header>
<v-stepper-step step="1" :complete="step > 1">Select image location</v-stepper-step> <v-stepper-step step="1" :complete="step > 1" editable>Select image location</v-stepper-step>
<v-divider></v-divider> <v-divider></v-divider>
<v-stepper-step step="2" :complete="step > 2">Set thumbnail details</v-stepper-step> <v-stepper-step step="2" :complete="step > 2" editable>Set thumbnail details</v-stepper-step>
<v-divider></v-divider> <v-divider></v-divider>
<v-stepper-step step="3">Result</v-stepper-step> <v-stepper-step step="3" editable>Result</v-stepper-step>
</v-stepper-header> </v-stepper-header>
<v-stepper-items> <v-stepper-items>
<v-stepper-content step="1" non-linear> <v-stepper-content step="1" non-linear>

View file

@ -23,7 +23,11 @@
</v-menu> </v-menu>
</v-toolbar> </v-toolbar>
<v-card-text > <v-card-text >
here <qd-autoheight>
<v-flex fill-height xs12 >
test here
</v-flex>
</qd-autoheight>
</v-card-text> </v-card-text>
</v-card> </v-card>
</v-container> </v-container>

View file

@ -33,28 +33,28 @@
</v-card> </v-card>
</v-menu> </v-menu>
</v-toolbar> </v-toolbar>
<v-card-text class="amber" > <v-card-text class="amber" >
<qd-autoheight> <qd-autoheight>
<v-flex v-if="showOptions.includes('result')" fill-height xs6> <v-flex v-if="showOptions.includes('result')" fill-height xs12 >
<vue-ace :content="result" mode="xml" wrap="true" :settings="aceSettings"></vue-ace> <vue-ace :content="result" mode="xml" wrap="true" :settings="aceSettings"></vue-ace>
</v-flex> </v-flex>
<v-flex v-if="showOptions.includes('xml')" fill-height xs6> <v-flex v-if="showOptions.includes('xml')" fill-height >
<vue-ace :content="xml" mode="xml" wrap="true" <vue-ace :content="xml" mode="xml" wrap="true"
v-on:change-content="v => this.xml=v" v-on:annotation="a => this.xmlValid=a.error===0 && a.warning===0" v-on:change-content="v => this.xml=v" v-on:annotation="a => this.xmlValid=a.error===0 && a.warning===0"
:settings="aceSettings"></vue-ace> :settings="aceSettings"></vue-ace>
</v-flex> </v-flex>
<v-flex v-if="showOptions.includes('xslt')" fill-height xs6>
<v-flex v-if="showOptions.includes('xslt')" fill-height >
<vue-ace :content="xslt" mode="xml" wrap="true" <vue-ace :content="xslt" mode="xml" wrap="true"
v-on:change-content="v => this.xslt=v" v-on:annotation="a => this.xslValid=a.error===0 && a.warning===0" v-on:change-content="v => this.xslt=v" v-on:annotation="a => this.xslValid=a.error===0 && a.warning===0"
:settings="aceSettings"></vue-ace> :settings="aceSettings"></vue-ace>
</v-flex> </v-flex>
</qd-autoheight> </qd-autoheight>
</v-card-text> </v-card-text>
</v-card> </v-card>
</v-container> </v-container>
</template> </template>

View file

@ -2,12 +2,11 @@
: pipeline library : pipeline library
: @author Andy Bunce : @author Andy Bunce
: @version 0.2 : @version 0.2
: @date nov 2017 : @date nov 2017 jun 2018
:) :)
module namespace qipe='http://quodatum.com/ns/pipeline'; module namespace qipe='http://quodatum.com/ns/pipeline';
import module namespace schematron = "http://github.com/Schematron/schematron-basex"; import module namespace schematron = "http://github.com/Schematron/schematron-basex";
declare variable $qipe:DEBUG:=false(); (: currently unused :)
(:~ run a pipeline (:~ run a pipeline
: @param $pipe the pipeline document : @param $pipe the pipeline document
@ -17,8 +16,14 @@ declare variable $qipe:DEBUG:=false(); (: currently unused :)
declare function qipe:run($pipe as node(),$initial as item()* ) declare function qipe:run($pipe as node(),$initial as item()* )
as item()* as item()*
{ {
let $steps:=$pipe/*/qipe:* let $opts:=map{"id":"66", "log":true(),"trace":true()}
return fold-left($steps,$initial,qipe:step#2) let $_:=qipe:log( "start: " || count($initial),$opts)
let $steps:=$pipe/qipe:*
let $result:= fold-left($steps,$initial,qipe:step(?,?,$opts))
return (
$result,
qipe:log( "end: ",$opts)
)
}; };
(:~ check pipeline is valid against schema :) (:~ check pipeline is valid against schema :)
@ -32,20 +37,20 @@ as document-node()
: @param $acc current state : @param $acc current state
: @param $this current step as qipe:* element : @param $this current step as qipe:* element
:) :)
declare function qipe:step($acc,$this as element(*)) declare function qipe:step($acc,$this as element(*),$opts as map(*))
{ {
typeswitch($this) typeswitch($this=>trace("RUNNING:"))
case element(qipe:validate) return qipe:validate($acc,$this) case element(qipe:validate) return qipe:validate($acc,$this,$opts)
case element(qipe:xquery) return qipe:xquery($acc,$this) case element(qipe:xquery) return qipe:xquery($acc,$this,$opts)
case element(qipe:xslt) return qipe:xslt($acc,$this) case element(qipe:xslt) return qipe:xslt($acc,$this,$opts)
case element(qipe:load) return qipe:load($acc,$this) case element(qipe:load) return qipe:load($acc,$this,$opts)
case element(qipe:store) return qipe:store($acc,$this) case element(qipe:store) return qipe:store($acc,$this,$opts)
default return error(xs:QName('qipe'), 'unknown step:' || name($this)) default return error(xs:QName('qipe'), 'unknown step:' || name($this))
}; };
(:~ run validate step based on @type (:~ run validate step based on @type
:) :)
declare function qipe:validate($acc,$this as element(qipe:validate)) declare function qipe:validate($acc,$this as element(qipe:validate),$opts as map(*))
{ {
let $href:=qipe:resolve($this/@href) let $href:=qipe:resolve($this/@href)
let $failOnError:=boolean($this/@failOnError) let $failOnError:=boolean($this/@failOnError)
@ -53,16 +58,20 @@ declare function qipe:validate($acc,$this as element(qipe:validate))
case "relax-ng" return qipe:relax-ng(?,$href ) case "relax-ng" return qipe:relax-ng(?,$href )
case "schematron" return qipe:schematron(?,$href ) case "schematron" return qipe:schematron(?,$href )
case "xml-schema" return qipe:validate-xsd(?,$href ) case "xml-schema" return qipe:validate-xsd(?,$href )
case "dtd" return qipe:validate-dtd(?,$href )
default return error(xs:QName('qipe'), 'unknown validation type: ' || $this/@type/string() ) default return error(xs:QName('qipe'), 'unknown validation type: ' || $this/@type/string() )
for $doc in $acc for $doc at $i in $acc
let $report:=$fn($doc) let $report:=$fn($doc)
let $_:=qipe:log("validate: " || $i,$opts)
return return
if($report/status = "valid") then if($report/status = "valid") then
$doc $doc
else else
let $_:=trace($report,"validation errors") let $_:=trace($report,"validation errors")
return if($failOnError) then return if($failOnError) then
error(xs:QName('qipe'), ' validation fails: ' || base-uri($doc)) error(xs:QName('qipe'),
' validation fails: ' || $i || "=" || base-uri($doc))
else else
$doc $doc
}; };
@ -70,7 +79,7 @@ declare function qipe:validate($acc,$this as element(qipe:validate))
(:~ (:~
: run xquery referenced by @href and append result sequence to accumulator : run xquery referenced by @href and append result sequence to accumulator
:) :)
declare function qipe:xquery($acc,$this as element(qipe:xquery)) declare function qipe:xquery($acc,$this as element(qipe:xquery),$opts as map(*))
{ {
let $href:=$this/@href/string() let $href:=$this/@href/string()
let $result:=xquery:invoke($href) let $result:=xquery:invoke($href)
@ -80,29 +89,36 @@ declare function qipe:xquery($acc,$this as element(qipe:xquery))
(:~ (:~
: apply XSLT transform to each item in accumulator : apply XSLT transform to each item in accumulator
:) :)
declare function qipe:xslt($acc,$this as element(qipe:xslt)) declare function qipe:xslt($acc,$this as element(qipe:xslt),$opts as map(*))
{ {
let $href:=qipe:resolve($this/@href) let $href:=qipe:resolve($this/@href)
let $result:=$acc!xslt:transform(., $href) for $d at $i in $acc
return $result let $_:=qipe:log("xslt: " || $i,$opts)
return xslt:transform($d, $href)
}; };
(:~ (:~
: store each item in accumulator at computed path : store each item in accumulator at computed path
:) :)
declare function qipe:store($acc,$this as element(qipe:store)) declare function qipe:store($acc,$this as element(qipe:store),$opts as map(*))
{ {
let $href:=qipe:resolve($this/@base) let $href:=qipe:resolve($this/@base)
let $dated:=boolean($this/@dated) let $dated:=boolean($this/@dated)
let $name:=$this/@fileExpression/string() let $name:=$this/@fileExpression/string()
let $href:=$href || (if( $dated) then format-date(current-date(),"/[Y0001][M01][D01]") else ()) let $eval:="declare variable $position external :=0; " || $name
let $href:=$href || (if( $dated) then
format-date(current-date(),"/[Y0001][M01][D01]")
else
())
return ($acc, return (
if(file:exists($href)) then () else file:create-dir($href), if(file:exists($href)) then () else file:create-dir($href),
for $item in $acc for $item at $pos in $acc
let $name:=xquery:eval($name,map{"":$item}) (:eval against doc:) let $name:=xquery:eval($eval,
map{"":$item,
"position": $pos}) (:eval against doc:)
let $dest:=$href || "/" || $name let $dest:=$href || "/" || $name
return file:write($dest,$item) return ($dest,file:write($dest,$item))
) )
}; };
@ -113,6 +129,13 @@ as element(report)
validate:xsd-report($doc,$xsd) validate:xsd-report($doc,$xsd)
}; };
(:~ validate with dtd :)
declare function qipe:validate-dtd($doc,$dtd )
as element(report)
{
validate:dtd-report($doc,$dtd)
};
(:~ validate with relax-ng :) (:~ validate with relax-ng :)
declare function qipe:relax-ng($doc,$rng ) declare function qipe:relax-ng($doc,$rng )
as element(report) as element(report)
@ -140,7 +163,7 @@ as element(report)
}; };
(:~ load from file system :) (:~ load from file system :)
declare function qipe:load($acc,$this ) declare function qipe:load($acc,$this,$opts as map(*) )
{ {
let $href:=qipe:resolve($this/@href)=>trace("load") let $href:=qipe:resolve($this/@href)=>trace("load")
let $new:=if(file:is-dir($href)) then let $new:=if(file:is-dir($href)) then
@ -155,3 +178,13 @@ declare function qipe:resolve($href as node()? )
{ {
resolve-uri( $href,base-uri($href)) resolve-uri( $href,base-uri($href))
}; };
(:~ log msg :)
declare function qipe:log($text as xs:string,$opts as map(*) )
as empty-sequence()
{
if($opts?log) then
admin:write-log(``[[`{ $opts?id }`] `{$text}`]``,"QIPE")
else
()
};

View file

@ -1,9 +1,9 @@
(: entity access maps (: entity access maps
: auto generated from xml files in entities folder at: 2018-05-16T23:18:57.393+01:00 : auto generated from xml files in entities folder at: 2018-06-20T22:41:55.037+01:00
:) :)
module namespace entity = 'quodatum.models.generated'; module namespace entity = 'quodatum.models.generated';
import module namespace cfg = "quodatum:media.image.configure" at "features/images/config.xqm";declare namespace ent='https://github.com/Quodatum/app-doc/entity'; import module namespace cfg = "quodatum:media.image.configure" at "config.xqm";declare namespace ent='https://github.com/Quodatum/app-doc/entity';
declare namespace h='urn:quodatum:vue-poc.history'; declare namespace h='urn:quodatum:vue-poc.history';
declare namespace xqdoc='http://www.xqdoc.org/1.0'; declare namespace xqdoc='http://www.xqdoc.org/1.0';
declare namespace c='http://www.w3.org/ns/xproc-step'; declare namespace c='http://www.w3.org/ns/xproc-step';

View file

@ -102,10 +102,7 @@ const router = new VueRouter({
{ path: '/tasks/xqdoc', component: Xqdoc, meta:{title:"build xqdoc"} }, { path: '/tasks/xqdoc', component: Xqdoc, meta:{title:"build xqdoc"} },
{ path: '/tasks/vuecompile', component: Vuecompile, meta:{title:"vue compile"} }, { path: '/tasks/vuecompile', component: Vuecompile, meta:{title:"vue compile"} },
{ path: '/tasks/:task', component: Runtask, props: true, meta:{title:"Run task"} }, { path: '/tasks/:task', component: Runtask, props: true, meta:{title:"Run task"} },
{ path: '/jobs', component: Jobs, meta:{title:"Jobs running"} },
{ path: '/jobs/:job', name:"jobShow", component: Job, props: true, meta:{title:"Job Status"} },
{ path: '/timeline', component: Timeline,meta:{title:"timeline"} }, { path: '/timeline', component: Timeline,meta:{title:"timeline"} },
{ path: '/tree', component: Tree, meta:{title:"tree"} }, { path: '/tree', component: Tree, meta:{title:"tree"} },
{ path: '/tree2', component: Tree2, meta:{title:"tree2"} }, { path: '/tree2', component: Tree2, meta:{title:"tree2"} },

View file

@ -1,10 +1,10 @@
// generated 2018-06-19T23:27:38.406+01:00 // generated 2018-06-24T22:46:13.105+01:00
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-autoheight.vue // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-autoheight.vue
Vue.component('qd-autoheight',{template:` Vue.component('qd-autoheight',{template:`
<v-flex style="height:200px;overflow:hidden;" ref="auto" v-resize="onResize" class="green"> <v-layout style="height:200px;overflow:hidden;" row="" wrap="" ref="auto" v-resize="onResize" class="green">
<slot>i will auto2</slot> <slot>i will auto2</slot>
</v-flex> </v-layout>
`, `,
props: ['show'], props: ['show'],
@ -968,7 +968,7 @@ const Logadd=Vue.extend({template:`
<v-card-text> <v-card-text>
<v-container fluid=""> <v-container fluid="">
<v-form ref="form" v-model="valid" lazy-validation=""> <v-form ref="form" v-model="valid" lazy-validation="">
<v-text-field v-model="name" :rules="nameRules" :counter="10" label="Name" required=""></v-text-field> <v-text-field v-model="message" :rules="[v => !!v || 'message is required']" :counter="10" label="Message" required=""></v-text-field>
<v-select v-model="type" :items="types" :rules="[v => !!v || 'type is required']" label="Type" required=""></v-select> <v-select v-model="type" :items="types" :rules="[v => !!v || 'type is required']" label="Type" required=""></v-select>
<v-checkbox v-model="checkbox" label="Add more?"></v-checkbox> <v-checkbox v-model="checkbox" label="Add more?"></v-checkbox>
@ -983,10 +983,9 @@ const Logadd=Vue.extend({template:`
data: () => ({ data: () => ({
valid: true, valid: true,
name: '', message: '',
nameRules: [ nameRules: [
v => !!v || 'Name is required', v => !!v || 'Message is required'
v => (v && v.length <= 10) || 'Name must be less than 10 characters'
], ],
type: "INFO", type: "INFO",
@ -1000,16 +999,20 @@ const Logadd=Vue.extend({template:`
methods: { methods: {
submit () { submit () {
if (this.$refs.form.validate()) { if (this.$refs.form.validate()) {
// Native form submission is not yet supported
HTTP.post("log/add",{ var data={message: this.message,
name: this.name, type: this.type,
type: this.type, checkbox: this.checkbox};
checkbox: this.checkbox HTTP.post("log/add",Qs.stringify(data))
})
.then(r=>{ .then(r=>{
alert("ok") console.log("submit: ",data);
}) if(this.checkbox){
} this.clear()
}else{
router.push({ name: 'logs'});
}
})
}
}, },
clear () { clear () {
this.$refs.form.reset() this.$refs.form.reset()
@ -1028,17 +1031,30 @@ const Log=Vue.extend({template:`
<v-card> <v-card>
<v-toolbar> <v-toolbar>
<v-btn icon="" :loading="loading" @click="getItems()" :disabled="loading">
<v-icon>refresh</v-icon>
</v-btn>
<v-btn icon="" to="add" append=""> <v-btn icon="" to="add" append="">
<v-icon>add_circle</v-icon> <v-icon>add_circle</v-icon>
</v-btn> </v-btn>
<v-spacer></v-spacer>
<v-text-field append-icon="search" label="Filter logs" single-line="" hide-details="" v-model="search"></v-text-field> <v-text-field append-icon="search" label="Filter logs" single-line="" hide-details="" v-model="search"></v-text-field>
<v-btn icon="" :color="autorefresh?'red':'green'" :loading="loading" @click="getItems" @dblclick="toggle" :disabled="loading">
<v-icon>refresh</v-icon>
</v-btn>
<v-spacer></v-spacer>
<v-menu offset-y="" left="">
<v-btn icon="" slot="activator"><v-icon>settings</v-icon></v-btn>
<v-card>
<v-toolbar class="green">
<v-card-title>Settings TODO</v-card-title>
</v-toolbar>
<v-card-text>
<v-btn @click="autorefresh= ! autorefresh">Autorefresh</v-btn>
</v-card-text>
</v-card>
</v-menu>
</v-toolbar> </v-toolbar>
<v-data-table :headers="headers" :items="items" :search="search" class="elevation-1" no-data-text="No logs found" v-bind:pagination.sync="pagination"> <v-data-table :headers="headers" :items="items" :search="search" class="elevation-1" no-data-text="No logs found" v-bind:pagination.sync="pagination">
<template slot="items" slot-scope="props"> <template slot="items" slot-scope="props">
@ -1074,7 +1090,8 @@ const Log=Vue.extend({template:`
selected:[], selected:[],
search:"", search:"",
loading:false, loading:false,
timer:null timer:null,
autorefresh: true
} }
}, },
methods:{ methods:{
@ -1086,14 +1103,21 @@ const Log=Vue.extend({template:`
//console.log(r.data) //console.log(r.data)
//var items=r.data.items.filter(item=>{return item.text!="[GET] http://localhost:8984/vue-poc/api/log"}) //var items=r.data.items.filter(item=>{return item.text!="[GET] http://localhost:8984/vue-poc/api/log"})
this.items=r.data.items this.items=r.data.items
this.timer=setTimeout(()=>{ this.getItems() }, 5000); if(this.autorefresh){
this.timer=setTimeout(()=>{ this.getItems() }, 5000);
}
}) })
},
toggle(){
alert("toggle auto");
this.autorefresh= !this.autorefresh;
} }
}, },
created:function(){ created:function(){
this.getItems() this.getItems()
}, },
beforeRouteLeave(to, from, next){ beforeRouteLeave(to, from, next){
this.autorefresh=false;
if(this.timer) clearTimeout(this.timer); if(this.timer) clearTimeout(this.timer);
return next() return next()
} }
@ -5220,11 +5244,11 @@ const Thumbnail=Vue.extend({template:`
<v-container fluid=""> <v-container fluid="">
<v-stepper v-model="step" non-linear=""> <v-stepper v-model="step" non-linear="">
<v-stepper-header> <v-stepper-header>
<v-stepper-step step="1" :complete="step > 1">Select image location</v-stepper-step> <v-stepper-step step="1" :complete="step > 1" editable="">Select image location</v-stepper-step>
<v-divider></v-divider> <v-divider></v-divider>
<v-stepper-step step="2" :complete="step > 2">Set thumbnail details</v-stepper-step> <v-stepper-step step="2" :complete="step > 2" editable="">Set thumbnail details</v-stepper-step>
<v-divider></v-divider> <v-divider></v-divider>
<v-stepper-step step="3">Result</v-stepper-step> <v-stepper-step step="3" editable="">Result</v-stepper-step>
</v-stepper-header> </v-stepper-header>
<v-stepper-items> <v-stepper-items>
<v-stepper-content step="1" non-linear=""> <v-stepper-content step="1" non-linear="">
@ -5360,7 +5384,11 @@ const Validate=Vue.extend({template:`
</v-menu> </v-menu>
</v-toolbar> </v-toolbar>
<v-card-text> <v-card-text>
here <qd-autoheight>
<v-flex fill-height="" xs12="">
test here
</v-flex>
</qd-autoheight>
</v-card-text> </v-card-text>
</v-card> </v-card>
</v-container> </v-container>
@ -5514,24 +5542,24 @@ const Transform=Vue.extend({template:`
</v-card> </v-card>
</v-menu> </v-menu>
</v-toolbar> </v-toolbar>
<v-card-text class="amber"> <v-card-text class="amber">
<qd-autoheight> <qd-autoheight>
<v-flex v-if="showOptions.includes('result')" fill-height="" xs6=""> <v-flex v-if="showOptions.includes('result')" fill-height="" xs12="">
<vue-ace :content="result" mode="xml" wrap="true" :settings="aceSettings"></vue-ace> <vue-ace :content="result" mode="xml" wrap="true" :settings="aceSettings"></vue-ace>
</v-flex> </v-flex>
<v-flex v-if="showOptions.includes('xml')" fill-height="" xs6=""> <v-flex v-if="showOptions.includes('xml')" fill-height="">
<vue-ace :content="xml" mode="xml" wrap="true" v-on:change-content="v => this.xml=v" v-on:annotation="a => this.xmlValid=a.error===0 &amp;&amp; a.warning===0" :settings="aceSettings"></vue-ace> <vue-ace :content="xml" mode="xml" wrap="true" v-on:change-content="v => this.xml=v" v-on:annotation="a => this.xmlValid=a.error===0 &amp;&amp; a.warning===0" :settings="aceSettings"></vue-ace>
</v-flex> </v-flex>
<v-flex v-if="showOptions.includes('xslt')" fill-height="" xs6="">
<v-flex v-if="showOptions.includes('xslt')" fill-height="">
<vue-ace :content="xslt" mode="xml" wrap="true" v-on:change-content="v => this.xslt=v" v-on:annotation="a => this.xslValid=a.error===0 &amp;&amp; a.warning===0" :settings="aceSettings"></vue-ace> <vue-ace :content="xslt" mode="xml" wrap="true" v-on:change-content="v => this.xslt=v" v-on:annotation="a => this.xslValid=a.error===0 &amp;&amp; a.warning===0" :settings="aceSettings"></vue-ace>
</v-flex> </v-flex>
</qd-autoheight> </qd-autoheight>
</v-card-text> </v-card-text>
</v-card> </v-card>
</v-container> </v-container>
`, `,
@ -5703,10 +5731,7 @@ const router = new VueRouter({
{ path: '/tasks/xqdoc', component: Xqdoc, meta:{title:"build xqdoc"} }, { path: '/tasks/xqdoc', component: Xqdoc, meta:{title:"build xqdoc"} },
{ path: '/tasks/vuecompile', component: Vuecompile, meta:{title:"vue compile"} }, { path: '/tasks/vuecompile', component: Vuecompile, meta:{title:"vue compile"} },
{ path: '/tasks/:task', component: Runtask, props: true, meta:{title:"Run task"} }, { path: '/tasks/:task', component: Runtask, props: true, meta:{title:"Run task"} },
{ path: '/jobs', component: Jobs, meta:{title:"Jobs running"} },
{ path: '/jobs/:job', name:"jobShow", component: Job, props: true, meta:{title:"Job Status"} },
{ path: '/timeline', component: Timeline,meta:{title:"timeline"} }, { path: '/timeline', component: Timeline,meta:{title:"timeline"} },
{ path: '/tree', component: Tree, meta:{title:"tree"} }, { path: '/tree', component: Tree, meta:{title:"tree"} },
{ path: '/tree2', component: Tree2, meta:{title:"tree2"} }, { path: '/tree2', component: Tree2, meta:{title:"tree2"} },

View file

@ -9,7 +9,7 @@ import module namespace bf = 'quodatum.tools.buildfields' at "../lib/entity-gen.
declare variable $efolder:="C:/Users/andy/git/vue-poc/src/vue-poc/models"; declare variable $efolder:="C:/Users/andy/git/vue-poc/src/vue-poc/models";
declare variable $target:="C:/Users/andy/git/vue-poc/src/vue-poc/models.gen.xqm"; declare variable $target:="C:/Users/andy/git/vue-poc/src/vue-poc/models.gen.xqm";
let $config:='import module namespace cfg = "quodatum:media.image.configure" at "features/images/config.xqm";' let $config:='import module namespace cfg = "quodatum:media.image.configure" at "config.xqm";'
let $src:=bf:module(bf:entities($efolder),$config) let $src:=bf:module(bf:entities($efolder),$config)
return ( return (