From b39eae4b52c199c30c3c7489382403057f12d93c Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Thu, 5 Apr 2018 15:37:52 -0400 Subject: #602 support --- www/js/DataModel.js | 43 +++++++++++++++++++++++++++++++++++++- www/js/EventServer.js | 2 +- www/js/LoginCtrl.js | 2 ++ www/js/MontageHistoryCtrl.js | 14 ++++++++++--- www/templates/montage-history.html | 2 +- 5 files changed, 57 insertions(+), 6 deletions(-) diff --git a/www/js/DataModel.js b/www/js/DataModel.js index d553f0dd..6384c324 100755 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -14,6 +14,9 @@ angular.module('zmApp.controllers') zm, $rootScope, $ionicContentBanner, $timeout, $cordovaPinDialog, $ionicPopup, $localstorage, $state, $ionicNativeTransitions, $translate) { + var currentServerMultiPortSupported = false; + var currentServerVersion = ''; + var zmAppVersion = "unknown"; var isBackground = false; var justResumed = false; @@ -289,6 +292,7 @@ angular.module('zmApp.controllers') $http.get(myurl) .success(function (data) { configParams.ZM_MIN_STREAMING_PORT = data.config.Value; + setCurrentServerMultiPortSupported(true); log("Got min streaming port value of: " + configParams.ZM_MIN_STREAMING_PORT); d.resolve(configParams.ZM_MIN_STREAMING_PORT); return (d.promise); @@ -296,6 +300,7 @@ angular.module('zmApp.controllers') .error(function (err) { configParams.ZM_MIN_STREAMING_PORT = 0; log("ZM_MIN_STREAMING_PORT not supported"); + setCurrentServerMultiPortSupported(false); d.resolve(configParams.ZM_MIN_STREAMING_PORT); return (d.promise); }); @@ -456,7 +461,35 @@ angular.module('zmApp.controllers') }, mytimer || 6000); } + function setCurrentServerMultiPortSupported (val) { + debug ("Setting multi-port to:"+val); + currentServerMultiPortSupported = val; + } + + function setCurrentServerVersion (val) { + currentServerMultiPortSupported = val; + debug ("Setting server version to:"+val); + } + + return { + setCurrentServerMultiPortSupported:function (val) { + setCurrentServerMultiPortSupported(val); + }, + + setCurrentServerVersion: function (val) { + setCurrentServerVersion(val); + }, + + + getCurrentServerMultiPortSupported: function () { + return (currentServerMultiPortSupported); + }, + + getCurrentServerVersion :function () { + return (currentServerMultiPortSupported); + }, + //------------------------------------------------------------- // used by various controllers to log messages to file @@ -1279,9 +1312,11 @@ angular.module('zmApp.controllers') .then(function (success) { if (success.data.version) { $rootScope.apiValid = true; + setCurrentServerVersion(success.data.version); d.resolve(success.data.version); } else { $rootScope.apiValid = false; + setCurrentServerVersion(""); d.reject("-1.-1.-1"); } return (d.promise); @@ -1290,6 +1325,7 @@ angular.module('zmApp.controllers') function (error) { debug("getAPIversion error handler " + JSON.stringify(error)); d.reject("-1.-1.-1"); + setCurrentServerVersion(""); $rootScope.apiValid = false; return (d.promise); }); @@ -2113,7 +2149,12 @@ angular.module('zmApp.controllers') } return "(Unknown)"; - }, + } + + + + + }; } diff --git a/www/js/EventServer.js b/www/js/EventServer.js index 3f230d91..0d439abe 100644 --- a/www/js/EventServer.js +++ b/www/js/EventServer.js @@ -265,7 +265,7 @@ angular.module('zmApp.controllers') // lets stack the display so they don't overwrite //eventsToDisplay.push(str.events[iter].Name + ": latest new alarm (" + str.events[iter].EventId + ")"); var txt = str.events[iter].EventId; - if (str.events[iter].Cause) { txt = str.events[iter].Cause}; + if (str.events[iter].Cause) { txt = str.events[iter].Cause;} eventsToDisplay.push(str.events[iter].Name + ": " + txt); localNotText = localNotText + str.events[iter].Name + ": " +txt+ ","; listOfMonitors.push(str.events[iter].MonitorId); diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index 36c139b1..a2e363b1 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -536,6 +536,8 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r //console.log ("*********** SAVE ITEMS CALLED "); //console.log('Saving login'); NVRDataModel.setFirstUse(false); + NVRDataModel.setCurrentServerVersion(''); + NVRDataModel.setCurrentServerMultiPortSupported(false); // used for menu display diff --git a/www/js/MontageHistoryCtrl.js b/www/js/MontageHistoryCtrl.js index 67b48707..c9f78499 100644 --- a/www/js/MontageHistoryCtrl.js +++ b/www/js/MontageHistoryCtrl.js @@ -898,6 +898,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc });*/ $scope.$on('$ionicView.beforeEnter', function() { + $scope.isMultiPort = NVRDataModel.getCurrentServerMultiPortSupported(); // NVRDataModel.log ("Before Enter History: initing connkeys"); }); $scope.$on('$ionicView.beforeLeave', function() @@ -1448,9 +1449,16 @@ angular.module('zmApp.controllers').controller('zmApp.MontageHistoryCtrl', ['$sc $scope.currentLimit = $scope.LoginData.maxMontage; if ($rootScope.platformOS != 'ios') { - NVRDataModel.log("Limiting montage to 5, thanks to Chrome's stupid connection limit"); - $scope.currentLimit = 5; - $scope.monLimit = 5; + if (!NVRDataModel.getCurrentServerMultiPortSupported()) { + NVRDataModel.log("Limiting montage to 5, thanks to Chrome's stupid connection limit"); + $scope.currentLimit = 5; + $scope.monLimit = 5; + } + else { + NVRDataModel.debug ("Since Multiport is supported, taking off Chrome limit!"); + } + + } $rootScope.authSession = "undefined"; $ionicLoading.show( diff --git a/www/templates/montage-history.html b/www/templates/montage-history.html index a1b9aafb..0aaaffbf 100644 --- a/www/templates/montage-history.html +++ b/www/templates/montage-history.html @@ -12,7 +12,7 @@
{{'kFrom' | translate}}:{{prettifyDateTimeFirst(datetimeValueFrom.value)}} ({{humanizeTime(datetimeValueFrom.value)}}) -
({{'kChromeMax' | translate}})
+
({{'kChromeMax' | translate}})
-- cgit v1.2.3