From 6cb35796a8539f662cef80eaaf0546149e2f6845 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 3 Feb 2020 09:18:45 +0000 Subject: [PATCH] vuetify 2.2.8 --- src/vue-poc/app.vue | 1 + src/vue-poc/components/vp-paramform.vue | 11 +- src/vue-poc/core.js | 2 +- src/vue-poc/data/vue-poc/entities/logxml.xml | 10 +- src/vue-poc/features/about.vue | 10 + .../features/adminlog/basexlogdate.vue | 3 + .../features/adminlog/basexlogdate1.vue | 38 +-- src/vue-poc/features/adminlog/logs.xqm | 12 +- .../features/collection/collections.xqm | 8 +- .../features/components/components.xqm | 11 + src/vue-poc/features/components/markdown.vue | 84 +++++++ src/vue-poc/features/components/md-sample.md | 222 ++++++++++++++++++ src/vue-poc/features/edit/edit.md | 6 + src/vue-poc/features/edit/edit.vue | 4 +- src/vue-poc/features/edit/edit.xqm | 11 +- src/vue-poc/features/tasks/readme.md | 1 + src/vue-poc/features/tasks/task/log.enrich.xq | 43 ++++ src/vue-poc/features/tasks/taskdef.xml | 31 +-- src/vue-poc/features/tasks/tasks.vue | 4 +- src/vue-poc/lib/file.xqm | 2 + src/vue-poc/models.gen.xqm | 15 +- src/vue-poc/router.js | 4 +- src/vue-poc/static/app-gen.js | 154 ++++++++++-- src/vue-poc/static/app.html | 10 +- 24 files changed, 606 insertions(+), 91 deletions(-) create mode 100644 src/vue-poc/features/components/markdown.vue create mode 100644 src/vue-poc/features/components/md-sample.md create mode 100644 src/vue-poc/features/edit/edit.md create mode 100644 src/vue-poc/features/tasks/readme.md create mode 100644 src/vue-poc/features/tasks/task/log.enrich.xq diff --git a/src/vue-poc/app.vue b/src/vue-poc/app.vue index 4292a45..ac68c93 100644 --- a/src/vue-poc/app.vue +++ b/src/vue-poc/app.vue @@ -229,6 +229,7 @@ {href: '/labs/tree',text: 'Tree',icon: 'nature'}, {href: '/labs/tree2',text: 'Tree 2',icon: 'nature'}, {href: '/labs/websocket',text: 'Web socket',icon: 'swap_calls'}, + {href: '/labs/markdown',text: 'Markdown',icon: 'receipt'}, ]}, {href: '/settings',text: 'Settings',icon: 'settings' }, {href: '/about',text: 'About (v0.3.2)' , icon: 'help' }, diff --git a/src/vue-poc/components/vp-paramform.vue b/src/vue-poc/components/vp-paramform.vue index 6ad1d0c..f49e4dc 100644 --- a/src/vue-poc/components/vp-paramform.vue +++ b/src/vue-poc/components/vp-paramform.vue @@ -7,6 +7,10 @@ {{ description }} + + + history{{ name }} + @@ -37,7 +41,7 @@ -
{{ url }} {{ updating }}
+
- time of event - @date + time of event e.g "09:44:15.186" + @time + + + datetime of event + @start end time of event - self::*[@ms]!(xs:dateTime(@date)+ xs:dayTimeDuration("PT" || (@ms div 1000) || "S")) + @end IP address diff --git a/src/vue-poc/features/about.vue b/src/vue-poc/features/about.vue index e501054..7501a19 100644 --- a/src/vue-poc/features/about.vue +++ b/src/vue-poc/features/about.vue @@ -75,5 +75,15 @@ return { fab: false } + }, + methods:{ + refresh(){ + HTTP.get("package.json") + .then(r=>{ + console.log("status",r) + + //this.$forceUpdate() + }) + }, } } diff --git a/src/vue-poc/features/adminlog/basexlogdate.vue b/src/vue-poc/features/adminlog/basexlogdate.vue index bfc3915..66ca378 100644 --- a/src/vue-poc/features/adminlog/basexlogdate.vue +++ b/src/vue-poc/features/adminlog/basexlogdate.vue @@ -1,4 +1,7 @@ + - - - - + + + skip_previous + + + skip_next + + + + + fit refresh @@ -136,12 +139,14 @@ methods:{ //console.log("logxml",items) // {id: 4, content: 'item 4', start: '2014-04-16', end: '2014-04-19', type: 'point'} this.data=items.map(x=>Object.assign({}, x, - { start: x.time, + { content: x.text.split(";",1)[0], title: x.text, style: x.text.startsWith("[POST] ")?"background-color: red;": "background-color: yellow;", group: x.user} )) + this.loading=false + return; //https://stackoverflow.com/a/39637877/3210344 round(date, moment.duration(15, "minutes"), "ceil") var roundDate= function (date, duration, method) { return moment(Math[method]((+date) / (+duration)) * (+duration)); @@ -157,7 +162,7 @@ methods:{ this.options.start=start.toDate() this.options.end=start.add(this.query.window,"s").toDate() //console.log("data",this.data) - this.loading=false + }) } }, @@ -173,10 +178,13 @@ watch:{ } }, created(){ - console.log("logxml: ",this.$route.query) + this.query=Object.assign(this.query,this.$route.query) this.query.start=Number(this.query.start) this.query.limit=Number(this.query.limit) + console.log("basexlogdate1 query: ",this.$route.query) + var v= this.query.from.match(/^(?:(?:([01]?\d|2[0-3]):)?([0-5]?\d):)?([0-5]?\d)$/) + this.query.from= v? this.query.from : "00:00:00" this.getItems(); } } diff --git a/src/vue-poc/features/adminlog/logs.xqm b/src/vue-poc/features/adminlog/logs.xqm index 314a45b..c54e81d 100644 --- a/src/vue-poc/features/adminlog/logs.xqm +++ b/src/vue-poc/features/adminlog/logs.xqm @@ -24,18 +24,18 @@ as element(json) :) declare %rest:GET %rest:path("/vue-poc/api/logxml") -%rest:query-param("from", "{ $time }") +%rest:query-param("from", "{ $from }", "00:00:00") %rest:query-param("date", "{ $date }") %rest:query-param("window", "{ $window }") %output:method("json") -function j:archive( $date as xs:string,$time as xs:string,$window) +function j:archive( $date as xs:string,$from as xs:string,$window) as element(json) { - let $start:=xs:dateTime(concat($date,"T",$time)) + let $start:=xs:dateTime(concat($date,"T",$from))=>trace("archive") let $items:=db:open("vue-poc","/logs/")[contains(base-uri(),$date)]/entries/entry - let $items:=$items transform with { insert node attribute date { concat($date,'T',@time) } into .} - let $items:= if ($time) then $items[xs:dateTime(@date) ge $start] else $items - let $entity:=$entity:list("logxml") + + let $items:= if ($from) then $items[@time ge $from] else $items + let $entity:=$entity:list("logxml")=>prof:time("entity") return dice:response($items,$entity,web:dice()) }; diff --git a/src/vue-poc/features/collection/collections.xqm b/src/vue-poc/features/collection/collections.xqm index d123683..a3781b3 100644 --- a/src/vue-poc/features/collection/collections.xqm +++ b/src/vue-poc/features/collection/collections.xqm @@ -41,9 +41,11 @@ function vue-api:xqdoc( ) }; (:~ - : Returns folder info. - : @param $url location - : @param $protocol 'file' or 'xmldb' + : Returns contents of a collection. example calls + : /vue-poc/api/collection?url=/&protocol=xmldb + : /vue-poc/api/collection?url=/ + : @param $url collection identifier, a path + : @param $protocol 'webfile' or 'xmldb' :) declare %rest:GET %rest:path("/vue-poc/api/collection") diff --git a/src/vue-poc/features/components/components.xqm b/src/vue-poc/features/components/components.xqm index 08232db..946ab8b 100644 --- a/src/vue-poc/features/components/components.xqm +++ b/src/vue-poc/features/components/components.xqm @@ -43,3 +43,14 @@ return }; +(:~ + : sample markdown + :) +declare +%rest:GET %rest:path("/vue-poc/api/components/markdown") +function j:markdown() +as xs:string +{ +let $uri:=resolve-uri("md-sample.md",static-base-uri()) +return fn:unparsed-text($uri) +}; diff --git a/src/vue-poc/features/components/markdown.vue b/src/vue-poc/features/components/markdown.vue new file mode 100644 index 0000000..09b36f4 --- /dev/null +++ b/src/vue-poc/features/components/markdown.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/src/vue-poc/features/components/md-sample.md b/src/vue-poc/features/components/md-sample.md new file mode 100644 index 0000000..2c96ef9 --- /dev/null +++ b/src/vue-poc/features/components/md-sample.md @@ -0,0 +1,222 @@ +# h1 Heading 8-) +

h2 Heading by HTML

+## h2 Heading +### h3 Heading + +## Horizontal Rules + +___ + +--- + +*** + +## Typographic replacements + +Enable typographer option to see result. + +(c) (C) (r) (R) (tm) (TM) (p) (P) +- + +test.. test... test..... test?..... test!.... + +!!!!!! ???? ,, -- --- + +"Smartypants, double quotes" and 'single quotes' + + +## Emphasis + +**This is bold text** + +__This is bold text__ + +*This is italic text* + +_This is italic text_ + +~~Strikethrough~~ + + +## Blockquotes + + +> Blockquotes can also be nested... +>> ...by using additional greater-than signs right next to each other... +> > > ...or with spaces between arrows. + + +## Lists + +Unordered + ++ Create a list by starting a line with `+`, `-`, or `*` ++ Sub-lists are made by indenting 2 spaces: + - Marker character change forces new list start: + * Ac tristique libero volutpat at + + Facilisis in pretium nisl aliquet + - Nulla volutpat aliquam velit ++ Very easy! + +Ordered + +1. Lorem ipsum dolor sit amet +2. Consectetur adipiscing elit +3. Integer molestie lorem at massa + + +1. You can use sequential numbers... +1. ...or keep all the numbers as `1.` + +Start numbering with offset: + +57. foo +1. bar + + +## Code + +Inline `code` + +Indented code + + // Some comments + line 1 of code + line 2 of code + line 3 of code + + +Block code "fences" + +``` +Sample text here... +``` +Syntax highlighting + +``` javascript +var foo = function (bar) { + return bar++; +}; + +console.log(foo(5)); +``` + +``` go +package main + +import "fmt" + +func main() { + fmt.Println("Hello, world!") +} +``` + +## Tables + +| Option | Description | +| ------ | ----------- | +| data | path to data files to supply the data that will be passed into templates. | +| engine | engine to be used for processing templates. Handlebars is the default. | +| ext | extension to be used for dest files. | + +Right aligned columns + +| Option | Description | +| ------:| -----------:| +| data | path to data files to supply the data that will be passed into templates. | +| engine | engine to be used for processing templates. Handlebars is the default. | +| ext | extension to be used for dest files. | + +## Links + +[vue-markdown](https://github.com/miaolz123/vue-markdown) + +[link with title](https://github.com/miaolz123/vue-markdown "VueMarkdown") + +Autoconverted link https://github.com/miaolz123/vue-markdown (enable linkify to see) + + +## Images + +![Minion](dist/img/minion.png) + +Like links, Images also have a footnote style syntax + +![Alt text][id] + +With a reference later in the document defining the URL location: + +[id]: dist/img/minion.png "The Dojocat" + + +### Emojies + +> Classic markup: :wink: :cry: :laughing: :yum: +> +> Shortcuts (emoticons): :-) :-( 8-) ;) + + +### Subscript / Superscript + +- 19^th^ +- H~2~O + + +### \ + +++Inserted text++ + + +### \ + +==Marked text== + + +### Footnotes + +Footnote 1 link[^first]. + +Footnote 2 link[^second]. + +Inline footnote^[Text of inline footnote] definition. + +Duplicated footnote reference[^second]. + +[^first]: Footnote **can have markup** + + and multiple paragraphs. + +[^second]: Footnote text. + + +### Definition lists + +Term 1 + +: Definition 1 +with lazy continuation. + +Term 2 with *inline markup* + +: Definition 2 + + { some code, part of Definition 2 } + + Third paragraph of definition 2. + +_Compact style:_ + +Term 1 + ~ Definition 1 + +Term 2 + ~ Definition 2a + ~ Definition 2b + + +### Abbreviations + +This is HTML abbreviation example. + +It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on. + +*[HTML]: Hyper Text Markup Language \ No newline at end of file diff --git a/src/vue-poc/features/edit/edit.md b/src/vue-poc/features/edit/edit.md new file mode 100644 index 0000000..382d0da --- /dev/null +++ b/src/vue-poc/features/edit/edit.md @@ -0,0 +1,6 @@ +single editor + +/vue-poc/api/edit + +protocol: webfile +url: \ No newline at end of file diff --git a/src/vue-poc/features/edit/edit.vue b/src/vue-poc/features/edit/edit.vue index 052222f..602dbf3 100644 --- a/src/vue-poc/features/edit/edit.vue +++ b/src/vue-poc/features/edit/edit.vue @@ -119,14 +119,14 @@
- + settings Show ACE settings - + keyboard diff --git a/src/vue-poc/features/edit/edit.xqm b/src/vue-poc/features/edit/edit.xqm index 3bb079b..c8717a8 100644 --- a/src/vue-poc/features/edit/edit.xqm +++ b/src/vue-poc/features/edit/edit.xqm @@ -18,15 +18,18 @@ declare namespace c="http://www.w3.org/ns/xproc-step"; declare %rest:GET %rest:path("/vue-poc/api/edit") %rest:query-param("url", "{$url}") -%rest:query-param("protocol", "{$protocol}","webfile") %rest:produces("application/json") %output:method("json") -function vue-api:edit-get($url as xs:string,$protocol as xs:string) +function vue-api:edit-get($url as xs:string) { + let $a:=analyze-string($url,"^\w*:")=>trace("PROTO") + let $protocol:=$a/fn:match/string() + let $protocol:=if ($protocol) then $protocol else "webfile" let $reader := map{ - "webfile":vue-api:get-webfile#1, - "xmldb":vue-api:get-basexdb#1 + "webfile": vue-api:get-webfile#1, + "xmldb": vue-api:get-basexdb#1 } + let $reader:=trace($reader) return $reader($protocol)($url) }; diff --git a/src/vue-poc/features/tasks/readme.md b/src/vue-poc/features/tasks/readme.md new file mode 100644 index 0000000..cea8d94 --- /dev/null +++ b/src/vue-poc/features/tasks/readme.md @@ -0,0 +1 @@ +Tasks diff --git a/src/vue-poc/features/tasks/task/log.enrich.xq b/src/vue-poc/features/tasks/task/log.enrich.xq new file mode 100644 index 0000000..e7114c5 --- /dev/null +++ b/src/vue-poc/features/tasks/task/log.enrich.xq @@ -0,0 +1,43 @@ +(:~ +: log enrich +: @author andy bunce +: @todo +:) +declare %updating function local:enrich($doc as document-node()){ + let $date:=fn:analyze-string(db:path($doc),"(\d{4}-\d{2}-\d{2})")/fn:match/fn:group/string() + return + for $entry in $doc/entries/entry + return local:update-entry($entry,$date) +}; + +declare %updating function local:update-entry($entry,$date as xs:string){ + let $start :=xs:dateTime(concat($date,"T",$entry/@time)) + return ( + local:set-start($entry,$start), + if($entry/@ms) then + let $end:=$start+ xs:dayTimeDuration("PT" || ($entry/@ms div 1000) || "S") + return local:set-end($entry,$end) + else + delete node $entry/@end + ) +}; + +declare %updating function local:set-start($entry,$start as xs:dateTime) +{ + if($entry/@start) then + replace value of node $entry/@start with $start + else + insert node attribute start {$start} into $entry +}; + +declare %updating function local:set-end($entry,$end ) +{ + if($entry/@end) then + replace value of node $entry/@end with $end + else + insert node attribute end {$end} into $entry +}; + +db:open("vue-poc","/logs") +!local:enrich(.), +update:output("Done") \ No newline at end of file diff --git a/src/vue-poc/features/tasks/taskdef.xml b/src/vue-poc/features/tasks/taskdef.xml index 4584e8d..587accf 100644 --- a/src/vue-poc/features/tasks/taskdef.xml +++ b/src/vue-poc/features/tasks/taskdef.xml @@ -1,7 +1,7 @@ Generate model.gen.xqm - Generate model.gen.xqm + Generate model.gen.xqm from files in entity folder @@ -13,26 +13,21 @@ Import files into a database Load files into database - - XQdoc 2 - Generate xquery documentation for folder. Using standard task. + + + log enrich + logs - - - XQdoc rest2 - XQdoc.2.. - - - - XQdoc to static - Generate xquery documentation for folder to static folder - - vue compile compile + + Create xqDoc + xquery documentation + + application template application template @@ -40,10 +35,4 @@ Name for new application - - - Create xqDoc - xquery documentation - - diff --git a/src/vue-poc/features/tasks/tasks.vue b/src/vue-poc/features/tasks/tasks.vue index 9c20714..d89431f 100644 --- a/src/vue-poc/features/tasks/tasks.vue +++ b/src/vue-poc/features/tasks/tasks.vue @@ -31,8 +31,8 @@ :search="q" class="elevation-1" > -