[fix] thumbnail generation

This commit is contained in:
Andy Bunce 2017-08-21 12:44:28 +01:00
parent 5e5e6182a8
commit 251cf23fd8
7 changed files with 94 additions and 53 deletions

View File

@ -41,10 +41,17 @@
JobId:
<v-chip class="green white--text">{{jobId}}</v-chip>
<v-progress-circular v-if="waiting" indeterminate class="primary--text"></v-progress-circular>
Elapsed:
<v-chip class="green white--text">{{elapsed}}</v-chip>
<v-chip label class="grey white--text">
<v-avatar class="red"> <v-icon>lock</v-icon>W</v-avatar>
{{ jobState.writes }}</v-chip>
<v-chip label class="grey white--text">
<v-avatar class="amber"> <v-icon>lock</v-icon>R</v-avatar>
{{ jobState.reads }}</v-chip>
<v-spacer></v-spacer>
<v-btn flat class="green--text darken-1">@TODO</v-btn>
<v-chip class="green white--text">
<v-avatar > <v-icon>timer</v-icon></v-avatar>
{{elapsed}}ms</v-chip>
</v-card-actions>
<v-card-text v-if="show">
<v-flex xs12 style="height:200px" fill-height>
@ -68,9 +75,10 @@
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")
}
},

View File

@ -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),

View File

@ -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)

View File

@ -5,33 +5,34 @@
<v-btn icon to="./"><v-icon>arrow_back</v-icon></v-btn>
<v-toolbar-title>{{ job }}</v-toolbar-title>
<v-btn
@click="stop()"
:disabled="finished"
>Stop</v-btn>
<v-btn
@click="getResult()"
:disabled="result || !finished"
>Result</v-btn>
<v-btn v-if="!finished" @click="stop()" :disabled="finished" >Stop</v-btn>
<v-btn v-if="finished && !result" @click="getResult()" :disabled="result || !finished">Result</v-btn>
<v-chip class="orange white--text">{{ jobstate.state }}</v-chip>
<v-chip label class="grey white--text"><v-icon class="red">lock</v-icon>{{ jobstate.writes }}</v-chip>
<v-chip label class="grey white--text"><v-icon class="amber">lock</v-icon>{{ jobstate.reads }}</v-chip>
<v-spacer></v-spacer>
<v-chip class="primary white--text">
<v-avatar>
<v-icon>account_circle</v-icon>
</v-avatar>
{{ jobstate.user }}</v-chip>
<v-chip class="primary white--text">{{ jobstate.duration }}</v-chip>
<v-spacer></v-spacer>
<v-chip class="green white--text">
<v-avatar ><v-icon>timer</v-icon></v-avatar>
{{ jobstate.duration }}</v-chip>
<v-btn light icon :loading="loading" @click="getJob()" :disabled="loading || finished">
<v-icon>refresh</v-icon>
</v-btn>
</v-toolbar>
<v-card-text v-if="result">
{{ result }}
</v-card-text>
<v-card-text>
<code>{{ jobstate.text }}</code>
</v-card-text>
</v-card>
</template>

View File

@ -47,6 +47,8 @@
<td class="vtop text-xs-right">{{ props.item.state }}</td>
<td class="vtop text-xs-right">{{ props.item.duration }}</td>
<td class="vtop text-xs-right">{{ props.item.type }}</td>
<td class="vtop text-xs-right">{{ props.item.writes }}</td>
<td class="vtop text-xs-right">{{ props.item.reads }}</td>
<td class="vtop text-xs-right">{{ props.item.user }}</td>
<td class="vtop"><code>{{ props.item.text }}</code></td>
</template>
@ -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' }
],

View File

@ -30,11 +30,11 @@ as element(json)
{
let $j:=jobs:list-details($job)
return <json type="object">
{j:job-json($j)}
{if($j) then j:job-json($j) else ()}
</json>
};
declare function j:job-json($j)
declare function j:job-json($j as element(job))
as element(*)*
{
<id>{$j/@id/string()}</id>
@ -43,4 +43,6 @@ as element(*)*
,<user>{$j/@user/string()}</user>
,<duration>{$j/@duration/string()}</duration>
,<text>{$j/string()}</text>
,<reads>{$j/@reads/string()}</reads>
,<writes>{$j/@writes/string()}</writes>
};

View File

@ -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:`
<a :href="href" :target="href"> {{href}}<v-icon>link</v-icon></a>
`,
@ -773,10 +773,17 @@ v0.0.3 </v-card-title> </v-card> </v-flex> <v-flex xs4="">
JobId:
<v-chip class="green white--text">{{jobId}}</v-chip>
<v-progress-circular v-if="waiting" indeterminate="" class="primary--text"></v-progress-circular>
Elapsed:
<v-chip class="green white--text">{{elapsed}}</v-chip>
<v-chip label="" class="grey white--text">
<v-avatar class="red"> <v-icon>lock</v-icon>W</v-avatar>
{{ jobState.writes }}</v-chip>
<v-chip label="" class="grey white--text">
<v-avatar class="amber"> <v-icon>lock</v-icon>R</v-avatar>
{{ jobState.reads }}</v-chip>
<v-spacer></v-spacer>
<v-btn flat="" class="green--text darken-1">@TODO</v-btn>
<v-chip class="green white--text">
<v-avatar> <v-icon>timer</v-icon></v-avatar>
{{elapsed}}ms</v-chip>
</v-card-actions>
<v-card-text v-if="show">
<v-flex xs12="" style="height:200px" fill-height="">
@ -798,9 +805,10 @@ v0.0.3 </v-card-title> </v-card> </v-flex> <v-flex xs4="">
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 </v-card-title> </v-card> </v-flex> <v-flex xs4="">
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 </v-card-title> </v-card> </v-flex> <v-flex xs4="">
})
},
imports(){
alert("imports")
alert("@TODO imports")
}
},
@ -1216,27 +1225,34 @@ body
<v-btn icon="" to="./"><v-icon>arrow_back</v-icon></v-btn>
<v-toolbar-title>{{ job }}</v-toolbar-title>
<v-btn @click="stop()" :disabled="finished">Stop</v-btn>
<v-btn @click="getResult()" :disabled="result || !finished">Result</v-btn>
<v-btn v-if="!finished" @click="stop()" :disabled="finished">Stop</v-btn>
<v-btn v-if="finished &amp;&amp; !result" @click="getResult()" :disabled="result || !finished">Result</v-btn>
<v-chip class="orange white--text">{{ jobstate.state }}</v-chip>
<v-chip label="" class="grey white--text"><v-icon class="red">lock</v-icon>{{ jobstate.writes }}</v-chip>
<v-chip label="" class="grey white--text"><v-icon class="amber">lock</v-icon>{{ jobstate.reads }}</v-chip>
<v-spacer></v-spacer>
<v-chip class="primary white--text">
<v-avatar>
<v-icon>account_circle</v-icon>
</v-avatar>
{{ jobstate.user }}</v-chip>
<v-chip class="primary white--text">{{ jobstate.duration }}</v-chip>
<v-spacer></v-spacer>
<v-chip class="green white--text">
<v-avatar><v-icon>timer</v-icon></v-avatar>
{{ jobstate.duration }}</v-chip>
<v-btn light="" icon="" :loading="loading" @click="getJob()" :disabled="loading || finished">
<v-icon>refresh</v-icon>
</v-btn>
</v-toolbar>
<v-card-text v-if="result">
{{ result }}
</v-card-text>
<v-card-text>
<code>{{ jobstate.text }}</code>
</v-card-text>
</v-card>
`,
@ -1303,6 +1319,8 @@ body
<td class="vtop text-xs-right">{{ props.item.state }}</td>
<td class="vtop text-xs-right">{{ props.item.duration }}</td>
<td class="vtop text-xs-right">{{ props.item.type }}</td>
<td class="vtop text-xs-right">{{ props.item.writes }}</td>
<td class="vtop text-xs-right">{{ props.item.reads }}</td>
<td class="vtop text-xs-right">{{ props.item.user }}</td>
<td class="vtop"><code>{{ props.item.text }}</code></td>
</template>
@ -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' }
],