From 0a4df85f5838cd32927d47d75c50899f6a7a5b4c Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Fri, 23 Nov 2018 10:52:53 -0500 Subject: switch between snapshot and support for older versions --- www/js/DataModel.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'www/js/DataModel.js') diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 25a42c86..86c9415a 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -25,6 +25,10 @@ angular.module('zmApp.controllers') var justResumed = false; var timeSinceResumed = -1; var monitorsLoaded = 0; + var snapshotFrame = 1; // will be 'snapshot' + // if ZM >= 1.31 + + var monitors = []; var multiservers = []; @@ -1780,10 +1784,19 @@ angular.module('zmApp.controllers') $http.get(apiurl) .then(function (success) { if (success.data.version) { - // console.log ("API VERSION RETURNED: " + JSON.stringify(success)); + console.log ("API VERSION RETURNED: " + JSON.stringify(success)); $rootScope.apiValid = true; + + if (versionCompare(success.data.version, '1.31.0') != -1 ) { + debug ("snapshot supported in image.php"); + snapshotFrame = 'snapshot'; + } + else { + debug ("snapshot NOT supported in image.php"); + snapshotFrame = 1; + } setCurrentServerVersion(success.data.version); - debug("getAPI version succeded with " + success.data.version); + debug("getAPI version succeeded with " + success.data.version); d.resolve(success.data.version); } else { debug("Setting APIValid to false as API version was not retrieved"); @@ -1952,6 +1965,10 @@ angular.module('zmApp.controllers') return getBandwidth(); }, + getSnapshotFrame: function () { + return snapshotFrame; + }, + //----------------------------------------------------------------------------- // This function returns a list of monitors // if forceReload == 1 then it will force an HTTP API request to get a list of monitors -- cgit v1.2.3