From c086ac875e6e63b82fc37659c651459391ed05ae Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Wed, 25 Jul 2018 12:39:05 -0400 Subject: #676 fixes for viewByName and other cleanup --- www/js/DataModel.js | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'www/js/DataModel.js') diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 2e7279ad..ee0603e5 100755 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -302,17 +302,19 @@ angular.module('zmApp.controllers') var myurl = apiurl + '/configs/viewByName/ZM_MIN_STREAMING_PORT.json'; $http.get(myurl) .success(function (data) { - configParams.ZM_MIN_STREAMING_PORT = data.config.Value; + //console.log ("GOT " + JSON.stringify(data)); - if (!data.config.Value) { + if (data.config && data.config.Value) { + configParams.ZM_MIN_STREAMING_PORT = data.config.Value; + setCurrentServerMultiPortSupported(true); + log("Got min streaming port value of: " + configParams.ZM_MIN_STREAMING_PORT); + } + else { setCurrentServerMultiPortSupported(false); log("ZM_MIN_STREAMING_PORT not configure, disabling"); configParams.ZM_MIN_STREAMING_PORT = 0; - } else { - setCurrentServerMultiPortSupported(true); - log("Got min streaming port value of: " + configParams.ZM_MIN_STREAMING_PORT); } - + d.resolve(configParams.ZM_MIN_STREAMING_PORT); return (d.promise); @@ -347,10 +349,10 @@ angular.module('zmApp.controllers') return d.promise; } - if (versionCompare(currentServerVersion, zm.versionWithLoginAPI) != -1 || loginData.loginAPISupported) { + if (currentServerVersion && (versionCompare(currentServerVersion, zm.versionWithLoginAPI) != -1 || loginData.loginAPISupported)) { myurl = loginData.apiurl + '/host/getCredentials.json'; - debug("Server version > 1.31.41, so using getCredentials API:" + myurl); + debug("Server version " + currentServerVersion+ " > 1.31.41, so using getCredentials API:" + myurl); $http.get(myurl) .then(function (s) { @@ -1590,6 +1592,7 @@ angular.module('zmApp.controllers') $http.get(apiurl) .then(function (success) { if (success.data.version) { + // console.log ("API VERSION RETURNED: " + JSON.stringify(success)); $rootScope.apiValid = true; setCurrentServerVersion(success.data.version); d.resolve(success.data.version); @@ -1921,7 +1924,7 @@ angular.module('zmApp.controllers') debug("Monitor URL to fetch is:" + myurl); $http.get(myurl /*,{timeout:15000}*/ ) .success(function (data) { - //console.log("HTTP success got " + JSON.stringify(data.monitors)); + // console.log("HTTP success got " + JSON.stringify(data.monitors)); monitors = data.monitors; @@ -2645,17 +2648,19 @@ angular.module('zmApp.controllers') $rootScope.authSession = "undefined"; - if (versionCompare(currentServerVersion, zm.versionWithLoginAPI) != -1 || loginData.loginAPISupported) { +// console.log ("CURRENT SERVER: "+currentServerVersion); + + if (currentServerVersion && (versionCompare(currentServerVersion, zm.versionWithLoginAPI) != -1 || loginData.loginAPISupported)) { debug ("Logging out using API method"); $http.get(loginData.apiurl+'/host/logout.json') .then (function(s) { - debug ("Logout returned "+JSON.stringify(s)); + debug ("Logout returned... "); d.resolve(true); return d.promise; }, function (e) { - debug ("Logout errored "+JSON.stringify(e)); + debug ("Logout errored but really don't worry, your ZM version may not support it"); d.resolve(true); return d.promise; } -- cgit v1.2.3