From ec224285320d38b3007fb469c10fffbca1294c10 Mon Sep 17 00:00:00 2001 From: PliablePixels Date: Tue, 30 Jun 2015 19:43:10 -0400 Subject: set 50K limit for logs, separated my modifications for angular-circular-navigations --- www/js/LogCtrl.js | 5 +++- www/js/LoginCtrl.js | 1 + www/js/angular-circular-navigation.js | 54 +++++++++++++++++++++++++++++++++++ www/js/app.js | 22 ++++++++++++-- 4 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 www/js/angular-circular-navigation.js (limited to 'www/js') diff --git a/www/js/LogCtrl.js b/www/js/LogCtrl.js index d2ff88d8..92b0aaad 100644 --- a/www/js/LogCtrl.js +++ b/www/js/LogCtrl.js @@ -2,11 +2,14 @@ /* jslint browser: true*/ /* global cordova,StatusBar,angular,console */ -angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$rootScope', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$fileLogger', '$cordovaEmailComposer', '$ionicPopup', function ($scope, $rootScope, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $fileLogger, $cordovaEmailComposer, $ionicPopup) { +angular.module('zmApp.controllers').controller('zmApp.LogCtrl', ['$scope', '$rootScope', '$ionicModal', 'ZMDataModel', '$ionicSideMenuDelegate', '$fileLogger', '$cordovaEmailComposer', '$ionicPopup', '$timeout', function ($scope, $rootScope, $ionicModal, ZMDataModel, $ionicSideMenuDelegate, $fileLogger, $cordovaEmailComposer, $ionicPopup, $timeout) { $scope.openMenu = function () { $ionicSideMenuDelegate.toggleLeft(); }; + + + //-------------------------------------------------------------------------- // Make sure user knows information masking is best effort //-------------------------------------------------------------------------- diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js index 4bf04285..7541000e 100644 --- a/www/js/LoginCtrl.js +++ b/www/js/LoginCtrl.js @@ -113,6 +113,7 @@ function addhttp(url) { console.log("Checking API: " + apiurl + " PORTAL: " + portalurl + " CGI-BIN: " + streamingurl); + ZMDataModel.zmLog ("Checking API: " + apiurl + " PORTAL: " + portalurl + " CGI-BIN: " + streamingurl); // Let's do a sanity check to see if the URLs are ok diff --git a/www/js/angular-circular-navigation.js b/www/js/angular-circular-navigation.js new file mode 100644 index 00000000..f3b9b0a0 --- /dev/null +++ b/www/js/angular-circular-navigation.js @@ -0,0 +1,54 @@ +// PP - Modified to show at right angles +(function () { + + 'use strict'; + + /*global define, module, exports, require */ + + /* istanbul ignore next */ + var angular = window.angular ? window.angular : 'undefined' !== typeof require ? require('angular') : undefined; + + var circular = angular.module('angularCircularNavigation', []) + .directive('circular', ['$compile', function ($compile) { + + return { + restrict: 'EA', + scope: { + options: '=' + }, + template: '' + + '
', + controller: ['$scope', '$element', '$attrs', + function ($scope, $element, $attrs) { + + $scope.toggleMenu = function () { + $scope.options.isOpen = !$scope.options.isOpen; + }; + + $scope.perform = function (options, item) { + if (typeof item.onclick === 'function') { + item.onclick(options, item); + } + + if ($scope.options.toggleOnClick) { + $scope.toggleMenu(); + } + }; + + } + ] + }; + }]); + + /* istanbul ignore next */ + if (typeof define === 'function' && define.amd) { + define('circular', ['angular'], circular); + } else if ('undefined' !== typeof exports && 'undefined' !== typeof module) { + module.exports = circular; + } + +})(); diff --git a/www/js/app.js b/www/js/app.js index d7ef3f01..9831ef19 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -164,7 +164,7 @@ angular.module('zmApp', [ // First run in ionic //------------------------------------------------------------------ -.run(function ($ionicPlatform, $ionicPopup, $rootScope, $state, ZMDataModel, $cordovaSplashscreen, $http, $interval, zmAutoLogin, $fileLogger) +.run(function ($ionicPlatform, $ionicPopup, $rootScope, $state, ZMDataModel, $cordovaSplashscreen, $http, $interval, zmAutoLogin, $fileLogger,$timeout) { ZMDataModel.init(); @@ -221,9 +221,25 @@ angular.module('zmApp', [ ZMDataModel.zmLog("Device is ready"); console.log("**** DEVICE READY ***"); - $fileLogger.deleteLogfile().then(function() { + + $fileLogger.checkFile().then(function(resp) { + if (parseInt(resp.size) > 50000) + { + console.log ("Deleting old log file as it exceeds 50K bytes"); + $fileLogger.deleteLogfile().then(function() + { console.log('Logfile deleted'); - }); + }); + } + else + { + console.log ("Log file size is " + resp.size + " bytes"); + } + + + }); + + $fileLogger.setStorageFilename('zmNinjaLog.txt'); -- cgit v1.2.3