[mod] vuetify 2.3.16
This commit is contained in:
parent
a5f2c39987
commit
d28c1b94aa
@ -22,7 +22,7 @@ const MimeTypes=new function(){
|
||||
"image/svg+xml":{ mode:"svg"}
|
||||
};
|
||||
|
||||
|
||||
// mode to {icon, format function}
|
||||
this.mode={
|
||||
"text": {
|
||||
"icon": "library_books"
|
||||
@ -44,11 +44,29 @@ const MimeTypes=new function(){
|
||||
"icon": "spa"
|
||||
}
|
||||
};
|
||||
this.modeForMime=function(mimetype){
|
||||
var r= this.contentType[mimetype] && this.contentType[mimetype].mode
|
||||
return r || 'text'
|
||||
};
|
||||
|
||||
this.headers= [
|
||||
{ text: 'Name', value: 'name'},
|
||||
{ text: 'Ace Mode', value: 'mode' },
|
||||
{ text: 'Icon', value: 'icon' },
|
||||
{ text: 'Format', value: 'format' }
|
||||
];
|
||||
|
||||
// return [{name:.. mode:..}..]
|
||||
this.list=function(){
|
||||
var that=this
|
||||
var h= Object.keys(this.contentType).map(
|
||||
function(k){ return {name: k, mode: that.contentType[k].mode}}
|
||||
function(k){ var mode=that.modeForMime(k)
|
||||
return {name: k,
|
||||
mode: mode,
|
||||
icon: that.icon(mode),
|
||||
format: !!that.mode[mode]
|
||||
}
|
||||
}
|
||||
)
|
||||
return h
|
||||
};
|
||||
|
@ -115,10 +115,11 @@
|
||||
noDataMsg:{ default: "No data found."},
|
||||
title:{ default: "" },
|
||||
entity:{ },
|
||||
initItems: { default: function(){return []}},
|
||||
query: {default: function(){return {filter:null}}},
|
||||
showSelect: { default: false },
|
||||
multiSort: { default: false },
|
||||
filter: { default: []},
|
||||
filter: { default: function(){return []}},
|
||||
customFilter: {default: function(value, search, item) {
|
||||
return value != null &&
|
||||
search != null &&
|
||||
@ -129,9 +130,9 @@
|
||||
|
||||
data: function(){
|
||||
return {
|
||||
items: [],
|
||||
selected: [],
|
||||
loading: false,
|
||||
items: [],
|
||||
showSelectL: this.showSelect,
|
||||
multiSortL: this.multiSort,
|
||||
autoRefreshL: false
|
||||
@ -140,15 +141,18 @@
|
||||
|
||||
methods:{
|
||||
getItems(){
|
||||
if(this.dataUri === null) return;
|
||||
this.loading=true;
|
||||
HTTP.get(this.dataUri)
|
||||
.then(r=>{
|
||||
this.loading=false;
|
||||
console.log("qd-table items:",r.data.items,"headers ",this.headers);
|
||||
this.items=r.data.items;
|
||||
if(this.autoRefreshL) this.timer=setTimeout(()=>{ this.getItems() }, 10000);
|
||||
})
|
||||
if(this.dataUri === null) {
|
||||
this.items= this.initItems
|
||||
} else {
|
||||
this.loading=true;
|
||||
HTTP.get(this.dataUri)
|
||||
.then(r=>{
|
||||
this.loading=false;
|
||||
console.log("qd-table items:",r.data.items,"headers ",this.headers);
|
||||
this.items=r.data.items;
|
||||
if(this.autoRefreshL) this.timer=setTimeout(()=>{ this.getItems() }, 10000);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
copy(){
|
||||
|
@ -141,13 +141,12 @@
|
||||
<v-progress-linear v-if="busy" v-bind:indeterminate="true" ></v-progress-linear>
|
||||
|
||||
<v-card-text v-if="!busy">
|
||||
<v-flex xs12 style="height:70vh" fill-height>
|
||||
|
||||
<vue-ace :content="contentA" :mode="mode" :wrap="wrap" :settings="aceSettings"
|
||||
:events="events" v-resize="onResize" :completer="$aceExtras.basexCompleter" :snippets="$aceExtras.snippets"
|
||||
v-on:change-content="changeContentA"
|
||||
v-on:annotation="annotation"></vue-ace>
|
||||
</v-flex>
|
||||
<v-flex xs12 style="height:70vh" fill-height>
|
||||
<vue-ace :content="contentA" :mode="mode" :wrap="wrap" :settings="aceSettings"
|
||||
:events="events" v-resize="onResize" :completer="$aceExtras.basexCompleter" :snippets="$aceExtras.snippets"
|
||||
v-on:change-content="changeContentA"
|
||||
v-on:annotation="annotation"></vue-ace>
|
||||
</v-flex>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<qd-confirm v-model="clearDialog" @confirm="reset">Delete all edit text?</qd-confirm>
|
||||
@ -162,7 +161,6 @@ v-on:annotation="annotation"></vue-ace>
|
||||
};`,
|
||||
mode: 'xquery',
|
||||
url: '',
|
||||
protocol: 'webfile',
|
||||
name: '',
|
||||
path: [],
|
||||
mimetype: "",
|
||||
@ -199,10 +197,11 @@ v-on:annotation="annotation"></vue-ace>
|
||||
this.url=url
|
||||
this.name=a.pop()
|
||||
this.path=a
|
||||
HTTP.get("edit",{params: {url:url,protocol:this.protocol}})
|
||||
HTTP.get("edit",{params: {url:url}})
|
||||
.then(r=>{
|
||||
//console.log(r)
|
||||
this.setMode(r.data.mimetype)
|
||||
this.mimetype=r.data.mimetype
|
||||
this.mode= this.$MimeTypes.modeForMime(this.mimetype)
|
||||
this.contentA=r.data.data
|
||||
|
||||
this.busy=false
|
||||
@ -230,7 +229,6 @@ v-on:annotation="annotation"></vue-ace>
|
||||
save(){
|
||||
alert("TODO save: "+this.url);
|
||||
var data= {
|
||||
protocol:this.protocol,
|
||||
url: this.url, //gave the values directly for testing
|
||||
data: this.contentA
|
||||
}
|
||||
@ -288,6 +286,9 @@ v-on:annotation="annotation"></vue-ace>
|
||||
},
|
||||
|
||||
computed:{
|
||||
protocol(){
|
||||
return this.url.split(':').shift()
|
||||
},
|
||||
icon(){
|
||||
return (this.protocol=="xmldb")?"account_balance":"folder"
|
||||
}
|
||||
@ -296,7 +297,6 @@ v-on:annotation="annotation"></vue-ace>
|
||||
created(){
|
||||
//https://forum.vuejs.org/t/detect-browser-close/5001/3 @fixme
|
||||
document.addEventListener('beforeunload', this.leaving);
|
||||
this.protocol=this.$route.query.protocol?this.$route.query.protocol:this.protocol
|
||||
var url=this.$route.query.url
|
||||
if(url) this.fetch(url)
|
||||
},
|
||||
|
@ -7,6 +7,7 @@ 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 ufile = 'vue-poc/file' at "../../lib/file.xqm";
|
||||
import module namespace resolve = 'urn:quodatum:resolve' at "../../lib/resolve.xqm";
|
||||
|
||||
import module namespace mt = 'urn:quodatum:data:mimetype' at "../../lib/mimetype.xqm";
|
||||
declare namespace c="http://www.w3.org/ns/xproc-step";
|
||||
@ -18,19 +19,17 @@ declare namespace c="http://www.w3.org/ns/xproc-step";
|
||||
declare
|
||||
%rest:GET %rest:path("/vue-poc/api/edit")
|
||||
%rest:query-param("url", "{ $url }")
|
||||
%rest:query-param("protocol", "{ $protocol }")
|
||||
%rest:produces("application/json")
|
||||
%output:method("json")
|
||||
function vue-api:edit-get($url as xs:string, $protocol as xs:string)
|
||||
function vue-api:edit-get($url as xs:string)
|
||||
{
|
||||
|
||||
let $reader := map{
|
||||
"webfile": vue-api:get-webfile#1,
|
||||
"xmldb": vue-api:get-basexdb#1
|
||||
}
|
||||
let $reader:=trace($reader)
|
||||
let $fn:=($reader($protocol),vue-api:get-webfile#1)[1]
|
||||
return $fn($url)
|
||||
let $u:=resolve:uri($url)
|
||||
return <json type="object">{
|
||||
element protocol{ $u?protocol},
|
||||
element uri { $u?uri },
|
||||
element mimetype { fetch:content-type($u?uri) },
|
||||
element data { $u?fnGet() }
|
||||
}</json>
|
||||
};
|
||||
|
||||
(:~
|
||||
|
@ -59,7 +59,9 @@
|
||||
<template v-slot:item.start="{ item }">
|
||||
<span>{{ item.start | fromNow }}</span>
|
||||
</template>
|
||||
|
||||
<template v-slot:item.writes="{ item }">
|
||||
<span>*{{ item.writes }}</span>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-card>
|
||||
</template>
|
||||
|
@ -12,11 +12,11 @@ declare variable $vue-login:SESSION-KEY := "id";
|
||||
declare variable $vue-login:SESSION-VALUE := session:get($vue-login:SESSION-KEY);
|
||||
|
||||
(:~
|
||||
: Permission check: Area for logged-in users.
|
||||
: Checks if a session id exists for the current user; if not, redirects to the login page.
|
||||
: Permission check:
|
||||
: @todo something useful
|
||||
:)
|
||||
declare
|
||||
%perm:check('/vue-poc')
|
||||
%perm:check('/vue-poc/api')
|
||||
function vue-login:check-app() {
|
||||
let $user := session:get('id')
|
||||
let $m:=``[path: `{ request:path() }`, user: `{ $user }`.]``
|
||||
|
@ -36,14 +36,14 @@
|
||||
</template>
|
||||
|
||||
<template v-slot:default="props">
|
||||
<v-layout wrap >
|
||||
<v-flex
|
||||
<v-row align-content="start" >
|
||||
<v-col
|
||||
v-for="item in props.items"
|
||||
:key="item.name" >
|
||||
:key="item.name" >
|
||||
|
||||
<v-card :hover="true" active-class="default-class qd-active" max-width="20em" min-width="20em">
|
||||
|
||||
<v-toolbar color="blue lighten-3" >
|
||||
<v-toolbar color="orange lighten-3" >
|
||||
<v-toolbar-title>
|
||||
<router-link :to="{path:'entity/'+ item.name}">
|
||||
<v-avatar color="lime">
|
||||
@ -59,8 +59,8 @@
|
||||
</v-toolbar>
|
||||
<v-card-text xs1 >{{ item.description }}</<v-card-text>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
</v-data-iterator>
|
||||
</v-container>
|
||||
|
@ -1,79 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<template id="mimetype">
|
||||
<v-container fluid grid-list-md>
|
||||
|
||||
<v-data-iterator
|
||||
:items="items"
|
||||
:items-per-page.sync="itemsPerPage"
|
||||
:search="q"
|
||||
hide-default-footer
|
||||
select-all
|
||||
:value="selected"
|
||||
>
|
||||
|
||||
<template v-slot:header>
|
||||
<v-toolbar >
|
||||
<v-toolbar-title>
|
||||
mimetype TODO
|
||||
<v-breadcrumbs :items="[{text:'Entities',to:'/entity'}]" >
|
||||
<template slot="item" slot-scope="props">
|
||||
<v-breadcrumbs-item :to="props.item.to" :disabled="props.item.disabled" :exact="true">
|
||||
{{ props.item.text }}
|
||||
</v-breadcrumbs-item>
|
||||
</template>
|
||||
</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>
|
||||
<v-btn @click="getItems" icon
|
||||
:loading="loading"
|
||||
:disabled="loading"
|
||||
><v-icon>refresh</v-icon></v-btn>
|
||||
<vp-entitylink entity="mimetype"></vp-entitylink>
|
||||
</v-toolbar>
|
||||
</template>
|
||||
|
||||
<template v-slot:default="props">
|
||||
<v-layout wrap>
|
||||
<v-flex
|
||||
v-for="item in props.items"
|
||||
:key="item.name"
|
||||
xs12
|
||||
sm6
|
||||
md4
|
||||
lg3
|
||||
>
|
||||
|
||||
<v-card :hover="true" active-class="default-class qd-active" height="200px" max-height="200px">
|
||||
|
||||
<v-toolbar color="blue lighten-3" dense>
|
||||
<v-toolbar-title>
|
||||
<router-link :to="{path:'entity/'+ item.name}">
|
||||
<v-avatar>
|
||||
<v-icon>{{ item.iconclass }}</v-icon>
|
||||
</v-avatar> {{ item.name }}
|
||||
</v-toolbar-title>
|
||||
</v-card-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-badge >
|
||||
<span slot="badge">{{ item.nfields }}</span>
|
||||
</v-badge>
|
||||
</v-toolbar>
|
||||
<v-card-text >{{ item.description }}</<v-card-text>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</template>
|
||||
</v-data-iterator>
|
||||
<qd-table :headers="$MimeTypes.headers" :init-items="items" item-key="name"
|
||||
:show-select="false" >
|
||||
<template v-slot:item.name="{ item }">
|
||||
<span>{{ item.name }} </span>
|
||||
</template>
|
||||
<template v-slot:actions>
|
||||
<v-list-item @click="remove">
|
||||
<v-list-item-avatar><v-icon>delete</v-icon></v-list-item-avatar>
|
||||
<v-list-item-title>Delete todo</v-list-item-title>
|
||||
</v-list-item>
|
||||
</template>
|
||||
</qd-table>
|
||||
|
||||
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>{
|
||||
data: function(){
|
||||
return {
|
||||
|
||||
itemsPerPage: 100,
|
||||
page: 1,
|
||||
items:[],
|
||||
@ -86,15 +34,9 @@
|
||||
},
|
||||
methods:{
|
||||
getItems(){
|
||||
this.loading=true
|
||||
HTTP.get("data/entity",{params:{q: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.items=r.data.items
|
||||
})
|
||||
this.items=this.$MimeTypes.list()
|
||||
},
|
||||
|
||||
setfilter(){
|
||||
console.log("TODO",this.q);
|
||||
this.$router.push({ query: {url: this.url,
|
||||
|
@ -4,6 +4,8 @@
|
||||
module namespace vue-rest = 'quodatum:vue.tasks';
|
||||
import module namespace query-a = 'vue-poc/query-a' at "../../lib/query-a.xqm";
|
||||
import module namespace hlog = 'quodatum.data.history' at '../../lib/history.xqm';
|
||||
import module namespace resolve = 'urn:quodatum:resolve' at '../../lib/resolve.xqm';
|
||||
|
||||
declare namespace hist="urn:quodatum:vue-poc.history";
|
||||
|
||||
(:~
|
||||
@ -39,18 +41,19 @@ function vue-rest:task($task,$id)
|
||||
{
|
||||
let $taskdef:=doc("taskdef.xml")/tasks/task[@name=$task]
|
||||
let $url:=resolve-uri($taskdef/@url)
|
||||
let $info:=query-a:inspect($url)
|
||||
|
||||
let $h:=if($id) then hlog:get($id) else ()
|
||||
return if($h) then (: use old values :)
|
||||
let $info:= query-a:inspect($url)
|
||||
let $info:= if($h) then (: use old values :)
|
||||
let $v:=<values type="object">{
|
||||
$h/hist:task/hist:param!element{@name}{string(.)}
|
||||
}</values> =>trace("O/P")
|
||||
return $info transform with {replace node ./values with $v}
|
||||
else
|
||||
$info
|
||||
return $info transform with { insert node <url2>{ resolve:special($url) }</url2> into . }
|
||||
};
|
||||
|
||||
|
||||
|
||||
(:~
|
||||
: Run the named task and log history
|
||||
:)
|
||||
|
@ -24,21 +24,21 @@ let $updating:=xquery:parse-uri($mod)/@updating/string()
|
||||
let $d:=inspect:module($mod)
|
||||
let $vars:=$d/variable[@external="true"]
|
||||
return <json type="object">
|
||||
<description>{ $d/description/string() }</description>
|
||||
<updating type="boolean" >{ $updating }</updating>
|
||||
<url >{ $mod }</url>
|
||||
<fields type="array">{
|
||||
$vars!
|
||||
<_ type="object">
|
||||
<model>{ @name/string() }</model>
|
||||
<label>{ description/string() }</label>
|
||||
<type>{ @type/string() }</type>
|
||||
</_>
|
||||
}</fields>
|
||||
<values type="object">{
|
||||
$vars!element{@name}{default_tag/string()}
|
||||
}</values>
|
||||
</json>
|
||||
<description>{ $d/description/string() }</description>
|
||||
<updating type="boolean" >{ $updating }</updating>
|
||||
<url >{ $mod }</url>
|
||||
<fields type="array">{
|
||||
$vars!
|
||||
<_ type="object">
|
||||
<model>{ @name/string() }</model>
|
||||
<label>{ description/string() }</label>
|
||||
<type>{ @type/string() }</type>
|
||||
</_>
|
||||
}</fields>
|
||||
<values type="object">{
|
||||
$vars!element{@name}{default_tag/string()}
|
||||
}</values>
|
||||
</json>
|
||||
};
|
||||
|
||||
(:~
|
||||
|
83
src/vue-poc/lib/resolve.xqm
Normal file
83
src/vue-poc/lib/resolve.xqm
Normal file
@ -0,0 +1,83 @@
|
||||
(:~
|
||||
: resolve uri tools supports protocols: "xmldb" "webfile"
|
||||
result map{
|
||||
"protocol": one of "file", "xmldb"
|
||||
"uri":
|
||||
"fnGet": function#0 to get
|
||||
}
|
||||
@since Sept 2020
|
||||
@author Andy Bunce
|
||||
@copyright Quodatum Ltd
|
||||
@version 0.0.4
|
||||
:)
|
||||
module namespace resolve = 'urn:quodatum:resolve';
|
||||
import module namespace web = 'http://basex.org/modules/web';
|
||||
|
||||
(:~
|
||||
:
|
||||
:)
|
||||
declare function resolve:uri($uri as xs:string)
|
||||
as map(*){
|
||||
let $t:=tokenize($uri,':')
|
||||
let $protocol:= if(count($t) gt 1 ) then head($t) else ()
|
||||
let $isDrive:= matches($protocol,"^[A-Za-z]$")
|
||||
let $path:= tail($t)=>string-join(":")
|
||||
let $uri:=switch ($protocol)
|
||||
case "webfile"
|
||||
return let $webroot:=db:system()/globaloptions/webpath/string()
|
||||
return concat($webroot,$path)
|
||||
case "xmldb"
|
||||
return $path
|
||||
|
||||
case "file"
|
||||
return web:decode-url($path)=>replace("^//*","")=>replace("/","\" || file:dir-separator())
|
||||
default
|
||||
return if ($isDrive) then $uri else $path
|
||||
|
||||
let $protocol:= switch (true())
|
||||
case $isDrive
|
||||
return "file"
|
||||
|
||||
case $protocol = "webfile"
|
||||
return "file"
|
||||
|
||||
default
|
||||
return $protocol
|
||||
|
||||
let $getfn:= switch ($protocol)
|
||||
case "xmldb"
|
||||
return function(){ doc($uri)}
|
||||
|
||||
default
|
||||
return function(){ fetch:text($uri)}
|
||||
|
||||
return map{
|
||||
"protocol": $protocol,
|
||||
"uri": $uri,
|
||||
"isDrive": $isDrive,
|
||||
"fnGet": $getfn
|
||||
}
|
||||
};
|
||||
|
||||
declare function resolve:meta($uri )
|
||||
as map(*){
|
||||
let $uri:=resolve:analyse($uri)
|
||||
let $size:=50
|
||||
return map:merge(($uri,map{"size": $size}))
|
||||
};
|
||||
|
||||
|
||||
declare function resolve:analyse($uri)
|
||||
as map(*){
|
||||
typeswitch($uri)
|
||||
case map(*) return $uri
|
||||
case xs:string return resolve:uri($uri)
|
||||
default return error(xs:QName("resolve:analyse"),"type not supported")
|
||||
};
|
||||
|
||||
declare function resolve:special($uri as xs:string)
|
||||
as xs:string{
|
||||
let $webroot:=db:system()/globaloptions/webpath/string()
|
||||
let $_:=trace(($uri,$webroot),"special")
|
||||
return $uri
|
||||
};
|
@ -1,4 +1,4 @@
|
||||
// generated 2020-11-01T22:01:41.739Z
|
||||
// generated 2020-11-07T23:04:20.292Z
|
||||
|
||||
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/components/qd-autoheight.vue
|
||||
Vue.component('qd-autoheight',{template:`
|
||||
@ -617,10 +617,11 @@ Vue.component('qd-table',{template:`
|
||||
noDataMsg:{ default: "No data found."},
|
||||
title:{ default: "" },
|
||||
entity:{ },
|
||||
initItems: { default: function(){return []}},
|
||||
query: {default: function(){return {filter:null}}},
|
||||
showSelect: { default: false },
|
||||
multiSort: { default: false },
|
||||
filter: { default: []},
|
||||
filter: { default: function(){return []}},
|
||||
customFilter: {default: function(value, search, item) {
|
||||
return value != null &&
|
||||
search != null &&
|
||||
@ -631,9 +632,9 @@ Vue.component('qd-table',{template:`
|
||||
|
||||
data: function(){
|
||||
return {
|
||||
items: [],
|
||||
selected: [],
|
||||
loading: false,
|
||||
items: [],
|
||||
showSelectL: this.showSelect,
|
||||
multiSortL: this.multiSort,
|
||||
autoRefreshL: false
|
||||
@ -642,15 +643,18 @@ Vue.component('qd-table',{template:`
|
||||
|
||||
methods:{
|
||||
getItems(){
|
||||
if(this.dataUri === null) return;
|
||||
this.loading=true;
|
||||
HTTP.get(this.dataUri)
|
||||
.then(r=>{
|
||||
this.loading=false;
|
||||
console.log("qd-table items:",r.data.items,"headers ",this.headers);
|
||||
this.items=r.data.items;
|
||||
if(this.autoRefreshL) this.timer=setTimeout(()=>{ this.getItems() }, 10000);
|
||||
})
|
||||
if(this.dataUri === null) {
|
||||
this.items= this.initItems
|
||||
} else {
|
||||
this.loading=true;
|
||||
HTTP.get(this.dataUri)
|
||||
.then(r=>{
|
||||
this.loading=false;
|
||||
console.log("qd-table items:",r.data.items,"headers ",this.headers);
|
||||
this.items=r.data.items;
|
||||
if(this.autoRefreshL) this.timer=setTimeout(()=>{ this.getItems() }, 10000);
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
copy(){
|
||||
@ -1683,7 +1687,7 @@ const MimeTypes=new function(){
|
||||
"image/svg+xml":{ mode:"svg"}
|
||||
};
|
||||
|
||||
|
||||
// mode to {icon, format function}
|
||||
this.mode={
|
||||
"text": {
|
||||
"icon": "library_books"
|
||||
@ -1705,11 +1709,29 @@ const MimeTypes=new function(){
|
||||
"icon": "spa"
|
||||
}
|
||||
};
|
||||
this.modeForMime=function(mimetype){
|
||||
var r= this.contentType[mimetype] && this.contentType[mimetype].mode
|
||||
return r || 'text'
|
||||
};
|
||||
|
||||
this.headers= [
|
||||
{ text: 'Name', value: 'name'},
|
||||
{ text: 'Ace Mode', value: 'mode' },
|
||||
{ text: 'Icon', value: 'icon' },
|
||||
{ text: 'Format', value: 'format' }
|
||||
];
|
||||
|
||||
// return [{name:.. mode:..}..]
|
||||
this.list=function(){
|
||||
var that=this
|
||||
var h= Object.keys(this.contentType).map(
|
||||
function(k){ return {name: k, mode: that.contentType[k].mode}}
|
||||
function(k){ var mode=that.modeForMime(k)
|
||||
return {name: k,
|
||||
mode: mode,
|
||||
icon: that.icon(mode),
|
||||
format: !!that.mode[mode]
|
||||
}
|
||||
}
|
||||
)
|
||||
return h
|
||||
};
|
||||
@ -3615,10 +3637,9 @@ const Edit=Vue.extend({template:`
|
||||
<v-progress-linear v-if="busy" v-bind:indeterminate="true"></v-progress-linear>
|
||||
|
||||
<v-card-text v-if="!busy">
|
||||
<v-flex xs12 style="height:70vh" fill-height>
|
||||
|
||||
<vue-ace :content="contentA" :mode="mode" :wrap="wrap" :settings="aceSettings" :events="events" v-resize="onResize" :completer="$aceExtras.basexCompleter" :snippets="$aceExtras.snippets" v-on:change-content="changeContentA" v-on:annotation="annotation"></vue-ace>
|
||||
</v-flex>
|
||||
<v-flex xs12 style="height:70vh" fill-height>
|
||||
<vue-ace :content="contentA" :mode="mode" :wrap="wrap" :settings="aceSettings" :events="events" v-resize="onResize" :completer="$aceExtras.basexCompleter" :snippets="$aceExtras.snippets" v-on:change-content="changeContentA" v-on:annotation="annotation"></vue-ace>
|
||||
</v-flex>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<qd-confirm v-model="clearDialog" @confirm="reset">Delete all edit text?</qd-confirm>
|
||||
@ -3632,7 +3653,6 @@ const Edit=Vue.extend({template:`
|
||||
};`,
|
||||
mode: 'xquery',
|
||||
url: '',
|
||||
protocol: 'webfile',
|
||||
name: '',
|
||||
path: [],
|
||||
mimetype: "",
|
||||
@ -3669,10 +3689,11 @@ const Edit=Vue.extend({template:`
|
||||
this.url=url
|
||||
this.name=a.pop()
|
||||
this.path=a
|
||||
HTTP.get("edit",{params: {url:url,protocol:this.protocol}})
|
||||
HTTP.get("edit",{params: {url:url}})
|
||||
.then(r=>{
|
||||
//console.log(r)
|
||||
this.setMode(r.data.mimetype)
|
||||
this.mimetype=r.data.mimetype
|
||||
this.mode= this.$MimeTypes.modeForMime(this.mimetype)
|
||||
this.contentA=r.data.data
|
||||
|
||||
this.busy=false
|
||||
@ -3700,7 +3721,6 @@ const Edit=Vue.extend({template:`
|
||||
save(){
|
||||
alert("TODO save: "+this.url);
|
||||
var data= {
|
||||
protocol:this.protocol,
|
||||
url: this.url, //gave the values directly for testing
|
||||
data: this.contentA
|
||||
}
|
||||
@ -3758,6 +3778,9 @@ const Edit=Vue.extend({template:`
|
||||
},
|
||||
|
||||
computed:{
|
||||
protocol(){
|
||||
return this.url.split(':').shift()
|
||||
},
|
||||
icon(){
|
||||
return (this.protocol=="xmldb")?"account_balance":"folder"
|
||||
}
|
||||
@ -3766,7 +3789,6 @@ const Edit=Vue.extend({template:`
|
||||
created(){
|
||||
//https://forum.vuejs.org/t/detect-browser-close/5001/3 @fixme
|
||||
document.addEventListener('beforeunload', this.leaving);
|
||||
this.protocol=this.$route.query.protocol?this.$route.query.protocol:this.protocol
|
||||
var url=this.$route.query.url
|
||||
if(url) this.fetch(url)
|
||||
},
|
||||
@ -5482,7 +5504,9 @@ const Jobs=Vue.extend({template:`
|
||||
<template v-slot:item.start="{ item }">
|
||||
<span>{{ item.start | fromNow }}</span>
|
||||
</template>
|
||||
|
||||
<template v-slot:item.writes="{ item }">
|
||||
<span>*{{ item.writes }}</span>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-card>
|
||||
`,
|
||||
@ -5922,12 +5946,12 @@ const Entity=Vue.extend({template:`
|
||||
</template>
|
||||
|
||||
<template v-slot:default="props">
|
||||
<v-layout wrap>
|
||||
<v-flex v-for="item in props.items" :key="item.name">
|
||||
<v-row align-content="start">
|
||||
<v-col v-for="item in props.items" :key="item.name">
|
||||
|
||||
<v-card :hover="true" active-class="default-class qd-active" max-width="20em" min-width="20em">
|
||||
|
||||
<v-toolbar color="blue lighten-3">
|
||||
<v-toolbar color="orange lighten-3">
|
||||
<v-toolbar-title>
|
||||
<router-link :to="{path:'entity/'+ item.name}">
|
||||
<v-avatar color="lime">
|
||||
@ -5943,8 +5967,8 @@ const Entity=Vue.extend({template:`
|
||||
</v-toolbar>
|
||||
<v-card-text xs1>{{ item.description }}<!--<v-card-text-->
|
||||
</v-card-text></v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
</v-data-iterator>
|
||||
</v-container>
|
||||
@ -6199,59 +6223,25 @@ const Entity1data=Vue.extend({template:`
|
||||
// src: file:///C:/Users/andy/git/vue-poc/src/vue-poc/features/model/mimetype.vue
|
||||
const Mimetype=Vue.extend({template:`
|
||||
<v-container fluid grid-list-md>
|
||||
|
||||
<v-data-iterator :items="items" :items-per-page.sync="itemsPerPage" :search="q" hide-default-footer select-all :value="selected">
|
||||
|
||||
<template v-slot:header>
|
||||
<v-toolbar>
|
||||
<v-toolbar-title>
|
||||
mimetype TODO
|
||||
<v-breadcrumbs :items="[{text:'Entities',to:'/entity'}]">
|
||||
<template slot="item" slot-scope="props">
|
||||
<v-breadcrumbs-item :to="props.item.to" :disabled="props.item.disabled" :exact="true">
|
||||
{{ props.item.text }}
|
||||
</v-breadcrumbs-item>
|
||||
</template>
|
||||
</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>
|
||||
<v-btn @click="getItems" icon :loading="loading" :disabled="loading"><v-icon>refresh</v-icon></v-btn>
|
||||
<vp-entitylink entity="mimetype"></vp-entitylink>
|
||||
</v-toolbar>
|
||||
</template>
|
||||
|
||||
<template v-slot:default="props">
|
||||
<v-layout wrap>
|
||||
<v-flex v-for="item in props.items" :key="item.name" xs12 sm6 md4 lg3>
|
||||
|
||||
<v-card :hover="true" active-class="default-class qd-active" height="200px" max-height="200px">
|
||||
|
||||
<v-toolbar color="blue lighten-3" dense>
|
||||
<v-toolbar-title>
|
||||
<router-link :to="{path:'entity/'+ item.name}">
|
||||
<v-avatar>
|
||||
<v-icon>{{ item.iconclass }}</v-icon>
|
||||
</v-avatar> {{ item.name }}
|
||||
</router-link></v-toolbar-title>
|
||||
|
||||
<v-spacer></v-spacer>
|
||||
<v-badge>
|
||||
<span slot="badge">{{ item.nfields }}</span>
|
||||
</v-badge>
|
||||
</v-toolbar>
|
||||
<v-card-text>{{ item.description }}<!--<v-card-text-->
|
||||
</v-card-text></v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</template>
|
||||
</v-data-iterator>
|
||||
<qd-table :headers="$MimeTypes.headers" :init-items="items" item-key="name" :show-select="false">
|
||||
<template v-slot:item.name="{ item }">
|
||||
<span>{{ item.name }} </span>
|
||||
</template>
|
||||
<template v-slot:actions>
|
||||
<v-list-item @click="remove">
|
||||
<v-list-item-avatar><v-icon>delete</v-icon></v-list-item-avatar>
|
||||
<v-list-item-title>Delete todo</v-list-item-title>
|
||||
</v-list-item>
|
||||
</template>
|
||||
</qd-table>
|
||||
|
||||
|
||||
</v-container>
|
||||
`,
|
||||
|
||||
data: function(){
|
||||
return {
|
||||
|
||||
itemsPerPage: 100,
|
||||
page: 1,
|
||||
items:[],
|
||||
@ -6264,15 +6254,9 @@ const Mimetype=Vue.extend({template:`
|
||||
},
|
||||
methods:{
|
||||
getItems(){
|
||||
this.loading=true
|
||||
HTTP.get("data/entity",{params:{q: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.items=r.data.items
|
||||
})
|
||||
this.items=this.$MimeTypes.list()
|
||||
},
|
||||
|
||||
setfilter(){
|
||||
console.log("TODO",this.q);
|
||||
this.$router.push({ query: {url: this.url,
|
||||
|
Loading…
Reference in New Issue
Block a user