diff --git a/src/vue-poc/cxan.xml b/src/vue-poc/cxan.xml
index 28a5c11..1e64daf 100644
--- a/src/vue-poc/cxan.xml
+++ b/src/vue-poc/cxan.xml
@@ -2,8 +2,8 @@
vue-poc test of vue.js.
Andy Bunce
Andy Bunce
-
- Library
+ https://github.com/apb2006/vue-poc
+ Application
vue
basex
\ No newline at end of file
diff --git a/src/vue-poc/history.xml b/src/vue-poc/data/vue-poc/history.xml
similarity index 100%
rename from src/vue-poc/history.xml
rename to src/vue-poc/data/vue-poc/history.xml
diff --git a/src/vue-poc/expath-pkg.xml b/src/vue-poc/expath-pkg.xml
index 0a53225..fda5824 100644
--- a/src/vue-poc/expath-pkg.xml
+++ b/src/vue-poc/expath-pkg.xml
@@ -2,7 +2,7 @@
abbrev="vue-poc" version="0.0.4" spec="1.0">
vue-poc test of vue.js.
-
+
diff --git a/src/vue-poc/features/search.vue b/src/vue-poc/features/search.vue
index 41fe8a3..9ff53dd 100644
--- a/src/vue-poc/features/search.vue
+++ b/src/vue-poc/features/search.vue
@@ -1,8 +1,31 @@
-
- TODO
+ Not finished
+
+
+
+
+
+
+
+
+
+
+
+ {{ index }} {{ item.title }}
+ {{ item.uri }}
+
+
+
+ info
+
+
+
+
+
+
@@ -10,11 +33,41 @@
data: function(){
return {
q: this.$route.query.q,
- results: []
+ results: [],
+ busy: false,
+ selected: []
}
},
+ methods:{
+ get() {
+ this.busy= true
+ console.log("q",this.q)
+ HTTP.get('search',{params:{q:this.q}})
+ .then((res) => {
+ this.busy=false
+ this.results = res.data.items;
+ this.selected=[false,true]
+ });
+ },
+ send(e){
+ if(e.keyCode==13){
+ this.get()
+ }
+ },
+ icon(index){
+ return this.selected[index]?"check_circle":"search"
+ },
+ search(item){
+ alert(item.title)
+ },
+ select(index){
+ this.$set(this.selected,index,!this.selected[index])
+ //alert(index)
+ }
+ },
created:function(){
console.log("Serch",this.$route.query.q)
+ this.get()
}
}
diff --git a/src/vue-poc/models.gen.xqm b/src/vue-poc/models.gen.xqm
index 982e509..47cb3c7 100644
--- a/src/vue-poc/models.gen.xqm
+++ b/src/vue-poc/models.gen.xqm
@@ -1,9 +1,10 @@
(: entity access maps
- : auto generated from xml files in entities folder at: 2017-09-05T14:36:25.45+01:00
+ : auto generated from xml files in entities folder at: 2017-09-08T12:06:30.901+01:00
:)
module namespace entity = 'quodatum.models.generated';
import module namespace cfg = "quodatum:media.image.configure" at "features/images/config.xqm";declare namespace h='urn:quodatum:vue-poc.history';
+declare namespace xqdoc='http://www.xqdoc.org/1.0';
declare namespace c='http://www.w3.org/ns/xproc-step';
declare variable $entity:list:=map {
@@ -92,7 +93,89 @@ declare variable $entity:list:=map {
} },
"data": function() as element(h:event)*
- { doc("history.xml")/h:history/h:event[h:file] },
+ { doc("vue-poc/history.xml")/h:history/h:event[h:file] },
+
+ "views": map{
+
+ }
+ },
+ "query": map{
+ "name": "query",
+ "description": "An replx query",
+ "access": map{
+ "created": function($_ as element()) as xs:string {$_/created },
+ "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($_/created)!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(query)*
+ { collection("replx/queries")/query
+ },
+
+ "views": map{
+ 'filter': 'name description'
+ }
+ },
+ "search-result": map{
+ "name": "search-result",
+ "description": "About a search result.",
+ "access": map{
+ "sref": function($_ as element()) as xs:string {$_/"app.item.index({'name':'benchx'})" },
+ "title": function($_ as element()) as xs:string {$_/title },
+ "type": function($_ as element()) as xs:string {$_/type },
+ "uri": function($_ as element()) as xs:string {$_/uri } },
+
+ "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{
+ "sref": function($_ as element()) as element(sref)? {
+ (: xs:string :)
+ fn:data($_/"app.item.index({'name':'benchx'})")!element sref { .}
+ },
+ "title": function($_ as element()) as element(title)? {
+ (: xs:string :)
+ fn:data($_/title)!element title { .}
+ },
+ "type": function($_ as element()) as element(type)? {
+ (: xs:string :)
+ fn:data($_/type)!element type { .}
+ },
+ "uri": function($_ as element()) as element(uri)? {
+ (: xs:string :)
+ fn:data($_/uri)!element uri { .}
+ } },
+
+ "data": function() as element(search)*
+ { () },
"views": map{
diff --git a/src/vue-poc/models/filehistory.xml b/src/vue-poc/models/filehistory.xml
index 8fe4897..569c83a 100644
--- a/src/vue-poc/models/filehistory.xml
+++ b/src/vue-poc/models/filehistory.xml
@@ -27,5 +27,5 @@
fa fa-calendar
- doc("history.xml")/h:history/h:event[h:file]
+ doc("vue-poc/history.xml")/h:history/h:event[h:file]
\ No newline at end of file
diff --git a/src/vue-poc/static/app-gen.js b/src/vue-poc/static/app-gen.js
index c8847bf..4acbac5 100644
--- a/src/vue-poc/static/app-gen.js
+++ b/src/vue-poc/static/app-gen.js
@@ -1,4 +1,4 @@
-// generated 2017-09-07T22:40:46.775+01:00
+// generated 2017-09-10T22:43:59.216+01:00
Vue.component('qd-fullscreen',{template:`
{{ fullscreenIcon }}
@@ -2090,19 +2090,71 @@ repository todo
);
const Search=Vue.extend({template:`
-
- TODO
+ Not finished
+
+
+
+
+
+
+
+
+
+
+
+ {{ index }} {{ item.title }}
+ {{ item.uri }}
+
+
+
+ info
+
+
+
+
+
+
`,
data: function(){
return {
q: this.$route.query.q,
- results: []
+ results: [],
+ busy: false,
+ selected: []
}
},
+ methods:{
+ get() {
+ this.busy= true
+ console.log("q",this.q)
+ HTTP.get('search',{params:{q:this.q}})
+ .then((res) => {
+ this.busy=false
+ this.results = res.data.items;
+ this.selected=[false,true]
+ });
+ },
+ send(e){
+ if(e.keyCode==13){
+ this.get()
+ }
+ },
+ icon(index){
+ return this.selected[index]?"check_circle":"search"
+ },
+ search(item){
+ alert(item.title)
+ },
+ select(index){
+ this.$set(this.selected,index,!this.selected[index])
+ //alert(index)
+ }
+ },
created:function(){
console.log("Serch",this.$route.query.q)
+ this.get()
}
}
@@ -3075,11 +3127,12 @@ router.beforeEach((to, from, next) => {
created(){
console.log("create-----------")
+ var that=this
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);
- this.showAlert("vue error:\n"+err)
+ that.showAlert("vue error:\n"+err)
alert("vue error");
};
// Add a response interceptor
@@ -3144,13 +3197,13 @@ Vue.use(Auth);
// read and write settings
// https://vuejs.org/v2/guide/state-management.html
var settings = {
- debug: true,
+ debug: false,
getItem (key) {
if (this.debug) console.log('getItem',key);
return new Promise((resolve, reject) => {
localforage.getItem(key)
.then((value) => {
- console.log('GET setting', key,value);
+ //console.log('GET setting', key,value);
resolve(value)
}).catch((err) => {
console.log('GET failed');
@@ -3163,7 +3216,7 @@ var settings = {
return new Promise((resolve, reject) => {
localforage.setItem(key, value)
.then((value) => {
- console.log('SET ',key, value);
+ //console.log('SET ',key, value);
return new Promise((resolve, reject) => {resolve(value);})
}).catch((err) => {
console.log('set failed');
@@ -3237,7 +3290,5 @@ const Fullscreen={
}) }
};
Vue.use(Fullscreen);
-
-
Vue.use(Vuetify);
new Vuepoc().$mount('#app')
diff --git a/src/vue-poc/vue-api2.xqm b/src/vue-poc/vue-api2.xqm
index 43708ba..d343b5a 100644
--- a/src/vue-poc/vue-api2.xqm
+++ b/src/vue-poc/vue-api2.xqm
@@ -6,7 +6,9 @@
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";
@@ -26,7 +28,29 @@ declare
};
(:~
- : Returns a query result.
+ : 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:=(
+ No search yet: {$q}
+ database?url=%2F
+ ,
+
+ soon
+ ping
+ )
+
+ return dice:response($items,$entity,web:dice())
+};
+(:~
+ : Returns test list for select.
:)
declare
%rest:path("/vue-poc/api/test-select")
@@ -44,7 +68,6 @@ function vue-api:test-select($q )
-
(:~
: Returns wadl.
:)