ali stopped
diff --git a/views/ngXosLib/gulpfile.js b/views/ngXosLib/gulpfile.js
index e514d7a..e030ad9 100644
--- a/views/ngXosLib/gulpfile.js
+++ b/views/ngXosLib/gulpfile.js
@@ -2,6 +2,7 @@
var gulp = require('gulp');
var wrench = require('wrench');
+var path = require('path');
var options = {
ngXosVendor: '../../xos/core/xoslib/static/js/vendor/', //save here the minfied vendor file, this is automatically loaded in the django page
@@ -11,9 +12,9 @@
docs: './docs'
};
-wrench.readdirSyncRecursive('./gulp')
+wrench.readdirSyncRecursive(path.join(__dirname, './gulp'))
.map(function(file) {
- require('./gulp/' + file)(options);
+ require(path.join(__dirname, './gulp/' + file))(options);
});
gulp.task('default', function () {
diff --git a/views/ngXosLib/xosHelpers/src/services/notification.service.js b/views/ngXosLib/xosHelpers/src/services/notification.service.js
index 7c4154b..e190451 100644
--- a/views/ngXosLib/xosHelpers/src/services/notification.service.js
+++ b/views/ngXosLib/xosHelpers/src/services/notification.service.js
@@ -1,7 +1,6 @@
(function() {
'use strict';
-
angular
.module('xos.helpers')
.factory('Notification', function(){
diff --git a/views/ngXosViews/synchronizerNotifier/src/js/main.js b/views/ngXosViews/synchronizerNotifier/src/js/main.js
index 1d7de32..54ef0a6 100644
--- a/views/ngXosViews/synchronizerNotifier/src/js/main.js
+++ b/views/ngXosViews/synchronizerNotifier/src/js/main.js
@@ -6,29 +6,6 @@
'ui.router',
'xos.helpers'
])
-.config(function($provide) {
- $provide.decorator('$rootScope', function($delegate) {
- var Scope = $delegate.constructor;
- // var origBroadcast = Scope.prototype.$broadcast;
- // var origEmit = Scope.prototype.$emit;
- var origOn = Scope.prototype.$on;
-
- // Scope.prototype.$broadcast = function() {
- // // console.log("$broadcast was called on $scope " + $scope.$id + " with arguments:", arguments);
- // return origBroadcast.apply(this, arguments);
- // };
- // Scope.prototype.$emit = function() {
- // // console.log("$emit was called on $scope " + $scope.$id + " with arguments:", arguments);
- // return origEmit.apply(this, arguments);
- // };
-
- Scope.prototype.$on = function(){
- // console.log('$on', arguments, arguments[1].toString());
- return origOn.apply(this, arguments);
- }
- return $delegate;
- });
-})
.service('Diag', function($rootScope, $http, $q, $interval){
let isRunning = false;
@@ -50,6 +27,7 @@
diags.forEach(d => {
let status = JSON.parse(d.backend_register);
status.last_run = new Date(status.last_run * 1000);
+ status.last_duration = status.last_duration * 1000;
status.last_synchronizer_start = new Date(status.last_synchronizer_start * 1000);
status.last_syncrecord_start = status.last_syncrecord_start ? new Date(status.last_syncrecord_start * 1000) : null;
$rootScope.$broadcast(`diag`, {
@@ -77,25 +55,26 @@
this.getSyncStatus = (status) => {
- let gap = 5 * 60 * 1000; /* ms */
- // let gap = 2;
- if(status.last_run > status.last_synchronizer_start){
- // the synchronizer has finished
- return true;
- }
- else {
+ // let gap = 5 * 60 * 1000; /* ms */
+ let gap = 1 * 60 * 1000;
+ // if(status.last_run > status.last_synchronizer_start){
+ // // the synchronizer has finished
+ // return true;
+ // }
+ // else {
// the synchronizer is running
- if(!status.last_syncrecord_start){
- // but no step have been completed
- return false;
- }
- else if (((new Date()) - status.last_syncrecord_start) > gap){
+ // if(status.last_syncrecord_start){
+ // // but no step have been completed
+ // return false;
+ // }
+ // else
+ if (((new Date()) - status.last_syncrecord_start) > gap){
return false;
}
else{
return true;
}
- }
+ // }
}
$interval(() => {
@@ -105,10 +84,7 @@
this.sendEvents(diags);
});
}
- }, 25000);
-})
-.run(function($log){
- $log.info('Listening for Syncronizers Events!');
+ }, 10000);
})
.directive('syncStatus', function() {
return {
@@ -117,18 +93,41 @@
bindToController: true,
controllerAs: 'vm',
templateUrl: 'templates/sync-status.tpl.html',
- controller: function($log, $rootScope, Diag){
+ controller: function($log, $rootScope, Diag, xosNotification){
Diag.start();
this.showNotificationPanel = true;
this.synchronizers = {};
+ const notified = {};
+
+ // xosNotification.notify('test', {icon: 'http://localhost:8888/static/cord-logo.png', body: 'Diag'});
+
this.showNoSync = true;
$rootScope.$on('diag', (e, d) => {
- if(d.name === 'vcpe'){
- $log.info('Received event: ', d.info.last_run, d.info.last_synchronizer_start);
+ // console.log(d.name);
+ if(d.name === 'global'){
+ $log.info('Received event: ', d.info.last_syncrecord_start);
}
this.synchronizers[d.name] = d;
+
+ if(!d.status){
+
+ if(!notified[d.name]){
+ console.log('sent notify');
+ xosNotification.notify('CORD Synchronizer Error', {
+ icon: 'http://localhost:8888/static/cord-logo.png',
+ body: `[DEBUG] The ${d.name} synchronizer has stopped.`
+ });
+ }
+
+ notified[d.name] = true;
+ }
+ else {
+ notified[d.name] = false;
+ }
+
+ // hide list if empty
this.showNoSync = false;
if(Object.keys(this.synchronizers).length === 0){
this.showNoSync = true;