From 251cf23fd84c1c0c16b0193ec8cefb3873c722ab Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 21 Aug 2017 12:44:28 +0100 Subject: [PATCH] [fix] thumbnail generation --- src/vue-poc/features/eval/eval.vue | 33 ++++++---- .../features/images/pics-02-store-meta.xq | 2 +- .../features/images/pics-04-store-thumbs.xq | 11 +++- src/vue-poc/features/job/job.vue | 29 ++++----- src/vue-poc/features/job/jobs.vue | 4 ++ src/vue-poc/features/job/jobs.xqm | 6 +- src/vue-poc/static/app-gen.js | 62 ++++++++++++------- 7 files changed, 94 insertions(+), 53 deletions(-) diff --git a/src/vue-poc/features/eval/eval.vue b/src/vue-poc/features/eval/eval.vue index 9acb145..bc26160 100644 --- a/src/vue-poc/features/eval/eval.vue +++ b/src/vue-poc/features/eval/eval.vue @@ -41,10 +41,17 @@ JobId: {{jobId}} - Elapsed: - {{elapsed}} + + + lockW + {{ jobState.writes }} + + lockR + {{ jobState.reads }} - @TODO + + timer + {{elapsed}}ms @@ -62,15 +69,16 @@ return { xq: '(: type your XQuery :)\n', result:'', - elapsed:null, - show:false, - showError:false, - jobId:null, - waiting:false, - start:null, - font:'Courier', + elapsed: null, + show: false, + showError: false, + jobId: null, + waiting: false, + start: null, + jobState: {}, + font: 'Courier', dropdown_font: [ - { text: 'Arial' }, + { text: 'Test select' }, { text: 'Calibri' }, { text: 'Courier' }, { text: 'Verdana' } @@ -125,6 +133,7 @@ this.waiting=true; HTTP.get("job/"+this.jobId) .then(r=>{ + this.jobState=r.data this.waiting=r.data.state!="cached"; this.elapsed=Math.floor(performance.now() - this.start); if(this.waiting) { @@ -143,7 +152,7 @@ }) }, imports(){ - alert("imports") + alert("@TODO imports") } }, 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 5766ab3..06a0d45 100644 --- a/src/vue-poc/features/images/pics-02-store-meta.xq +++ b/src/vue-poc/features/images/pics-02-store-meta.xq @@ -16,7 +16,7 @@ let $relpath:= $files!( ancestor-or-self::*/@name=>string-join("/")) let $todo:= $relpath[not("/vue-poc/" || .|| "/meta.xml"=$done)] return (for $f in subsequence($todo,1, $CHUNK) - let $spath:=$cfg:IMAGEDIR || $f + let $spath:=$cfg:IMAGEDIR || "../" || $f let $dbpath:=$f || "/meta.xml" let $meta:=imgmeta:read($spath) return db:replace($DB,$dbpath,$meta), 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 cf8c6a4..95462ea 100644 --- a/src/vue-poc/features/images/pics-04-store-thumbs.xq +++ b/src/vue-poc/features/images/pics-04-store-thumbs.xq @@ -10,9 +10,13 @@ declare variable $CHUNK:=1000; declare %updating function local:store-thumb($f as xs:string) { - let $src:=$cfg:IMAGEDIR || trace($f) + let $src:=$cfg:IMAGEDIR || "../" || trace($f) let $trg:= $cfg:THUMBDIR || $f - return fetch:binary($src)=>t:size(80)=>local:write-binary($trg) + return try{ + fetch:binary($src)=>t:size(80)=>local:write-binary($trg) + } catch * { + db:output("bad: " || $f) + } }; (:~ create folder if missing) :) declare %updating function local:write-binary($data,$url as xs:string) @@ -30,7 +34,8 @@ 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 $relpath:=filter($relpath,function($f){ - not(file:exists($cfg:IMAGEDIR || $f)) and file:exists($cfg:IMAGEDIR || $f) + not(file:exists($cfg:THUMBDIR || $f)) + and file:exists($cfg:IMAGEDIR || "../" || $f) }) let $todo:= $relpath=>subsequence(1, $CHUNK) diff --git a/src/vue-poc/features/job/job.vue b/src/vue-poc/features/job/job.vue index bec1d89..2e68446 100644 --- a/src/vue-poc/features/job/job.vue +++ b/src/vue-poc/features/job/job.vue @@ -5,33 +5,34 @@ arrow_back {{ job }} - Stop - Result + Stop + Result {{ jobstate.state }} - - + + lock{{ jobstate.writes }} + lock{{ jobstate.reads }} + + + account_circle {{ jobstate.user }} - {{ jobstate.duration }} - + + timer + {{ jobstate.duration }} refresh - - + + {{ result }} + {{ jobstate.text }} + diff --git a/src/vue-poc/features/job/jobs.vue b/src/vue-poc/features/job/jobs.vue index 069a4e2..b91913d 100644 --- a/src/vue-poc/features/job/jobs.vue +++ b/src/vue-poc/features/job/jobs.vue @@ -47,6 +47,8 @@ {{ props.item.state }} {{ props.item.duration }} {{ props.item.type }} + {{ props.item.writes }} + {{ props.item.reads }} {{ props.item.user }} {{ props.item.text }} @@ -66,6 +68,8 @@ { text: 'State', value: 'state' }, { text: 'Duration', value: 'duration' }, { text: 'Type', value: 'type' }, + { text: 'WriteL', value: 'writes' }, + { text: 'ReadL', value: 'reads' }, { text: 'User', value: 'user' }, { text: 'Query', value: 'text' } ], diff --git a/src/vue-poc/features/job/jobs.xqm b/src/vue-poc/features/job/jobs.xqm index 03bcb73..6bc8f58 100644 --- a/src/vue-poc/features/job/jobs.xqm +++ b/src/vue-poc/features/job/jobs.xqm @@ -30,11 +30,11 @@ as element(json) { let $j:=jobs:list-details($job) return - {j:job-json($j)} + {if($j) then j:job-json($j) else ()} }; -declare function j:job-json($j) +declare function j:job-json($j as element(job)) as element(*)* { {$j/@id/string()} @@ -43,4 +43,6 @@ as element(*)* ,{$j/@user/string()} ,{$j/@duration/string()} ,{$j/string()} + ,{$j/@reads/string()} + ,{$j/@writes/string()} }; \ 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 b6f10f9..5f5d826 100644 --- a/src/vue-poc/static/app-gen.js +++ b/src/vue-poc/static/app-gen.js @@ -1,4 +1,4 @@ -// generated 2017-08-20T13:42:15.528+01:00 +// generated 2017-08-21T11:24:21.865+01:00 Vue.component('qd-link',{template:` {{href}}link `, @@ -773,10 +773,17 @@ v0.0.3 JobId: {{jobId}} - Elapsed: - {{elapsed}} + + + lockW + {{ jobState.writes }} + + lockR + {{ jobState.reads }} - @TODO + + timer + {{elapsed}}ms @@ -792,15 +799,16 @@ v0.0.3 return { xq: '(: type your XQuery :)\n', result:'', - elapsed:null, - show:false, - showError:false, - jobId:null, - waiting:false, - start:null, - font:'Courier', + elapsed: null, + show: false, + showError: false, + jobId: null, + waiting: false, + start: null, + jobState: {}, + font: 'Courier', dropdown_font: [ - { text: 'Arial' }, + { text: 'Test select' }, { text: 'Calibri' }, { text: 'Courier' }, { text: 'Verdana' } @@ -855,6 +863,7 @@ v0.0.3 this.waiting=true; HTTP.get("job/"+this.jobId) .then(r=>{ + this.jobState=r.data this.waiting=r.data.state!="cached"; this.elapsed=Math.floor(performance.now() - this.start); if(this.waiting) { @@ -873,7 +882,7 @@ v0.0.3 }) }, imports(){ - alert("imports") + alert("@TODO imports") } }, @@ -1216,27 +1225,34 @@ body arrow_back {{ job }} - Stop - Result + Stop + Result {{ jobstate.state }} - - + + lock{{ jobstate.writes }} + lock{{ jobstate.reads }} + + + account_circle {{ jobstate.user }} - {{ jobstate.duration }} - + + timer + {{ jobstate.duration }} refresh - - + + {{ result }} + {{ jobstate.text }} + `, @@ -1303,6 +1319,8 @@ body {{ props.item.state }} {{ props.item.duration }} {{ props.item.type }} + {{ props.item.writes }} + {{ props.item.reads }} {{ props.item.user }} {{ props.item.text }} @@ -1321,6 +1339,8 @@ 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' }, { text: 'Query', value: 'text' } ],