Compare commits
5 Commits
57901853a9
...
1f6261dba0
Author | SHA1 | Date | |
---|---|---|---|
1f6261dba0 | |||
4aa5856fbc | |||
d003166e33 | |||
0097de5122 | |||
5a4faca86f |
@ -101,6 +101,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
router,
|
router,
|
||||||
el: '#api',
|
el: '#api',
|
||||||
@ -111,6 +112,7 @@
|
|||||||
// Locally registered variables
|
// Locally registered variables
|
||||||
auth: auth,
|
auth: auth,
|
||||||
},
|
},
|
||||||
|
|
||||||
computed:{
|
computed:{
|
||||||
// Methods to change data appearance, does cache results
|
// Methods to change data appearance, does cache results
|
||||||
},
|
},
|
||||||
@ -120,6 +122,7 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<!-- NOTE: Call SW registration -->
|
<!-- NOTE: Call SW registration -->
|
||||||
<script src="registerSW.js"></script>
|
<script src="registerSW.js"></script>
|
||||||
|
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
var tagArray = [];
|
var tagArray = [];
|
||||||
const data=[
|
|
||||||
'th',
|
|
||||||
'efi',
|
|
||||||
'wichtig',
|
|
||||||
];
|
|
||||||
const CreateMsgRouter = {
|
const CreateMsgRouter = {
|
||||||
template: `
|
template: `
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@ -22,12 +17,12 @@ const CreateMsgRouter = {
|
|||||||
<b-taginput
|
<b-taginput
|
||||||
id="tag"
|
id="tag"
|
||||||
v-model="selected"
|
v-model="selected"
|
||||||
:data=taglist
|
:data="filteredDataArray"
|
||||||
autocomplete
|
autocomplete
|
||||||
allow-new:false
|
allow-new:false
|
||||||
icon="label"
|
icon="label"
|
||||||
placeholder="#"
|
placeholder="#"
|
||||||
@typing="getFilteredTags"
|
|
||||||
@input="saveTagsToArray">
|
@input="saveTagsToArray">
|
||||||
</b-taginput>
|
</b-taginput>
|
||||||
</b-field>
|
</b-field>
|
||||||
@ -56,12 +51,12 @@ const CreateMsgRouter = {
|
|||||||
<b-taginput
|
<b-taginput
|
||||||
id="tag"
|
id="tag"
|
||||||
v-model="selected"
|
v-model="selected"
|
||||||
:data=taglist
|
:data="filteredDataArray"
|
||||||
autocomplete
|
autocomplete
|
||||||
allow-new:false
|
allow-new:false
|
||||||
icon="label"
|
icon="label"
|
||||||
placeholder="#"
|
placeholder="#"
|
||||||
@typing="getFilteredTags"
|
|
||||||
@input="saveTagsToArray">
|
@input="saveTagsToArray">
|
||||||
</b-taginput>
|
</b-taginput>
|
||||||
</b-field>
|
</b-field>
|
||||||
@ -81,9 +76,20 @@ const CreateMsgRouter = {
|
|||||||
auth: auth,
|
auth: auth,
|
||||||
isDisabled: false,
|
isDisabled: false,
|
||||||
selected: [],
|
selected: [],
|
||||||
|
searchtext : "",
|
||||||
taglist: data,
|
taglist: data,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed:{
|
||||||
|
filteredDataArray() {
|
||||||
|
return this.taglist.filter((option) => {
|
||||||
|
return option
|
||||||
|
.toString()
|
||||||
|
.toLowerCase()
|
||||||
|
.indexOf(this.searchtext.toLowerCase()) >= 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
saveTagsToArray: function() {
|
saveTagsToArray: function() {
|
||||||
tagArray = this.selected;
|
tagArray = this.selected;
|
||||||
@ -128,12 +134,15 @@ const CreateMsgRouter = {
|
|||||||
$.ajax({url: "api/tag/ids",method: "GET"})
|
$.ajax({url: "api/tag/ids",method: "GET"})
|
||||||
.done(jd => {
|
.done(jd => {
|
||||||
// NICHT SO wg. Vue: _messagelist = jd;
|
// NICHT SO wg. Vue: _messagelist = jd;
|
||||||
_taglist.splice(0, _taglist.length);
|
console.log("DATA: "+data);
|
||||||
_taglist.push.apply(_taglist, jd);
|
if(data == ""){
|
||||||
console.log("tag: jd: " + jd);
|
_taglist.splice(0, _taglist.length);
|
||||||
for (var e in jd) {
|
_taglist.push.apply(_taglist, jd);
|
||||||
if (!_tags[jd[e]]) {
|
console.log("tag: jd: " + jd);
|
||||||
get_insert_tag(jd[e]);
|
for (var e in jd) {
|
||||||
|
if (!_tags[jd[e]]) {
|
||||||
|
get_insert_tag(jd[e]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).fail(function (e, f, g) {
|
}).fail(function (e, f, g) {
|
||||||
@ -154,17 +163,9 @@ const CreateMsgRouter = {
|
|||||||
userField.prop('disabled',false);
|
userField.prop('disabled',false);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.list_tags();
|
//this.list_tags();
|
||||||
if ($(this).bootstrapMaterialDesign)
|
if ($(this).bootstrapMaterialDesign)
|
||||||
$(this).bootstrapMaterialDesign();
|
$(this).bootstrapMaterialDesign();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function get_insert_tag(id){
|
|
||||||
$.ajax({ url: "api/tag/id/"+id, method: "GET" }).done(function (tag) {
|
|
||||||
data.push("#" + tag.name);
|
|
||||||
console.log("Array:"+this.data);
|
|
||||||
}).fail(function (e, f, g) {
|
|
||||||
console.log("cannot load " + id + ".json: " + e + f + g);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
@ -23,16 +23,16 @@ const FileRouter = {
|
|||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
<b-field v-if="selectedOptions=='tags'">
|
<b-field v-if="selectedOptions=='tags'">
|
||||||
<b-autocomplete rounded v-model="searchtext"
|
<b-autocomplete v-model="searchtext"
|
||||||
:data="filteredDataArray"
|
:data="filteredDataArray"
|
||||||
placeholder="suche..." icon="magnify"
|
placeholder="#" icon="label"
|
||||||
@select="option => selected = option">
|
@select="option => selected = option">
|
||||||
</b-autocomplete>
|
</b-autocomplete>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
|
||||||
<b-button type="is-primary" @click="search">SUCHE</b-button>
|
<b-button type="is-primary" @click="search">SUCHE</b-button>
|
||||||
|
|
||||||
<div id="om-msg-cards">
|
<div id="om-msg-cards" v-if="isExtendedSearch==true">
|
||||||
<MsgCard
|
<MsgCard
|
||||||
v-for="id in messagelist.slice().reverse()"
|
v-for="id in messagelist.slice().reverse()"
|
||||||
:key="id"
|
:key="id"
|
||||||
@ -88,6 +88,7 @@ const FileRouter = {
|
|||||||
taglist: data,
|
taglist: data,
|
||||||
messagelist: _messagelist,
|
messagelist: _messagelist,
|
||||||
messages: _messages,
|
messages: _messages,
|
||||||
|
isExtendedSearch: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -104,10 +105,6 @@ const FileRouter = {
|
|||||||
list_messages: function () {
|
list_messages: function () {
|
||||||
messages();
|
messages();
|
||||||
},
|
},
|
||||||
saveTagsToArray: function () {
|
|
||||||
tagArray = this.selected;
|
|
||||||
console.info(tagArray);
|
|
||||||
},
|
|
||||||
getFilteredTags(text) {
|
getFilteredTags(text) {
|
||||||
this.taglist = data.filter((option) => {
|
this.taglist = data.filter((option) => {
|
||||||
return option
|
return option
|
||||||
@ -115,7 +112,6 @@ const FileRouter = {
|
|||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.indexOf(text.toLowerCase()) >= 0
|
.indexOf(text.toLowerCase()) >= 0
|
||||||
})
|
})
|
||||||
this.search();
|
|
||||||
},
|
},
|
||||||
list_tags: function () {
|
list_tags: function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -124,6 +120,7 @@ const FileRouter = {
|
|||||||
})
|
})
|
||||||
.done(jd => {
|
.done(jd => {
|
||||||
// NICHT SO wg. Vue: _messagelist = jd;
|
// NICHT SO wg. Vue: _messagelist = jd;
|
||||||
|
if(data == ""){
|
||||||
_taglist.splice(0, _taglist.length);
|
_taglist.splice(0, _taglist.length);
|
||||||
_taglist.push.apply(_taglist, jd);
|
_taglist.push.apply(_taglist, jd);
|
||||||
console.log("tag: jd: " + jd);
|
console.log("tag: jd: " + jd);
|
||||||
@ -132,6 +129,7 @@ const FileRouter = {
|
|||||||
get_insert_tag(jd[e]);
|
get_insert_tag(jd[e]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}).fail(function (e, f, g) {
|
}).fail(function (e, f, g) {
|
||||||
console.log("err: " + e + f + g);
|
console.log("err: " + e + f + g);
|
||||||
});
|
});
|
||||||
@ -142,6 +140,7 @@ const FileRouter = {
|
|||||||
},
|
},
|
||||||
search: function () {
|
search: function () {
|
||||||
searching(this.searchtext);
|
searching(this.searchtext);
|
||||||
|
this.isExtendedSearch=true;
|
||||||
},
|
},
|
||||||
list_messages: function () {
|
list_messages: function () {
|
||||||
messages();
|
messages();
|
||||||
@ -149,7 +148,7 @@ const FileRouter = {
|
|||||||
},
|
},
|
||||||
mounted: function () {
|
mounted: function () {
|
||||||
//this.search();
|
//this.search();
|
||||||
this.list_tags();
|
//this.list_tags();
|
||||||
//this.list_messages();
|
//this.list_messages();
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
var isSearchActive = false,
|
var isSearchActive = false,
|
||||||
tagArray = ["lorem"];
|
tagArray = ["lorem"];
|
||||||
|
|
||||||
const dat=[
|
const data=[],
|
||||||
'th',
|
|
||||||
'efi',
|
|
||||||
'wichtig',
|
|
||||||
],
|
|
||||||
search_data = [];
|
search_data = [];
|
||||||
|
|
||||||
Vue.component('search',{
|
Vue.component('search',{
|
||||||
@ -27,7 +23,7 @@ Vue.component('search',{
|
|||||||
return{
|
return{
|
||||||
searchtext: "",
|
searchtext: "",
|
||||||
selected: [],
|
selected: [],
|
||||||
taglist: dat,
|
taglist: data,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed:{
|
computed:{
|
||||||
@ -42,7 +38,7 @@ Vue.component('search',{
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getFilteredTags(text) {
|
getFilteredTags(text) {
|
||||||
this.taglist = dat.filter((option) => {
|
this.taglist = data.filter((option) => {
|
||||||
return option
|
return option
|
||||||
.toString()
|
.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
@ -64,6 +60,7 @@ Vue.component('search',{
|
|||||||
$.ajax({url: "api/tag/ids", method: "GET"})
|
$.ajax({url: "api/tag/ids", method: "GET"})
|
||||||
.done(jd => {
|
.done(jd => {
|
||||||
// NICHT SO wg. Vue: _messagelist = jd;
|
// NICHT SO wg. Vue: _messagelist = jd;
|
||||||
|
if(data == ""){
|
||||||
_taglist.splice(0, _taglist.length);
|
_taglist.splice(0, _taglist.length);
|
||||||
_taglist.push.apply(_taglist, jd);
|
_taglist.push.apply(_taglist, jd);
|
||||||
// console.log("tag: jd: " + jd);
|
// console.log("tag: jd: " + jd);
|
||||||
@ -72,6 +69,7 @@ Vue.component('search',{
|
|||||||
get_insert_tag(jd[e]);
|
get_insert_tag(jd[e]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}).fail(function (e, f, g) {
|
}).fail(function (e, f, g) {
|
||||||
console.log("err: " + e + f + g);
|
console.log("err: " + e + f + g);
|
||||||
});
|
});
|
||||||
@ -96,7 +94,7 @@ function get_insert_tag(id) {
|
|||||||
url: "api/tag/id/" + id,
|
url: "api/tag/id/" + id,
|
||||||
method: "GET"
|
method: "GET"
|
||||||
}).done(function(tag) {
|
}).done(function(tag) {
|
||||||
dat.push("#" + tag.name);
|
data.push("#" + tag.name);
|
||||||
}).fail(function(e, f, g) {
|
}).fail(function(e, f, g) {
|
||||||
console.log("cannot load " + id + ".json: " + e + f + g);
|
console.log("cannot load " + id + ".json: " + e + f + g);
|
||||||
})
|
})
|
||||||
|
@ -59,7 +59,7 @@ const dbs = {
|
|||||||
get: function(req, res) {
|
get: function(req, res) {
|
||||||
model.Messages.find(
|
model.Messages.find(
|
||||||
{$text: {$search: req.params.phrase}})
|
{$text: {$search: req.params.phrase}})
|
||||||
.sort({tag:1, user:1, message:1, subject:1})
|
.sort({tag:-1})
|
||||||
.exec().then(results => {
|
.exec().then(results => {
|
||||||
//selects id from message:
|
//selects id from message:
|
||||||
var parsed = [];
|
var parsed = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user