diff --git a/src/vue-poc/app.vue b/src/vue-poc/app.vue index 9b14bef..ae381fe 100644 --- a/src/vue-poc/app.vue +++ b/src/vue-poc/app.vue @@ -168,18 +168,25 @@ {href: '/map',text: 'Map',icon: 'place'}, {href: '/images/report',text: 'Reports',icon: 'report'} ]}, + { + icon: 'format_list_bulleted', + text: 'Forms' , + model: false, + children: [ + + {href: '/form',text: 'Forms',icon: 'format_list_bulleted' }, + {href: '/form2',text: 'Forms 2',icon: 'format_list_bulleted' } + ]}, { icon: 'more_horiz', text: 'More' , model: false, children: [ + {href: '/tabs',text: 'Tabs',icon: 'switch_camera'}, {href: '/session',text: 'Session',icon: 'person'}, {href: '/select',text: 'Select',icon: 'extension'}, {href: '/puzzle',text: 'Puzzle',icon: 'extension'}, - {href: '/svg',text: 'SVG',icon: 'extension'}, - {href: '/form',text: 'Forms',icon: 'format_list_bulleted' }, - {href: '/form2',text: 'Forms 2',icon: 'format_list_bulleted' }, - {href: '/tabs',text: 'Tabs',icon: 'switch_camera'} + {href: '/svg',text: 'SVG',icon: 'extension'} ]}, {href: '/settings',text: 'Settings',icon: 'settings' }, diff --git a/src/vue-poc/app.xqm b/src/vue-poc/app.xqm index 44a93f4..2c81cc1 100644 --- a/src/vue-poc/app.xqm +++ b/src/vue-poc/app.xqm @@ -47,13 +47,24 @@ declare function vue-poc:get-file($file) { let $path := resolve-uri( 'static/' || $file,static-base-uri()) let $path:=if(file:exists($path))then $path else $vue-poc:index - return ( - web:response-header(map { 'media-type': web:content-type($path) }), + web:response-header(map { 'media-type': vue-poc:content-type($path) }), file:read-binary($path) ) }; +(:~ + : content type for path + :) +declare function vue-poc:content-type($path as xs:string) +as xs:string +{ + let $ct:=web:content-type($path) + return if($ct = "text/ecmascript") then "text/javascript" else $ct +}; + +(:~ unused + :) declare function vue-poc:get-filex($file) { let $path := resolve-uri( 'static/' || $file,static-base-uri()) diff --git a/src/vue-poc/components/qd-link.vue b/src/vue-poc/components/qd-link.vue index 322683d..69b6f71 100644 --- a/src/vue-poc/components/qd-link.vue +++ b/src/vue-poc/components/qd-link.vue @@ -3,7 +3,10 @@ simple link test component --> diff --git a/src/vue-poc/features/brutusin.vue b/src/vue-poc/features/form/brutusin.vue similarity index 84% rename from src/vue-poc/features/brutusin.vue rename to src/vue-poc/features/form/brutusin.vue index 936e4b2..38e0dcd 100644 --- a/src/vue-poc/features/brutusin.vue +++ b/src/vue-poc/features/form/brutusin.vue @@ -2,8 +2,22 @@ @@ -103,6 +117,11 @@ el.style.height=h +"px" } }, + filters: { + pretty: function(value) { + return JSON.stringify(value, null, 2); + } + }, created:function(){ console.log("form") } diff --git a/src/vue-poc/features/form/formschema.vue b/src/vue-poc/features/form/formschema.vue index 9abb8b1..874e05b 100644 --- a/src/vue-poc/features/form/formschema.vue +++ b/src/vue-poc/features/form/formschema.vue @@ -2,10 +2,12 @@ @@ -20,10 +22,11 @@ schema: { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", - "title": "Newsletter Subscription", + "title": "Sample form title", "properties": { "name": { - "type": "string", + "type": "string", + "title": "Name ", "minLength": 8, "maxLength": 80, "attrs": { @@ -32,7 +35,8 @@ } }, "email": { - "type": "string", + "type": "string", + "title": "Email label ", "maxLength": 120, "attrs": { "type": "email", @@ -41,10 +45,12 @@ }, "lists": { "type": "string", - "enum": ["Daily New", "Promotion"] + "title": "List label ", + "enum": ["Daily New", "Promotion", "Another"] }, "arrayInput": { "type": "array", + "title": "Array label ", "items": { "type": "string" } diff --git a/src/vue-poc/features/model/entity.vue b/src/vue-poc/features/model/entity.vue index f7fbd90..642f405 100644 --- a/src/vue-poc/features/model/entity.vue +++ b/src/vue-poc/features/model/entity.vue @@ -32,7 +32,7 @@ md4 lg3 > - + diff --git a/src/vue-poc/features/model/entity1.vue b/src/vue-poc/features/model/entity1.vue new file mode 100644 index 0000000..8ee3c2b --- /dev/null +++ b/src/vue-poc/features/model/entity1.vue @@ -0,0 +1,46 @@ + + + + diff --git a/src/vue-poc/features/namespace.vue b/src/vue-poc/features/namespace.vue index 0467ebc..a4f76e8 100644 --- a/src/vue-poc/features/namespace.vue +++ b/src/vue-poc/features/namespace.vue @@ -29,7 +29,7 @@ md4 lg3 > - + @@ -59,7 +59,12 @@ items: [], loading: false, q: "", - message: 'bad route!' + message: 'bad route!', + rowsPerPageItems: [4, 8, 20], + pagination: { + rowsPerPage: 20 + }, + selected:[] } }, methods: { diff --git a/src/vue-poc/features/ping/ping.vue b/src/vue-poc/features/ping/ping.vue index b07e4da..bf39d89 100644 --- a/src/vue-poc/features/ping/ping.vue +++ b/src/vue-poc/features/ping/ping.vue @@ -151,8 +151,15 @@ this.$forceUpdate() } }, - computed: { - + beforeRouteLeave(to, from, next){ + var on=this.repeat.get || this.repeat.post + + if (on) { + alert("running!") //<--undefined + return next(false) + } else { + return next() + } } } diff --git a/src/vue-poc/features/tabs.vue b/src/vue-poc/features/tabs.vue index c2b265f..dde2056 100644 --- a/src/vue-poc/features/tabs.vue +++ b/src/vue-poc/features/tabs.vue @@ -22,7 +22,7 @@ :key="i" :href="'#tab-' + i" > - favorite diff --git a/src/vue-poc/features/tasks/taskdef.xml b/src/vue-poc/features/tasks/taskdef.xml index cec07fa..bc5aa7f 100644 --- a/src/vue-poc/features/tasks/taskdef.xml +++ b/src/vue-poc/features/tasks/taskdef.xml @@ -11,12 +11,17 @@ + + Load files into database + Load files into database + + XQdoc Generate XQdoc as html - + XQdoc to db Generate XQdoc to save diff --git a/src/vue-poc/features/xqdoc/xqdoc.vue b/src/vue-poc/features/xqdoc/xqdoc.vue new file mode 100644 index 0000000..3a942f0 --- /dev/null +++ b/src/vue-poc/features/xqdoc/xqdoc.vue @@ -0,0 +1,73 @@ + + + + diff --git a/src/vue-poc/lib/dbtools.xqm b/src/vue-poc/lib/dbtools.xqm index 5a02ccf..c36c537 100644 --- a/src/vue-poc/lib/dbtools.xqm +++ b/src/vue-poc/lib/dbtools.xqm @@ -30,7 +30,10 @@ return $zip : @param $dbname name of database : @param $path file path contain files :) -declare %updating function dbtools:sync-from-path($dbname as xs:string,$path as xs:string){ +declare %updating function dbtools:sync-from-path( + $dbname as xs:string, + $path as xs:string) +{ dbtools:sync-from-files($dbname, $path, file:list($path,fn:true()), diff --git a/src/vue-poc/lib/vue-compile/html5parse.xqm b/src/vue-poc/lib/vue-compile/html5parse.xqm index c9f076e..9f208f5 100644 --- a/src/vue-poc/lib/vue-compile/html5parse.xqm +++ b/src/vue-poc/lib/vue-compile/html5parse.xqm @@ -1,4 +1,6 @@ - +(:~ + : wrapper for https://github.com/digitalfondue/jfiveparse A java html5 compliant parser + :) module namespace html5="text.html5"; declare namespace Document="java:ch.digitalfondue.jfiveparse.Document"; @@ -36,6 +38,23 @@ declare function html5:getElementFirstByTagName($doc,$tag as xs:string) =>list:get(xs:int(0)) }; +(:~ + : get attribute from node + :) +declare function html5:getAttribute($node,$atname as xs:string) +as xs:string +{ + Element:getAttribute($node,$atname) +}; + +(:~ + : get html from node + :) +declare function html5:getInnerHTML($node) +as xs:string +{ + Node:getInnerHTML($node) +}; (:~ : @return matcher for given element and attribute with value :) diff --git a/src/vue-poc/lib/vue-compile/vue-compile.xqm b/src/vue-poc/lib/vue-compile/vue-compile.xqm index 9cc39cd..2101897 100644 --- a/src/vue-poc/lib/vue-compile/vue-compile.xqm +++ b/src/vue-poc/lib/vue-compile/vue-compile.xqm @@ -6,9 +6,7 @@ module namespace vue = 'quodatum:vue.compile'; import module namespace html5="text.html5" at "html5parse.xqm"; import module namespace fw="quodatum:file.walker"; declare namespace c="http://www.w3.org/ns/xproc-step"; -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 namespace functx = "http://www.functx.com"; @@ -56,11 +54,11 @@ declare function vue:parse($doc) as map(*) { let $tempNode:= html5:getElementFirstByTagName($doc,"template") - let $template:= Node:getInnerHTML($tempNode) - let $id := Element:getAttribute($tempNode,"id")=>trace("ID") + let $template:= html5:getInnerHTML($tempNode) + let $id := html5:getAttribute($tempNode,"id")=>trace("ID") let $script:= html5:getElementFirstByTagName($doc,"script") - let $script:= Node:getInnerHTML($script) + let $script:= html5:getInnerHTML($script) return map{"id":$id,"template":$template,"script":$script} }; diff --git a/src/vue-poc/models.gen.xqm b/src/vue-poc/models.gen.xqm index 6640022..30d789e 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: 2018-03-01T21:54:58.72Z + : auto generated from xml files in entities folder at: 2018-03-12T22:33:57.01Z :) module namespace entity = 'quodatum.models.generated'; @@ -219,6 +219,50 @@ declare variable $entity:list:=map { "views": map{ + } + }, + "jobrun": map{ + "name": "jobrun", + "description": "About the running of a job", + "access": map{ + "created": function($_ as element()) as xs:string {$_/json/dateTime }, + "id": function($_ as element()) as xs:string {$_/@id }, + "query": function($_ as element()) as xs:string {$_/query }, + "result": function($_ as element()) as xs:string {$_/substring(result,0,1000) }, + "resultlength": function($_ as element()) as xs:integer {$_/string-length(result) } }, + + "filter": function($item,$q) as xs:boolean{ + some $e in ( ) satisfies + fn:contains($e,$q, 'http://www.w3.org/2005/xpath-functions/collation/html-ascii-case-insensitive') + }, + "json": map{ + "created": function($_ as element()) as element(created)? { + (: xs:string :) + fn:data($_/json/dateTime)!element created { .} + }, + "id": function($_ as element()) as element(id)? { + (: xs:string :) + fn:data($_/@id)!element id { .} + }, + "query": function($_ as element()) as element(query)? { + (: xs:string :) + fn:data($_/query)!element query { .} + }, + "result": function($_ as element()) as element(result)? { + (: xs:string :) + fn:data($_/substring(result,0,1000))!element result { .} + }, + "resultlength": function($_ as element()) as element(resultlength)? { + (: xs:integer :) + fn:data($_/string-length(result))!element resultlength { attribute type {'number'}, .} + } }, + + "data": function() as element(jobrun)* + { collection("vue-poc/jobrun")/jobrun + }, + + "views": map{ + 'filter': 'name description' } }, "namespace": map{ @@ -335,50 +379,6 @@ declare variable $entity:list:=map { "views": map{ - } - }, - "task": map{ - "name": "task", - "description": "A task", - "access": map{ - "created": function($_ as element()) as xs:string {$_/json/dateTime }, - "id": function($_ as element()) as xs:string {$_/@id }, - "query": function($_ as element()) as xs:string {$_/query }, - "result": function($_ as element()) as xs:string {$_/substring(result,0,1000) }, - "resultlength": function($_ as element()) as xs:integer {$_/string-length(result) } }, - - "filter": function($item,$q) as xs:boolean{ - some $e in ( ) satisfies - fn:contains($e,$q, 'http://www.w3.org/2005/xpath-functions/collation/html-ascii-case-insensitive') - }, - "json": map{ - "created": function($_ as element()) as element(created)? { - (: xs:string :) - fn:data($_/json/dateTime)!element created { .} - }, - "id": function($_ as element()) as element(id)? { - (: xs:string :) - fn:data($_/@id)!element id { .} - }, - "query": function($_ as element()) as element(query)? { - (: xs:string :) - fn:data($_/query)!element query { .} - }, - "result": function($_ as element()) as element(result)? { - (: xs:string :) - fn:data($_/substring(result,0,1000))!element result { .} - }, - "resultlength": function($_ as element()) as element(resultlength)? { - (: xs:integer :) - fn:data($_/string-length(result))!element resultlength { attribute type {'number'}, .} - } }, - - "data": function() as element(task)* - { collection("vue-poc/tasks")/task - }, - - "views": map{ - 'filter': 'name description' } }, "thumbnail": map{ @@ -437,6 +437,34 @@ declare variable $entity:list:=map { "views": map{ 'filter': 'name' + } + }, + "user": map{ + "name": "user", + "description": "users ", + "access": map{ + "name": function($_ as element()) as xs:string {$_/@name }, + "permission": function($_ as element()) as xs:string {$_/@permission } }, + + "filter": function($item,$q) as xs:boolean{ + some $e in ( ) satisfies + fn:contains($e,$q, 'http://www.w3.org/2005/xpath-functions/collation/html-ascii-case-insensitive') + }, + "json": map{ + "name": function($_ as element()) as element(name)? { + (: xs:string :) + fn:data($_/@name)!element name { .} + }, + "permission": function($_ as element()) as element(permission)? { + (: xs:string :) + fn:data($_/@permission)!element permission { .} + } }, + + "data": function() as element(user)* + { user:list-details() }, + + "views": map{ + } }, "xqdoc": map{ diff --git a/src/vue-poc/models/task.xml b/src/vue-poc/models/jobrun.xml similarity index 82% rename from src/vue-poc/models/task.xml rename to src/vue-poc/models/jobrun.xml index 0bde0bf..9fe6b82 100644 --- a/src/vue-poc/models/task.xml +++ b/src/vue-poc/models/jobrun.xml @@ -1,5 +1,5 @@ - - A task + + About the running of a job @@ -28,6 +28,6 @@ name description fa fa-file-code-o - collection("vue-poc/tasks")/task + collection("vue-poc/jobrun")/jobrun \ No newline at end of file diff --git a/src/vue-poc/models/users.xml b/src/vue-poc/models/users.xml new file mode 100644 index 0000000..48817ec --- /dev/null +++ b/src/vue-poc/models/users.xml @@ -0,0 +1,18 @@ + + users + + + + user name + @name + + + user permission + @permission + + + + + fa fa-calendar + user:list-details() + \ No newline at end of file diff --git a/src/vue-poc/router.js b/src/vue-poc/router.js index 554ab4b..2dec809 100644 --- a/src/vue-poc/router.js +++ b/src/vue-poc/router.js @@ -27,7 +27,10 @@ const router = new VueRouter({ { path: '/images/people', component: People, meta:{title:"Image people"} }, { path: '/documentation', component: Documentation, meta:{title:"documentation"} }, + { path: '/entity', component: Entity, meta:{title:"Entities"} }, + { path: '/entity/:entity', name:"entity1", component: Entity1, props: true, meta:{title:"Entity"} }, + { path: '/namespace', component: Namespace, meta:{title:"Namespaces"} }, { path: '/select', component: Select, meta:{title:"Select"} }, { path: '/search', component: Search, meta:{title:"Search"} }, @@ -47,15 +50,21 @@ const router = new VueRouter({ /* { path: '/svg2', component: Svg2, meta:{title:"SVG2"} }, */ { path: '/transform', component: Transform, meta:{title:"XSLT2 Transform"} }, { path: '/validate', component: Validate, meta:{title:"Validate"} }, + { path: '/eval', component: Eval, meta:{title:"Evaluate XQuery"} }, + { path: '/eval/:id', component: Evalid, props: true, meta:{title:"Run details"} }, + { path: '/logs', component: Log, meta:{title:"Server logs"} }, + { path: '/tasks', component: Task, meta:{title:"Runnable tasks"} }, { path: '/tasks/model', component: Model, meta:{title:"build model"} }, { path: '/tasks/xqdoc', component: Xqdoc, meta:{title:"build xqdoc"} }, { path: '/tasks/vuecompile', component: Vuecompile, meta:{title:"vue compile"} }, { path: '/tasks/:task', component: Runtask, props: true, meta:{title:"Run task"} }, + { path: '/jobs', component: Jobs, meta:{title:"Jobs running"} }, { path: '/jobs/:job', name:"jobShow", component: Job, props: true, meta:{title:"Job Status"} }, + { path: '/timeline', component: Timeline,meta:{title:"timeline"} }, { path: '/map', component: Map,meta:{title:"map"} }, { path: '/form', component: Brutusin, meta:{title:"Form demo"} }, diff --git a/src/vue-poc/static/app-gen.js b/src/vue-poc/static/app-gen.js index 1a32610..ac92961 100644 --- a/src/vue-poc/static/app-gen.js +++ b/src/vue-poc/static/app-gen.js @@ -1,4 +1,4 @@ -// generated 2018-03-04T18:03:42.736Z +// generated 2018-03-13T22:19:53.996Z // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-confirm.vue Vue.component('qd-confirm',{template:` @@ -50,7 +50,10 @@ Vue.component('qd-fullscreen',{template:` // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-link.vue Vue.component('qd-link',{template:` - {{href}}link + + link + {{href}} + `, props: ['href'], @@ -767,117 +770,6 @@ const Log=Vue.extend({template:` ); -// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/brutusin.vue -const Brutusin=Vue.extend({template:` - - - vue-form-generator - - - - `, - - components: { - "vue-form-generator": VueFormGenerator.component - }, - data() { - return { - model: { - id: 1, - name: "John Doe", - password: "J0hnD03!x4", - age: 35, - skills: ["Javascript", "VueJS"], - email: "john.doe@gmail.com", - status: true - }, - schema: { - fields: [{ - type: "input", - inputType: "text", - label: "ID", - model: "id", - readonly: true, - featured: false, - disabled: true - }, { - type: "input", - inputType: "text", - label: "Name", - model: "name", - readonly: false, - featured: true, - required: true, - disabled: false, - placeholder: "User's name", - validator: VueFormGenerator.validators.string - }, { - type: "input", - inputType: "password", - label: "Password", - model: "password", - min: 6, - required: true, - hint: "Minimum 6 characters", - validator: VueFormGenerator.validators.string - }, { - type: "input", - inputType: "number", - label: "Age", - model: "age", - min: 18, - validator: VueFormGenerator.validators.number - }, { - type: "input", - inputType: "email", - label: "E-mail", - model: "email", - placeholder: "User's e-mail address", - validator: VueFormGenerator.validators.email - }, { - type: "checklist", - label: "Skills", - model: "skills", - multi: true, - required: true, - multiSelect: true, - values: ["HTML5", "Javascript", "CSS3", "CoffeeScript", "AngularJS", "ReactJS", "VueJS"] - }, { - type: "switch", - label: "Status", - model: "status", - multi: true, - readonly: false, - featured: false, - disabled: false, - default: true, - textOn: "Active", - textOff: "Inactive" - }] - }, - - formOptions: { - validateAfterLoad: true, - validateAfterChanged: true - } - }; - }, - methods:{ - onResize(){ - var el=this.$refs["page"] - console.log("top",el.offsetTop) - var h=Math.max(1,window.innerHeight - el.offsetTop)-60 - console.log("h",h) - el.style.height=h +"px" - } - }, - created:function(){ - console.log("form") - } -} - - ); - // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/collection/files.vue const Files=Vue.extend({template:` @@ -1748,14 +1640,165 @@ const Eval=Vue.extend({template:` ); +// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/eval/evalid.vue +const Evalid=Vue.extend({template:` + + todo {{id}} + + `, + + props:["id"], + data: function(){ + return { + xq: '(: type your XQuery :)\n' + + } + } + +} + + ); + +// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/form/brutusin.vue +const Brutusin=Vue.extend({template:` + + + vue-form-generator@2.2.1 + + + + + + + + + + +
{{ model | pretty }}
+
+
+
+
+
+
+ `, + + components: { + "vue-form-generator": VueFormGenerator.component + }, + data() { + return { + model: { + id: 1, + name: "John Doe", + password: "J0hnD03!x4", + age: 35, + skills: ["Javascript", "VueJS"], + email: "john.doe@gmail.com", + status: true + }, + schema: { + fields: [{ + type: "input", + inputType: "text", + label: "ID", + model: "id", + readonly: true, + featured: false, + disabled: true + }, { + type: "input", + inputType: "text", + label: "Name", + model: "name", + readonly: false, + featured: true, + required: true, + disabled: false, + placeholder: "User's name", + validator: VueFormGenerator.validators.string + }, { + type: "input", + inputType: "password", + label: "Password", + model: "password", + min: 6, + required: true, + hint: "Minimum 6 characters", + validator: VueFormGenerator.validators.string + }, { + type: "input", + inputType: "number", + label: "Age", + model: "age", + min: 18, + validator: VueFormGenerator.validators.number + }, { + type: "input", + inputType: "email", + label: "E-mail", + model: "email", + placeholder: "User's e-mail address", + validator: VueFormGenerator.validators.email + }, { + type: "checklist", + label: "Skills", + model: "skills", + multi: true, + required: true, + multiSelect: true, + values: ["HTML5", "Javascript", "CSS3", "CoffeeScript", "AngularJS", "ReactJS", "VueJS"] + }, { + type: "switch", + label: "Status", + model: "status", + multi: true, + readonly: false, + featured: false, + disabled: false, + default: true, + textOn: "Active", + textOff: "Inactive" + }] + }, + + formOptions: { + validateAfterLoad: true, + validateAfterChanged: true + } + }; + }, + methods:{ + onResize(){ + var el=this.$refs["page"] + console.log("top",el.offsetTop) + var h=Math.max(1,window.innerHeight - el.offsetTop)-60 + console.log("h",h) + el.style.height=h +"px" + } + }, + filters: { + pretty: function(value) { + return JSON.stringify(value, null, 2); + } + }, + created:function(){ + console.log("form") + } +} + + ); + // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/form/formschema.vue const Formsjson=Vue.extend({template:` - vue-json-schema@1.1.0 https://github.com/formschema/native - - Subscribe + vue-json-schema@1.1.0 + + + Send + `, @@ -1769,10 +1812,11 @@ const Formsjson=Vue.extend({template:` schema: { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", - "title": "Newsletter Subscription", + "title": "Sample form title", "properties": { "name": { - "type": "string", + "type": "string", + "title": "Name ", "minLength": 8, "maxLength": 80, "attrs": { @@ -1781,7 +1825,8 @@ const Formsjson=Vue.extend({template:` } }, "email": { - "type": "string", + "type": "string", + "title": "Email label ", "maxLength": 120, "attrs": { "type": "email", @@ -1790,10 +1835,12 @@ const Formsjson=Vue.extend({template:` }, "lists": { "type": "string", - "enum": ["Daily New", "Promotion"] + "title": "List label ", + "enum": ["Daily New", "Promotion", "Another"] }, "arrayInput": { "type": "array", + "title": "Array label ", "items": { "type": "string" } @@ -2733,7 +2780,7 @@ const Entity=Vue.extend({template:` - + @@ -2789,6 +2836,50 @@ const Entity=Vue.extend({template:` ); +// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/model/entity1.vue +const Entity1=Vue.extend({template:` + + + Entity: {{ entity }} + + Refresh + + + + + + hello + + + `, + + props: ['entity'], + data: function(){ + return { + q: 'filter', + item: {}, + loading: false + } + }, + methods:{ + getItem(){ + this.loading=true + HTTP.get("data/entity",{params:this.q}) + .then(r=>{ + this.loading=false + //console.log(r.data) + //var items=r.data.items.filter(item=>{return item.text!="[GET] http://localhost:8984/vue-poc/api/log"}) + this.item=r.data.items + }) + } + }, + created:function(){ + this.getItem() + }, +} + + ); + // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/namespace.vue const Namespace=Vue.extend({template:` @@ -2800,7 +2891,7 @@ const Namespace=Vue.extend({template:` - + @@ -2829,7 +2920,12 @@ const Namespace=Vue.extend({template:` items: [], loading: false, q: "", - message: 'bad route!' + message: 'bad route!', + rowsPerPageItems: [4, 8, 20], + pagination: { + rowsPerPage: 20 + }, + selected:[] } }, methods: { @@ -3011,8 +3107,15 @@ const Ping=Vue.extend({template:` this.$forceUpdate() } }, - computed: { - + beforeRouteLeave(to, from, next){ + var on=this.repeat.get || this.repeat.post + + if (on) { + alert("running!") //<--undefined + return next(false) + } else { + return next() + } } } @@ -3619,7 +3722,7 @@ const Tabs=Vue.extend({template:` - + favorite {{ i }} @@ -4252,6 +4355,78 @@ const Validate=Vue.extend({template:` ); +// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/xqdoc/xqdoc.vue +const Xqdoc2=Vue.extend({template:` + + + + play_circle_outlinexqdoc + ms. Height: + + + + + settings + + + Settings................ + + + stuff + + + + + + here + + + + `, + + data: function(){ + return { + loading: false, + elapsed: null, + height: null, + result: null, + doc: "c:/test.xml", + schema: "c:/schema.xsd" + } + }, + methods:{ + onResize(){ + this.height = window.innerHeight + }, + validate(){ + + this.loading=true + this.start = performance.now(); + HTTPNE.get("validate",Qs.stringify({doc: this.doc, schema: this.schema})) + .then(r=>{ + console.log(r) + this.elapsed=Math.floor(performance.now() - this.start); + this.loading=false + if(r.data.rc==0){ + this.result=r.data.result + }else{ + this.result=r.data.info + } + }) + .catch(r=> { + console.log("error",r) + this.result=r.message + ": "+ r.config.url + "\n"+ r.response.data + this.loading=false + }); + }, + }, + created:function(){ + console.log("notfound",this.$route.query.q) + } +} + + ); + // src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/xslt/transform.vue const Transform=Vue.extend({template:` @@ -4409,7 +4584,10 @@ const router = new VueRouter({ { path: '/images/people', component: People, meta:{title:"Image people"} }, { path: '/documentation', component: Documentation, meta:{title:"documentation"} }, + { path: '/entity', component: Entity, meta:{title:"Entities"} }, + { path: '/entity/:entity', name:"entity1", component: Entity1, props: true, meta:{title:"Entity"} }, + { path: '/namespace', component: Namespace, meta:{title:"Namespaces"} }, { path: '/select', component: Select, meta:{title:"Select"} }, { path: '/search', component: Search, meta:{title:"Search"} }, @@ -4429,15 +4607,21 @@ const router = new VueRouter({ /* { path: '/svg2', component: Svg2, meta:{title:"SVG2"} }, */ { path: '/transform', component: Transform, meta:{title:"XSLT2 Transform"} }, { path: '/validate', component: Validate, meta:{title:"Validate"} }, + { path: '/eval', component: Eval, meta:{title:"Evaluate XQuery"} }, + { path: '/eval/:id', component: Evalid, props: true, meta:{title:"Run details"} }, + { path: '/logs', component: Log, meta:{title:"Server logs"} }, + { path: '/tasks', component: Task, meta:{title:"Runnable tasks"} }, { path: '/tasks/model', component: Model, meta:{title:"build model"} }, { path: '/tasks/xqdoc', component: Xqdoc, meta:{title:"build xqdoc"} }, { path: '/tasks/vuecompile', component: Vuecompile, meta:{title:"vue compile"} }, { path: '/tasks/:task', component: Runtask, props: true, meta:{title:"Run task"} }, + { path: '/jobs', component: Jobs, meta:{title:"Jobs running"} }, { path: '/jobs/:job', name:"jobShow", component: Job, props: true, meta:{title:"Job Status"} }, + { path: '/timeline', component: Timeline,meta:{title:"timeline"} }, { path: '/map', component: Map,meta:{title:"map"} }, { path: '/form', component: Brutusin, meta:{title:"Form demo"} }, @@ -4628,18 +4812,25 @@ const Vuepoc=Vue.extend({template:` {href: '/map',text: 'Map',icon: 'place'}, {href: '/images/report',text: 'Reports',icon: 'report'} ]}, + { + icon: 'format_list_bulleted', + text: 'Forms' , + model: false, + children: [ + + {href: '/form',text: 'Forms',icon: 'format_list_bulleted' }, + {href: '/form2',text: 'Forms 2',icon: 'format_list_bulleted' } + ]}, { icon: 'more_horiz', text: 'More' , model: false, children: [ + {href: '/tabs',text: 'Tabs',icon: 'switch_camera'}, {href: '/session',text: 'Session',icon: 'person'}, {href: '/select',text: 'Select',icon: 'extension'}, {href: '/puzzle',text: 'Puzzle',icon: 'extension'}, - {href: '/svg',text: 'SVG',icon: 'extension'}, - {href: '/form',text: 'Forms',icon: 'format_list_bulleted' }, - {href: '/form2',text: 'Forms 2',icon: 'format_list_bulleted' }, - {href: '/tabs',text: 'Tabs',icon: 'switch_camera'} + {href: '/svg',text: 'SVG',icon: 'extension'} ]}, {href: '/settings',text: 'Settings',icon: 'settings' }, @@ -4834,6 +5025,7 @@ var settings = { if (this.debug) console.log('getItem',key); return localforage.getItem(key) .then(value => { + value=value?value:this.defaults[key]; //console.log('GET setting', key,value); return value; diff --git a/src/vue-poc/static/app.html b/src/vue-poc/static/app.html index 1b41e2e..ba6e3ea 100644 --- a/src/vue-poc/static/app.html +++ b/src/vue-poc/static/app.html @@ -9,19 +9,19 @@ Vue Router Test - - + + - + - +
-

vue-poc (v0.3.1)

+

vue-poc (v0.3.2)

@@ -33,26 +33,32 @@
- - - - - - - - - - - - - - + + + + + + + + + + + + + + - - + + + \ No newline at end of file diff --git a/src/vue-poc/static/serviceworker.js b/src/vue-poc/static/serviceworker.js new file mode 100644 index 0000000..8ebbd0b --- /dev/null +++ b/src/vue-poc/static/serviceworker.js @@ -0,0 +1,199 @@ +"use strict"; + +console.log('WORKER: executing.'); + +/* A version number is useful when updating the worker logic, + allowing you to remove outdated cache entries during the update. +*/ +var version = 'v1::'; + +/* These resources will be downloaded and cached by the service worker + during the installation process. If any resource fails to be downloaded, + then the service worker won't be installed either. +*/ +var offlineFundamentals = [ + '', + 'prof-stat.js', + '//cdnjs.cloudflare.com/ajax/libs/vue/2.5.13/vue.js' +]; + +/* The install event fires when the service worker is first installed. + You can use this event to prepare the service worker to be able to serve + files while visitors are offline. +*/ +self.addEventListener("install", function(event) { + console.log('WORKER: install event in progress.'); + /* Using event.waitUntil(p) blocks the installation process on the provided + promise. If the promise is rejected, the service worker won't be installed. + */ + event.waitUntil( + /* The caches built-in is a promise-based API that helps you cache responses, + as well as finding and deleting them. + */ + caches + /* You can open a cache by name, and this method returns a promise. We use + a versioned cache name here so that we can remove old cache entries in + one fell swoop later, when phasing out an older service worker. + */ + .open(version + 'fundamentals') + .then(function(cache) { + /* After the cache is opened, we can fill it with the offline fundamentals. + The method below will add all resources in `offlineFundamentals` to the + cache, after making requests for them. + */ + return cache.addAll(offlineFundamentals); + }) + .then(function() { + console.log('WORKER: install completed'); + }) + ); +}); + +/* The fetch event fires whenever a page controlled by this service worker requests + a resource. This isn't limited to `fetch` or even XMLHttpRequest. Instead, it + comprehends even the request for the HTML page on first load, as well as JS and + CSS resources, fonts, any images, etc. +*/ +self.addEventListener("fetch", function(event) { + console.log('WORKER: fetch event in progress.'); + + /* We should only cache GET requests, and deal with the rest of method in the + client-side, by handling failed POST,PUT,PATCH,etc. requests. + */ + if (event.request.method !== 'GET') { + /* If we don't block the event as shown below, then the request will go to + the network as usual. + */ + console.log('WORKER: fetch event ignored.', event.request.method, event.request.url); + return; + } + /* Similar to event.waitUntil in that it blocks the fetch event on a promise. + Fulfillment result will be used as the response, and rejection will end in a + HTTP response indicating failure. + */ + event.respondWith( + caches + /* This method returns a promise that resolves to a cache entry matching + the request. Once the promise is settled, we can then provide a response + to the fetch request. + */ + .match(event.request) + .then(function(cached) { + /* Even if the response is in our cache, we go to the network as well. + This pattern is known for producing "eventually fresh" responses, + where we return cached responses immediately, and meanwhile pull + a network response and store that in the cache. + + Read more: + https://ponyfoo.com/articles/progressive-networking-serviceworker + */ + var networked = fetch(event.request) + // We handle the network request with success and failure scenarios. + .then(fetchedFromNetwork, unableToResolve) + // We should catch errors on the fetchedFromNetwork handler as well. + .catch(unableToResolve); + + /* We return the cached response immediately if there is one, and fall + back to waiting on the network as usual. + */ + console.log('WORKER: fetch event', cached ? '(cached)' : '(network)', event.request.url); + return cached || networked; + + function fetchedFromNetwork(response) { + /* We copy the response before replying to the network request. + This is the response that will be stored on the ServiceWorker cache. + */ + var cacheCopy = response.clone(); + + console.log('WORKER: fetch response from network.', event.request.url); + + caches + // We open a cache to store the response for this request. + .open(version + 'pages') + .then(function add(cache) { + /* We store the response for this request. It'll later become + available to caches.match(event.request) calls, when looking + for cached responses. + */ + return cache.put(event.request, cacheCopy); + }) + .then(function() { + console.log('WORKER: fetch response stored in cache.', event.request.url); + }); + + // Return the response so that the promise is settled in fulfillment. + return response; + } + + /* When this method is called, it means we were unable to produce a response + from either the cache or the network. This is our opportunity to produce + a meaningful response even when all else fails. It's the last chance, so + you probably want to display a "Service Unavailable" view or a generic + error response. + */ + function unableToResolve () { + /* There's a couple of things we can do here. + - Test the Accept header and then return one of the `offlineFundamentals` + e.g: `return caches.match('/some/cached/image.png')` + - You should also consider the origin. It's easier to decide what + "unavailable" means for requests against your origins than for requests + against a third party, such as an ad provider. + - Generate a Response programmaticaly, as shown below, and return that. + */ + + console.log('WORKER: fetch request failed in both cache and network.'); + + /* Here we're creating a response programmatically. The first parameter is the + response body, and the second one defines the options for the response. + */ + return new Response('

Service Unavailable

', { + status: 503, + statusText: 'Service Unavailable', + headers: new Headers({ + 'Content-Type': 'text/html' + }) + }); + } + }) + ); +}); + +/* The activate event fires after a service worker has been successfully installed. + It is most useful when phasing out an older version of a service worker, as at + this point you know that the new worker was installed correctly. In this example, + we delete old caches that don't match the version in the worker we just finished + installing. +*/ +self.addEventListener("activate", function(event) { + /* Just like with the install event, event.waitUntil blocks activate on a promise. + Activation will fail unless the promise is fulfilled. + */ + console.log('WORKER: activate event in progress.'); + + event.waitUntil( + caches + /* This method returns a promise which will resolve to an array of available + cache keys. + */ + .keys() + .then(function (keys) { + // We return a promise that settles when all outdated caches are deleted. + return Promise.all( + keys + .filter(function (key) { + // Filter by keys that don't start with the latest version prefix. + return !key.startsWith(version); + }) + .map(function (key) { + /* Return a promise that's fulfilled + when each outdated cache is deleted. + */ + return caches.delete(key); + }) + ); + }) + .then(function() { + console.log('WORKER: activate completed.'); + }) + ); +});