From dff6a797479320d4f6a697b1fb9b5533c445dbe9 Mon Sep 17 00:00:00 2001 From: andy Date: Sun, 27 Aug 2017 11:43:08 +0100 Subject: [PATCH] timeline --- src/vue-poc/components/vis-time-line.vue | 16 +- src/vue-poc/features/images/config.xqm | 2 +- .../images/pics-01-store-directory.xq | 3 +- .../features/images/pics-02-store-meta.xq | 8 +- .../features/images/pics-03-store-image.xq | 4 +- .../features/images/pics-04-store-thumbs.xq | 4 +- .../features/images/pics-05-set-original.xq | 6 +- src/vue-poc/features/ping/ping.vue | 5 +- src/vue-poc/features/search.vue | 5 +- src/vue-poc/features/settings.vue | 76 ++++++++-- src/vue-poc/features/timeline.vue | 48 +++--- src/vue-poc/mimetypes.xml | 12 +- src/vue-poc/models/thumbnail.xml | 26 ++-- src/vue-poc/static/app-gen.js | 141 ++++++++++++------ src/vue-poc/static/perf-stat.js | 5 +- 15 files changed, 247 insertions(+), 114 deletions(-) diff --git a/src/vue-poc/components/vis-time-line.vue b/src/vue-poc/components/vis-time-line.vue index 0c2cd8f..45048a1 100644 --- a/src/vue-poc/components/vis-time-line.vue +++ b/src/vue-poc/components/vis-time-line.vue @@ -6,17 +6,25 @@ for vis-time-line
diff --git a/src/vue-poc/features/images/config.xqm b/src/vue-poc/features/images/config.xqm index 60ef33c..4de1a81 100644 --- a/src/vue-poc/features/images/config.xqm +++ b/src/vue-poc/features/images/config.xqm @@ -2,7 +2,7 @@ xquery version "3.1"; (:~ data locations for image feature :) module namespace cfg = "quodatum:media.image.configure"; -declare variable $cfg:DB-IMAGE:="vue-poc"; +declare variable $cfg:DB-IMAGE:="media-images"; declare variable $cfg:IMAGEDIR:="P:/pictures/Pictures/"; declare variable $cfg:THUMBDIR:="C:/tmp/"; diff --git a/src/vue-poc/features/images/pics-01-store-directory.xq b/src/vue-poc/features/images/pics-01-store-directory.xq index 7f0ba21..0ef1421 100644 --- a/src/vue-poc/features/images/pics-01-store-directory.xq +++ b/src/vue-poc/features/images/pics-01-store-directory.xq @@ -7,8 +7,9 @@ declare namespace c="http://www.w3.org/ns/xproc-step"; (: declare variable $DEST:="c:\tmp\pics2.xml"; :) declare variable $DEST:="/pics.xml"; + declare %updating function local:put($data,$path){ -db:replace("vue-poc",$path,$data) + db:replace($cfg:DB-IMAGE,$path,$data) }; let $opt:=map{"include-info":true()} 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 fef33db..04f2f2a 100644 --- a/src/vue-poc/features/images/pics-02-store-meta.xq +++ b/src/vue-poc/features/images/pics-02-store-meta.xq @@ -6,11 +6,11 @@ import module namespace cfg = "quodatum:media.image.configure" at "config.xqm"; import module namespace imgmeta = "expkg-zone58:image.metadata" ; 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/meta") -let $files:= doc("/vue-poc/pics.xml")//c:file[ends-with(lower-case(@name),".jpg")] +let $done:=uri-collection($cfg:DB-IMAGE || "/meta") +let $files:= doc($cfg:DB-IMAGE || "/pics.xml")//c:file[ends-with(lower-case(@name),".jpg")] let $relpath:= $files!( ancestor-or-self::*/@name=>string-join("/")) @@ -19,5 +19,5 @@ return (for $f in subsequence($todo,1, $CHUNK) let $spath:=$cfg:IMAGEDIR || "../" || $f let $dbpath:="meta/" || $f || "/meta.xml" let $meta:=imgmeta:read($spath) - return db:replace($DB,$dbpath,$meta), + return db:replace($cfg:DB-IMAGE,$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 1c7842c..83ec7d3 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/meta")/metadata +for $meta in collection($cfg:DB-IMAGE || "/meta")/metadata let $loc:=db:path($meta)=>tokenize("/") let $name:=$loc[count($loc)-1] let $path:= subsequence($loc,1,count($loc)-1)=>string-join("/") @@ -15,4 +15,4 @@ for $meta in collection("/vue-poc/meta")/metadata metadata:keywords($meta) } let $target:="image/"|| $path || "/image.xml" -return db:replace("vue-poc",$target,$image) \ No newline at end of file +return db:replace($cfg:DB-IMAGE,$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 34ec50c..7ea1d3c 100644 --- a/src/vue-poc/features/images/pics-04-store-thumbs.xq +++ b/src/vue-poc/features/images/pics-04-store-thumbs.xq @@ -5,7 +5,7 @@ import module namespace t="expkg-zone58:image.thumbnailator"; import module namespace cfg = "quodatum:media.image.configure" at "config.xqm"; declare namespace c="http://www.w3.org/ns/xproc-step"; -declare variable $DB:="vue-poc"; + declare variable $CHUNK:=1000; declare %updating function local:store-thumb($f as xs:string) @@ -30,7 +30,7 @@ declare %updating function local:write-binary($data,$url as xs:string) ) }; -let $files:= doc("/vue-poc/pics.xml")//c:file[ends-with(lower-case(@name),".jpg")] +let $files:= doc($cfg:DB-IMAGE || "/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){ 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 d5295ae..f4aa4d0 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,6 @@ -(: set original:) -for $i in collection("/vue-poc/image")/image +(:~ set original:) +import module namespace cfg = "quodatum:media.image.configure" at "config.xqm"; + +for $i in collection($cfg:DB-IMAGE || "/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/ping/ping.vue b/src/vue-poc/features/ping/ping.vue index dace44e..072e608 100644 --- a/src/vue-poc/features/ping/ping.vue +++ b/src/vue-poc/features/ping/ping.vue @@ -131,8 +131,9 @@ }) }, reset(){ - this.getValues.clear(); - this.postValues.clear(); + Object.assign(this.getValues,this.getValues.clear()); + Object.assign(this.postValues,this.postValues.clear()); + this.$forceUpdate() } }, computed: { diff --git a/src/vue-poc/features/search.vue b/src/vue-poc/features/search.vue index 733d175..41fe8a3 100644 --- a/src/vue-poc/features/search.vue +++ b/src/vue-poc/features/search.vue @@ -2,14 +2,15 @@ diff --git a/src/vue-poc/mimetypes.xml b/src/vue-poc/mimetypes.xml index 8224e5c..f196f45 100644 --- a/src/vue-poc/mimetypes.xml +++ b/src/vue-poc/mimetypes.xml @@ -1,7 +1,10 @@ - - - + + + + + + @@ -11,4 +14,7 @@ + + + \ No newline at end of file diff --git a/src/vue-poc/models/thumbnail.xml b/src/vue-poc/models/thumbnail.xml index fa4106c..369ea6f 100644 --- a/src/vue-poc/models/thumbnail.xml +++ b/src/vue-poc/models/thumbnail.xml @@ -1,29 +1,31 @@ an image. - + + - - Database Id. - db:node-id(.) - + + Database Id. + db:node-id(.) + File name. file/@name - File path. e.g. Pictures/2012/2012-06-23/skating.jpg - file/@path - + File path. e.g. Pictures/2012/2012-06-23/skating.jpg + + file/@path + file size. 0 - + - name - + name + + fa fa-file collection($cfg:DB-IMAGE || "/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 033d299..5005ea1 100644 --- a/src/vue-poc/static/app-gen.js +++ b/src/vue-poc/static/app-gen.js @@ -1,4 +1,4 @@ -// generated 2017-08-25T20:24:29.63+01:00 +// generated 2017-08-27T11:38:03.302+01:00 Vue.component('qd-link',{template:` {{href}}link `, @@ -94,18 +94,26 @@
`, - props: ['items', 'groups', 'options'], + props: ['items', 'groups', 'options','events'], + data(){ + return {timeline:Object} + }, methods:{ select(properties){ - //alert('selected items: ' + properties.items); + this.$emit('select',properties.items); } }, mounted: function () { var items = new vis.DataSet(this.items); var options = this.options; var groups = this.groups; - var timeline = new vis.Timeline(this.$el, items, groups, options); - timeline.on('select', this.select); + this.timeline = new vis.Timeline(this.$el, items, groups, options); + this.timeline.on('select', this.select); + if(this.events){ + this.events.$on('fit', (cmd) => { + this.timeline.fit(true) + }) + } } } ); @@ -1623,8 +1631,9 @@ body }) }, reset(){ - this.getValues.clear(); - this.postValues.clear(); + Object.assign(this.getValues,this.getValues.clear()); + Object.assign(this.postValues,this.postValues.clear()); + this.$forceUpdate() } }, computed: { @@ -1714,13 +1723,14 @@ body const Search=Vue.extend({template:` + TODO `, data: function(){ return { - message: 'Hello Vue.js!', - q:this.$route.query.q + q: this.$route.query.q, + results: [] } }, created:function(){ @@ -1878,7 +1888,7 @@ body - + Not fully implemented Ace editor settings @@ -1898,7 +1908,7 @@ body enableBasicAutocompletion - enableBasicAutocompletion + Autocompletion via control-space @@ -1908,11 +1918,42 @@ body enableLiveAutocompletion - enableLiveAutocompletion + Autocompletion while typing - + + + + + + + Theme + + + + + + + + Key binding + + + + + + + + + Font size + + + + + + + + @@ -1920,20 +1961,27 @@ body data () { return { - ace: { - enableSnippets: true, - enableBasicAutocompletion: true, - enableLiveAutocompletion: true - } - } + ace: { + enableSnippets: true, + enableBasicAutocompletion: true, + enableLiveAutocompletion: true, + theme: "github", + keybinding: "Ace", + fontsize: "14px" + + }, + keybindings:[ 'Ace', 'Vim', 'Emacs' ] + } }, - created: function () { + + beforeRouteEnter (to, from, next) { settings.getItem('settings/ace') .then((v)=>{ - console.log("AAAA",v) - this.ace=v + next(vm => vm.ace=v) }) - + }, + created: function () { + }, watch: {"ace":{ handler:function(v){ @@ -2308,17 +2356,20 @@ body const Timeline=Vue.extend({template:` - Line 1 + + Line 1 + + fit + - + - Line 2 - - - + + {{msg}} + `, @@ -2326,24 +2377,28 @@ body data(){ return { vueState: { - data1: [ { id: 1, content: 'item 1', start: '2013-04-20 23:06:15.304' }, - { id: 2, content: 'item 2', start: '2013-04-14' }, - { id: 3, content: 'item 3', start: '2013-04-18' }, + { id: 2, content: 'iso date time', start: '2013-04-14T11:11:15.304' }, + { id: 3, content: '[GET] http://localhost:8984/vue-poc/ui/icon.png', start: '2013-04-18', end: '2013-04-19' }, { id: 4, content: 'item 4', start: '2013-04-16', end: '2013-04-19' }, - { id: 5, content: 'item 5', start: '2013-04-25' }, - { id: 6, content: 'item 6', start: '2013-04-27' }], - - data2: [ - { id: 1, content: 'item 11', start: '2017-04-20' }, - { id: 2, content: 'item 12', start: '2017-04-14' }, - { id: 3, content: 'item 13', start: '2017-04-18' }, - { id: 4, content: 'item 14', start: '2017-04-16', end: '2017-04-19' }, - { id: 5, content: 'item 15', start: '2017-04-25' }, - { id: 6, content: 'item 16', start: '2017-04-27' }] + { id: 5, content: '[GET] http://localhost:8984/vue-poc/ui/app.css', start: '2013-04-25' }, + { id: 6, content: 'item 6', start: '2013-04-27' }] + }, + Events: new Vue({}), + msg:"Item detail" } -} +}, +methods:{ + fit(){ + this.Events.$emit('fit'); + }, + select(items){ + this.msg='Selected items: ' + items + } +}, +created(){ + console.log("timeline") } } ); diff --git a/src/vue-poc/static/perf-stat.js b/src/vue-poc/static/perf-stat.js index c2bab19..5947025 100644 --- a/src/vue-poc/static/perf-stat.js +++ b/src/vue-poc/static/perf-stat.js @@ -1,7 +1,7 @@ // performance monitoring. of value stream // stores max min etc function perfStat() { - this.data={count:0,max:null,min:null,total:0,median:0,last:null}; + this.data={count:0,max:null,min:null,total:0,median:0,last:null,avg:null}; // add a value return updated stats this.log=function(val){ var data=this.data @@ -28,7 +28,8 @@ function perfStat() { }; // clear stats this.clear=function(){ - this.data={count:0,max:null,min:null,total:0}; + this.data={count:0,max:null,min:null,total:0,median:0,last:null,avg:null}; + return this.data }; // return values this.values=function(){