(js) New progress indicator in AddressBook module
This commit is contained in:
parent
3611c4021d
commit
1667f8879d
|
@ -366,6 +366,12 @@
|
||||||
</div>
|
</div>
|
||||||
</md-list>
|
</md-list>
|
||||||
</md-virtual-repeat-container>
|
</md-virtual-repeat-container>
|
||||||
|
<div class="sg-progress-circular-floating"
|
||||||
|
ng-show="addressbook.selectedFolder.$isLoading">
|
||||||
|
<md-progress-circular class="md-accent"
|
||||||
|
md-mode="indeterminate"
|
||||||
|
md-diameter="32"><!-- progress --></md-progress-circular>
|
||||||
|
</div>
|
||||||
<md-button class="md-fab md-fab-bottom-right md-accent"
|
<md-button class="md-fab md-fab-bottom-right md-accent"
|
||||||
label:aria-label="New Contact"
|
label:aria-label="New Contact"
|
||||||
ng-show="addressbook.selectedFolder.acls.objectCreator"
|
ng-show="addressbook.selectedFolder.acls.objectCreator"
|
||||||
|
|
|
@ -215,6 +215,7 @@
|
||||||
* @param {object} data - attributes of addressbook
|
* @param {object} data - attributes of addressbook
|
||||||
*/
|
*/
|
||||||
AddressBook.prototype.init = function(data) {
|
AddressBook.prototype.init = function(data) {
|
||||||
|
this.$isLoading = true;
|
||||||
this.$cards = [];
|
this.$cards = [];
|
||||||
this.cards = [];
|
this.cards = [];
|
||||||
angular.extend(this, data);
|
angular.extend(this, data);
|
||||||
|
@ -289,34 +290,7 @@
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
this.$startRefreshTimeout();
|
this.$startRefreshTimeout();
|
||||||
|
return this.$filter();
|
||||||
return AddressBook.$$resource.fetch(this.id, 'view')
|
|
||||||
.then(function(response) {
|
|
||||||
var index, card,
|
|
||||||
results = response.cards,
|
|
||||||
cards = _this.cards,
|
|
||||||
compareIds = function(data) {
|
|
||||||
return this.id == data.id;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Remove cards that no longer exist
|
|
||||||
for (index = cards.length - 1; index >= 0; index--) {
|
|
||||||
card = cards[index];
|
|
||||||
if (_.isUndefined(_.find(results, compareIds, card))) {
|
|
||||||
cards.splice(index, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add new cards
|
|
||||||
_.each(results, function(data, index) {
|
|
||||||
if (_.isUndefined(_.find(cards, compareIds, data))) {
|
|
||||||
var card = new AddressBook.$Card(data);
|
|
||||||
cards.splice(index, 0, card);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return cards;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -330,6 +304,8 @@
|
||||||
AddressBook.prototype.$filter = function(search, options, excludedCards) {
|
AddressBook.prototype.$filter = function(search, options, excludedCards) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
|
this.$isLoading = true;
|
||||||
|
|
||||||
return AddressBook.$Preferences.ready().then(function() {
|
return AddressBook.$Preferences.ready().then(function() {
|
||||||
if (options) {
|
if (options) {
|
||||||
angular.extend(AddressBook.$query, options);
|
angular.extend(AddressBook.$query, options);
|
||||||
|
@ -347,7 +323,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddressBook.$query.value = search;
|
if (angular.isDefined(search))
|
||||||
|
AddressBook.$query.value = search;
|
||||||
|
|
||||||
return _this.$id().then(function(addressbookId) {
|
return _this.$id().then(function(addressbookId) {
|
||||||
return AddressBook.$$resource.fetch(addressbookId, 'view', AddressBook.$query);
|
return AddressBook.$$resource.fetch(addressbookId, 'view', AddressBook.$query);
|
||||||
|
@ -396,6 +373,7 @@
|
||||||
cards.splice(index, 0, removedCards[0]);
|
cards.splice(index, 0, removedCards[0]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
_this.$isLoading = false;
|
||||||
return cards;
|
return cards;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -528,6 +506,8 @@
|
||||||
|
|
||||||
_this.$startRefreshTimeout();
|
_this.$startRefreshTimeout();
|
||||||
|
|
||||||
|
_this.$isLoading = false;
|
||||||
|
|
||||||
return _this;
|
return _this;
|
||||||
});
|
});
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
|
|
Loading…
Reference in a new issue