istic-openstack/client/js/controllers/status.js

27 lines
581 B
JavaScript
Raw Normal View History

2016-01-24 15:10:13 +01:00
/*
* mainApp Controller
*/
mainApp.controller('statusCtrl', function ($scope,$interval,$sce)
2016-01-24 15:10:13 +01:00
{
2016-01-31 11:47:13 +01:00
// Update status every 2 seconds
$interval(function(){
var status=identity.fetchStatus();
$scope.username=status[1];
$scope.lastconnection=status[2];
if(status[0] == "1"){
$scope.connection=$sce.trustAsHtml("Connection : <span style=\"color:green;\">Online</span>");
}
else{
$scope.connection="Connection : <span style=\"color:red;\">Offline</span>";
}
2016-01-31 11:47:13 +01:00
}, 2000);
2016-01-24 15:10:13 +01:00
});