mirror of
https://github.com/documize/community.git
synced 2025-08-05 05:25:27 +02:00
bulk data load methods for space and document views
This commit is contained in:
parent
bc72db711f
commit
318abef710
9 changed files with 315 additions and 29 deletions
|
@ -151,5 +151,34 @@ export default BaseService.extend({
|
|||
}).then((response) => {
|
||||
return response;
|
||||
});
|
||||
},
|
||||
|
||||
// fetchXXX represents UI specific bulk data loading designed to
|
||||
// reduce network traffic and boost app performance.
|
||||
// This method that returns:
|
||||
// 1. getUserVisible()
|
||||
// 2. getSummary()
|
||||
// 3. getSpaceCategoryMembership()
|
||||
fetchSpaceData(spaceId) {
|
||||
return this.get('ajax').request(`fetch/category/space/${spaceId}`, {
|
||||
method: 'GET'
|
||||
}).then((response) => {
|
||||
let data = {
|
||||
category: [],
|
||||
membership: [],
|
||||
summary: []
|
||||
};
|
||||
|
||||
let cats = response.category.map((obj) => {
|
||||
let data = this.get('store').normalize('category', obj);
|
||||
return this.get('store').push(data);
|
||||
});
|
||||
|
||||
data.category = cats;
|
||||
data.membership = response.membership;
|
||||
data.summary = response.summary;
|
||||
|
||||
return data;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue