summaryrefslogtreecommitdiffstats
path: root/ui/imports
diff options
context:
space:
mode:
Diffstat (limited to 'ui/imports')
-rw-r--r--ui/imports/api/configurations/configurations.js2
-rw-r--r--ui/imports/api/messages/server/publications.js16
-rw-r--r--ui/imports/ui/components/configuration/configuration.html18
-rw-r--r--ui/imports/ui/components/configuration/configuration.js19
-rw-r--r--ui/imports/ui/components/configuration/configuration.styl33
-rw-r--r--ui/imports/ui/components/dashboard/dashboard.html4
-rw-r--r--ui/imports/ui/components/dashboard/dashboard.js33
-rw-r--r--ui/imports/ui/components/environment-dashboard/environment-dashboard.js25
8 files changed, 118 insertions, 32 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}`);
diff --git a/ui/imports/ui/components/configuration/configuration.html b/ui/imports/ui/components/configuration/configuration.html
index f381453..c8d81b2 100644
--- a/ui/imports/ui/components/configuration/configuration.html
+++ b/ui/imports/ui/components/configuration/configuration.html
@@ -4,14 +4,18 @@
<form>
<div class="cl-field-group">
<label class="cl-field-label">Message view backward delta</label>
- <input name="msgsViewBackDelta"
- value="{{ getModelField 'messages_view_backward_delta' }}"
- class="cl-msgs-view-back-delta cl-input"
- type="number"
- placeholder="" />
- <div class="cl-field-desc">Backward duration of {{ durationHumanize (getModelField 'messages_view_backward_delta') }} from current date (miliseconds)</div>
+ <div class="input-box">
+ <input name="msgsViewBackDelta"
+ value="{{ getModelField 'messages_view_backward_delta' }}"
+ class="sm-msgs-view-back-delta cl-input"
+ type="number"
+ placeholder="" />
+ <div class="input-hint">
+ {{ durationAsText (getModelField 'messages_view_backward_delta') }}
+ </div>
+ </div>
+ <div class="cl-field-desc">Change the start duration of message display (miliseconds)</div>
</div>
-
<button type="button"
class="js-submit-button mdl-button mdl-js-button mdl-button--raised
mdl-js-ripple-effect mdl-button--colored"
diff --git a/ui/imports/ui/components/configuration/configuration.js b/ui/imports/ui/components/configuration/configuration.js
index 493cc36..a3582df 100644
--- a/ui/imports/ui/components/configuration/configuration.js
+++ b/ui/imports/ui/components/configuration/configuration.js
@@ -55,9 +55,16 @@ Template.Configuration.rendered = function() {
Template.Configuration.events({
'click .js-submit-button': function (event, instance) {
event.preventDefault();
- let msgsViewBackDelta = instance.$('.cl-msgs-view-back-delta')[0].value;
+ let msgsViewBackDelta = Number.parseInt(instance.$('.sm-msgs-view-back-delta')[0].value);
saveForm(instance, msgsViewBackDelta);
- }
+ },
+
+ 'input .sm-msgs-view-back-delta': function (_e, instance) {
+ let msgsViewBackDelta = Number.parseInt(instance.$('.sm-msgs-view-back-delta')[0].value);
+ let model = instance.state.get('model');
+ model = R.assoc('messages_view_backward_delta', msgsViewBackDelta, model);
+ instance.state.set('model', model);
+ },
});
/*
@@ -85,9 +92,11 @@ Template.Configuration.helpers({
return instance.state.get('actionResult') === 'success';
},
- durationHumanize: function (duration) {
- return moment.duration(duration).humanize();
- }
+ durationAsText: function (delta) {
+ let duration = moment.duration(delta);
+ let text = `${duration.years()} years, ${duration.months()} months, ${duration.days()} days, ${duration.hours()} hours and ${duration.minutes()} minutes from current time.`;
+ return text;
+ },
}); // end: helpers
function saveForm(instance, msgsViewBackDelta) {
diff --git a/ui/imports/ui/components/configuration/configuration.styl b/ui/imports/ui/components/configuration/configuration.styl
index b8be180..b14ce7d 100644
--- a/ui/imports/ui/components/configuration/configuration.styl
+++ b/ui/imports/ui/components/configuration/configuration.styl
@@ -15,22 +15,31 @@
width: 120px;
margin: 0 5px;
- >.cl-input
+ .input-box
display: block;
- width: 100%;
- min-height: 34px;
- padding: 6px 12px;
- font-size: 14px;
- line-height: 1.42857143;
- color: #555;
- background-color: #fff;
- background-image: none;
- border: 1px solid #ccc;
- border-radius: 4px;
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
width: 400px;
margin: 0 5px;
+ .cl-input
+ display: block;
+ width: 100%;
+ min-height: 34px;
+ padding: 6px 12px;
+ font-size: 14px;
+ line-height: 1.42857143;
+ color: #555;
+ background-color: #fff;
+ background-image: none;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
+ width: 400px;
+
+ .input-hint
+ position: absolute;
+ margin: 5px 0;
+
+
.cl-field-desc
margin: 0 5px;
diff --git a/ui/imports/ui/components/dashboard/dashboard.html b/ui/imports/ui/components/dashboard/dashboard.html
index fcc1d6e..1edf507 100644
--- a/ui/imports/ui/components/dashboard/dashboard.html
+++ b/ui/imports/ui/components/dashboard/dashboard.html
@@ -36,7 +36,7 @@
(vconnectorsCount envItem.name)
) }}
</div>
- {{/each}} <!-- envItem in envList -->
+ {{/each}} <!-- envItem in envList -->
</div> <!-- flex box for environment cards -->
@@ -47,7 +47,7 @@
{{#each messagesInfoBox in (getListMessagesInfoBox) }}
<div class="sm-message-box">
{{> MessagesInfoBox (argsMessagesInfoBox messagesInfoBox
- (messageCount messagesInfoBox.level)) }}
+ (countOf (msgCounterName messagesInfoBox.level))) }}
</div>
{{/each }}
</div>
diff --git a/ui/imports/ui/components/dashboard/dashboard.js b/ui/imports/ui/components/dashboard/dashboard.js
index 6fdc184..fb42d70 100644
--- a/ui/imports/ui/components/dashboard/dashboard.js
+++ b/ui/imports/ui/components/dashboard/dashboard.js
@@ -19,10 +19,11 @@ import { //Messages,
import { Template } from 'meteor/templating';
import { Inventory } from '/imports/api/inventories/inventories';
import { Counts } from 'meteor/tmeasday:publish-counts';
-import { Counter } from 'meteor/natestrauser:publish-performant-counts';
+//import { Counter } from 'meteor/natestrauser:publish-performant-counts';
//import { Messages } from '/imports/api/messages/messages';
import { store } from '/imports/ui/store/store';
import { setMainAppSelectedEnvironment } from '/imports/ui/actions/main-app.actions';
+import { Configurations } from '/imports/api/configurations/configurations';
import '/imports/ui/components/messages-info-box/messages-info-box';
import '/imports/ui/components/environment-box/environment-box';
@@ -36,6 +37,11 @@ import './dashboard.html';
Template.Dashboard.onCreated(function () {
var instance = this;
+ instance.state = new ReactiveDict();
+ instance.state.setDefault({
+ msgsViewBackDelta: 1
+ });
+
instance.autorun(function () {
instance.subscribe('environments_config');
@@ -54,6 +60,21 @@ Template.Dashboard.onCreated(function () {
store.dispatch(setMainAppSelectedEnvironment(null));
});
+
+ instance.autorun(function () {
+ instance.subscribe('configurations?user');
+ Configurations.find({user_id: Meteor.userId()}).forEach((conf) => {
+ instance.state.set('msgsViewBackDelta', conf.messages_view_backward_delta);
+ });
+ });
+
+ instance.autorun(function () {
+ let msgsViewBackDelta = instance.state.get('msgsViewBackDelta');
+
+ instance.subscribe('messages/count?backDelta&level', msgsViewBackDelta, 'info');
+ instance.subscribe('messages/count?backDelta&level', msgsViewBackDelta, 'warning');
+ instance.subscribe('messages/count?backDelta&level', msgsViewBackDelta, 'error');
+ });
});
Template.Dashboard.rendered = function(){
@@ -170,7 +191,7 @@ Template.Dashboard.helpers({
return Counts.get('messages?level!counter?' +
'level=' + 'error');
},
-/*
+ /*
notificationsTimestamp: function(){
var msgTimestamp = Messages.findOne({state:'added'},{fields: {'timestamp': 1} });
return msgTimestamp.timestamp;
@@ -197,8 +218,12 @@ Template.Dashboard.helpers({
];
},
- messageCount: function (level) {
- return Counter.get(`messages/count?level=${level}`);
+ msgCounterName: function (level) {
+ let instance = Template.instance();
+ let msgsViewBackDelta = instance.state.get('msgsViewBackDelta');
+ let counterName = `messages/count?backDelta=${msgsViewBackDelta}&level=${level}`;
+
+ return counterName;
},
argsMessagesInfoBox: function(boxDef, messageCount) {
diff --git a/ui/imports/ui/components/environment-dashboard/environment-dashboard.js b/ui/imports/ui/components/environment-dashboard/environment-dashboard.js
index 82fbb52..4fb6366 100644
--- a/ui/imports/ui/components/environment-dashboard/environment-dashboard.js
+++ b/ui/imports/ui/components/environment-dashboard/environment-dashboard.js
@@ -26,6 +26,7 @@ import { calcIconForMessageLevel, lastMessageTimestamp, calcColorClassForMessage
import { Counts } from 'meteor/tmeasday:publish-counts';
import { Roles } from 'meteor/alanning:roles';
//import { idToStr } from '/imports/lib/utilities';
+import { Configurations } from '/imports/api/configurations/configurations';
import { Counter } from 'meteor/natestrauser:publish-performant-counts';
import '/imports/ui/components/data-cubic/data-cubic';
@@ -87,6 +88,7 @@ Template.EnvironmentDashboard.onCreated(function() {
_id: null,
envName: null,
allowEdit: false,
+ msgsViewBackDelta: 1,
});
instance.autorun(function () {
@@ -125,9 +127,11 @@ Template.EnvironmentDashboard.onCreated(function() {
instance.subscribe('inventory?env+type', env.name, 'project');
instance.subscribe('inventory?env+type', env.name, 'region');
+ /*
instance.subscribe('messages/count?level&env', 'info', env.name);
instance.subscribe('messages/count?level&env', 'warning', env.name);
instance.subscribe('messages/count?level&env', 'error', env.name);
+ */
let vConnectorCounterName = 'inventory?env+type!counter?env=' +
env.name + '&type=' + 'vconnector';
@@ -161,6 +165,22 @@ Template.EnvironmentDashboard.onCreated(function() {
});
});
+
+ instance.autorun(function () {
+ instance.subscribe('configurations?user');
+ Configurations.find({user_id: Meteor.userId()}).forEach((conf) => {
+ instance.state.set('msgsViewBackDelta', conf.messages_view_backward_delta);
+ });
+ });
+
+ instance.autorun(function () {
+ let msgsViewBackDelta = instance.state.get('msgsViewBackDelta');
+ let env = instance.state.get('envName');
+
+ instance.subscribe('messages/count?backDelta&level&env', msgsViewBackDelta, 'info', env);
+ instance.subscribe('messages/count?backDelta&level&env', msgsViewBackDelta, 'warning', env);
+ instance.subscribe('messages/count?backDelta&level&env', msgsViewBackDelta, 'error', env);
+ });
});
/*
@@ -312,13 +332,16 @@ Template.EnvironmentDashboard.helpers({
argsMessagesInfoBox: function(boxDef, env) {
let instance = Template.instance();
let envName = instance.state.get('envName');
+ let msgsViewBackDelta = instance.state.get('msgsViewBackDelta');
+
if (R.isNil(envName)) {
return {
title: '', count: 0, lastScanTimestamp: '', onMoreDetailsReq: function () {}
};
}
- let counterName = `messages/count?level=${boxDef.level}&env=${envName}`;
+ //let counterName = `messages/count?level=${boxDef.level}&env=${envName}`;
+ let counterName = `messages/count?backDelta=${msgsViewBackDelta}&level=${boxDef.level}&env=${envName}`;
let count = Counter.get(counterName);
//let count = Counts.get('messages?env+level!counter?env=' +