diff --git a/vipra-ui/app/js/app.js b/vipra-ui/app/js/app.js index 7bd748f86f79b2c4bf16b19b950a3c129b07c2db..9b679b93edd12d6f3eb45f804241e0b959a0aff4 100644 --- a/vipra-ui/app/js/app.js +++ b/vipra-ui/app/js/app.js @@ -101,17 +101,26 @@ app.config(['$httpProvider', function($httpProvider) { + var loadingTimeout; + $httpProvider.interceptors.push(function ($q, $injector, $rootScope) { var requestIncrement = function(config) { $rootScope.loading.requests = ++$rootScope.loading.requests || 1; $rootScope.loading[config.method] = ++$rootScope.loading[config.method] || 1; $rootScope.loading.any = true; + + clearTimeout(loadingTimeout); }; var requestDecrement = function(config) { $rootScope.loading.requests = Math.max(--$rootScope.loading.requests, 0); $rootScope.loading[config.method] = Math.max(--$rootScope.loading[config.method], 0); $rootScope.loading.any = $rootScope.loading.requests > 0; + + loadingTimeout = setTimeout(function() { + console.log('loading done'); + NProgress.done(); + }, 100); }; return { @@ -147,6 +156,7 @@ $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { console.log('changing state: ' + toState.name); + NProgress.start(); }); }]); diff --git a/vipra-ui/app/js/helpers.js b/vipra-ui/app/js/helpers.js index 726e96c9628dba8fd9a4e15b0292f20f8fb65b7e..dacff035c3e805cb785d4e5b980162a1cc93e37f 100644 --- a/vipra-ui/app/js/helpers.js +++ b/vipra-ui/app/js/helpers.js @@ -1,6 +1,6 @@ /****************************************************************************** * Vipra Application - * Helpers + * Helpers & Polyfills ******************************************************************************/ (function() { @@ -31,4 +31,8 @@ return this; }; + window.console = window.console || { + log: function () {} + }; + })(); \ No newline at end of file diff --git a/vipra-ui/bower.json b/vipra-ui/bower.json index 8cd59437848336d9d6ab5ce6bf8189fe3874144d..1efe46c3299924589c13c787c661a50ef095b070 100644 --- a/vipra-ui/bower.json +++ b/vipra-ui/bower.json @@ -23,7 +23,9 @@ "angular-resource": "^1.5.0", "angular-ui-router": "^0.2.17", "angular-sanitize": "^1.5.0", + "angular-bootstrap": "^1.1.2", "highcharts": "^4.2.2", - "angular-bootstrap": "^1.1.2" + "nprogress": "^0.2.0", + "vis": "https://github.com/almende/vis.git#^4.14.0" } } diff --git a/vipra-ui/gulpfile.js b/vipra-ui/gulpfile.js index 89250fac8356aa74b9db6d859dabe27ccf1950d8..7b4035879b6efa6731e3da89373b5738a12d6472 100644 --- a/vipra-ui/gulpfile.js +++ b/vipra-ui/gulpfile.js @@ -17,11 +17,13 @@ var assets = { 'bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js', 'bower_components/bootstrap/dist/js/bootstrap.min.js', 'bower_components/highcharts/highcharts.js', - 'bower_components/vis/dist/vis.min.js' + 'bower_components/vis/dist/vis.min.js', + 'bower_components/nprogress/nprogress.js' ], css: [ 'bower_components/bootstrap/dist/css/bootstrap.min.css', - 'bower_components/vis/dist/vis.min.css' + 'bower_components/vis/dist/vis.min.css', + 'bower_components/nprogress/nprogress.css' ], fonts: [ 'bower_components/bootstrap/dist/fonts/*'