-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync with piSignagePro commit a8a234f96
- Loading branch information
Showing
15 changed files
with
359 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "pisignage-server", | ||
"version": "2.3.0", | ||
"version": "2.5.4", | ||
"description": "Server to manage piSignage players in a LAN or Private Network.", | ||
"author": "colloqi <[email protected]>", | ||
"engines": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
'use strict'; | ||
|
||
angular.module('dashboard.controllers', []) | ||
.controller('DashboardCtrl', function ($scope,$http,$interval,piUrls) { | ||
|
||
var BUCKET_INTERVALS = [5,60,240,24 * 60, 7 * 24 * 60]; | ||
|
||
$scope.COUNT_FIELDS = [ | ||
{field:"groupName",name:"Group wise"}, | ||
{field:"currentPlaylist",name:"Playlists playing"}, | ||
{field:"version",name:"Software version"}, | ||
{field:"locationName",name:"Location wise"} | ||
] | ||
|
||
$scope.playersStatFieldWise = {} | ||
|
||
$scope.BUCKET_TITLE = ["now","Last 60 minutes","Last 4 hours","Today","Last 7 days","> 7 days"] | ||
$scope.BUCKET_CLASS = ["success","primary","info","warning","light-danger","danger"] | ||
|
||
var getPlayers = function() { | ||
var options = {params: {}}, | ||
lastReportedTimeInMinutes; | ||
|
||
$http.get(piUrls.players, options) | ||
.then(function(response) { | ||
var data = response.data; | ||
if (data.success) { | ||
$scope.players = data.data.objects; | ||
$scope.currentVersion = data.data.currentVersion; | ||
|
||
$scope.COUNT_FIELDS.forEach(function(obj){ | ||
$scope.playersStatFieldWise[obj.field] = {} | ||
}) | ||
$scope.playersStat = [0,0,0,0,0,0] | ||
$scope.playersExpectedToReport = [] | ||
|
||
$scope.players.forEach(function(player){ | ||
var l, lIndex; | ||
|
||
player.lastReported = player.lastReported || 0; //never reported | ||
player.groupName = player.group && player.group.name | ||
player.locationName = player.configLocation || player.location | ||
|
||
$scope.COUNT_FIELDS.forEach(function(obj){ | ||
l = player[obj.field] || "NA"; | ||
if (l && l.trim()) { | ||
l = l.trim() | ||
if (!$scope.playersStatFieldWise[obj.field][l]) | ||
$scope.playersStatFieldWise[obj.field][l] = {name: l, count: 1} | ||
else | ||
$scope.playersStatFieldWise[obj.field][l].count += 1; | ||
} | ||
}) | ||
|
||
lastReportedTimeInMinutes = parseInt((Date.now() - (new Date(player.lastReported).getTime()))/60000); | ||
for (var i=0,len=BUCKET_INTERVALS.length;i<len;i++) { | ||
if (lastReportedTimeInMinutes <= BUCKET_INTERVALS[i]) { | ||
$scope.playersStat[i] += 1; | ||
break; | ||
} | ||
} | ||
if (i == len) | ||
$scope.playersStat[i] += 1; | ||
if (lastReportedTimeInMinutes > 6 && lastReportedTimeInMinutes < 60) | ||
$scope.playersExpectedToReport.push({name:player.name || player.localName || ("Player "+player.cpuSerialNumber.slice(12)),lastReported:player.lastReported}) | ||
|
||
}); | ||
$scope.COUNT_FIELDS.forEach(function(obj){ | ||
$scope.playersStatFieldWise[obj.field+"Count"] = [] | ||
for(var objectKey in $scope.playersStatFieldWise[obj.field]) { | ||
$scope.playersStatFieldWise[obj.field+"Count"].push($scope.playersStatFieldWise[obj.field][objectKey]); | ||
} | ||
|
||
$scope.playersStatFieldWise[obj.field+"Count"].sort(function(a, b){ | ||
return parseInt(b.count) - parseInt(a.count); | ||
}); | ||
}) | ||
} | ||
$scope.COUNT_FIELDS_TO_SHOW = $scope.COUNT_FIELDS; | ||
|
||
},function (response) { | ||
}); | ||
} | ||
getPlayers() | ||
$scope.playerFetchTimer =$interval(getPlayers,60000); | ||
|
||
getPlayers(); | ||
|
||
$scope.$on("$destroy", function(){ | ||
$interval.cancel($scope.playerFetchTimer) | ||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.