From 1fff14f0a5e25adaa851537c71c7bd8381c1bbb1 Mon Sep 17 00:00:00 2001 From: Koren Lev Date: Mon, 2 Oct 2017 11:37:03 +0300 Subject: ui move to docker Change-Id: Iff31ebb3fff782e848704801b7800fdf480264a1 Signed-off-by: Koren Lev (cherry picked from commit a9691f5fe78af32c474754f841a71a68e2d2a484) --- .../ui/components/alarm-icons/alarm-icons.js | 78 ---------------------- 1 file changed, 78 deletions(-) delete mode 100644 ui/imports/ui/components/alarm-icons/alarm-icons.js (limited to 'ui/imports/ui/components/alarm-icons/alarm-icons.js') diff --git a/ui/imports/ui/components/alarm-icons/alarm-icons.js b/ui/imports/ui/components/alarm-icons/alarm-icons.js deleted file mode 100644 index e379007..0000000 --- a/ui/imports/ui/components/alarm-icons/alarm-icons.js +++ /dev/null @@ -1,78 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////// -// Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others / -// / -// All rights reserved. This program and the accompanying materials / -// are made available under the terms of the Apache License, Version 2.0 / -// which accompanies this distribution, and is available at / -// http://www.apache.org/licenses/LICENSE-2.0 / -///////////////////////////////////////////////////////////////////////////////////////// -/* - * Template Component: alarmIcons - */ - -import '/imports/ui/components/breadcrumb/breadcrumb'; -import { Messages } from '/imports/api/messages/messages'; -import { Roles } from 'meteor/alanning:roles'; -import { ReactiveDict } from 'meteor/reactive-dict'; - -import { UserSettings } from '/imports/api/user-settings/user-settings'; - -import './alarm-icons.html'; - -/* - * Lifecycle - */ - -Template.alarmIcons.onCreated(function () { - let instance = this; - - instance.state = new ReactiveDict(); - instance.state.setDefault({ - msgsViewBackDelta: 1 - }); - - instance.autorun(function () { - instance.subscribe('user_settings?user'); - UserSettings.find({user_id: Meteor.userId()}).forEach((userSettings) => { - instance.state.set('msgsViewBackDelta', userSettings.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'); - }); -}); - -/* - * Helpers - */ - -Template.alarmIcons.helpers({ - isAdmin: function () { - return Roles.userIsInRole(Meteor.userId(), 'manage-users', Roles.GLOBAL_GROUP); - }, - - infosCount: function(){ - return Messages.find({level:'info'}).count(); - }, - - warningsCount: function(){ - return Messages.find({level:'warning'}).count(); - }, - - errorsCount: function(){ - return Messages.find({level:'error'}).count(); - }, - - msgCounterName: function (level) { - let instance = Template.instance(); - let msgsViewBackDelta = instance.state.get('msgsViewBackDelta'); - let counterName = `messages/count?backDelta=${msgsViewBackDelta}&level=${level}`; - - return counterName; - } -}); -- cgit 1.2.3-korg