vuetify 1.1.9

This commit is contained in:
Andy Bunce 2018-07-31 23:45:40 +01:00
parent a077b4180f
commit ac9cb9ff8d
36 changed files with 1118 additions and 618 deletions

View file

@ -7,8 +7,8 @@ module namespace vue-api = 'quodatum:vue.api';
import module namespace rest = "http://exquery.org/ns/restxq";
import module namespace session = "http://basex.org/modules/session";
import module namespace entity = 'quodatum.models.generated' at "models.gen.xqm";
import module namespace dice = 'quodatum.web.dice/v4' at "lib/dice.xqm";
import module namespace web = 'quodatum.web.utils4' at "lib/webutils.xqm";
declare namespace c="http://www.w3.org/ns/xproc-step";
@ -27,29 +27,6 @@ declare
()
};
(:~
: Returns search results
:)
declare
%rest:path("/vue-poc/api/search")
%rest:query-param("q", "{$q}")
%rest:produces("application/json")
%output:method("json")
function vue-api:search($q )
{
let $entity:=$entity:list("search-result")
let $items:=(<search>
<title>No search yet: {$q} </title>
<uri>database?url=%2F</uri>
</search>,
<search>
<title>soon</title>
<uri>ping</uri>
</search>)
return dice:response($items,$entity,web:dice())
};
(:~

View file

@ -71,8 +71,8 @@
<v-icon>notifications</v-icon>
</v-badge>
</v-btn>
<v-menu bottom left min-width="300px">
<v-btn icon slot="activator" dark>
<v-menu bottom left min-width="300px">
<v-btn icon slot="activator" >
<v-icon>more_vert</v-icon>
</v-btn>
<v-list>
@ -82,6 +82,11 @@
<v-list-tile >
<v-list-tile-title><v-switch label="Dark theme" v-model="dark"></v-switch></v-list-tile-title>
</v-list-tile>
<v-divider ></v-divider>
<v-list-tile >
<v-list-tile-title>Refresh:</v-list-tile-title>
<v-list-tile-action ><v-btn @click="init">.init</v-btn></v-list-tile-action>
</v-list-tile>
</v-list>
</v-menu>
</v-toolbar>
@ -202,7 +207,9 @@
}},
methods: {
init(){
HTTP.get("../../.init");
},
session(){
this.$router.push({path: '/about'})
@ -210,7 +217,9 @@
logout(){
HTTP.get("logout").then(r=>{
alert("logout")
this.$auth.role=null;
this.$auth.user="guest";
this.$router.push({path: '/'});
})
},
showAlert(msg){

View file

@ -0,0 +1,17 @@
// Authorization Object
const Auth={
user:"guest",
permission:null,
session:null,
created:null,
install: function(Vue){
Object.defineProperty(Vue.prototype, '$auth', {
get () { return Auth }
})
},
logout(){
Auth.user="guest";
Auth.permission=null;
}
};
Vue.use(Auth);

View file

@ -27,6 +27,7 @@
},
methods: {
querySelections (v) {
console.log("QQ",this.si," r:",this.$router.options.routes);
this.loading = true
// Simulated ajax query
setTimeout(() => {

View file

@ -3,7 +3,8 @@
manage parameters for query
-->
<template id="vp-paramform">
<v-form ref="form" lazy-validation>
<v-form ref="form" lazy-validation>
<div class="title">{{ description }}</div>
<v-flex v-for="field in fields" :key="field.model">
<v-text-field v-if="field.type === 'xs:anyURI'" xs10
@ -22,7 +23,7 @@
></v-text-field>
</v-flex>
<div>{{ description }}</div>
</v-form>
</template>
@ -57,7 +58,7 @@
return [this.rules.required];
},
submit(){
return this.params;
return HTTP.post(this.endpoint, Qs.stringify(this.params));
},
valid(){
return this.$refs.form.validate()

View file

@ -3,8 +3,7 @@
const AXIOS_CONFIG={
baseURL: "/vue-poc/api/",
headers: {
'X-Custom-Header': 'vue-poc',
accept: 'application/json'
'X-Custom-Header': 'vue-poc'
},
paramsSerializer: function(params) {
return Qs.stringify(params)
@ -47,21 +46,6 @@ const HTTPNE = axios.create(AXIOS_CONFIG);
const axios_json={ headers: {accept: 'application/json'}};
// Authorization Object
const Auth={
user:"guest",
permission:null,
session:null,
created:null,
install: function(Vue){
Object.defineProperty(Vue.prototype, '$auth', {
get () { return Auth }
}) }
};
Vue.use(Auth);
// Settings read and write list clear
localforage.config({
name: 'vuepoc'

View file

@ -29,7 +29,7 @@
<v-text-field v-if="!selection.length" prepend-icon="filter_list" label="Filter..." v-model="q" type="search"
hide-details single-line @keyup.enter="setfilter"
:append-icon="this.q?'clear':''" :append-icon-cb="e=>this.q=''"></v-text-field>
:append-icon="this.q?'clear':''" @click:append="e=>this.q=''"></v-text-field>
<v-toolbar-items v-if="!selection.length">

View file

@ -4,11 +4,14 @@ module namespace j = 'quodatum.test.components';
declare function j:tax($items){
for $a in $items
return <_ type="object">
<id>{$a/@id/string()}</id>
<label>{$a/@label/string()}</label>
{if($a/item)then
<children type="array">{j:tax($a/item)}</children>
else ()}
<id>{$a/@id/string()}</id>
<label>{$a/@label/string()}</label>
{if($a/item)then (
<children type="array">{j:tax($a/item)}</children>
,<icon></icon>
) else (
<icon>fa fa-tag</icon>
)}
</_>
};

View file

@ -7,8 +7,25 @@
<v-spacer></v-spacer>
<v-btn>todo</v-btn>
</v-toolbar>
<v-card-text>
{{ selected }}
</v-card-text>
<v-card-text>
<v-jstree :data="data" show-checkbox multiple allow-batch whole-row @item-click="itemClick"></v-jstree>
<v-layout>
<v-flex xs6>
<v-jstree :data="data" text-field-name="label" ref="tree" :async="loadData"
show-checkbox multiple allow-batch whole-row @item-click="itemClick"></v-jstree>
</v-flex>
<v-flex xs6>
<pre>
{{ JSON.stringify(data, null, '\t') }}
</pre>
</v-flex>
</v-layout>
</v-card-text>
</v-card>
@ -18,82 +35,55 @@
<script>{
data:function(){
return {
data: [
{
"text": "Same but with checkboxes",
"children": [
{
"text": "initially selected",
"selected": true
},
{
"text": "custom icon",
"icon": "fa fa-warning icon-state-danger"
},
{
"text": "initially open",
"icon": "fa fa-folder icon-state-default",
"opened": true,
"children": [
{
"text": "Another node"
}
]
},
{
"text": "custom icon",
"icon": "fa fa-warning icon-state-warning"
},
{
"text": "disabled node",
"icon": "fa fa-check icon-state-success",
"disabled": true
}
]
},
{
"text": "Same but with checkboxes",
"opened": true,
"children": [
{
"text": "initially selected",
"selected": true
},
{
"text": "custom icon",
"icon": "fa fa-warning icon-state-danger"
},
{
"text": "initially open",
"icon": "fa fa-folder icon-state-default",
"opened": true,
"children": [
{
"text": "Another node"
}
]
},
{
"text": "custom icon",
"icon": "fa fa-warning icon-state-warning"
},
{
"text": "disabled node",
"icon": "fa fa-check icon-state-success",
"disabled": true
}
]
},
{
"text": "And wholerow selection"
}
]
}
data: [],
loadData: function (oriNode, resolve) {
var id = oriNode.data.id ? oriNode.data.id : 0
console.log("LOAD DATA",id);
HTTP.get("components/tree")
.then(r=>{
console.log(r);
resolve(r.data)
})
.catch(error=> {
console.log(error);
alert("Get query error"+url)
});
}
}
},
methods: {
itemClick (node) {
console.log(node.model.text + ' clicked !')
node.model.selected= !node.model.selected;
console.log(' clicked !',node.model)
},
load(){
this.asyncData = [this.$refs.tree.initializeLoading()];
this.$refs.tree.handleAsyncLoad(this.asyncData, this.$refs.tree)
},
sel1(item){
if(item.children){
var res=[];
for (const node of item.children) {res.push(this.sel1(node))}
return res;
}else{
return item.selected?item.label:[]
}
}
},
computed:{
selected(){
return this.sel1(this.data);
},
},
mounted: function(){
this.load()
}
}

View file

@ -29,8 +29,8 @@
</p>
<ul>
<li><router-link :to="{path:'files', query:{url:'/vue-poc/'}}">vue-poc files</router-link></li>
<li><router-link :to="{path:'database', query:{url:'/vue-poc/'}}">vue-poc db</router-link></li>
<li><router-link :to="{path:'files', query:{url:'/vue-poc/'}}"> <v-icon>developer_mode</v-icon>vue-poc files</router-link></li>
<li><router-link :to="{path:'database', query:{url:'/vue-poc/'}}"> <v-icon>folder</v-icon>vue-poc db</router-link></li>
<li><a href="/doc/#/data/app/vue-poc" target="new">doc</a></li>
<li><a href="/dba" target="new">DBA app</a></li>
<li><a href="/vue-poc/ui/database?url=%2Fvue-poc%2F" target="new">db</a></li>

View file

@ -15,7 +15,7 @@
<v-spacer></v-spacer>
<v-text-field prepend-icon="search" label="Filter..." v-model="q" type="search"
hide-details single-line @keyup.enter="setfilter"
:append-icon="this.q?'clear':''" :append-icon-cb="e=>this.q=''"></v-text-field>
:append-icon="this.q?'clear':''" @click:append="e=>this.q=''"></v-text-field>
</v-toolbar>
<v-card-text>
<v-progress-linear v-if="busy" v-bind:indeterminate="true" ></v-progress-linear>

View file

@ -2,19 +2,19 @@
<template id="jobs">
<v-card >
<v-toolbar >
<v-btn
@click="stop()"
:disabled="noSelection"
>Stop</v-btn>
<v-text-field
append-icon="search"
<v-text-field
prepend-icon="filter_list"
label="Filter jobs"
single-line
hide-details
v-model="search"
></v-text-field>
></v-text-field>
<v-spacer></v-spacer>
<v-btn
@click="stop()"
:disabled="noSelection"
>Stop</v-btn>
<v-btn icon ><v-icon>add</v-icon></v-btn>
<v-spacer></v-spacer>

View file

@ -1,42 +1,46 @@
<!DOCTYPE html>
<template id="login">
<v-card class="grey lighten-4 elevation-0">
<v-card-title class="green darken-1">
<span class="white--text">Login</span>
</v-card-title>
<v-alert color="error" v-bind:value="showMessage">
{{message}}
</v-alert>
<v-card-actions>
<v-text-field
name="input-name"
label="Enter your name"
hint="name??"
v-model="name"
required
></v-text-field>
</v-card-actions>
<v-card-actions>
<v-text-field
name="input-password"
label="Enter your password"
hint="Enter your password"
v-model="password"
:append-icon="hidepass ? 'visibility' : 'visibility_off'"
:append-icon-cb="() => (hidepass = !hidepass)"
:type="hidepass ? 'password' : 'text'"
required
></v-text-field>
</v-card-actions>
<v-divider></v-divider>
<v-card-actions class="blue-grey darken-1 mt-0">
<v-btn color="primary" @click="go()">Continue</v-btn>
<v-spacer></v-spacer>
</v-card-actions>
</v-card>
<v-layout>
<v-flex xs12 sm6 offset-sm3>
<v-card class="grey lighten-4 elevation-0">
<v-card-title class="amber ">
<span class="white--text">Please login as user with permission is required</span>
</v-card-title>
<v-alert color="error" v-bind:value="showMessage">
{{message}}
</v-alert>
<v-card-actions>
<v-text-field
name="input-name"
label="User name"
hint="Enter your name"
v-model="name"
required
></v-text-field>
</v-card-actions>
<v-card-actions>
<v-text-field
name="input-password"
label="Password"
hint="Enter your password"
v-model="password"
:append-icon="hidepass ? 'visibility' : 'visibility_off'"
@click:append="() => (hidepass = !hidepass)"
:type="hidepass ? 'password' : 'text'"
required
></v-text-field>
</v-card-actions>
<v-divider></v-divider>
<v-card-actions >
<v-spacer></v-spacer>
<v-btn color="primary" @click="go()">Continue</v-btn>
</v-card-actions>
</v-card>
</v-flex>
</v-layout>
</template>
<script>{
@ -63,8 +67,10 @@
.then(r=>{
console.log("login",r.data)
if(r.data.status){
this.$auth.role="admin"
this.$router.replace(this.redirect)
this.$auth.role="admin";
this.$auth.user=this.name;
console.log("redirect",this.redirect);
this.$router.replace({path: this.redirect});
}else{
this.message=r.data.message
this.showMessage=true;

View file

@ -2,16 +2,21 @@
<template id="entity">
<v-card>
<v-toolbar >
<v-toolbar-title>Entities</v-toolbar-title>
<v-toolbar-title>
<v-breadcrumbs >
<v-breadcrumbs-item to="/entity" :exact="true">
Entities
</v-breadcrumbs-item>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-text-field prepend-icon="search" label="Filter..." v-model="q" type="search"
<v-text-field prepend-icon="filter_list" label="Filter..." v-model="q" type="search"
hide-details single-line @keyup.enter="setfilter"
:append-icon="this.q?'clear':''" :append-icon-cb="e=>this.q=''"></v-text-field>
:append-icon="this.q?'clear':''" @click:append="e=>this.q=''"></v-text-field>
<v-btn @click="getItems"
:loading="loading"
:disabled="loading"
>Refresh</v-btn>
Text
<vp-entitylink entity="entity"></vp-entitylink>
</v-toolbar>
<v-container fluid grid-list-md>

View file

@ -2,18 +2,33 @@
<template id="entity1">
<v-card>
<v-toolbar >
<v-toolbar-title> Entity: {{ entity }}</v-toolbar-title>
<v-toolbar-title>
<v-breadcrumbs >
<v-breadcrumbs-item to="/entity" :exact="true">
Entities
</v-breadcrumbs-item>
<v-breadcrumbs-item >
{{ entity }}
</v-breadcrumbs-item>
</v-breadcrumbs>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn @click="getItem"
:loading="loading"
:disabled="loading"
>Refresh</v-btn>
<v-btn @click="getxml"
:loading="loading"
:disabled="loading"
>XML</v-btn>
</v-toolbar>
<v-container fluid grid-list-md>
hello
<pre>{{ xml }}</pre>
</v-container>
</v-card>
</template>
@ -24,19 +39,27 @@
return {
q: 'filter',
item: {},
loading: false
loading: false,
xml: null
}
},
methods:{
getItem(){
this.loading=true
HTTP.get("data/entity",{params:this.q})
HTTP.get("data/entity/"+this.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
})
},
getxml(){
HTTP.get("data/entity/"+this.entity,{params:this.q, headers: {Accept: "text/xml"}})
.then(r=>{
console.log(r.data)
this.xml=r.data;
})
}
},
created:function(){

View file

@ -1,11 +1,18 @@
<!DOCTYPE html>
<template id="namespace">
<v-container fluid grid-list-md>
<v-toolbar >
<v-toolbar-title>Namespaces</v-toolbar-title>
<v-container fluid>
<v-card>
<v-toolbar >
<v-toolbar-title>
<v-breadcrumbs >
<v-breadcrumbs-item to="/namespace" :exact="true">
Namespaces
</v-breadcrumbs-item>
</v-breadcrumbs>
</v-toolbar-title>
<v-btn @click="load"
<v-btn @click="load" icon
:loading="loading"
:disabled="loading"
><v-icon>refresh</v-icon></v-btn>
@ -14,13 +21,13 @@
<v-text-field prepend-icon="filter_list" label="Filter..." v-model="q" type="search"
hide-details single-line @keyup.enter="setfilter"
:append-icon="this.q?'clear':''" :append-icon-cb="e=>this.q=''"></v-text-field>
clearable></v-text-field>
<v-spacer></v-spacer>
<vp-entitylink entity="namespace"></vp-entitylink>
</v-toolbar>
<v-card-text>
<v-data-table
:headers="headers"
:items="items"
@ -42,8 +49,9 @@
</v-alert>
</template>
</v-data-table>
</v-container>
</v-card-text>
</v-card>
</v-container>
</template>
<script>{

View file

@ -2,12 +2,24 @@
<template id="namespace1">
<v-card>
<v-toolbar >
<v-toolbar-title> Namespace: {{ namespace }}</v-toolbar-title>
<v-toolbar-title>
<v-breadcrumbs >
<v-breadcrumbs-item to="/namespace" :exact="true">
Namespaces
</v-breadcrumbs-item>
<v-breadcrumbs-item >
{{ xmlns }}
</v-breadcrumbs-item>
</v-breadcrumbs>
</v-toolbar-title>
<v-toolbar-title>
<v-spacer></v-spacer>
<v-btn @click="getItem"
<v-btn @click="getItem" icon
:loading="loading"
:disabled="loading"
>Refresh</v-btn>
><v-icon>refresh</v-icon></v-btn>
</v-toolbar>
<v-container fluid grid-list-md>
@ -19,10 +31,9 @@
</template>
<script>{
props: ['namespace'],
data: function(){
return {
q: 'filter',
xmlns: '',
item: {},
loading: false
}
@ -30,16 +41,16 @@
methods:{
getItem(){
this.loading=true
HTTP.get("data/namespace",{params:this.q})
HTTP.get("data/namespace/item",{id: this.xmlns})
.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
this.loading=false;
console.log(r.data)
})
}
},
created:function(){
this.xmlns=this.$route.query.xmlns;
this.getItem()
},
}

View file

@ -51,6 +51,7 @@ function data($entity as xs:string,$q )
:)
declare
%rest:GET %rest:path("vue-poc/api/data/entity/{$entity}")
%rest:produces("application/json")
%output:method("json")
function model($entity) {
let $this:=$entity:list("entity")
@ -62,6 +63,23 @@ let $this:=$entity:list("entity")
};
(:~
: details of the entity $entity
:)
declare
%rest:GET %rest:path("vue-poc/api/data/entity/{$entity}")
%rest:produces("text/xml;qs=0.8")
%output:method("xml")
function model2($entity) {
let $this:=$entity:list("entity")
let $items:=$this?data()
let $fields:=$this?json
let $item:=$items[@name=$entity]
(: just one :)
return <json objects="json">{dice:json-flds($item,$fields)/*}</json>
};
(:~
: field list for model
:)

View file

@ -0,0 +1,34 @@
(:~
: vue-poc search api.
:
: @author Andy Bunce aug-2018
:)
module namespace vue-search = 'quodatum:vue.search';
import module namespace entity = 'quodatum.models.generated' at "../../models.gen.xqm";
import module namespace dice = 'quodatum.web.dice/v4' at "../../lib/dice.xqm";
import module namespace web = 'quodatum.web.utils4' at "../../lib/webutils.xqm";
import module namespace rest = "http://exquery.org/ns/restxq";
(:~
: Returns search results
:)
declare
%rest:path("/vue-poc/api/search")
%rest:query-param("q", "{$q}")
%rest:produces("application/json")
%output:method("json")
function vue-search:search($q )
{
let $entity:=$entity:list("search-result")
let $items:=(<search>
<title>No search yet: {$q} </title>
<uri>database?url=%2F</uri>
</search>,
<search>
<title>soon</title>
<uri>server/ping</uri>
</search>)
return dice:response($items,$entity,web:dice())
};

View file

@ -29,6 +29,9 @@
</tr>
</tbody>
</table>
<pre>
{{ $auth }}
</pre>
</v-container>
</template>

View file

@ -46,6 +46,7 @@ function vue-rest:task($task)
declare
%rest:POST %rest:path("/vue-poc/api/tasks/{$task}")
%rest:produces("application/json")
%updating
%output:method("json")
function vue-rest:runtask($task)
{

View file

@ -2,24 +2,21 @@
<template id="runtask">
<v-container fluid>
<v-card >
<v-toolbar class="orange darken-1">
<v-btn icon to="/tasks"><v-icon>arrow_back</v-icon></v-btn>
<v-card-title >
<span class="white--text">Task: {{ task }}</span>
</v-card-title>
<v-toolbar>
<v-toolbar-title>
<v-breadcrumbs >
<v-breadcrumbs-item to="/tasks" :exact="true">
Tasks
</v-breadcrumbs-item>
<v-breadcrumbs-item >
{{ task }}
</v-breadcrumbs-item>
</v-breadcrumbs>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn @click="$refs.params.clear()" :loading="loading"
:disabled="loading"
>Clear</v-btn>
<v-btn @click="$refs.params.reset()" :loading="loading"
:disabled="loading"
>Reset</v-btn>
<v-spacer></v-spacer>
<v-btn color="primary" @click="submit()" :loading="waiting"
:disabled="waiting">
<v-icon>play_circle_outline</v-icon>
Run</v-btn>
</v-toolbar>
</v-toolbar>
<v-card-text>
<v-container fluid>
<v-layout row wrap>
@ -31,7 +28,19 @@
</v-container>
</v-card-text>
<v-toolbar>
<v-btn @click="$refs.params.clear()" :loading="loading"
:disabled="loading"
>Clear</v-btn>
<v-btn @click="$refs.params.reset()" :loading="loading"
:disabled="loading"
>Reset</v-btn>
<v-spacer></v-spacer>
<v-btn color="primary" @click="submit()" :loading="loading"
:disabled="loading">
<v-icon>play_circle_outline</v-icon>
Run</v-btn>
</v-toolbar>
<v-snackbar v-model="snackbar.show"
:timeout="6000"
:success="snackbar.context === 'success'"
@ -48,31 +57,27 @@
props:["task"],
data: function(){
return {
waiting:false,
snackbar:{show:false,msg:"",context:"success"},
loading: false,
snackbar: {show:false,msg:"",context:"success"},
valid: false
}
},
methods:{
submit(){
this.waiting=true;
var params=this.$refs.params.submit();
HTTP.post("tasks/" + this.task, Qs.stringify(params))
this.loading=true;
this.$refs.params.submit()
.then(r=>{
this.waiting=false
this.snackbar={show:true,msg:r.data.msg,context:"success"}
this.loading= false
this.snackbar= {show:true,msg:r.data.msg,context:"success"}
console.log(r.data)
})
.catch(error=>{
this.waiting=false
this.snackbar={show:true,msg:"Problem",context:"error"}
this.loading= false
this.snackbar= {show:true,msg:"Problem",context:"error"}
console.log(error);
});
}
},
computed:{
code(){return 'code here'}
}
}
</script>

View file

@ -1,5 +1,5 @@
(:~
: import to db
: Import a file or directory into a database
: @author andy bunce
: @since july 2018
:)
@ -11,10 +11,10 @@ import module namespace dbtools = 'quodatum.dbtools' at "../../../lib/dbtools.xq
:)
declare variable $srcpath as xs:anyURI external :="C:/Users/andy/git/vue-poc/src/vue-poc/models/entities";
(:~ base db path for import files
: @default /
(:~ Target BaseX db root path for imported files
: @default /vuepoc-test/
:)
declare variable $targetpath as xs:anyURI external :="/";
declare variable $targetpath as xs:anyURI external :="/vuepoc-test";
(:~ unused boolean test
: @default true

View file

@ -1,14 +1,37 @@
<!DOCTYPE html>
<template id="task">
<v-container fluid>
<h3>Available Tasks</h3>
<v-progress-linear v-if="loading" v-bind:indeterminate="true" ></v-progress-linear>
<ul>
<li v-for="task in tasks" :key="task.to">
<router-link :to="'tasks/' + task.to" v-text="task.title"></router-link>
<div v-html="task.description"></div>
</li>
<v-progress-linear v-if="loading" v-bind:indeterminate="true" ></v-progress-linear>
<v-card>
<v-toolbar>
<v-toolbar-title>
<v-breadcrumbs >
<v-breadcrumbs-item to="/tasks" :exact="true">
Tasks
</v-breadcrumbs-item>
</v-breadcrumbs>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-text-field prepend-icon="filter_list" label="Filter..." v-model="q" type="search"
hide-details single-line @keyup.enter="setfilter"
clearable></v-text-field>
<v-spacer></v-spacer>
<vp-entitylink entity="namespace"></vp-entitylink>
</v-toolbar>
<v-card-text>
<ul>
<li v-for="task in tasks" :key="task.to">
<router-link :to="'tasks/' + task.to" v-text="task.title"></router-link>
<div v-html="task.description"></div>
</li>
</ul>
</v-card-text>
</v-card>
</v-container>
</template>
@ -16,7 +39,8 @@
data(){
return {
tasks: [],
loading: false
loading: false,
q: null
}
},
methods:{

View file

@ -9,12 +9,14 @@ import module namespace vue = 'quodatum:vue.compile' at "../../../lib/vue-compil
(:~ URL of the doc to validate
: @default C:/Users/andy/git/vue-poc/src/vue-poc/models/entities/adminlog.xml
:)
declare variable $doc as xs:anyURI external :="C:/Users/andy/git/vue-poc/src/vue-poc/models/entities/adminlog.xml";
declare variable $doc as xs:anyURI external :=
"C:/Users/andy/git/vue-poc/src/vue-poc/models/entities/adminlog.xml" cast as xs:anyURI;
(:~ URL of the schema to use
: @default C:/Users/andy/git/vue-poc/src/vue-poc/models/schemas/entity.xsd
:)
declare variable $schema as xs:anyURI external :="C:/Users/andy/git/vue-poc/src/vue-poc/models/schemas/entity.xsd";
declare variable $schema as xs:anyURI external :=
"C:/Users/andy/git/vue-poc/src/vue-poc/models/schemas/entity.xsd" cast as xs:anyURI;
let $result:=<json type="object"><hello>TODO</hello></json>
return $result

View file

@ -19,8 +19,7 @@ declare
%updating
function tx:run( )
{
let $r:= resolve-uri("tx-validate.xq")=>query-a:run(query-a:params())
return $r=>update:output()
resolve-uri("tx-validate.xq")=>query-a:run(query-a:params())
};
(:~ validation settings

View file

@ -10,12 +10,15 @@ import module namespace qv = 'quodatum.validate' at "../../lib/validate.xqm";
(:~ URL of the doc to validate
: @default C:/Users/andy/git/vue-poc/src/vue-poc/models/entities/adminlog.xml
:)
declare variable $doc as xs:anyURI external :="C:/Users/andy/git/vue-poc/src/vue-poc/models/entities/adminlog.xml";
declare variable $doc as xs:anyURI external :=
"C:/Users/andy/git/vue-poc/src/vue-poc/models/entities/adminlog.xml" cast as xs:anyURI;
(:~ URL of the schema to use
: @default C:/Users/andy/git/vue-poc/src/vue-poc/models/schemas/entity.xsd
:)
declare variable $schema as xs:anyURI external :="C:/Users/andy/git/vue-poc/src/vue-poc/models/schemas/entity.xsd";
declare variable $schema as xs:anyURI external :=
"C:/Users/andy/git/vue-poc/src/vue-poc/models/schemas/entity.xsd" cast as xs:anyURI;
let $validators:=qv:xsd(?,$schema)
let $report:= qv:validation($doc ,$validators,attribute type {"xsd"})

View file

@ -1,4 +1,7 @@
xquery version "3.1";
(:~
: log an event
:)
module namespace hlog = 'quodatum.data.history';
declare namespace hist="urn:quodatum:vue-poc.history";
declare variable $hlog:doc as element(hist:history):=db:open("vue-poc","/history.xml")/hist:history;
@ -9,7 +12,7 @@ function hlog:save($item as element(*))
{
let $id:=$hlog:doc/@next-id/string(.)
let $n:=<hist:event id="{$id}" when="{fn:current-dateTime()}">{$item}</hist:event>
return (insert node $n into $hlog:doc,
return (insert node $n as first into $hlog:doc,
replace value of node $hlog:doc/@next-id with number($id)+1
)
};

View file

@ -4,10 +4,12 @@
: @author Andy Bunce, 2018
:)
module namespace query-a = 'vue-poc/query-a';
import module namespace hlog = 'quodatum.data.history' at 'history.xqm';
import module namespace request = "http://exquery.org/ns/request";
declare namespace map2='http://www.woerteler.de/xquery/modules/map-extras';
(:~
: attributes of a stored query
: attributes of a stored query including parameters and updating status.
: @return json format
:)
declare function query-a:fields($mod as xs:anyURI)
as element(json)
@ -32,6 +34,29 @@ return <json type="object">
</json>
};
(:~
:convert type
:)
declare function query-a:cast($val as item(),$type as xs:string)
as item()
{
switch($type)
case "xs:anyURI" return xs:anyURI($val)
default return $val
};
(:~
:@return map param->type
:)
declare function query-a:types($mod as xs:anyURI)
as map(*)
{
let $vars:=inspect:module($mod)/variable[@external="true"]
return map:merge(
$vars!map:entry(@name/string(),@type/string())
)
};
declare
function query-a:params()
as map(*)
@ -41,10 +66,25 @@ as map(*)
)
};
declare
declare
%updating
function query-a:run($query as xs:anyURI,$params as map(*))
{
xquery:invoke($query,$params)
let $types:=query-a:types($query)
let $params:=query-a:map-with-key($params,
function($key,$val){
switch($types($key)=>trace("CONV"))
case "xs:anyURI" return xs:anyURI($val)
default return $val
}
)
return (
xquery:invoke($query,$params)=>update:output(),
hlog:save(<task url="{ $query }">
<params/>
</task>)
)
};
declare
@ -52,4 +92,25 @@ declare
function query-a:update($query as xs:anyURI,$params as map(*))
{
xquery:invoke-update($query,$params)
};
};
(:~
: Maps a function over all entries of the map <code>$map</code>.
: Each entry <code>($key, $value)</code> in the map is replaced by a new
: entry <code>($key, $f($key, $value))</code>, the keys are not touched.
:
: @param $f function to be applies to all entries
: @param $map input map
: @return copy of <code>$map</code> where all values <code>$value</code>
: are replaced by <code>$f($key, $value)</code>
:)
declare function query-a:map-with-key(
$map as map(*),
$f as function(item(), item()*) as item()*
) as map(*)
{
map:merge(
for $key in map:keys($map)
return map:entry($key, $f($key, $map($key)))
)
};

View file

@ -1,5 +1,5 @@
(: entity access maps
: auto generated from xml files in entities folder at: 2018-07-17T22:21:31.112+01:00
: auto generated from xml files in entities folder at: 2018-07-31T22:46:52.921+01:00
:)
module namespace entity = 'quodatum.models.generated';

File diff suppressed because it is too large Load diff

View file

@ -11,7 +11,7 @@
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic"/>
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons"/>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<link href="//unpkg.com/vuetify@1.1.7/dist/vuetify.min.css" rel="stylesheet" type="text/css"/>
<link href="//unpkg.com/vuetify@1.1.9/dist/vuetify.min.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="//unpkg.com/@riophae/vue-treeselect@0.0.29/dist/vue-treeselect.min.css">
<link rel="stylesheet" href="//unpkg.com/vue-form-generator@2.2.2/dist/vfg-core.css"/>
<link href="/vue-poc/ui/app.css" rel="stylesheet" type="text/css"/>
@ -22,7 +22,7 @@
<body>
<div id="app">
<h3><code>vue-poc</code> <small>(v0.3.6)</small> </h3>
<h3><code>vue-poc</code> <small>(v0.3.8)</small> </h3>
<div class="spinner">
<div class="rect1"></div>
@ -38,7 +38,7 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/vue-router/3.0.1/vue-router.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/axios/0.17.1/axios.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/qs/6.4.0/qs.js" crossorigin="anonymous" ></script>
<script src="//unpkg.com/vuetify@1.1.7/dist/vuetify.min.js" crossorigin="anonymous"></script>
<script src="//unpkg.com/vuetify@1.1.9/dist/vuetify.min.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.3.3/ace.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.3.3/ext-language_tools.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.3.3/ext-linking.js" type="text/javascript" charset="utf-8"></script>

View file

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Source: https://github.com/dret/XIPr -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- XInclude Processor (XIPr) - Erik Wilde (http://dret.net/netdret/) -->
<!-- This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. Enjoy! -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- XIPr Instructions: Include the XIPr XSLT document in your XSLT 2.0 stylesheet using <xsl:include href=".../xipr.xsl"> and initiate the XInclude process at any node (only document and element nodes are reasonable node kinds, though) of a given XML document with the following instruction: <xsl:apply-templates select="$node" mode="xipr"/> -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- XInclude Instructions: For instructions on how to use XInclude, please look at the XInclude specification (http://www.w3.org/TR/xinclude/) or other resources available on the Web. Please remember that the XInclude elements <xi:include> and <xi:fallback> must use the XInclude namespace (http://www.w3.org/2001/XInclude), otherwise they will not be recognized as XInclude elements. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xipr="http://dret.net/projects/xipr/">
<xsl:template match="/*">
<!-- if there is no other template handling the document element, this template initiates XInclude processing at the document element of the input document. -->
<xsl:apply-templates select="." mode="xipr"/>
</xsl:template>
<xsl:template match="@* | node()" mode="xipr">
<xsl:apply-templates select="." mode="xipr-internal">
<!-- the sequences of included URI/XPointer values need to be initialized with the starting document of the XInclude processing (required for detecting inclusion loops). -->
<xsl:with-param name="uri-history" select="document-uri(/)" tunnel="yes"/>
<xsl:with-param name="xpointer-history" select="''" tunnel="yes"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="@* | node()" mode="xipr-internal">
<!-- this template handles all nodes which do not require XInclude processing. -->
<xsl:copy>
<!-- the XInclude process recursively processes the document until it finds an XInclude node. -->
<xsl:apply-templates select="@* | node()" mode="xipr-internal"/>
</xsl:copy>
</xsl:template>
<xsl:template match="xi:include" mode="xipr-internal">
<!-- the two parameters are required for detecting inclusion loops, they contain the complete history of href and xpointer attributes as sequences. -->
<xsl:param name="uri-history" tunnel="yes"/>
<xsl:param name="xpointer-history" tunnel="yes"/>
<!-- REC: The children property of the xi:include element may include a single xi:fallback element; the appearance of more than one xi:fallback element, an xi:include element, or any other element from the XInclude namespace is a fatal error. -->
<xsl:if test="count(xi:fallback) &gt; 1 or exists(xi:include) or exists(xi:*[local-name() ne 'fallback'])">
<xsl:sequence select="xipr:message('xi:include elements may only have no or one single xi:fallback element as their only xi:* child', 'fatal')"/>
</xsl:if>
<xsl:if test="not(matches(@accept, '^[ -~]*$'))">
<!-- SPEC: Values containing characters outside the range #x20 through #x7E must be flagged as fatal errors. -->
<xsl:sequence select="xipr:message('accept contains illegal character(s)', 'fatal')"/>
</xsl:if>
<xsl:if test="not(matches(@accept-language, '^[ -~]*$'))">
<!-- SPEC: Values containing characters outside the range #x20 through #x7E are disallowed in HTTP headers, and must be flagged as fatal errors. -->
<xsl:sequence select="xipr:message('accept-language contains illegal character(s)', 'fatal')"/>
</xsl:if>
<xsl:if test="exists(@accept)">
<xsl:sequence select="xipr:message('XIPr does not support the accept attribute', 'info')"/>
</xsl:if>
<xsl:if test="exists(@accept-language)">
<xsl:sequence select="xipr:message('XIPr does not support the accept-language attribute', 'info')"/>
</xsl:if>
<xsl:variable name="include-uri" select="resolve-uri(@href, document-uri(/))"/>
<xsl:choose>
<xsl:when test="@parse eq 'xml' or empty(@parse)">
<!-- SPEC: This attribute is optional. When omitted, the value of "xml" is implied (even in the absence of a default value declaration). -->
<xsl:if test="empty(@href | @xpointer)">
<!-- SPEC: If the href attribute is absent when parse="xml", the xpointer attribute must be present. -->
<xsl:sequence select="xipr:message('For parse=&quot;xml&quot;, at least one the href or xpointer attributes must be present', 'fatal')"/>
</xsl:if>
<xsl:if test="( index-of($uri-history, $include-uri ) = index-of($xpointer-history, string(@xpointer)) )">
<!-- SPEC: When recursively processing an xi:include element, it is a fatal error to process another xi:include element with an include location and xpointer attribute value that have already been processed in the inclusion chain. -->
<xsl:sequence select="xipr:message(concat('Recursive inclusion (same href/xpointer) of ', @href), 'fatal')"/>
</xsl:if>
<xsl:choose>
<xsl:when test="doc-available($include-uri)">
<xsl:variable name="include-doc" select="doc($include-uri)"/>
<xsl:choose>
<xsl:when test="empty(@xpointer)">
<!-- SPEC: The inclusion target might be a document information item (for instance, no specified xpointer attribute, or an XPointer specifically locating the document root.) In this case, the set of top-level included items is the children of the acquired infoset's document information item, except for the document type declaration information item child, if one exists. -->
<xsl:for-each select="$include-doc/node()">
<xsl:choose>
<xsl:when test="self::*">
<!-- for elements, copy the element and perform base URI fixup. -->
<xsl:copy-of select="xipr:include(., $include-uri, @xpointer, $uri-history, $xpointer-history)"/>
</xsl:when>
<xsl:otherwise>
<!-- copy everything else (i.e., everything which is not an element). -->
<xsl:copy/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<!-- there is an xpointer attribute... -->
<xsl:variable name="xpointer-node">
<xsl:choose>
<!-- xpointer uses a shorthand pointer (formerly known as barename), NCName regex copied from the schema for schemas. -->
<xsl:when test="matches(@xpointer, '^[\i-[:]][\c-[:]]*$')">
<xsl:copy-of select="xipr:include(id(@xpointer, $include-doc), $include-uri, @xpointer, $uri-history, $xpointer-history)"/>
</xsl:when>
<!-- xpointer uses the element() scheme; regex derived from XPointer element() scheme spec: http://www.w3.org/TR/xptr-element/#NT-ElementSchemeData (NCName regex copied from the schema for schemas). -->
<xsl:when test="matches(@xpointer, '^element\([\i-[:]][\c-[:]]*((/[1-9][0-9]*)+)?|(/[1-9][0-9]*)+\)$')">
<xsl:variable name="element-pointer" select="replace(@xpointer, 'element\((.*)\)', '$1')"/>
<xsl:choose>
<xsl:when test="not(contains($element-pointer, '/'))">
<!-- the pointer is a simple id, which can be located using the id() function. -->
<xsl:copy-of select="xipr:include(id($element-pointer, $include-doc), $include-uri, @xpointer, $uri-history, $xpointer-history)"/>
</xsl:when>
<xsl:otherwise>
<!-- child sequence evaluation starts from the root or from an element identified by a NCName. -->
<xsl:copy-of select="xipr:include(xipr:child-sequence( if ( starts-with($element-pointer, '/') ) then $include-doc else id(substring-before($element-pointer, '/'), $include-doc), substring-after($element-pointer, '/')), $include-uri, @xpointer, $uri-history, $xpointer-history)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<!-- xpointer uses none of the schemes covered in the preceding branches. -->
<xsl:sequence select="xipr:message('XIPr only supports the XPointer element() scheme (skipping...)', 'warning')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="exists($xpointer-node/node())">
<!-- xpointer evaluation returned a node. -->
<xsl:copy-of select="$xpointer-node/node()"/>
</xsl:when>
<xsl:otherwise>
<!-- the xpointer did not return a result, a message is produced and fallback processing is initiated. -->
<xsl:sequence select="xipr:message(concat('Evaluation of xpointer ', @xpointer, ' returned nothing'), 'resource')"/>
<xsl:call-template name="fallback"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<!-- this branch is executed when the doc-available() function returned false(), a message is produced and fallback processing is initiated. -->
<xsl:sequence select="xipr:message(concat('Could not read document ', $include-uri), 'resource')"/>
<xsl:call-template name="fallback"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@parse eq 'text'">
<xsl:if test="exists(@xpointer)">
<!-- SPEC: The xpointer attribute must not be present when parse="text". -->
<xsl:sequence select="xipr:message('The xpointer attribute is not allowed for parse=&quot;text&quot;', 'warning')"/>
</xsl:if>
<xsl:choose>
<xsl:when test="unparsed-text-available($include-uri)">
<xsl:value-of select="if ( empty(@encoding) ) then unparsed-text($include-uri) else unparsed-text($include-uri, string(@encoding))"/>
</xsl:when>
<xsl:otherwise>
<!-- this branch is executed when the unparsed-text-available() function returned false(), a message is produced and fallback processing is initiated. -->
<xsl:sequence select="xipr:message(concat('Could not read document ', $include-uri), 'resource')"/>
<xsl:call-template name="fallback"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<!-- SPEC: Values other than "xml" and "text" are a fatal error. -->
<xsl:sequence select="xipr:message(concat('Unknown xi:include attribute value parse=&quot;', @parse ,'&quot;'), 'fatal')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:function name="xipr:include">
<xsl:param name="context"/>
<xsl:param name="include-uri"/>
<xsl:param name="xpointer"/>
<xsl:param name="uri-history"/>
<xsl:param name="xpointer-history"/>
<xsl:for-each select="$context">
<xsl:copy>
<xsl:attribute name="xml:base" select="$include-uri"/>
<!-- SPEC: If an xml:base attribute information item is already present, it is replaced by the new attribute. -->
<xsl:apply-templates select="@*[name() ne 'xml:base'] | node()" mode="xipr-internal">
<xsl:with-param name="uri-history" select="($uri-history, $include-uri)" tunnel="yes"/>
<xsl:with-param name="xpointer-history" select="($xpointer-history, string($xpointer))" tunnel="yes"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:for-each>
</xsl:function>
<xsl:function name="xipr:child-sequence">
<xsl:param name="context"/>
<xsl:param name="path"/>
<xsl:choose>
<!-- if this is the last path segment, return the node. -->
<xsl:when test="not(contains($path, '/'))">
<xsl:sequence select="$context/*[number($path)]"/>
</xsl:when>
<xsl:otherwise>
<!-- go one step along the child sequence by selecting the next node and trimming the path. -->
<xsl:sequence select="xipr:child-sequence($context/*[number(substring-before($path, '/'))], substring-after($path, '/'))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
<xsl:template name="fallback">
<xsl:if test="exists(xi:fallback[empty(parent::xi:include)])">
<!-- SPEC: It is a fatal error for an xi:fallback element to appear in a document anywhere other than as the direct child of the xi:include (before inclusion processing on the contents of the element). -->
<xsl:sequence select="xipr:message('xi:fallback is only allowed as the direct child of xi:include', 'fatal')"/>
</xsl:if>
<xsl:if test="exists(xi:fallback[count(xi:include) ne count(xi:*)])">
<!-- SPEC: It is a fatal error for the xi:fallback element to contain any elements from the XInclude namespace other than xi:include. -->
<xsl:sequence select="xipr:message('xi:fallback may not contain other xi:* elements than xi:include', 'fatal')"/>
</xsl:if>
<xsl:choose>
<xsl:when test="count(xi:fallback) = 1">
<xsl:apply-templates select="xi:fallback/*" mode="xipr-internal"/>
</xsl:when>
<xsl:otherwise>
<!-- SPEC: It is a fatal error if there is zero or more than one xi:fallback element. -->
<xsl:sequence select="xipr:message('No xi:fallback for resource error', 'fatal')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:function name="xipr:message">
<xsl:param name="message"/>
<xsl:param name="level"/>
<xsl:choose>
<xsl:when test="$level eq 'info'">
<xsl:message terminate="no">
<xsl:value-of select="concat('INFO: ', $message)"/>
</xsl:message>
</xsl:when>
<xsl:when test="$level eq 'warning'">
<xsl:message terminate="no">
<xsl:value-of select="concat('WARNING: ', $message)"/>
</xsl:message>
</xsl:when>
<xsl:when test="$level eq 'resource'">
<xsl:message terminate="no">
<xsl:value-of select="concat('RESOURCE ERROR: ', $message)"/>
</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">
<xsl:value-of select="concat('FATAL ERROR: ', $message)"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
</xsl:stylesheet>