+ |
+
+ |
+ {{ props.item.name }} |
+ {{ props.item.permission }}
+
+
+
+
diff --git a/src/vue-poc/features/settings/acesettings.vue b/src/vue-poc/features/settings/acesettings.vue
index c25bf2d..bb3edff 100644
--- a/src/vue-poc/features/settings/acesettings.vue
+++ b/src/vue-poc/features/settings/acesettings.vue
@@ -8,11 +8,11 @@
Not fully implemented
-
-
- Theme
-
-
+
+
+
+
+
+
-
- Key binding
-
-
+
+
-
- Font size
-
-
+
+
+
+
+
+
+
diff --git a/src/vue-poc/features/settings/settings.vue b/src/vue-poc/features/settings/settings.vue
index 06a200a..ba6de3e 100644
--- a/src/vue-poc/features/settings/settings.vue
+++ b/src/vue-poc/features/settings/settings.vue
@@ -41,7 +41,7 @@
if(confirm("wipe localstorage? "+this.keys.length)) settings.clear();
},
theme(){
- this.$emit("theme",this.dark)
+ this.$root.$emit("theme",this.dark)
}
},
created(){
diff --git a/src/vue-poc/features/svg.vue b/src/vue-poc/features/svg.vue
new file mode 100644
index 0000000..066b69e
--- /dev/null
+++ b/src/vue-poc/features/svg.vue
@@ -0,0 +1,18 @@
+
+
+
+svg
+
+
+
+
diff --git a/src/vue-poc/features/tasks/model.build/model.vue b/src/vue-poc/features/tasks/model.build/model.vue
index fc3ab05..d6bd40b 100644
--- a/src/vue-poc/features/tasks/model.build/model.vue
+++ b/src/vue-poc/features/tasks/model.build/model.vue
@@ -8,7 +8,7 @@
Generate model.gen.xqm
-
play_circle_outline
Run
diff --git a/src/vue-poc/features/tasks/vue-compile/vuecompile.vue b/src/vue-poc/features/tasks/vue-compile/vuecompile.vue
index 7fb16d1..cb7947c 100644
--- a/src/vue-poc/features/tasks/vue-compile/vuecompile.vue
+++ b/src/vue-poc/features/tasks/vue-compile/vuecompile.vue
@@ -8,7 +8,7 @@
compile
-
play_circle_outline
Run
diff --git a/src/vue-poc/features/tasks/xqdoc/xqdoc.vue b/src/vue-poc/features/tasks/xqdoc/xqdoc.vue
index c49d15b..49b31d6 100644
--- a/src/vue-poc/features/tasks/xqdoc/xqdoc.vue
+++ b/src/vue-poc/features/tasks/xqdoc/xqdoc.vue
@@ -8,7 +8,7 @@
Task: Generate xqdoc
-
play_circle_outline
Run
diff --git a/src/vue-poc/features/thumbnail/thumbnail.vue b/src/vue-poc/features/thumbnail/thumbnail.vue
index ff3f57b..ab6d5eb 100644
--- a/src/vue-poc/features/thumbnail/thumbnail.vue
+++ b/src/vue-poc/features/thumbnail/thumbnail.vue
@@ -20,7 +20,7 @@
required
>
- Next
+ Next
@@ -31,8 +31,8 @@
Back
- Validate
- Next
+ Validate
+ Next
@@ -41,7 +41,7 @@
Back
- go
+ go
diff --git a/src/vue-poc/features/timeline.vue b/src/vue-poc/features/timeline.vue
index 4c1d09e..b7d3788 100644
--- a/src/vue-poc/features/timeline.vue
+++ b/src/vue-poc/features/timeline.vue
@@ -9,7 +9,7 @@
+ :options="{editable: true, clickToUse: false}" @select="select">
diff --git a/src/vue-poc/features/users.vue b/src/vue-poc/features/users.vue
index 5a3f12d..cd35519 100644
--- a/src/vue-poc/features/users.vue
+++ b/src/vue-poc/features/users.vue
@@ -1,16 +1,69 @@
-users todo
+
+
+
+
+
+
+
+
+
+ |
+ {{ props.item.name }} |
+ {{ props.item.permission }}
+
+
+
diff --git a/src/vue-poc/features/xslt/rq-xslt.xqm b/src/vue-poc/features/xslt/rq-xslt.xqm
new file mode 100644
index 0000000..73d899d
--- /dev/null
+++ b/src/vue-poc/features/xslt/rq-xslt.xqm
@@ -0,0 +1,39 @@
+(:~
+: validation handler
+: @author andy bunce
+: @since oct 2017
+:)
+
+module namespace tx = 'quodatum:vue.api.validate';
+
+(:~
+ : validate
+ :)
+declare
+%rest:POST %rest:path("/vue-poc/api/validate")
+%rest:query-param("xml", "{$xml}")
+%rest:query-param("schema", "{$schema}")
+%output:method("json")
+%updating
+function tx:validate($xml,$schema) {
+ let $xslt:="fixme"
+ let $result:=try{
+ let $x:=fn:parse-xml($xml)
+ let $s:=fn:parse-xml($xslt)
+ let $t:=fn:trace($xml,"xml")
+ let $t:=fn:trace($xslt,"xml")
+ let $r:=xslt:transform($x,$s)
+ return
+
+ 0
+ {fn:serialize($r)}
+
+ }
+ catch *{
+
+ 1
+ {$err:description}
+
+ }
+ return db:output($result)
+};
\ No newline at end of file
diff --git a/src/vue-poc/features/xslt/transform.vue b/src/vue-poc/features/xslt/transform.vue
new file mode 100644
index 0000000..fa0e4f4
--- /dev/null
+++ b/src/vue-poc/features/xslt/transform.vue
@@ -0,0 +1,107 @@
+
+
+
+
+
+ play_circle_outlineRun
+
+
+ visibility
+
+ Result
+
+
+ XML
+
+
+ XSLT
+
+
+ settings
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/vue-poc/router.js b/src/vue-poc/router.js
index 5226e12..bf1ab84 100644
--- a/src/vue-poc/router.js
+++ b/src/vue-poc/router.js
@@ -28,6 +28,9 @@ const router = new VueRouter({
{ path: '/acesettings', component: Acesettings, meta:{title:"Editor settings"} },
{ path: '/history', component: History, meta:{title:"File History"} },
{ path: '/puzzle', component: Puzzle, meta:{title:"Jigsaw"} },
+ { path: '/svg', component: Svg, meta:{title:"SVG"} },
+ { path: '/transform', component: Transform, meta:{title:"XSLT2 Transform"} },
+ { path: '/validate', component: Validate, meta:{title:"Validate"} },
{ path: '/eval', component: Eval, meta:{title:"Evaluate XQuery"} },
{ path: '/logs', component: Log, meta:{title:"Server logs"} },
{ path: '/tasks', component: Task, meta:{title:"Runnable tasks"} },
diff --git a/src/vue-poc/static/app-gen.js b/src/vue-poc/static/app-gen.js
index b28c126..3eede55 100644
--- a/src/vue-poc/static/app-gen.js
+++ b/src/vue-poc/static/app-gen.js
@@ -1,23 +1,23 @@
-// generated 2017-10-06T15:15:26.236+01:00
+// generated 2017-10-09T10:18:05.74+01:00
Vue.component('qd-confirm',{template:`
-
+
-
+
Confirm action
- Delete all edit text?
+
+ Test message
+
- Cancel
- Ok
+ Cancel
+ Ok
`,
- data(){
- return {showDialog:false}
- },
+ props: ['value']
}
);
@@ -203,7 +203,7 @@
var session=this.editor.getSession()
session.setUseWrapMode(value)
},
- 'settings' (value) {
+ 'setting' (value) {
console.log("--settings--",value)
this.applySettings(value)
}
@@ -227,7 +227,7 @@
},
applySettings(aceSettings){
- console.log("apply: ",aceSettings)
+ console.log("apply: ",aceSettings.theme)
this.editor.setTheme(`ace/theme/${aceSettings.theme}`)
//this.editor.setKeyboardHandler(`ace/keyboard//${aceSettings.keybinding}`)
this.editor.setFontSize(parseInt(aceSettings.fontsize,10))
@@ -280,7 +280,7 @@
}
}
//console.log(this.annots)
- this.$emit('annotation',this.annots)
+ this.$emit('annotation',{error: this.annots["error"]+0, warning: this.annots["warning"]+0})
});
if(this.events){
this.events.$on('eventFired', (cmd) => {
@@ -760,7 +760,7 @@ Vue.filter('round', function(value, decimals) {
- {{icon}}
+ {{icon}}
@@ -782,8 +782,7 @@ Vue.filter('round', function(value, decimals) {
Changed?
-
-
+
{{ mode }}
@@ -791,8 +790,6 @@ Vue.filter('round', function(value, decimals) {
-
-
@@ -873,19 +870,7 @@ Vue.filter('round', function(value, decimals) {
-
-
-
- Confirm action
-
- Delete all edit text?
-
-
- Cancel
- Ok
-
-
-
+ Delete all edit text?
`,
@@ -1082,7 +1067,7 @@ Vue.filter('round', function(value, decimals) {
label
Namespaces
- more_vert
+ more_vert
Show query plan
@@ -1333,7 +1318,7 @@ Vue.filter('round', function(value, decimals) {
- {{m}}
+ {{m}}
@@ -1450,10 +1435,10 @@ Vue.filter('round', function(value, decimals) {
{{ total }} in {{ elapsed | round(2) }} secs
Page:{{ query.page+1 }}
-
+
arrow_back
-
+
arrow_forward
@@ -1463,23 +1448,31 @@ Vue.filter('round', function(value, decimals) {
-
-
-
-
-
- favorite
+
+
+
+ check_circle
+
+
+
+
+
+ #
+
+ place
-
- bookmark
+
+
+ info
+
+
share
-
-
+
@@ -1503,17 +1496,14 @@ Vue.filter('round', function(value, decimals) {
-
- closeClear keyword
-
- Cancel
- Save
+ Cancel
+ Save
@@ -1527,8 +1517,8 @@ Vue.filter('round', function(value, decimals) {
- Cancel
- Save
+ Cancel
+ Save
@@ -1541,7 +1531,7 @@ Vue.filter('round', function(value, decimals) {
- Apply
+ Apply
@@ -1710,8 +1700,8 @@ body
-
-
+
+
@@ -1960,7 +1950,7 @@ people
- Continue
+ Continue
@@ -2268,15 +2258,50 @@ people
);
const Repo=Vue.extend({template:`
-repository todo
+
+
+
+
+
+
+
+
+
+ |
+ {{ props.item.name }} |
+ {{ props.item.permission }}
+ |
+
+
`,
data: function(){
return {
- message: 'bad route!'
+ loading: false,
+ items: [],
+ search: null,
+ selected: [],
+ headers: [
+ {
+ text: 'Name',
+ left: true,
+ value: 'id'
+ },
+ { text: 'Permission', value: 'state' }
+ ]
}
},
+ methods:{
+ getUsers(){
+ this.loading=true;
+ HTTP.get("repo")
+ .then(r=>{
+ this.loading=false
+ this.items=r.data
+ })
+ }
+ },
created:function(){
console.log("notfound",this.$route.query.q)
}
@@ -2508,31 +2533,33 @@ repository todo
Not fully implemented
+
+
-
- Theme
-
-
+
+
+
-
- Key binding
-
-
+
+
-
- Font size
-
-
+
+
+
+
+
+
+
@@ -2665,7 +2692,7 @@ repository todo
if(confirm("wipe localstorage? "+this.keys.length)) settings.clear();
},
theme(){
- this.$emit("theme",this.dark)
+ this.$root.$emit("theme",this.dark)
}
},
created(){
@@ -2678,6 +2705,23 @@ repository todo
}
}
+ );
+ const Svg=Vue.extend({template:`
+
+svg
+
+ `,
+
+ data: function(){
+ return {
+ message: 'bad route!'
+ }
+ },
+ created:function(){
+ console.log("notfound",this.$route.query.q)
+ }
+}
+
);
const Tabs=Vue.extend({template:`
@@ -2736,7 +2780,7 @@ repository todo
Generate model.gen.xqm
-
+
play_circle_outline
Run
@@ -2844,7 +2888,7 @@ repository todo
compile
-
+
play_circle_outline
Run
@@ -2919,7 +2963,7 @@ repository todo
Task: Generate xqdoc
-
+
play_circle_outline
Run
@@ -3009,7 +3053,7 @@ repository todo
- Next
+ Next
@@ -3018,8 +3062,8 @@ repository todo
Back
- Validate
- Next
+ Validate
+ Next
@@ -3028,7 +3072,7 @@ repository todo
Back
- go
+ go
@@ -3073,7 +3117,7 @@ repository todo
fit
-
+
@@ -3115,7 +3159,59 @@ created(){
);
const Users=Vue.extend({template:`
-users todo
+
+
+
+
+
+
+
+
+
+ |
+ {{ props.item.name }} |
+ {{ props.item.permission }}
+ |
+
+
+
+ `,
+
+ data: function(){
+ return {
+ loading: false,
+ items: [],
+ search: null,
+ selected: [],
+ headers: [
+ {
+ text: 'Name',
+ left: true,
+ value: 'id'
+ },
+ { text: 'Permission', value: 'state' }
+ ]
+ }
+ },
+ methods:{
+ getUsers(){
+ this.loading=true;
+ HTTP.get("user")
+ .then(r=>{
+ this.loading=false
+ this.items=r.data
+ })
+ }
+ },
+ created:function(){
+ console.log("notfound",this.$route.query.q)
+ }
+}
+
+ );
+ const Validate=Vue.extend({template:`
+
+validate
`,
@@ -3129,6 +3225,106 @@ users todo
}
}
+ );
+ const Transform=Vue.extend({template:`
+
+
+
+ play_circle_outlineRun
+
+
+ visibility
+
+ Result
+
+
+ XML
+
+
+ XSLT
+
+
+ settings
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+
+ data: function(){
+ return {
+ xml:"",
+ xmlValid: true,
+ xslt:'\n',
+ xslValid: true,
+ aceSettings: {},
+ result: "(result here)",
+ resultValid: true,
+ showOptions: ["xml","xslt"],
+ loading: false
+ }
+ },
+ methods:{
+
+ transform(){
+ localforage.setItem('transform/xml', this.xml)
+ localforage.setItem('transform/xslt', this.xslt)
+ if(!this.showOptions.includes("result"))this.showOptions.push("result")
+ this.loading=true
+ this.resultValid=true
+ HTTPNE.post("xslt",Qs.stringify({xml:this.xml,xslt:this.xslt}))
+ .then(r=>{
+ console.log(r)
+ this.loading=false
+ if(r.data.rc==0){
+ this.result=r.data.result
+ }else{
+ this.result=r.data.info
+ this.resultValid=false
+ }
+ })
+ .catch(r=> {
+ console.log("error",r)
+ this.result=r.response.data.info
+ this.loading=false
+ });
+ }
+ },
+ beforeRouteEnter (to, from, next) {
+ settings.getItem('settings/ace')
+ .then( v =>{
+
+ next(vm => {
+ console.log('eval settings: ',v);
+ vm.aceSettings = v;
+ })})
+ },
+ created:function(){
+ console.log("transform")
+ localforage.getItem('transform/xml').then((value) => { this.xml=value || this.xml});
+ localforage.getItem('transform/xslt').then((value) => { this.xslt=value || this.xslt});
+ }
+}
+
);
const router = new VueRouter({
base:"/vue-poc/ui/",
@@ -3160,6 +3356,9 @@ users todo
{ path: '/acesettings', component: Acesettings, meta:{title:"Editor settings"} },
{ path: '/history', component: History, meta:{title:"File History"} },
{ path: '/puzzle', component: Puzzle, meta:{title:"Jigsaw"} },
+ { path: '/svg', component: Svg, meta:{title:"SVG"} },
+ { path: '/transform', component: Transform, meta:{title:"XSLT2 Transform"} },
+ { path: '/validate', component: Validate, meta:{title:"Validate"} },
{ path: '/eval', component: Eval, meta:{title:"Evaluate XQuery"} },
{ path: '/logs', component: Log, meta:{title:"Server logs"} },
{ path: '/tasks', component: Task, meta:{title:"Runnable tasks"} },
@@ -3194,8 +3393,20 @@ router.beforeEach((to, from, next) => {
next() // make sure to always call next()!
}
});const Vuepoc=Vue.extend({template:`
-
-
+
+
+
+
+ Notifications
+
+ close
+
+
+ TODO
+
+
+
+
@@ -3264,13 +3475,14 @@ router.beforeEach((to, from, next) => {
router,
data:function(){return {
- q:"",
- status:{},
- drawer:true,
+ q: "",
+ status: {},
+ drawer: true,
+ drawerRight: false,
mini: false,
dark: false,
- alert:{show:false,msg:"Hello"},
- items:[
+ alert: {show:false,msg:"Hello"},
+ items: [
{href: '/',text: 'Home', icon: 'home' },
{
icon: 'folder_open',
@@ -3288,6 +3500,8 @@ router.beforeEach((to, from, next) => {
children: [
{href: '/eval',text: 'Query',icon: 'play_circle_outline'},
{href: '/edit',text: 'Edit',icon: 'mode_edit'},
+ {href: '/validate',text: 'Validate',icon: 'playlist_add_check'},
+ {href: '/transform',text: 'XSLT Transform',icon: 'input'},
{href: '/tasks',text: 'Tasks',icon: 'history'}
]},
{
@@ -3297,6 +3511,7 @@ router.beforeEach((to, from, next) => {
children: [
{href: '/jobs',text: 'Running jobs',icon: 'dashboard'},
{href: '/logs',text: 'Server logs',icon: 'dns'},
+ {href: '/timeline',text: 'Time line',icon: 'timelapse'},
{href: '/server/users',text: 'Users',icon: 'supervisor_account'},
{href: '/server/repo',text: 'Server code repository',icon: 'local_library'},
{href: '/ping',text: 'Ping',icon: 'update'}
@@ -3321,9 +3536,9 @@ router.beforeEach((to, from, next) => {
children: [
{href: '/session',text: 'Session',icon: 'person'},
{href: '/select',text: 'Select',icon: 'extension'},
- {href: '/puzzle',text: 'Puzzle',icon: 'extension'},
- {href: '/tabs',text: 'Tabs',icon: 'switch_camera'},
- {href: '/timeline',text: 'Time line',icon: 'timelapse'}
+ {href: '/puzzle',text: 'Puzzle',icon: 'extension'},
+ {href: '/svg',text: 'SVG',icon: 'extension'},
+ {href: '/tabs',text: 'Tabs',icon: 'switch_camera'}
]},
{href: '/settings',text: 'Settings',icon: 'settings' },
@@ -3349,13 +3564,12 @@ router.beforeEach((to, from, next) => {
},
onDark(dark){
this.dark=dark
- alert("theme")
},
favorite(){
alert("@TODO")
},
notifications(){
- alert("@TODO")
+ this.drawerRight=true
}
},
@@ -3363,12 +3577,14 @@ router.beforeEach((to, from, next) => {
console.log("create-----------")
var that=this
+ this.$on("theme",this.onDark)
Vue.config.errorHandler = function (err, vm, info) {
// handle error
// `info` is a Vue-specific error info, e.g. which lifecycle hook
console.error(err, vm, info);
- that.showAlert("vue error:\n"+err)
- alert("vue error");
+ var msg=JSON.stringify(err)
+ that.showAlert("vue error:\n"+msg)
+ //alert("vue error");
};
// Add a response interceptor
@@ -3483,7 +3699,22 @@ var settings = {
}
};
+// error help
+// https://stackoverflow.com/questions/18391212/is-it-not-possible-to-stringify-an-error-using-json-stringify/18391400#18391400
+if (!('toJSON' in Error.prototype))
+ Object.defineProperty(Error.prototype, 'toJSON', {
+ value: function () {
+ var alt = {};
+ Object.getOwnPropertyNames(this).forEach(function (key) {
+ alt[key] = this[key];
+ }, this);
+
+ return alt;
+ },
+ configurable: true,
+ writable: true
+ });
//Returns a function, that, as long as it continues to be invoked, will not
//be triggered. The function will be called after it stops being called for
diff --git a/src/vue-poc/static/app.css b/src/vue-poc/static/app.css
index 307de57..8219aec 100644
--- a/src/vue-poc/static/app.css
+++ b/src/vue-poc/static/app.css
@@ -1,5 +1,11 @@
/* app.css */
-
+pre {
+ white-space: pre-wrap; /* css-3 */
+ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
+ white-space: -pre-wrap; /* Opera 4-6 */
+ white-space: -o-pre-wrap; /* Opera 7 */
+ word-wrap: break-word; /* Internet Explorer 5.5+ */
+}
/* http://tobiasahlin.com/spinkit/ */
.spinner {
margin: 100px auto;
diff --git a/src/vue-poc/static/app.html b/src/vue-poc/static/app.html
index 09c5ad7..5fb8b50 100644
--- a/src/vue-poc/static/app.html
+++ b/src/vue-poc/static/app.html
@@ -9,7 +9,7 @@
Vue Router Test
-
+
-
+
@@ -48,7 +48,7 @@
-
+
| |