From 07509ce03bc3bf1e8d7bd23b2a369933502fb6bb Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 24 Aug 2017 18:17:53 +0100 Subject: [PATCH] crumbs --- src/vue-poc/components/core.js | 16 ++ src/vue-poc/features/collection/files.vue | 9 +- src/vue-poc/features/eval/eval.vue | 84 ++++++---- src/vue-poc/features/eval/eval.xqm | 16 ++ src/vue-poc/features/images/image.vue | 6 +- src/vue-poc/features/images/images.vue | 9 +- src/vue-poc/features/images/images.xqm | 40 +++-- .../features/images/pics-02-store-meta.xq | 6 +- .../features/images/pics-03-store-image.xq | 4 +- .../features/images/pics-04-store-thumbs.xq | 2 +- .../features/images/pics-05-set-original.xq | 2 +- src/vue-poc/features/job/jobs.vue | 45 ++--- src/vue-poc/lib/vue-compile/vue-compile.xqm | 23 ++- src/vue-poc/models.gen.xqm | 4 +- src/vue-poc/models/thumbnail.xml | 2 +- src/vue-poc/static/app-gen.js | 156 +++++++++++------- src/vue-poc/static/app.css | 12 +- src/vue-poc/tasks/generate-model-local.xq | 6 +- tools/split.xq | 30 ---- 19 files changed, 289 insertions(+), 183 deletions(-) delete mode 100644 tools/split.xq diff --git a/src/vue-poc/components/core.js b/src/vue-poc/components/core.js index 1308e00..ad0ec12 100644 --- a/src/vue-poc/components/core.js +++ b/src/vue-poc/components/core.js @@ -60,6 +60,22 @@ Vue.config.errorHandler = function (err, vm, info) { alert("vue error"); }; +//Returns a function, that, as long as it continues to be invoked, will not +//be triggered. The function will be called after it stops being called for +//N milliseconds. If `immediate` is passed, trigger the function on the +//leading edge, instead of the trailing. https://gist.github.com/nmsdvid/8807205 +function debounce(func, wait, immediate) { + var timeout; + return function() { + var context = this, args = arguments; + clearTimeout(timeout); + timeout = setTimeout(function() { + timeout = null; + if (!immediate) func.apply(context, args); + }, wait); + if (immediate && !timeout) func.apply(context, args); + }; +}; // used by vue-ace var Events = new Vue({}); diff --git a/src/vue-poc/features/collection/files.vue b/src/vue-poc/features/collection/files.vue index da4556c..c575018 100644 --- a/src/vue-poc/features/collection/files.vue +++ b/src/vue-poc/features/collection/files.vue @@ -10,8 +10,8 @@ - - {{ item }} + + {{ item.name }} @@ -149,7 +149,10 @@ return (this.protocol=="basexdb")?"developer_mode":"folder" }, crumbs(){ - return this.url.split("/").filter((a)=>a.length>0) + var parts=this.url.split("/").filter((a)=>a.length>0) + var a=parts.map(function(v,i,a){return {name:v, + path:"/"+a.slice(0,i+1).join("/")+"/"}}) + return a } }, watch:{ diff --git a/src/vue-poc/features/eval/eval.vue b/src/vue-poc/features/eval/eval.vue index bc26160..c023f0c 100644 --- a/src/vue-poc/features/eval/eval.vue +++ b/src/vue-poc/features/eval/eval.vue @@ -12,17 +12,15 @@ play_circle_outline Imports - - - {{font}} - arrow_drop_down - - - - - - - + + more_vert + + Show query plan + + + hit me + + @@ -37,25 +35,27 @@ {{result}} - - JobId: - {{jobId}} - - + + {{jobId}} + lockW {{ jobState.writes }} lockR {{ jobState.reads }} + - + + {{ jobState.state }} + timer {{elapsed}}ms + - + - @@ -71,18 +71,12 @@ result:'', elapsed: null, show: false, - showError: false, + showError: false, //unused + showResult: false, // jobId: null, waiting: false, start: null, - jobState: {}, - font: 'Courier', - dropdown_font: [ - { text: 'Test select' }, - { text: 'Calibri' }, - { text: 'Courier' }, - { text: 'Verdana' } - ] + jobState: {} } }, methods:{ @@ -93,14 +87,13 @@ }, run(){ - this.showError=this.show=false + this.awaitResult(false) this.start = performance.now(); HTTP.post("eval/execute",Qs.stringify({xq:this.xq})) .then(r=>{ this.elapsed=Math.floor(performance.now() - this.start); this.result=r.data.result this.jobId=null - this.show=true }) .catch(r=> { console.log("error",r) @@ -112,12 +105,12 @@ }, submit(){ var data={xq:this.xq} - this.showError=this.show=false + this.showResult=this.show=false this.start = performance.now(); HTTP.post("eval/submit",Qs.stringify(data)) .then(r=>{ this.elapsed=Math.floor(performance.now() - this.start); - this.result=this.jobId=r.data.job + this.jobId=r.data.job this.show=true this.pollState() @@ -144,15 +137,38 @@ }) }, getResult(){ + this.awaitResult(true) HTTP.post("eval/result/"+this.jobId) .then(r=>{ this.result=r.data.result - this.jobId=null - this.show=true }) }, + hitme(){ + this.showResult=true + setTimeout(()=>{this.result="123\n".repeat(20000); },10); + + }, imports(){ alert("@TODO imports") + }, + plan(){ + this.awaitResult(false) + HTTP.post("eval/plan",Qs.stringify({xq:this.xq})) + .then(r=>{ + this.result=r.data.result + }) + .catch(r=> { + console.log("error",r) + this.result=r.response.data + this.showError=true; + + }); + }, + awaitResult(show){ + // ace slow when setting large text while hidden + this.show=show + this.result="(Please wait..)" + this.showResult=true } }, diff --git a/src/vue-poc/features/eval/eval.xqm b/src/vue-poc/features/eval/eval.xqm index 675a416..67b5737 100644 --- a/src/vue-poc/features/eval/eval.xqm +++ b/src/vue-poc/features/eval/eval.xqm @@ -24,6 +24,22 @@ function vue-api:eval($xq ) }; +(:~ + : query plan + :) +declare +%rest:POST %rest:path("/vue-poc/api/eval/plan") +%rest:form-param("xq", "{$xq}") +%output:method("json") +function vue-api:plan($xq ) +{ + let $x:=fn:trace($xq,"task: ") + let $r:=xquery:parse($xq,map{"compile":true(),"plan":true()}) + return + { serialize($r) } + +}; + (:~ : submit a simple job :) diff --git a/src/vue-poc/features/images/image.vue b/src/vue-poc/features/images/image.vue index aa77d74..1eb4323 100644 --- a/src/vue-poc/features/images/image.vue +++ b/src/vue-poc/features/images/image.vue @@ -20,6 +20,7 @@
{{ image.doc }}
+ full metadata
@@ -40,7 +41,10 @@ computed: { path(){ return this.loaded?'/vue-poc/api/images/list/'+ this.id+ '/image':null - } + }, + meta(){ + return this.loaded?'/vue-poc/api/images/list/'+ this.id+ '/meta':null + } }, created:function(){ var id=this._props.id diff --git a/src/vue-poc/features/images/images.vue b/src/vue-poc/features/images/images.vue index 0ec343b..3b663d2 100644 --- a/src/vue-poc/features/images/images.vue +++ b/src/vue-poc/features/images/images.vue @@ -14,9 +14,10 @@ v-if="query.keyword || query.from || query.until"> clear - {{ total }} + - + + {{ total }} in {{ elapsed | round(2) }} secs Page:{{ query.page+1 }} @@ -25,6 +26,7 @@ arrow_forward + @@ -163,6 +165,7 @@ keyword:null }, total:null, + elapsed:null, showFilter:false, busy:false, menu2:false, @@ -184,7 +187,7 @@ this.total=r.data.total this.images=r.data.items var t1 = performance.now(); - console.log("Time: ",t1 - t0) + this.elapsed= 0.001 *(t1 - t0) }) }, clear(){ diff --git a/src/vue-poc/features/images/images.xqm b/src/vue-poc/features/images/images.xqm index b9526dc..c82f1d0 100644 --- a/src/vue-poc/features/images/images.xqm +++ b/src/vue-poc/features/images/images.xqm @@ -72,7 +72,7 @@ declare function vue-api:keywords() { let $keys:= -collection("/vue-poc/Pictures")/image/keywords/keyword +collection("/vue-poc/image")/image/keywords/keyword =>distinct-values() =>sort("http://www.w3.org/2005/xpath-functions/collation/html-ascii-case-insensitive") return @@ -82,14 +82,37 @@ return }; -(:~ fields for image for json :) +(:~ full size image :) +declare +%rest:GET %rest:path("/vue-poc/api/images/list/{ $id }/image") +function vue-api:rawimage($id as xs:integer) +{ + let $image as element(image):=db:open-id("vue-poc",$id) + let $path:=$cfg:IMAGEDIR || '../' || $vue-api:entity?access?path($image) + return ( + web:response-header(map { 'media-type': web:content-type($path) }), + file:read-binary($path) + ) +}; + +(:~ image metadata :) +declare +%rest:GET %rest:path("/vue-poc/api/images/list/{ $id }/meta") +function vue-api:meta($id as xs:integer) +{ + let $image as element(image):=db:open-id("vue-poc",$id) + let $path:="vue-poc/meta/" || $vue-api:entity?access?path($image) || "/meta.xml" + return doc($path) +}; + +(:~ fields for thumbnail for json :) declare function vue-api:get-image($image as element(image)) as element(*)* { let $id:=$vue-api:entity?access?id($image) let $path:=$vue-api:entity?access?path($image) let $name:=$vue-api:entity?access?name($image) -let $thumb:= $cfg:THUMBDIR || $path +let $thumb:= $cfg:THUMBDIR || $path let $thumb:=if(file:exists($thumb)) then $thumb else $cfg:THUMBDIR || "missing.jpg" return ( {$id} ,{$name} @@ -98,16 +121,5 @@ return ( {$id} ,{fetch:content-type($thumb)}) }; -declare -%rest:GET %rest:path("/vue-poc/api/images/list/{ $id }/image") -function vue-api:rawimage($id as xs:integer) -{ - let $image as element(image):=db:open-id("vue-poc",$id) - let $path:=$cfg:IMAGEDIR || $vue-api:entity?access?path($image) - return ( - web:response-header(map { 'media-type': web:content-type($path) }), - file:read-binary($path) - ) - }; diff --git a/src/vue-poc/features/images/pics-02-store-meta.xq b/src/vue-poc/features/images/pics-02-store-meta.xq index 06a0d45..fef33db 100644 --- a/src/vue-poc/features/images/pics-02-store-meta.xq +++ b/src/vue-poc/features/images/pics-02-store-meta.xq @@ -9,15 +9,15 @@ declare namespace c="http://www.w3.org/ns/xproc-step"; declare variable $DB:="vue-poc"; declare variable $CHUNK:=1000; -let $done:=uri-collection("vue-poc/Pictures") +let $done:=uri-collection("vue-poc/meta") let $files:= doc("/vue-poc/pics.xml")//c:file[ends-with(lower-case(@name),".jpg")] let $relpath:= $files!( ancestor-or-self::*/@name=>string-join("/")) -let $todo:= $relpath[not("/vue-poc/" || .|| "/meta.xml"=$done)] +let $todo:= $relpath[not("/vue-poc/meta/" || .|| "/meta.xml"=$done)] return (for $f in subsequence($todo,1, $CHUNK) let $spath:=$cfg:IMAGEDIR || "../" || $f - let $dbpath:=$f || "/meta.xml" + let $dbpath:="meta/" || $f || "/meta.xml" let $meta:=imgmeta:read($spath) return db:replace($DB,$dbpath,$meta), db:output($todo=>count())) \ No newline at end of file diff --git a/src/vue-poc/features/images/pics-03-store-image.xq b/src/vue-poc/features/images/pics-03-store-image.xq index 6c940e6..1c7842c 100644 --- a/src/vue-poc/features/images/pics-03-store-image.xq +++ b/src/vue-poc/features/images/pics-03-store-image.xq @@ -4,7 +4,7 @@ :) import module namespace metadata = 'expkg-zone58:image.metadata'; import module namespace cfg = "quodatum:media.image.configure" at "config.xqm"; -for $meta in collection("/vue-poc/Pictures")/metadata +for $meta in collection("/vue-poc/meta")/metadata let $loc:=db:path($meta)=>tokenize("/") let $name:=$loc[count($loc)-1] let $path:= subsequence($loc,1,count($loc)-1)=>string-join("/") @@ -14,5 +14,5 @@ for $meta in collection("/vue-poc/Pictures")/metadata metadata:geo($meta), metadata:keywords($meta) } -let $target:=$path || "/image.xml" +let $target:="image/"|| $path || "/image.xml" return db:replace("vue-poc",$target,$image) \ No newline at end of file diff --git a/src/vue-poc/features/images/pics-04-store-thumbs.xq b/src/vue-poc/features/images/pics-04-store-thumbs.xq index 95462ea..34ec50c 100644 --- a/src/vue-poc/features/images/pics-04-store-thumbs.xq +++ b/src/vue-poc/features/images/pics-04-store-thumbs.xq @@ -29,7 +29,7 @@ declare %updating function local:write-binary($data,$url as xs:string) file:write-binary($url,$data) ) }; -let $done:=uri-collection("vue-poc/Pictures") + let $files:= doc("/vue-poc/pics.xml")//c:file[ends-with(lower-case(@name),".jpg")] let $relpath:= $files!( ancestor-or-self::*/@name=>string-join("/")) diff --git a/src/vue-poc/features/images/pics-05-set-original.xq b/src/vue-poc/features/images/pics-05-set-original.xq index 7819d52..d5295ae 100644 --- a/src/vue-poc/features/images/pics-05-set-original.xq +++ b/src/vue-poc/features/images/pics-05-set-original.xq @@ -1,4 +1,4 @@ (: set original:) -for $i in collection("/vue-poc/Pictures")/image +for $i in collection("/vue-poc/image")/image where $i[file/@path=>contains('original')] return insert node attribute { 'original' } { true() } into $i \ No newline at end of file diff --git a/src/vue-poc/features/job/jobs.vue b/src/vue-poc/features/job/jobs.vue index b91913d..d00469a 100644 --- a/src/vue-poc/features/job/jobs.vue +++ b/src/vue-poc/features/job/jobs.vue @@ -2,29 +2,30 @@ @@ -67,7 +68,6 @@ }, { text: 'State', value: 'state' }, { text: 'Duration', value: 'duration' }, - { text: 'Type', value: 'type' }, { text: 'WriteL', value: 'writes' }, { text: 'ReadL', value: 'reads' }, { text: 'User', value: 'user' }, @@ -75,9 +75,10 @@ ], items:[ ], - selected:[], - search:"", - loading:false + selected: [], + search: "", + loading: false, + autorefresh: true } }, methods:{ @@ -87,7 +88,7 @@ .then(r=>{ this.loading=false this.items=r.data - setTimeout(()=>{ this.getJobs() }, 10000); + if(this.autorefresh) setTimeout(()=>{ this.getJobs() }, 10000); }) }, @@ -102,7 +103,7 @@ noSelection: function () { // `this` points to the vm instance return this.selected.length==0 - } + }, }, created(){ this.getJobs() diff --git a/src/vue-poc/lib/vue-compile/vue-compile.xqm b/src/vue-poc/lib/vue-compile/vue-compile.xqm index e410ee9..69bb265 100644 --- a/src/vue-poc/lib/vue-compile/vue-compile.xqm +++ b/src/vue-poc/lib/vue-compile/vue-compile.xqm @@ -25,7 +25,7 @@ declare variable $vue:DEST:="static/app-gen.js"; declare function vue:feature($doc,$isComp as xs:boolean) as xs:string { -let $p:=vue:parse($doc) +let $p:=vue:parse($doc=>trace("feature: ")) let $script:= $p?script=>substring-after("{") return if(empty($p?id)) then @@ -64,6 +64,20 @@ declare function vue:capitalize-first concat(upper-case(substring($arg,1,1)), substring($arg,2)) }; +declare function vue:feature-files($proj) +as xs:string* +{ + let $FEATURES:="features/"=>file:resolve-path($proj=>trace("proj:")) + return fw:directory-list($FEATURES,map{"include-filter":".*\.vue"}) + //c:file/@name/resolve-uri(.,base-uri(.)) +}; + +declare function vue:feature-build($url as xs:string,$isComp as xs:boolean) +as xs:string +{ + fetch:text($url)=>html5:doc()=>vue:feature($isComp) +}; + (:~ : compile vue code to "static/app-gen.js" : @param $proj root folder e.g "C:/Users/andy/git/vue-poc/src/vue-poc/" @@ -76,13 +90,12 @@ let $CORE:="components/core.js"=>file:resolve-path($proj) let $FILTERS:="components/filters.js"=>file:resolve-path($proj) let $DEST:="static/app-gen.js"=>file:resolve-path($proj) -let $files:= fw:directory-list($FEATURES,map{"include-filter":".*\.vue"}) - //c:file/@name/resolve-uri(.,base-uri(.)) -let $feats:=$files!(fetch:text(.)=>html5:doc()=>vue:feature(false())) +let $files:=vue:feature-files($proj) +let $feats:=$files!vue:feature-build(.,false()) let $files:= fw:directory-list($COMPONENTS,map{"include-filter":".*\.vue"}) //c:file/@name/resolve-uri(.,base-uri(.)) -let $comps:=$files!(fetch:text(.)=>html5:doc()=>vue:feature(true())) +let $comps:=$files!vue:feature-build(.,true()) let $comment:="// generated " || current-dateTime() || " " return file:write-text($DEST,string-join(($comment, diff --git a/src/vue-poc/models.gen.xqm b/src/vue-poc/models.gen.xqm index c3d0ee9..ba181a9 100644 --- a/src/vue-poc/models.gen.xqm +++ b/src/vue-poc/models.gen.xqm @@ -1,5 +1,5 @@ (: entity access maps - : auto generated from xml files in entities folder at: 2017-08-13T22:21:05.468+01:00 + : auto generated from xml files in entities folder at: 2017-08-23T10:12:22.413+01:00 :) module namespace entity = 'quodatum.models.generated'; @@ -130,7 +130,7 @@ declare variable $entity:list:=map { } }, "data": function() as element(image)* - { collection("/vue-poc/Pictures")/image }, + { collection("/vue-poc/image")/image }, "views": map{ 'filter': 'name' diff --git a/src/vue-poc/models/thumbnail.xml b/src/vue-poc/models/thumbnail.xml index 44a4372..877422c 100644 --- a/src/vue-poc/models/thumbnail.xml +++ b/src/vue-poc/models/thumbnail.xml @@ -24,6 +24,6 @@ name fa fa-file - collection("/vue-poc/Pictures")/image + collection("/vue-poc/image")/image \ No newline at end of file diff --git a/src/vue-poc/static/app-gen.js b/src/vue-poc/static/app-gen.js index 5f5d826..f9b81a8 100644 --- a/src/vue-poc/static/app-gen.js +++ b/src/vue-poc/static/app-gen.js @@ -1,4 +1,4 @@ -// generated 2017-08-21T11:24:21.865+01:00 +// generated 2017-08-24T18:16:31.442+01:00 Vue.component('qd-link',{template:` {{href}}link `, @@ -263,8 +263,8 @@ v0.0.3 - - {{ item }} + + {{ item.name }} @@ -400,7 +400,10 @@ v0.0.3 return (this.protocol=="basexdb")?"developer_mode":"folder" }, crumbs(){ - return this.url.split("/").filter((a)=>a.length>0) + var parts=this.url.split("/").filter((a)=>a.length>0) + var a=parts.map(function(v,i,a){return {name:v, + path:"/"+a.slice(0,i+1).join("/")+"/"}}) + return a } }, watch:{ @@ -746,17 +749,15 @@ v0.0.3 play_circle_outline Imports - - - {{font}} - arrow_drop_down - - - - - - - + + more_vert + + Show query plan + + + hit me + + @@ -769,25 +770,27 @@ v0.0.3 {{result}} - - JobId: - {{jobId}} - - + + {{jobId}} + lockW {{ jobState.writes }} lockR {{ jobState.reads }} + - + + {{ jobState.state }} + timer {{elapsed}}ms + - + - + @@ -801,18 +804,12 @@ v0.0.3 result:'', elapsed: null, show: false, - showError: false, + showError: false, //unused + showResult: false, // jobId: null, waiting: false, start: null, - jobState: {}, - font: 'Courier', - dropdown_font: [ - { text: 'Test select' }, - { text: 'Calibri' }, - { text: 'Courier' }, - { text: 'Verdana' } - ] + jobState: {} } }, methods:{ @@ -823,14 +820,13 @@ v0.0.3 }, run(){ - this.showError=this.show=false + this.awaitResult(false) this.start = performance.now(); HTTP.post("eval/execute",Qs.stringify({xq:this.xq})) .then(r=>{ this.elapsed=Math.floor(performance.now() - this.start); this.result=r.data.result this.jobId=null - this.show=true }) .catch(r=> { console.log("error",r) @@ -842,12 +838,12 @@ v0.0.3 }, submit(){ var data={xq:this.xq} - this.showError=this.show=false + this.showResult=this.show=false this.start = performance.now(); HTTP.post("eval/submit",Qs.stringify(data)) .then(r=>{ this.elapsed=Math.floor(performance.now() - this.start); - this.result=this.jobId=r.data.job + this.jobId=r.data.job this.show=true this.pollState() @@ -874,15 +870,38 @@ v0.0.3 }) }, getResult(){ + this.awaitResult(true) HTTP.post("eval/result/"+this.jobId) .then(r=>{ this.result=r.data.result - this.jobId=null - this.show=true }) }, + hitme(){ + this.showResult=true + setTimeout(()=>{this.result="123\n".repeat(20000); },10); + + }, imports(){ alert("@TODO imports") + }, + plan(){ + this.awaitResult(false) + HTTP.post("eval/plan",Qs.stringify({xq:this.xq})) + .then(r=>{ + this.result=r.data.result + }) + .catch(r=> { + console.log("error",r) + this.result=r.response.data + this.showError=true; + + }); + }, + awaitResult(show){ + // ace slow when setting large text while hidden + this.show=show + this.result="(Please wait..)" + this.showResult=true } }, @@ -961,6 +980,7 @@ v0.0.3
{{ image.doc }}
+ full metadata
@@ -980,7 +1000,10 @@ v0.0.3 computed: { path(){ return this.loaded?'/vue-poc/api/images/list/'+ this.id+ '/image':null - } + }, + meta(){ + return this.loaded?'/vue-poc/api/images/list/'+ this.id+ '/meta':null + } }, created:function(){ var id=this._props.id @@ -1003,9 +1026,10 @@ v0.0.3 clear - {{ total }} + - + + {{ total }} in {{ elapsed | round(2) }} secs Page:{{ query.page+1 }} @@ -1014,6 +1038,7 @@ v0.0.3 arrow_forward + @@ -1111,6 +1136,7 @@ v0.0.3 keyword:null }, total:null, + elapsed:null, showFilter:false, busy:false, menu2:false, @@ -1132,7 +1158,7 @@ v0.0.3 this.total=r.data.total this.images=r.data.items var t1 = performance.now(); - console.log("Time: ",t1 - t0) + this.elapsed= 0.001 *(t1 - t0) }) }, clear(){ @@ -1300,15 +1326,15 @@ body const Jobs=Vue.extend({template:` - - refresh - + Stop - + - - + + + {{ autorefresh?'refresh':'arrow_downward' }} + @@ -1338,7 +1364,6 @@ body }, { text: 'State', value: 'state' }, { text: 'Duration', value: 'duration' }, - { text: 'Type', value: 'type' }, { text: 'WriteL', value: 'writes' }, { text: 'ReadL', value: 'reads' }, { text: 'User', value: 'user' }, @@ -1346,9 +1371,10 @@ body ], items:[ ], - selected:[], - search:"", - loading:false + selected: [], + search: "", + loading: false, + autorefresh: true } }, methods:{ @@ -1358,7 +1384,7 @@ body .then(r=>{ this.loading=false this.items=r.data - setTimeout(()=>{ this.getJobs() }, 10000); + if(this.autorefresh) setTimeout(()=>{ this.getJobs() }, 10000); }) }, @@ -1373,7 +1399,7 @@ body noSelection: function () { // `this` points to the vm instance return this.selected.length==0 - } + }, }, created(){ this.getJobs() @@ -2362,6 +2388,22 @@ Vue.config.errorHandler = function (err, vm, info) { alert("vue error"); }; +//Returns a function, that, as long as it continues to be invoked, will not +//be triggered. The function will be called after it stops being called for +//N milliseconds. If `immediate` is passed, trigger the function on the +//leading edge, instead of the trailing. https://gist.github.com/nmsdvid/8807205 +function debounce(func, wait, immediate) { + var timeout; + return function() { + var context = this, args = arguments; + clearTimeout(timeout); + timeout = setTimeout(function() { + timeout = null; + if (!immediate) func.apply(context, args); + }, wait); + if (immediate && !timeout) func.apply(context, args); + }; +}; // used by vue-ace var Events = new Vue({}); diff --git a/src/vue-poc/static/app.css b/src/vue-poc/static/app.css index 120da70..2f626a3 100644 --- a/src/vue-poc/static/app.css +++ b/src/vue-poc/static/app.css @@ -54,4 +54,14 @@ td.vtop { height: 100%; } - \ No newline at end of file +.multiline-ellipsis { + display: block; + display: -webkit-box; + max-height: 110px; + margin: 0 auto; + line-height: 1.4; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; + overflow: hidden; + text-overflow: ellipsis; +} \ No newline at end of file diff --git a/src/vue-poc/tasks/generate-model-local.xq b/src/vue-poc/tasks/generate-model-local.xq index a0f7d0d..5241e84 100644 --- a/src/vue-poc/tasks/generate-model-local.xq +++ b/src/vue-poc/tasks/generate-model-local.xq @@ -6,7 +6,7 @@ declare namespace task="https://github.com/Quodatum/app-doc/task"; import module namespace bf = 'quodatum.tools.buildfields' at "../lib/entity-gen.xqm"; -let $efolder:="file:///C:/Users/andy/workspace/app-doc/src/doc/data/doc/models" -let $target:="file:///C:/Users/andy/workspace/app-doc/src/doc/generated/models.xqm" -return (bf:write($efolder,$target),db:output("generated C:/Users/andy/workspace/app-doc/src/doc/generated/models.xqm")) +let $efolder:="C:/Users/andy/git/vue-poc/src/vue-poc/models" +let $target:="C:/Users/andy/git/vue-poc/src/vue-poc/models.gen.xqm" +return (bf:write($efolder,$target),db:output("generated " || $target)) diff --git a/tools/split.xq b/tools/split.xq deleted file mode 100644 index e55b665..0000000 --- a/tools/split.xq +++ /dev/null @@ -1,30 +0,0 @@ -(:~ - : create vue files from app.html - :) -import module namespace html5="text.html5" at "html5parse.xqm"; -declare namespace Document="java:ch.digitalfondue.jfiveparse.Document"; -declare namespace Element="java:ch.digitalfondue.jfiveparse.Element"; -declare namespace Node="java:ch.digitalfondue.jfiveparse.Node"; - -declare variable $DEST:="C:/Users/andy/git/vue-poc/src/vue-poc/templates/"; -declare variable $SRC:="C:/Users/andy/git/vue-poc/src/vue-poc/static/app.html"; - - -declare function local:process($node) -{ - let $id:= Element:getAttribute($node,"id") - let $html:=Node:getInnerHTML($node) - let $name:=$DEST || $id || ".vue" - let $out:=``[ - - -]`` - return file:write-text($name,$out) - -}; - -let $doc:=$SRC=>fetch:text()=>html5:doc() -let $matcher:=html5:selector() -let $nodes:= Document:getAllNodesMatching($doc,$matcher) -return $nodes=>html5:for-each(local:process#1) \ No newline at end of file