diff options
author | Koren Lev <korenlev@gmail.com> | 2017-09-07 16:07:17 +0300 |
---|---|---|
committer | Koren Lev <korenlev@gmail.com> | 2017-09-07 16:07:17 +0300 |
commit | f95cd97e11f6d11d5412ef19704dcb6e8b9d022c (patch) | |
tree | 2b10ad279f02c5a575e0a723484a69ebe7474113 /ui/imports/api | |
parent | cb24f67be756b8a92cee1ee3284207e95a03e6d3 (diff) |
refactoring of messages
Change-Id: Ia0de54892a5175194234d887e617715398c9a639
Signed-off-by: Koren Lev <korenlev@gmail.com>
Diffstat (limited to 'ui/imports/api')
-rw-r--r-- | ui/imports/api/configurations/configurations.js | 2 | ||||
-rw-r--r-- | ui/imports/api/messages/server/publications.js | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/ui/imports/api/configurations/configurations.js b/ui/imports/api/configurations/configurations.js index 067b69f..44cf4ee 100644 --- a/ui/imports/api/configurations/configurations.js +++ b/ui/imports/api/configurations/configurations.js @@ -20,7 +20,7 @@ let schema = { messages_view_backward_delta: { type: Number, minCount: 1, - defaultValue: '1209600000', // 2 weeks + defaultValue: '1209600000', // 14 days } }; diff --git a/ui/imports/api/messages/server/publications.js b/ui/imports/api/messages/server/publications.js index 6b147f0..8c5b59d 100644 --- a/ui/imports/api/messages/server/publications.js +++ b/ui/imports/api/messages/server/publications.js @@ -103,6 +103,22 @@ Meteor.publish('messages/count?backDelta&level', function (backDelta, level) { return new Counter(counterName, Messages.find(query)); }); +Meteor.publish('messages/count?backDelta&level&env', function (backDelta, level, env) { + const counterName = `messages/count?backDelta=${backDelta}&level=${level}&env=${env}`; + console.log(`subscribe - counter: ${counterName}`); + + let begining = moment().subtract(backDelta); + let query = { + level: level, + environment: env, + timestamp: { $gte: begining.toDate() } + }; + + console.log(`query: ${R.toString(query)}`); + + return new Counter(counterName, Messages.find(query)); +}); + Meteor.publish('messages/count?level&env', function (level, env) { const counterName = `messages/count?level=${level}&env=${env}`; console.log(`subscribe - counter: ${counterName}`); |