Skip to content

Commit

Permalink
OLMIS-3446: Make offline latency timeout configurable at build time
Browse files Browse the repository at this point in the history
  • Loading branch information
adugnaworku committed Oct 18, 2018
1 parent 9d20c92 commit 2733f77
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,7 @@ Breaking changes:

Improvements:
* [OLMIS-3696](https://openlmis.atlassian.net/browse/OLMIS-3696): Added dependency and development dependency locking.
* [OLMIS-3446](https://openlmis.atlassian.net/browse/OLMIS-3446): Make offline latency timeout configurable at build time

6.0.1 / 2018-10-01
==================
Expand Down
3 changes: 2 additions & 1 deletion config.json
Expand Up @@ -16,5 +16,6 @@
"defaultDateFormat": "dd/MM/yyyy",
"defaultDatepickerFormat": "dd/mm/yyyy",
"defaultDatetimeFormat": "dd/MM/yyyy HH:mm:ss",
"maxUriLength": 2000
"maxUriLength": 2000,
"offlineCheckTimeOut" : 20000
}
7 changes: 4 additions & 3 deletions src/openlmis-offline/offline-service.js
Expand Up @@ -27,9 +27,10 @@
angular.module('openlmis-offline')
.service('offlineService', offlineService);

offlineService.$inject = ['Offline', '$timeout', '$q', '$rootScope', 'localStorageFactory'];
offlineService.$inject = ['Offline', '$timeout', '$q', '$rootScope', 'localStorageFactory',
'OFFLINE_CHECK_TIME_OUT'];

function offlineService(Offline, $timeout, $q, $rootScope, localStorageFactory) {
function offlineService(Offline, $timeout, $q, $rootScope, localStorageFactory, OFFLINE_CHECK_TIME_OUT) {
var service = this,
storedFlag = localStorageFactory('offlineFlag'),
isOfflineFlag = localStorageFactory('offlineFlag')
Expand All @@ -50,7 +51,7 @@
return 'favicon.ico?_=' + new Date()
.getTime();
},
timeout: 20000
timeout: OFFLINE_CHECK_TIME_OUT
}
}
};
Expand Down
10 changes: 9 additions & 1 deletion src/openlmis-offline/offline.constant.js
Expand Up @@ -26,6 +26,14 @@
*/
angular.module('openlmis-offline')
//eslint-disable-next-line no-undef
.constant('Offline', Offline);
.constant('Offline', Offline)
.constant('OFFLINE_CHECK_TIME_OUT', getOfflineCheckTimeOut());

function getOfflineCheckTimeOut() {
var offlineCheckTimeOut = '@@OFFLINE_CHECK_TIME_OUT';

return (parseInt(offlineCheckTimeOut) && parseInt(offlineCheckTimeOut) > 0)
? parseInt(offlineCheckTimeOut) : 20000;
}

})();

0 comments on commit 2733f77

Please sign in to comment.