diff --git a/src/vue-poc/app.vue b/src/vue-poc/app.vue index e81a9b1..eddad8a 100644 --- a/src/vue-poc/app.vue +++ b/src/vue-poc/app.vue @@ -282,7 +282,8 @@ this.$auth=Object.assign(this.$auth,r.data); console.log("AFTER: ",this.$auth); //this.$forceUpdate() - }) + }) + EditTabs.restore(); }, beforeDestroy(){ diff --git a/src/vue-poc/components/EditTabs.js b/src/vue-poc/components/EditTabs.js new file mode 100644 index 0000000..98bb141 --- /dev/null +++ b/src/vue-poc/components/EditTabs.js @@ -0,0 +1,84 @@ +//Manage array of text sources used for:edit tabs +// item{ +// name: +// contentType: +// text: +// id: +// url: +// +const EditTabs=new Vue({ + data(){ + return { + items:[], + nextId: 1, + currentId: null + } + }, + + methods: { + addItem(tab){ + console.log("new: ",tab); + var def={name: "AA"+this.nextId, + contentType: "text/xml", + mode: "xml", + text: "" +this.nextId +"", + url: null + }; + var etab = Object.assign(def,tab); + etab.id= ""+this.nextId + this.items.push (etab); + this.nextId++; + return etab; + }, + + closeItem(item){ + var index=this.items.indexOf(item); + if (index > -1) { + alert("index: "+index) + this.items.splice(index, 1); + index=(index==0)?0:index-1; + this.currentId=(this.items.length)?"T"+this.items[index].id : null; + } + }, + + // fetch content from server and create tab + loadItem(url){ + HTTP.get("get",{params: {url:url}}) + .then(r=>{ + console.log(r) + var tab={ + text: ""+ r.data.data, + url: url, + name: url.split(/.*[\/|\\]/)[1] + }; + this.addItem(tab); + }) + .catch(error=> { + console.log(error); + alert("Get query error:\n"+url) + }); + }, + + save(){ + Settings.setItem('edit/items',this.items); + }, + + restore(){ + that=this + Settings.getItem('edit/items') + .then(function (v){ + console.log("items ",v) + v.forEach(v =>that.addItem(v)) + }) + .catch(error=> { + console.log(error); + alert("load error") + }); + }, + + sorted(){ + return this.items.slice(0).sort((a,b) => a.name.localeCompare(b.name)) + } + } +}); + diff --git a/src/vue-poc/components/notification.js b/src/vue-poc/components/notification.js index edc6673..5ee0481 100644 --- a/src/vue-poc/components/notification.js +++ b/src/vue-poc/components/notification.js @@ -3,12 +3,15 @@ const Notification={ messages:[], nextId: 0, unseen:0, - add(msg){ - var data={ - text: msg, + add(opts){ + var data=Object.assign({ + html: 'no html', index: ++this.nextId, - created: new Date() - }; + created: new Date(), + elapsed: null + }, + opts); + console.log("opt",opts); this.messages.unshift(data); this.messages.length = Math.min(this.messages.length, 30); ++this.unseen; diff --git a/src/vue-poc/components/qd-breadcrumbs.vue b/src/vue-poc/components/qd-breadcrumbs.vue new file mode 100644 index 0000000..b1d95c7 --- /dev/null +++ b/src/vue-poc/components/qd-breadcrumbs.vue @@ -0,0 +1,34 @@ + + + + + diff --git a/src/vue-poc/components/vp-notifications.vue b/src/vue-poc/components/vp-notifications.vue index ad6be67..e46b24f 100644 --- a/src/vue-poc/components/vp-notifications.vue +++ b/src/vue-poc/components/vp-notifications.vue @@ -18,16 +18,15 @@ swap_horiz - - - {{ msg.created | fromNow("from") }} - - - - - - #{{ msg.index }} - + + + {{ msg.created | fromNow("from") }} + msg + + + {{ msg.elapsed }} ms + #{{ msg.index }} + diff --git a/src/vue-poc/components/vp-paramform.vue b/src/vue-poc/components/vp-paramform.vue index ec5d720..51e3e48 100644 --- a/src/vue-poc/components/vp-paramform.vue +++ b/src/vue-poc/components/vp-paramform.vue @@ -1,7 +1,7 @@