From 38aecc45c37dbaf35a0523f3e8a880570b64f47a Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Wed, 31 Oct 2018 14:51:39 -0400 Subject: #733 use new Monitor_Status if available --- www/js/DataModel.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'www/js/DataModel.js') diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 17305f22..c558d884 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -2081,6 +2081,29 @@ angular.module('zmApp.controllers') },*/ + getMultiServersCached: function () { + return multiservers; + }, + + // use non cached for daemon status + getMultiServers: function () { + return $http.get (loginData.apiurl+'/servers.json'); + + }, + + getMultiServer: function (id) { + + var ndx = -1; + for (var i=0; i < multiservers.length; i++) { + if (multiservers[i].Server.Id == id) { + ndx = i; + break; + } + } + return ndx == -1 ? {}:multiservers[ndx]; + + }, + regenConnKeys: function () { debug("DataModel: Regenerating connkeys..."); @@ -2144,7 +2167,7 @@ angular.module('zmApp.controllers') data = data.data; // We found a server list API, so lets make sure // we get the hostname as it will be needed for playback - log("multi server list loaded" + JSON.stringify(data)); + log("multi server list loaded:" + JSON.stringify(data)); multiservers = data.servers; var multiserver_scheme = "http://"; @@ -2158,6 +2181,8 @@ angular.module('zmApp.controllers') for (var i = 0; i < monitors.length; i++) { // make them all show for now + + monitors[i].Monitor.listDisplay = 'show'; monitors[i].Monitor.isAlarmed = false; monitors[i].Monitor.connKey = (Math.floor((Math.random() * 999999) + 1)).toString(); @@ -2276,11 +2301,13 @@ angular.module('zmApp.controllers') } else { //monitors[i].Monitor.listDisplay = 'show'; + debug ("No servers matched, filling defaults..."); monitors[i].Monitor.isAlarmed = false; monitors[i].Monitor.connKey = (Math.floor((Math.random() * 999999) + 1)).toString(); monitors[i].Monitor.rndKey = (Math.floor((Math.random() * 999999) + 1)).toString(); var st2 = loginData.streamingurl; + controlURL = loginData.url; if (zmsPort > 0 && !loginData.disableSimulStreaming) { // we need to insert minport @@ -2302,6 +2329,8 @@ angular.module('zmApp.controllers') if (p3.path) controlURL += p3.path; } + debug ("Storing streaming="+st2+" recording="+controlURL); + monitors[i].Monitor.streamingURL = st2; monitors[i].Monitor.controlURL = controlURL; //debug ("Streaming URL for Monitor " + monitors[i].Monitor.Id + " is " + monitors[i].Monitor.streamingURL ); -- cgit v1.2.3