(js) Progress indicator for event/task lists

This commit is contained in:
Francis Lachapelle 2016-08-02 12:09:11 -04:00
parent 8946880c84
commit 6ebf834729
4 changed files with 36 additions and 1 deletions

1
NEWS
View file

@ -12,6 +12,7 @@ Enhancements
- [web] removed animation when dragging an event to speed up rendering - [web] removed animation when dragging an event to speed up rendering
- [web] expunge drafts mailbox when a draft is sent and deleted - [web] expunge drafts mailbox when a draft is sent and deleted
- [web] actions of Sieve filters are now sortable - [web] actions of Sieve filters are now sortable
- [web] show progress indicator when refreshing events/tasks lists
Bug fixes Bug fixes
- [web] fixed refresh of addressbook when deleting one or many cards - [web] fixed refresh of addressbook when deleting one or many cards

View file

@ -660,6 +660,12 @@
</md-tab> </md-tab>
</md-tabs> </md-tabs>
</md-content> </md-content>
<div class="sg-progress-circular-floating"
ng-show="list.component.$isLoading()">
<md-progress-circular class="md-accent"
md-mode="indeterminate"
md-diameter="32"><!-- mailbox loading progress --></md-progress-circular>
</div>
<md-fab-speed-dial <md-fab-speed-dial
class="md-fling md-fab-bottom-right" class="md-fling md-fab-bottom-right"
md-direction="up" md-open="false" md-direction="up" md-open="false"

View file

@ -31,8 +31,9 @@
* @desc The factory we'll use to register with Angular * @desc The factory we'll use to register with Angular
* @returns the Component constructor * @returns the Component constructor
*/ */
Component.$factory = ['$q', '$timeout', '$log', 'sgSettings', 'Preferences', 'Card', 'Gravatar', 'Resource', function($q, $timeout, $log, Settings, Preferences, Card, Gravatar, Resource) { Component.$factory = ['$q', '$timeout', '$log', 'sgSettings', 'sgComponent_STATUS', 'Preferences', 'Card', 'Gravatar', 'Resource', function($q, $timeout, $log, Settings, Component_STATUS, Preferences, Card, Gravatar, Resource) {
angular.extend(Component, { angular.extend(Component, {
STATUS: Component_STATUS,
$q: $q, $q: $q,
$timeout: $timeout, $timeout: $timeout,
$log: $log, $log: $log,
@ -87,6 +88,13 @@
angular.module('SOGo.SchedulerUI', ['SOGo.Common']); angular.module('SOGo.SchedulerUI', ['SOGo.Common']);
} }
angular.module('SOGo.SchedulerUI') angular.module('SOGo.SchedulerUI')
.constant('sgComponent_STATUS', {
NOT_LOADED: 0,
DELAYED_LOADING: 1,
LOADING: 2,
LOADED: 3,
DELAYED_MS: 300
})
.factory('Component', Component.$factory); .factory('Component', Component.$factory);
/** /**
@ -129,6 +137,16 @@
}); });
}; };
/**
* @function $isLoading
* @memberof Component
* @returns true if the components list is still being retrieved from server after a specific delay
* @see sgMessage_STATUS
*/
Component.$isLoading = function() {
return Component.$loaded == Component.STATUS.LOADING;
};
/** /**
* @function $filter * @function $filter
* @memberof Component * @memberof Component
@ -398,6 +416,13 @@
var _this = this, var _this = this,
components = []; components = [];
// Components list is not loaded yet
Component.$loaded = Component.STATUS.DELAYED_LOADING;
Component.$timeout(function() {
if (Component.$loaded != Component.STATUS.LOADED)
Component.$loaded = Component.STATUS.LOADING;
}, Component.STATUS.DELAYED_MS);
return futureComponentData.then(function(data) { return futureComponentData.then(function(data) {
return Component.$timeout(function() { return Component.$timeout(function() {
var fields = _.invokeMap(data.fields, 'toLowerCase'); var fields = _.invokeMap(data.fields, 'toLowerCase');
@ -422,6 +447,8 @@
// Save the list of components to the object model // Save the list of components to the object model
Component['$' + type] = components; Component['$' + type] = components;
Component.$loaded = Component.STATUS.LOADED;
return components; return components;
}); });
}); });

View file

@ -15,6 +15,7 @@
border-radius: 50%; border-radius: 50%;
padding: $baseline-grid/2; padding: $baseline-grid/2;
box-shadow: $whiteframe-shadow-3dp; box-shadow: $whiteframe-shadow-3dp;
z-index: $z-index-view;
md-progress-circular { md-progress-circular {
display: block; display: block;
} }