summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/MenuController.js3
-rw-r--r--www/js/MontageCtrl.js6
-rw-r--r--www/js/NVR.js22
3 files changed, 26 insertions, 5 deletions
diff --git a/www/js/MenuController.js b/www/js/MenuController.js
index e7bf6c53..15715ffb 100644
--- a/www/js/MenuController.js
+++ b/www/js/MenuController.js
@@ -114,7 +114,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io
NVR.debug("**Switching to new server...");
-
+
NVR.clearZmsMultiPortSupport();
var zmServers = NVR.getServerGroups();
var loginData = zmServers[s];
@@ -198,6 +198,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io
zmAutoLogin.start();
// possible image digits changed between servers
NVR.getKeyConfigParams(0);
+ NVR.getZMGroups();
$rootScope.runMode = NVR.getBandwidth();
//console.log ("HERE");
var apiurl = loginData.apiurl + '/host/getVersion.json?'+$rootScope.authSession;
diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js
index 8663918b..be1e2c25 100644
--- a/www/js/MontageCtrl.js
+++ b/www/js/MontageCtrl.js
@@ -828,7 +828,7 @@ angular.module('zmApp.controllers')
} // before reorder array
} // montage monitors
- console.log ("AFTER REORDER="+JSON.stringify(beforeReorderPositions));
+ //console.log ("AFTER REORDER="+JSON.stringify(beforeReorderPositions));
for (var n = 0; i < $scope.MontageMonitors.length; i++) {
$scope.MontageMonitors[n].Monitor.connKey = NVR.regenConnKeys($scope.MontageMonitors[i]);
@@ -912,7 +912,7 @@ angular.module('zmApp.controllers')
$scope.copyMontage = angular.copy($scope.MontageMonitors);
beforeReorderPositions = pckry.getShiftPositions('data-item-id');
- console.log ("BEFORE REORDER="+JSON.stringify(beforeReorderPositions));
+ //console.log ("BEFORE REORDER="+JSON.stringify(beforeReorderPositions));
if (simulStreaming) {
NVR.debug("Killing all streams in montage to save memory/nw...");
@@ -1008,7 +1008,7 @@ angular.module('zmApp.controllers')
for (var i = 0; i < $scope.MontageMonitors.length; i++) {
if ($scope.MontageMonitors[i].Monitor.listDisplay == 'show' && simulStreaming) NVR.killLiveStream($scope.MontageMonitors[i].Monitor.connKey, $scope.MontageMonitors[i].Monitor.controlURL);
- console.log ('Working on '+$scope.MontageMonitors[i].Monitor.Name+" with ZMG "+ld.currentZMGroupName );
+ // console.log ('Working on '+$scope.MontageMonitors[i].Monitor.Name+" with ZMG "+ld.currentZMGroupName );
var isInGroup = !ld.currentZMGroupName ? true: false;
if (ld.currentZMGroupName) {
for (var k=0; k < $scope.MontageMonitors[i].Monitor.Group.length; k++) {
diff --git a/www/js/NVR.js b/www/js/NVR.js
index 6fed062b..198675f4 100644
--- a/www/js/NVR.js
+++ b/www/js/NVR.js
@@ -497,6 +497,7 @@ angular.module('zmApp.controllers')
function getZMGroups() {
//{"groups":[{"Group":{"Id":"1","Name":"test","ParentId":null}},{"Group":{"Id":"2","Name":"test2","ParentId":null}}]}
var d = $q.defer();
+ zmgroups = [];
if (get_unsupported('groups_associations')) {
debug ('Groups Association API is marked as unsupported, not invoking');
@@ -515,7 +516,7 @@ angular.module('zmApp.controllers')
data = data.data;
// console.log (JSON.stringify(data));
- debug ('Groups are:'+JSON.stringify(data));
+ //debug ('Groups are:'+JSON.stringify(data));
if (data && data.groups) {
for (var i=0; i< data.groups.length; i++) {
zmgroups.push(data.groups[i].Group.Name);
@@ -525,6 +526,25 @@ angular.module('zmApp.controllers')
// console.log(k);
if (monitors[k].Monitor.Id == data.groups[i].Monitor[j].Id) {
monitors[k].Monitor.Group.push({'id':data.groups[i].Group.Id, 'name':data.groups[i].Group.Name});
+
+ var parent = data.groups[i].Group.ParentId;
+ while (parent) {
+ var parentFound = false;
+ var x;
+ for (x = 0; x < data.groups.length; x++) {
+ if (data.groups[x].Group.Id == parent) {
+ parentFound = true;
+ break;
+ }
+ }
+ if (parentFound) {
+ monitors[k].Monitor.Group.push({'id':data.groups[x].Group.Id, 'name':data.groups[x].Group.Name});
+ // console.log (data.groups[x].Group.Id+ " is parent of "+data.groups[i].Group.Id);
+ parent = data.groups[x].Group.ParentId;
+ }
+ }
+
+ // console.log ('DONE HIERARCHY');
// console.log ('Monitor: '+ monitors[k].Monitor.Name+" belongs to Group:"+data.groups[i].Group.Name);
}
} // monitors