From: Fulup Ar Foll Date: Wed, 16 Dec 2015 20:38:04 +0000 (+0100) Subject: Added AFB monitoring and token auto-refresh X-Git-Tag: blowfish_2.0.1~1^2~27 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=src%2Fapp-framework-demo.git;a=commitdiff_plain;h=98522d2a6ce7c7a709728872ed892970d0a1df7b Added AFB monitoring and token auto-refresh --- diff --git a/afb-client/app/Frontend/pages/Home/Home.html b/afb-client/app/Frontend/pages/Home/Home.html index 9b9cc01..6eda66d 100644 --- a/afb-client/app/Frontend/pages/Home/Home.html +++ b/afb-client/app/Frontend/pages/Home/Home.html @@ -31,4 +31,6 @@ animationIn: slideInRight + diff --git a/afb-client/app/Frontend/services/ConfigApp.js b/afb-client/app/Frontend/services/ConfigApp.js index cafda3f..adec5ac 100644 --- a/afb-client/app/Frontend/services/ConfigApp.js +++ b/afb-client/app/Frontend/services/ConfigApp.js @@ -20,7 +20,7 @@ session: { // Those data are updated by session service refresh : '/api/token/refresh', - check : '/api/token/check', + ping : '/api/token/check', token : '123456789', // typical dev initial token timeout : 3600, // timeout is updated client sessin context creation uuid : '', // uuid map with cookie or long term session access key diff --git a/afb-client/app/Frontend/widgets/Notifications/Notifications.scss b/afb-client/app/Frontend/widgets/Notifications/Notifications.scss index 5a4adc1..fb740b7 100644 --- a/afb-client/app/Frontend/widgets/Notifications/Notifications.scss +++ b/afb-client/app/Frontend/widgets/Notifications/Notifications.scss @@ -46,10 +46,18 @@ tip-modal { } } +token-refresh { + @include ibz-button(grey,1rem) + i {margin-left: .5rem;} + margin-right: 1rem; +} + token-refresh.online { - color: blue; + color: #0066cc; + i {color: lime;} } token-refresh.offline { - color: red; + color: #ff00ff; + i {color: red;} } diff --git a/afb-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js b/afb-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js index 1671748..2b1e9db 100644 --- a/afb-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js +++ b/afb-client/app/Frontend/widgets/Notifications/TokenRefreshSvc.js @@ -25,11 +25,10 @@ 'use strict'; var template = - '
' - + 'afb://{{hostname}}:{{httpdport}}' - + '' - + '
' - ; + '
' + + 'afb://{{hostname}}:{{httpdport}}' + + '' + + '
'; // scope module is load statically before any route is cativated @@ -39,7 +38,7 @@ angular.module('TokenRefresh', []) function mymethods(scope, elem, attrs) { - scope.status; + scope.status=false; scope.online = function () { elem.addClass ("online"); @@ -54,10 +53,10 @@ angular.module('TokenRefresh', []) // Check Binder status scope.getping = function() { - var handler = $http.get(ConfigApp.api.ping+'xx?token='+ ConfigApp.session.token); + var handler = $http.post(ConfigApp.session.ping+'?token='+ ConfigApp.session.token); handler.success(function(response, errcode, headers, config) { if (!scope.status) { - Notification.success ({message: "AFB Back to Live", delay: 3000}); + Notification.success ({message: "AppFramework Binder Back to Live", delay: 3000}); scope.online(); } scope.status = 1; @@ -65,7 +64,7 @@ angular.module('TokenRefresh', []) handler.error(function(response, errcode, headers) { if (scope.status) { - Notification.warning ({message: "AFB Lost", delay: 5000}); + Notification.warning ({message: "AppFramework Binder Lost", delay: 5000}); scope.offline(); } scope.status = 0; @@ -77,8 +76,8 @@ angular.module('TokenRefresh', []) // Check Binder status scope.refresh = function() { - var handler = $http.get(ConfigApp.api.refresh+'?token='+ ConfigApp.session.token); - $timeout (scope.refresh, ConfigApp.session.timeout *800); + var handler = $http.post(ConfigApp.session.refresh+'?token='+ ConfigApp.session.token); + $timeout (scope.refresh, ConfigApp.session.timeout *250); }; scope.icon = attrs.icon || "fi-lightbulb";