diff --git a/node_modules/lodash/core.min.js b/node_modules/lodash/core.min.js index bb543ff..1a14c40 100644 --- a/node_modules/lodash/core.min.js +++ b/node_modules/lodash/core.min.js @@ -26,4 +26,4 @@ return t(n),n},o.thru=function(n,t){return t(n)},o.toArray=function(n){return M( },o.isDate=function(n){return H(n)&&"[object Date]"==hn.call(n)},o.isEmpty=function(t){return M(t)&&(Nn(t)||L(t)||U(t.splice)||n(t))?!t.length:!_n(t).length},o.isEqual=function(n,t){return b(n,t)},o.isFinite=function(n){return typeof n=="number"&&gn(n)},o.isFunction=U,o.isNaN=function(n){return K(n)&&n!=+n},o.isNull=function(n){return null===n},o.isNumber=K,o.isObject=V,o.isRegExp=function(n){return H(n)&&"[object RegExp]"==hn.call(n)},o.isString=L,o.isUndefined=function(n){return n===Z},o.last=function(n){ var t=null==n?0:n.length;return t?n[t-1]:Z},o.max=function(n){return n&&n.length?a(n,X,v):Z},o.min=function(n){return n&&n.length?a(n,X,_):Z},o.noConflict=function(){return on._===this&&(on._=vn),this},o.noop=function(){},o.reduce=C,o.result=function(n,t,r){return t=null==n?Z:n[t],t===Z&&(t=r),U(t)?t.call(n):t},o.size=function(n){return null==n?0:(n=M(n)?n:_n(n),n.length)},o.some=function(n,t,r){return t=r?Z:t,E(n,g(t))},o.uniqueId=function(n){var t=++sn;return Q(n)+t},o.each=z,o.first=q,Y(o,function(){ var n={};return s(o,function(t,r){pn.call(o.prototype,r)||(n[r]=t)}),n}(),{chain:false}),o.VERSION="4.17.15",mn("pop join replace reverse split push shift sort splice unshift".split(" "),function(n){var t=(/^(?:replace|split)$/.test(n)?String.prototype:an)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|join|replace|shift)$/.test(n);o.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(Nn(u)?u:[],n)}return this[r](function(r){return t.apply(Nn(r)?r:[],n); -})}}),o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=function(){return w(this.__wrapped__,this.__actions__)},typeof define=="function"&&typeof define.amd=="object"&&define.amd?(on._=o, define(function(){return o})):cn?((cn.exports=o)._=o,un._=o):on._=o}).call(this); \ No newline at end of file +})}}),o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=function(){return w(this.__wrapped__,this.__actions__)},typeof define=="function"&&typeof define.amd=="object"&&define.amd?(on._=o, define(function(){return o})):cn?((cn.exports=o)._=o,un._=o):on._=o}).call(this); diff --git a/node_modules/lodash/index.js b/node_modules/lodash/index.js index 5d063e2..6038840 100644 --- a/node_modules/lodash/index.js +++ b/node_modules/lodash/index.js @@ -1 +1 @@ -module.exports = require('./lodash'); \ No newline at end of file +module.exports = require('./lodash'); diff --git a/node_modules/lodash/lodash.min.js b/node_modules/lodash/lodash.min.js index 13ec307..929da3c 100644 --- a/node_modules/lodash/lodash.min.js +++ b/node_modules/lodash/lodash.min.js @@ -134,4 +134,4 @@ return!i&&s?(o=c?o:new Un(this),o=n.apply(o,f),o.__actions__.push({func:Qe,args: n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},Un.prototype.value=function(){var n,t=this.__wrapped__.value(),r=this.__dir__,e=ff(t),u=0>r,i=e?t.length:0;n=i;for(var o=this.__views__,f=0,c=-1,a=o.length;++c=this.__values__.length;return{done:n,value:n?T:this.__values__[this.__index__++]}},An.prototype.plant=function(n){ for(var t,r=this;r instanceof En;){var e=Fe(r);e.__index__=0,e.__values__=T,t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},An.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Un?(this.__actions__.length&&(n=new Un(this)),n=n.reverse(),n.__actions__.push({func:Qe,args:[Ge],thisArg:T}),new On(n,this.__chain__)):this.thru(Ge)},An.prototype.toJSON=An.prototype.valueOf=An.prototype.value=function(){return wr(this.__wrapped__,this.__actions__)},An.prototype.first=An.prototype.head, -wi&&(An.prototype[wi]=Xe),An}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($n._=rt, define(function(){return rt})):Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt}).call(this); \ No newline at end of file +wi&&(An.prototype[wi]=Xe),An}();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($n._=rt, define(function(){return rt})):Nn?((Nn.exports=rt)._=rt,Fn._=rt):$n._=rt}).call(this); diff --git a/public/index.html b/public/index.html index 313cdc0..d737f5b 100644 --- a/public/index.html +++ b/public/index.html @@ -101,6 +101,7 @@ + diff --git a/public/routes/createMessage.js b/public/routes/createMessage.js index 2722502..ddcdb9c 100644 --- a/public/routes/createMessage.js +++ b/public/routes/createMessage.js @@ -1,9 +1,4 @@ var tagArray = []; -const data=[ - 'th', - 'efi', - 'wichtig', - ]; const CreateMsgRouter = { template: `
@@ -22,12 +17,12 @@ const CreateMsgRouter = { @@ -47,9 +42,20 @@ const CreateMsgRouter = { auth: auth, isDisabled: false, selected: [], + searchtext : "", taglist: data, }; }, + computed:{ + filteredDataArray() { + return this.taglist.filter((option) => { + return option + .toString() + .toLowerCase() + .indexOf(this.searchtext.toLowerCase()) >= 0 + }) + } + }, methods: { saveTagsToArray: function() { tagArray = this.selected; @@ -94,12 +100,15 @@ const CreateMsgRouter = { $.ajax({url: "api/tag/ids",method: "GET"}) .done(jd => { // NICHT SO wg. Vue: _messagelist = jd; - _taglist.splice(0, _taglist.length); - _taglist.push.apply(_taglist, jd); - console.log("tag: jd: " + jd); - for (var e in jd) { - if (!_tags[jd[e]]) { - get_insert_tag(jd[e]); + console.log("DATA: "+data); + if(data == ""){ + _taglist.splice(0, _taglist.length); + _taglist.push.apply(_taglist, jd); + console.log("tag: jd: " + jd); + for (var e in jd) { + if (!_tags[jd[e]]) { + get_insert_tag(jd[e]); + } } } }).fail(function (e, f, g) { @@ -120,17 +129,9 @@ const CreateMsgRouter = { userField.prop('disabled',false); } - this.list_tags(); + //this.list_tags(); if ($(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); - }) -} diff --git a/public/routes/files.js b/public/routes/files.js index aabb914..972075d 100644 --- a/public/routes/files.js +++ b/public/routes/files.js @@ -3,7 +3,6 @@ var tagArray = []; const FileRouter = { template: `
-

Erweiterte Suche

@@ -23,16 +22,16 @@ const FileRouter = { - SUCHE -
+
-
`, data: function () { @@ -51,6 +49,7 @@ const FileRouter = { taglist: data, messagelist: _messagelist, messages: _messages, + isExtendedSearch: false, } }, computed: { @@ -67,10 +66,6 @@ const FileRouter = { list_messages: function () { messages(); }, - saveTagsToArray: function () { - tagArray = this.selected; - console.info(tagArray); - }, getFilteredTags(text) { this.taglist = data.filter((option) => { return option @@ -78,7 +73,6 @@ const FileRouter = { .toLowerCase() .indexOf(text.toLowerCase()) >= 0 }) - this.search(); }, list_tags: function () { $.ajax({ @@ -87,6 +81,7 @@ const FileRouter = { }) .done(jd => { // NICHT SO wg. Vue: _messagelist = jd; + if(data == ""){ _taglist.splice(0, _taglist.length); _taglist.push.apply(_taglist, jd); console.log("tag: jd: " + jd); @@ -95,6 +90,7 @@ const FileRouter = { get_insert_tag(jd[e]); } } + } }).fail(function (e, f, g) { console.log("err: " + e + f + g); }); @@ -105,6 +101,7 @@ const FileRouter = { }, search: function () { searching(this.searchtext); + this.isExtendedSearch=true; }, list_messages: function () { messages(); @@ -112,7 +109,7 @@ const FileRouter = { }, mounted: function () { //this.search(); - this.list_tags(); + //this.list_tags(); //this.list_messages(); }, }; diff --git a/public/search.js b/public/search.js index dd86a98..9aba881 100644 --- a/public/search.js +++ b/public/search.js @@ -1,11 +1,7 @@ var isSearchActive = false, tagArray = ["lorem"]; -const dat=[ - 'th', - 'efi', - 'wichtig', - ], +const data=[], search_data = []; Vue.component('search',{ @@ -27,7 +23,7 @@ Vue.component('search',{ return{ searchtext: "", selected: [], - taglist: dat, + taglist: data, }; }, computed:{ @@ -42,7 +38,7 @@ Vue.component('search',{ }, methods: { getFilteredTags(text) { - this.taglist = dat.filter((option) => { + this.taglist = data.filter((option) => { return option .toString() .toLowerCase() @@ -64,6 +60,7 @@ Vue.component('search',{ $.ajax({url: "api/tag/ids", method: "GET"}) .done(jd => { // NICHT SO wg. Vue: _messagelist = jd; + if(data == ""){ _taglist.splice(0, _taglist.length); _taglist.push.apply(_taglist, jd); // console.log("tag: jd: " + jd); @@ -72,6 +69,7 @@ Vue.component('search',{ get_insert_tag(jd[e]); } } + } }).fail(function (e, f, g) { console.log("err: " + e + f + g); }); @@ -96,7 +94,7 @@ function get_insert_tag(id) { url: "api/tag/id/" + id, method: "GET" }).done(function(tag) { - dat.push("#" + tag.name); + data.push("#" + tag.name); }).fail(function(e, f, g) { console.log("cannot load " + id + ".json: " + e + f + g); }) diff --git a/server/dbs.js b/server/dbs.js index 0362fbd..402f30f 100644 --- a/server/dbs.js +++ b/server/dbs.js @@ -59,7 +59,7 @@ const dbs = { get: function(req, res) { model.Messages.find( {$text: {$search: req.params.phrase}}) - .sort({tag:1, user:1, message:1, subject:1}) + .sort({tag:-1}) .exec().then(results => { //selects id from message: var parsed = [];