From fc2702ba260b7a8705ee9f2d1f606af8dfa768da Mon Sep 17 00:00:00 2001 From: Koren Lev Date: Wed, 6 Sep 2017 19:47:54 +0300 Subject: ui updates Change-Id: I2d3f87e34a74ce21bbb9e3df989b6527337b7228 Signed-off-by: Koren Lev --- ui/imports/api/messages/server/methods.js | 4 ++-- ui/imports/api/messages/server/publications.js | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'ui/imports/api/messages') diff --git a/ui/imports/api/messages/server/methods.js b/ui/imports/api/messages/server/methods.js index 119e6b0..540c0a1 100644 --- a/ui/imports/api/messages/server/methods.js +++ b/ui/imports/api/messages/server/methods.js @@ -11,7 +11,7 @@ import { Messages } from '/imports/api/messages/messages'; Meteor.methods({ 'messages/get?level&env&page&amountPerPage&sortField&sortDirection': function ( - level, env, page, amountPerPage, sortField, sortDirection) { + level, env, page, amountPerPage, sortField, sortDirection) { logMethodCall('messages/get?level&env&page&amountPerPage&sortField&sortDirection', {level, env, page, amountPerPage}); @@ -27,7 +27,7 @@ Meteor.methods({ query = R.ifElse(R.isNil, R.always(query),R.assoc('level', R.__, query))(level); sortParams = R.ifElse(R.isNil, R.always(sortParams), - R.assoc(R.__, sortDirection, sortParams))(sortField); + R.assoc(R.__, sortDirection, sortParams))(sortField); console.log('sort params:', sortParams); diff --git a/ui/imports/api/messages/server/publications.js b/ui/imports/api/messages/server/publications.js index 13c7c50..6b147f0 100644 --- a/ui/imports/api/messages/server/publications.js +++ b/ui/imports/api/messages/server/publications.js @@ -88,11 +88,28 @@ Meteor.publish('messages/count?level', function (level) { return new Counter(counterName, Messages.find({ level: level })); }); +Meteor.publish('messages/count?backDelta&level', function (backDelta, level) { + const counterName = `messages/count?backDelta=${backDelta}&level=${level}`; + console.log(`subscribe - counter: ${counterName}`); + + let begining = moment().subtract(backDelta); + let query = { + level: level, + 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}`); let query = { level: level }; query = R.ifElse(R.isNil, R.always(query), R.assoc('environment', R.__, query))(env); + console.log(`query: ${R.toString(query)}`); - return new Counter(counterName, Messages.find(query)); }); + return new Counter(counterName, Messages.find(query)); +}); -- cgit 1.2.3-korg