diff --git a/src/vue-poc/lib/cons.xqm b/src/vue-poc/lib/cons.xqm new file mode 100644 index 0000000..48f5239 --- /dev/null +++ b/src/vue-poc/lib/cons.xqm @@ -0,0 +1,87 @@ +(:~ + : Global constants and functions. + : + : @author Christian Grün, BaseX Team, 2014-16 + :) +module namespace cons = 'vue-poc/cons'; + +import module namespace Request = 'http://exquery.org/ns/request'; +import module namespace Session = 'http://basex.org/modules/session'; + +(:~ Session key. :) +declare variable $cons:SESSION-KEY := "vue-poc"; +(:~ Current session. :) +declare variable $cons:SESSION-VALUE := Session:get($cons:SESSION-KEY); + +(:~ Directory for DBA files. :) +declare variable $cons:DBA-DIR := file:temp-dir() || 'vue-poc/'; +(:~ Configuration file. :) +declare variable $cons:DBA-SETTINGS-FILE := $cons:DBA-DIR || 'poc-settings.xml'; + +(:~ Permissions. :) +declare variable $cons:PERMISSIONS := ('none', 'read', 'write', 'create', 'admin'); + +(:~ Maximum length of XML characters. :) +declare variable $cons:K-MAXCHARS := 'maxchars'; +(:~ Maximum number of table entries. :) +declare variable $cons:K-MAXROWS := 'maxrows'; +(:~ Query timeout. :) +declare variable $cons:K-TIMEOUT := 'timeout'; +(:~ Maximal memory consumption. :) +declare variable $cons:K-MEMORY := 'memory'; +(:~ Permission when running queries. :) +declare variable $cons:K-PERMISSION := 'permission'; + +(:~ Configuration. :) +declare variable $cons:OPTION := + let $defaults := map { + 'maxchars': 100000, + 'maxrows': 100, + 'timeout': 10, + 'memory': 500, + 'permission': 'admin' + } + return if(file:exists($cons:DBA-SETTINGS-FILE)) then ( + try { + (: merge defaults with options from settings file :) + let $configs := fetch:xml($cons:DBA-SETTINGS-FILE)/config + return map:merge( + map:for-each($defaults, function($key, $value) { + map:entry($key, + let $config := $configs/*[name() = $key] + return if($config) then ( + if($value instance of xs:numeric) then xs:integer($config) else xs:string($config) + ) else ( + $value + ) + ) + }) + ) + } catch * { + (: use defaults if an error occurs while parsing the configuration file :) + $defaults + } + ) else ( + $defaults + ); + +(:~ + : Checks if the current client is logged in. If not, raises an error. + :) +declare function cons:check( +) as empty-sequence() { + if($cons:SESSION-VALUE) then () else + error(xs:QName('basex:login'), 'Please log in again.', Request:path()) +}; + +(:~ + : Convenience function for redirecting to another page from update operations. + : @param $url URL + : @param $params query parameters + :) +declare %updating function cons:redirect( + $url as xs:string, + $params as map(*) +) as empty-sequence() { + db:output(web:redirect($url, $params)) +}; diff --git a/src/vue-poc/lib/util.xqm b/src/vue-poc/lib/util.xqm new file mode 100644 index 0000000..3808c70 --- /dev/null +++ b/src/vue-poc/lib/util.xqm @@ -0,0 +1,122 @@ +(:~ + : Utility functions. + : + : @author Christian Grün, BaseX Team, 2014-16 + :) +module namespace util = 'vue-poc/util'; + +import module namespace cons = 'vue-poc/cons' at 'cons.xqm'; + +(:~ + : Evaluates a query and returns the result. + : @param $query query string + : @param $context initial context value + : @return serialized result of query + :) +declare function util:query( + $query as xs:string?, + $context as item()* +) as xs:string { + let $limit := $cons:OPTION($cons:K-MAXCHARS) + let $result := xquery:eval($query, map { '': $context }, util:query-options()) + (: serialize more characters than requested, because limit represents number of bytes :) + return util:chop(serialize($result, map { 'limit': $limit * 2 + 1, 'method': 'basex' }), $limit) +}; + +(:~ + : Runs an updating query. + : @param $query query string + : @return empty sequence + :) +declare %updating function util:update-query( + $query as xs:string? +) { + xquery:update($query, map { }, util:query-options()) +}; + +(:~ + : Returns the options for evaluating a query. + : @return options + :) +declare %private function util:query-options() as map(*) { + map { + 'timeout' : $cons:OPTION($cons:K-TIMEOUT), + 'memory' : $cons:OPTION($cons:K-MEMORY), + 'permission': $cons:OPTION($cons:K-PERMISSION) + } +}; + +(:~ + : Checks if the specified binary input can be converted to an XML string. + : @param $input input + : @return XML string + :) +declare function util:to-xml-string( + $input as xs:base64Binary +) as xs:string { + let $string := + try { + convert:binary-to-string($input) + } catch * { + error((), "Input is no valid UTF8 string.") + } + return + try { + (: tries to convert the input to XML, but discards the results :) + prof:void(parse-xml($string)), + $string + } catch * { + error((), "Input is no well-formed XML.") + } +}; + +(:~ + : Returns the index of the first result to generate. + : @param $page current page + : @param $sort sort key + : @return last result + :) +declare function util:start( + $page as xs:integer, + $sort as xs:string +) as xs:integer { + if($page and not($sort)) then ( + ($page - 1) * $cons:OPTION($cons:K-MAXROWS) + 1 + ) else ( + 1 + ) +}; + +(:~ + : Returns the index of the last result to generate. + : @param $page current page + : @param $sort sort key + : @return last result + :) +declare function util:end( + $page as xs:integer, + $sort as xs:string +) as xs:integer { + if($page and not($sort)) then ( + $page * $cons:OPTION($cons:K-MAXROWS) + ) else ( + 999999999 + ) +}; + +(:~ + : Chops a string result to the maximum number of allowed characters. + : @param $string string + : @param $max maximum number of characters + : @return string + :) +declare function util:chop( + $string as xs:string, + $max as xs:integer +) { + if(string-length($string) > $max) then ( + substring($string, 1, $max) || '...' + ) else ( + $string + ) +}; diff --git a/src/vue-poc/login.xqm b/src/vue-poc/login.xqm index cb3558b..3c0ded8 100644 --- a/src/vue-poc/login.xqm +++ b/src/vue-poc/login.xqm @@ -3,38 +3,43 @@ : :) module namespace vue-login = 'vue-poc/login'; +import module namespace session = "http://basex.org/modules/session"; -import module namespace Session = 'http://basex.org/modules/session'; (:~ Session key. :) declare variable $vue-login:SESSION-KEY := "vue-poc"; (:~ Current session. :) -declare variable $vue-login:SESSION-VALUE := Session:get($vue-login:SESSION-KEY); +declare variable $vue-login:SESSION-VALUE := session:get($vue-login:SESSION-KEY); (:~ : Checks the user input and redirects to the main page, or back to the login page. : @param $name user name : @param $pass password : @param $path path to redirect to (optional) - : @return redirect + : @return true/false :) declare %rest:path("/vue-poc/api/login-check") %rest:form-param("username", "{$name}") %rest:form-param("password", "{$pass}") + %rest:form-param("redirect", "{$path}") +%rest:produces("application/json") +%output:method("json") function vue-login:login( $name as xs:string, - $pass as xs:string -) as element(rest:response) { + $pass as xs:string, + $path as xs:string?) +as element(json) +{ try { user:check($name, $pass), - if(false() and user:list-details($name)/@permission ) then ( - vue-login:reject($name, 'Admin credentials required.', "$path") + if( user:list-details($name)/@permission ne "admin") then ( + vue-login:reject($name, 'Admin credentials required.', $path) ) else ( - vue-login:accept($name, $pass, "$path") + vue-login:accept($name, $pass, $path) ) } catch user:* { - vue-login:reject($name, 'Please check your login data.', "$path") + vue-login:reject($name, 'Please check your login data.', $path) } }; @@ -48,23 +53,24 @@ function vue-login:logout( ) as element(rest:response) { admin:write-log('vue-poc user was logged out: ' || $vue-login:SESSION-VALUE), web:redirect("/vue-poc/login", map { 'name': $vue-login:SESSION-VALUE }), - Session:delete($vue-login:SESSION-KEY) + session:delete($vue-login:SESSION-KEY) }; (:~ : Accepts a user and redirects to the main page. : @param $name entered user name : @param $path path to redirect to - : @return redirect :) declare %private function vue-login:accept( $name as xs:string, $pass as xs:string, $path as xs:string? ) { - Session:set($vue-login:SESSION-KEY, $name), + session:set($vue-login:SESSION-KEY, $name), admin:write-log('VUEPOC user was logged in: ' || $name), - web:redirect(if($path) then $path else "/") + + true + }; (:~ @@ -72,13 +78,16 @@ declare %private function vue-login:accept( : @param $name entered user name : @param $message error message : @param $path path to redirect to - : @return redirect + : @return json :) declare %private function vue-login:reject( $name as xs:string, $message as xs:string, - $path as xs:string? -) as element(rest:response) { - admin:write-log('DBA login was denied: ' || $name), - web:redirect("login", map { 'name': $name, 'error': $message, 'path': $path }) + $path as xs:string?) + as element(json) { + admin:write-log('VUE login was denied: ' || $name), + + false + {$message} + }; diff --git a/src/vue-poc/static/app-gen.js b/src/vue-poc/static/app-gen.js index d37d967..5b8f760 100644 --- a/src/vue-poc/static/app-gen.js +++ b/src/vue-poc/static/app-gen.js @@ -1,4 +1,4 @@ -// generated 2017-06-21T16:59:58.292+01:00 +// generated 2017-06-24T12:17:19.685+01:00 /** * vue filters */ @@ -78,7 +78,7 @@ const Edit=Vue.extend({template:` {{ name }} - + * . @@ -153,28 +153,30 @@ const Edit=Vue.extend({template:` + + + + Clear? + + + clear text. + + + Cancel + Ok + + + - - - - - Clear? - - - clear text. - - - Cancel - Ok - - - + + + `, @@ -203,6 +205,7 @@ const Edit=Vue.extend({template:` "text/ecmascript":"javascript", "application/sparql-query":"sparql", "text/html":"html", + "text/turtle":"turtle", "text/css":"css" } } @@ -252,7 +255,17 @@ const Edit=Vue.extend({template:` Events.$emit('eventFired',"foldall"); }, save(){ - alert("TODO save: "+this.path.join("/")); + alert("TODO save: "+this.url); + var data=Qs.stringify( + { + url: this.url, //gave the values directly for testing + data: this.contentA + }) + HTTP.post("edit", data,{ + headers: { "Content-Type": "application/x-www-form-urlencoded"} + }).then(r=>{ + alert("AAA") + }) }, showfiles(){ router.push({ path: 'files', query: { url: this.path.join("/") }}) @@ -312,20 +325,59 @@ const Edit=Vue.extend({template:` ); const Eval=Vue.extend({template:` - - + + + Run + Submit + + + + + + {{result}} + + + + + + `, data: function(){ return { - xq: '(:~ do something :)' + xq: '(: type your XQuery :)\n', + result:'', + elapsed:null, + show:false, + showError:false } }, methods:{ - onChange(){ - console.log("go") + onChange(val){ + if (this.xq !== val) { + this.xq = val + } + }, + + run(){ + var data={xq:this.xq} + this.showError=this.show=false + HTTP.post("eval/execute",Qs.stringify(data)) + .then(r=>{ + this.result=r.data.result + this.show=true + }) + .catch(r=> { + console.log("error",r) + this.result=r.response.data + this.showError=true; + + }); + }, + submit(){ + alert("submit") } }, created:function(){ @@ -339,17 +391,18 @@ const Files=Vue.extend({template:` - - folder - - - - {{ item }} - - - - + + folder + + + + {{ item }} + + + + {{ url }} + view_module @@ -535,7 +588,7 @@ const Home=Vue.extend({template:`

This is a experiment in using vue.js.

    -
  • vuetifyjs
  • +
  • vuetifyjs
  • vue-multiselect
  • vue-select
  • js-beautify
  • @@ -546,21 +599,64 @@ const Home=Vue.extend({template:` add - REPLACED + REPLACED `, } +); +const Job=Vue.extend({template:` + +

    JOBS

    + +
    + `, + + data: function(){ + return { + message: 'Hello Vue.js!', + q:this.$route.query.q, + items:[ + {href: '/',text: 'Home', icon: 'home' }, + + {href: 'files', text: 'File system',icon: 'folder' }, + {href: 'edit',text: 'edit',icon: 'mode_edit'}, + {href: 'history',text: 'history',icon: 'history'}, + + {href: 'eval',text: 'Evaluate',icon: 'cake'}, + {href: 'tasks',text: 'Tasks',icon: 'build'}, + {href: 'jobs',text: 'Jobs',icon: 'print'}, + + {href: 'logs',text: 'Server logs',icon: 'dns'}, + {href: 'people',text: 'People',icon: 'person'}, + {href: 'select',text: 'select',icon: 'extension'}, + {href: 'puzzle',text: 'Puzzle',icon: 'extension'}, + {href: 'options',text: 'options',icon: 'domain'}, + {href: 'tabs',text: 'tabs',icon: 'switch_camera'}, + {href: 'ping',text: 'ping',icon: 'update'}, + {href: 'thumbnail',text: 'thumbnail',icon: 'touch_app'}, + {href: 'settings',text: 'settings',icon: 'settings' } + ] + } + }, + created:function(){ + console.log("Serch",this.$route.query.q) + } +} + ); const Login=Vue.extend({template:` + Login - + + {{message}} + @@ -581,33 +677,57 @@ const Login=Vue.extend({template:` return { hidepass: true, name:'', - password: '' + password: '', + redirect: this.$route.query.redirect, + message:"", + showMessage:false } }, methods:{ go () { this.hidepass=true + this.showMessage=false var data=Qs.stringify( { username: this.name, //gave the values directly for testing password: this.password, - client_id: 'user-client' + redirect: this.redirect }) - HTTP.post("login-check", data, - { - headers: { - "Content-Type": "application/x-www-form-urlencoded" - }}) + HTTP.post("login-check", data) .then(r=>{ - console.log(r) - alert("loh") + console.log("login",r.data) + if(r.data.status){ + this.$auth.role="admin" + this.$router.replace(this.redirect) + }else{ + this.message=r.data.message + this.showMessage=true; + } + }).catch(error=> { - alert("err") + alert("err login") }) } } } +); +const Log=Vue.extend({template:` + +

    LOGS

    +
    `, + + data: function(){ + return { + message: 'Hello Vue.js!', + q:this.$route.query.q + } + }, + created:function(){ + console.log("Serch",this.$route.query.q) + } +} + ); const Options=Vue.extend({template:` @@ -668,7 +788,7 @@ const People=Vue.extend({template:` - + @@ -823,7 +943,19 @@ const Puzzle=Vue.extend({template:` - + + +
    {{cell}} + {{cell}} +
    +
    + + +
    + + + +
    @@ -837,11 +969,12 @@ const Puzzle=Vue.extend({template:` [3,7,10,14], [4,null,11,15] ], - empty:[3,1] + empty:[3,1], + tiles:[{data:""}] } }, methods: { - click: function (row,col) { + click(row,col) { var g=this.grid var h=g[row][col] g[row][col]=null @@ -851,7 +984,31 @@ const Puzzle=Vue.extend({template:` this.grid= g console.log("click",this.grid,e) this.$forceUpdate() + }, + disabled(row,col){ + var ok=(row==this.empty[0]) && (col==this.empty[1]-1 ||col==this.empty[1]+1) + ok=ok || (col==this.empty[1]) && (row==this.empty[0]-1 ||row==this.empty[0]+1); + return !ok + }, + gettiles(){ + HTTP.get("thumbnail/images") + .then(r=>{ + this.tiles=r.data.items + this.$forceUpdate() + }) + + }, + src(row,col){ + var v=this.grid[row][col] + var d="" + if(typeof this.tiles[v] !== 'undefined') d=this.tiles[v].data + + return "data:image/jpeg;base64,"+d } + + }, + created(){ + this.gettiles() } } @@ -1062,6 +1219,24 @@ const Tabs=Vue.extend({template:` } } +); +const Task=Vue.extend({template:` + +

    Tasks

    +
    + `, + + data: function(){ + return { + message: 'Hello Vue.js!', + q:this.$route.query.q + } + }, + created:function(){ + console.log("Serch",this.$route.query.q) + } +} + ); const Thumbnail=Vue.extend({template:` @@ -1115,7 +1290,9 @@ const Thumbnail=Vue.extend({template:` if (this.taskxml !== val) this.taskxml = val; }, validate(){ - alert + alert("validate") + HTTP.post("thumbnail/validate",Qs.stringify({task: this.taskxml})) + .then(r=>{alert("gg")}) }, go(){ alert("post") @@ -1143,8 +1320,15 @@ const HTTP = axios.create({ }); const axios_json={ headers: {accept: 'application/json'}}; - - +const Auth={ + name:"guest", + role:null, + install: function(Vue){ + Object.defineProperty(Vue.prototype, '$auth', { + get () { return Auth } + }) } +}; +Vue.use(Auth); Vue.config.errorHandler = function (err, vm, info) { // handle error // `info` is a Vue-specific error info, e.g. which lifecycle hook @@ -1153,12 +1337,83 @@ Vue.config.errorHandler = function (err, vm, info) { }; Vue.component('my-component', { - template: '
    A custom component!
    ', + + props: ['href'], + template: ' {{href}}link', created:function(){ console.log("my-component"); }, }); +Vue.component('nav-apb', { + + props: ['items'], + template:` + + +`, + created:function(){ + console.log("my-component"); + } + }); + var Events = new Vue({}); @@ -1182,6 +1437,9 @@ const router = new VueRouter({ { path: '/history', component: History,meta:{title:"File History"} }, { path: '/puzzle', component: Puzzle,meta:{title:"Jigsaw"} }, { path: '/eval', component: Eval,meta:{title:"Evaluate XQuery"} }, + { path: '/logs', component: Log,meta:{title:"Server logs"} }, + { path: '/tasks', component: Task,meta:{title:"Runnable tasks"} }, + { path: '/jobs', component: Job,meta:{title:"Jobs"} }, { path: '*', component: Notfound,meta:{title:"Page not found"} } ], }); @@ -1193,7 +1451,7 @@ router.beforeEach((to, from, next) => { if (to.matched.some(record => record.meta.requiresAuth)) { // this route requires auth, check if logged in // if not, redirect to login page. - if (true) { + if ("admin"==Auth.role) { next({ path: '/login', query: { redirect: to.fullPath } @@ -1216,10 +1474,16 @@ const app = new Vue({ mini: false, items: [ {href: '/',title: 'Home', icon: 'home' }, + {href: 'files', title: 'File system',icon: 'folder' }, {href: 'edit',title: 'edit',icon: 'mode_edit'}, {href: 'history',title: 'history',icon: 'history'}, - {href: 'eval',title: 'Evaluate',icon: 'cake'}, + + {href: 'eval',title: 'Evaluate',icon: 'cake'}, + {href: 'tasks',title: 'Tasks',icon: 'build'}, + {href: 'jobs',title: 'Jobs',icon: 'print'}, + + {href: 'logs',title: 'Server logs',icon: 'dns'}, {href: 'people',title: 'People',icon: 'person'}, {href: 'select',title: 'select',icon: 'extension'}, {href: 'puzzle',title: 'Puzzle',icon: 'extension'}, @@ -1242,7 +1506,8 @@ const app = new Vue({ HTTP.get("status") .then(r=>{ console.log("status",r) - this.status=r.data + this.$auth.name=r.data.user + this.$forceUpdate() }) }, beforeDestroy(){ diff --git a/src/vue-poc/static/app.html b/src/vue-poc/static/app.html index beeee85..1be73f9 100644 --- a/src/vue-poc/static/app.html +++ b/src/vue-poc/static/app.html @@ -80,7 +80,7 @@ - {{status.user}} + {{$auth.name}}
    diff --git a/src/vue-poc/static/core.js b/src/vue-poc/static/core.js index d458084..084e30d 100644 --- a/src/vue-poc/static/core.js +++ b/src/vue-poc/static/core.js @@ -11,8 +11,15 @@ const HTTP = axios.create({ }); const axios_json={ headers: {accept: 'application/json'}}; - - +const Auth={ + name:"guest", + role:null, + install: function(Vue){ + Object.defineProperty(Vue.prototype, '$auth', { + get () { return Auth } + }) } +}; +Vue.use(Auth); Vue.config.errorHandler = function (err, vm, info) { // handle error // `info` is a Vue-specific error info, e.g. which lifecycle hook @@ -21,12 +28,83 @@ Vue.config.errorHandler = function (err, vm, info) { }; Vue.component('my-component', { - template: '
    A custom component!
    ', + + props: ['href'], + template: ' {{href}}link', created:function(){ console.log("my-component"); }, }); +Vue.component('nav-apb', { + + props: ['items'], + template:` + + +`, + created:function(){ + console.log("my-component"); + } + }); + var Events = new Vue({}); @@ -50,6 +128,9 @@ const router = new VueRouter({ { path: '/history', component: History,meta:{title:"File History"} }, { path: '/puzzle', component: Puzzle,meta:{title:"Jigsaw"} }, { path: '/eval', component: Eval,meta:{title:"Evaluate XQuery"} }, + { path: '/logs', component: Log,meta:{title:"Server logs"} }, + { path: '/tasks', component: Task,meta:{title:"Runnable tasks"} }, + { path: '/jobs', component: Job,meta:{title:"Jobs"} }, { path: '*', component: Notfound,meta:{title:"Page not found"} } ], }); @@ -61,7 +142,7 @@ router.beforeEach((to, from, next) => { if (to.matched.some(record => record.meta.requiresAuth)) { // this route requires auth, check if logged in // if not, redirect to login page. - if (true) { + if ("admin"==Auth.role) { next({ path: '/login', query: { redirect: to.fullPath } @@ -84,10 +165,16 @@ const app = new Vue({ mini: false, items: [ {href: '/',title: 'Home', icon: 'home' }, + {href: 'files', title: 'File system',icon: 'folder' }, {href: 'edit',title: 'edit',icon: 'mode_edit'}, {href: 'history',title: 'history',icon: 'history'}, - {href: 'eval',title: 'Evaluate',icon: 'cake'}, + + {href: 'eval',title: 'Evaluate',icon: 'cake'}, + {href: 'tasks',title: 'Tasks',icon: 'build'}, + {href: 'jobs',title: 'Jobs',icon: 'print'}, + + {href: 'logs',title: 'Server logs',icon: 'dns'}, {href: 'people',title: 'People',icon: 'person'}, {href: 'select',title: 'select',icon: 'extension'}, {href: 'puzzle',title: 'Puzzle',icon: 'extension'}, @@ -110,7 +197,8 @@ const app = new Vue({ HTTP.get("status") .then(r=>{ console.log("status",r) - this.status=r.data + this.$auth.name=r.data.user + this.$forceUpdate() }) }, beforeDestroy(){ diff --git a/src/vue-poc/static/vue-ace.js b/src/vue-poc/static/vue-ace.js index 54261d1..1ed462b 100644 --- a/src/vue-poc/static/vue-ace.js +++ b/src/vue-poc/static/vue-ace.js @@ -1,9 +1,8 @@ // ace editor for vue.js //https://jsfiddle.net/bc_rikko/gbpw2q9x/3/ Vue.component('vue-ace', { - template: '
    ', - props: ['editorId', - 'content', + template: '
    ', + props: [ 'content', 'mode', 'theme', 'wrap', @@ -65,7 +64,7 @@ Vue.component('vue-ace', { const readOnly = this.readOnly || false ace.config.set("workerPath", "/vue-poc/ui/ace-workers") - this.editor = window.ace.edit(this.editorId) + this.editor = window.ace.edit(this.$el) this.editor.$blockScrolling = Infinity this.editor.setValue(this.content, 1) diff --git a/src/vue-poc/templates/edit.vue b/src/vue-poc/templates/edit.vue index 7073aca..5667cdd 100644 --- a/src/vue-poc/templates/edit.vue +++ b/src/vue-poc/templates/edit.vue @@ -100,29 +100,31 @@ + + + + Clear? + + + clear text. + + + Cancel + Ok + + + - - - - - Clear? - - - clear text. - - - Cancel - Ok - - - + + @@ -153,6 +155,7 @@ v-on:annotation="annotation"> "text/ecmascript":"javascript", "application/sparql-query":"sparql", "text/html":"html", + "text/turtle":"turtle", "text/css":"css" } } @@ -202,7 +205,17 @@ v-on:annotation="annotation"> Events.$emit('eventFired',"foldall"); }, save(){ - alert("TODO save: "+this.path.join("/")); + alert("TODO save: "+this.url); + var data=Qs.stringify( + { + url: this.url, //gave the values directly for testing + data: this.contentA + }) + HTTP.post("edit", data,{ + headers: { "Content-Type": "application/x-www-form-urlencoded"} + }).then(r=>{ + alert("AAA") + }) }, showfiles(){ router.push({ path: 'files', query: { url: this.path.join("/") }}) diff --git a/src/vue-poc/templates/eval.vue b/src/vue-poc/templates/eval.vue deleted file mode 100644 index fab701d..0000000 --- a/src/vue-poc/templates/eval.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - - diff --git a/src/vue-poc/templates/eval/eval.vue b/src/vue-poc/templates/eval/eval.vue new file mode 100644 index 0000000..b850d38 --- /dev/null +++ b/src/vue-poc/templates/eval/eval.vue @@ -0,0 +1,67 @@ + + + + diff --git a/src/vue-poc/templates/eval/eval.xqm b/src/vue-poc/templates/eval/eval.xqm new file mode 100644 index 0000000..1d9dc10 --- /dev/null +++ b/src/vue-poc/templates/eval/eval.xqm @@ -0,0 +1,26 @@ +(:~ + : vue-poc thumbnail api. + : + : @author Andy Bunce may-2017 + :) +module namespace vue-api = 'quodatum:vue.api.eval'; +import module namespace rest = "http://exquery.org/ns/restxq"; +import module namespace util = 'vue-poc/util' at "../../lib/util.xqm"; + + +(:~ + : eval + :) +declare +%rest:POST %rest:path("/vue-poc/api/eval/execute") +%rest:form-param("xq", "{$xq}") +%output:method("json") +function vue-api:eval($xq ) +{ + let $x:=fn:trace($xq,"task: ") + let $r:=util:query($xq,()) + return + {$r} + +}; + diff --git a/src/vue-poc/templates/files.vue b/src/vue-poc/templates/files.vue index 04a3f8d..c73bd45 100644 --- a/src/vue-poc/templates/files.vue +++ b/src/vue-poc/templates/files.vue @@ -4,17 +4,18 @@ - - folder - - - - {{ item }} - - - - + + folder + + + + {{ item }} + + + + {{ url }} + diff --git a/src/vue-poc/templates/home.vue b/src/vue-poc/templates/home.vue index e3a9b61..2bc33ea 100644 --- a/src/vue-poc/templates/home.vue +++ b/src/vue-poc/templates/home.vue @@ -12,7 +12,7 @@

    This is a experiment in using vue.js.

      -
    • vuetifyjs
    • +
    • vuetifyjs
    • vue-multiselect
    • vue-select
    • js-beautify
    • @@ -23,7 +23,7 @@ add - REPLACED + REPLACED diff --git a/src/vue-poc/templates/login.vue b/src/vue-poc/templates/login.vue index a719b1a..9f80b9c 100644 --- a/src/vue-poc/templates/login.vue +++ b/src/vue-poc/templates/login.vue @@ -1,12 +1,15 @@