Events Table refreshing
-
Hello,
I have just started to learn and check if Mango would be a good choice for my current project. I think I'll have lots of questions because I'm not familiar with HTML programming... :)
But the first thing I really need is to refresh Events Table when the new event occurs. Now I can see only “a clock with number” on right top corner. Is it possible to add new row into table immediately? Is it possible to show some popup window and/or play sound if new event occurs?
Now I’m using free-m2m2-core-3.2.1.
Best Regards,
Dovydas -
Sorry, just found that there is an upgrade for MangoUI and it seems that now it works like I want. But would be great to play some alarm sound if there is a new event.
-
@dovydasz said in Events Table refreshing:
Sorry, just found that there is an upgrade for MangoUI and it seems that now it works like I want. But would be great to play some alarm sound if there is a new event.
Glad you found the update, we did add immediate updates via WebSockets recently.
We don't currently have a built in way to play a sound but it shouldn't be too difficult to implement yourself. I'll put together a quick example.
-
So you will need to add a custom AngularJS module as per this link - https://help.infiniteautomation.com/getting-started-with-a-user-module/
This component will just watch for new events of a certain level and play the sound, you can customize it to your needs.
define(['angular', 'require'], function(angular, require) { 'use strict'; var userModule = angular.module('userModule', ['maUiApp']); userModule.component('eventAudio', { bindings: { audioFile: '@', eventLevel: '@' }, controller: ['maEvents', '$scope', function(maEvents, $scope) { this.$onInit = () => { maEvents.notificationManager.subscribe((event, mangoEvent) => { if (mangoEvent.alarmLevel === this.eventLevel) { new Audio(this.audioFile).play(); } }, $scope, ['RAISED']); }; }] }); return userModule; }); // define
Use it like this
<event-audio audio-file="/audio/critical.mp3" event-level="CRITICAL"></event-audio>
If this is all too complicated, I might add something similar to this into the UI module for the next release so sit tight.