mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Added node pagination to SiteModel (#2136)
This commit is contained in:
@@ -15,6 +15,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { Pagination } from 'alfresco-js-api';
|
||||||
|
|
||||||
export class SiteModel {
|
export class SiteModel {
|
||||||
role: string;
|
role: string;
|
||||||
visibility: string;
|
visibility: string;
|
||||||
@@ -25,6 +27,7 @@ export class SiteModel {
|
|||||||
title: string;
|
title: string;
|
||||||
contents: SiteContentsModel[] = [];
|
contents: SiteContentsModel[] = [];
|
||||||
members: SiteMembersModel[] = [];
|
members: SiteMembersModel[] = [];
|
||||||
|
pagination: Pagination;
|
||||||
|
|
||||||
constructor(obj?: any) {
|
constructor(obj?: any) {
|
||||||
if (obj && obj.entry) {
|
if (obj && obj.entry) {
|
||||||
@@ -35,6 +38,7 @@ export class SiteModel {
|
|||||||
this.id = obj.entry.id || null;
|
this.id = obj.entry.id || null;
|
||||||
this.preset = obj.entry.preset;
|
this.preset = obj.entry.preset;
|
||||||
this.title = obj.entry.title;
|
this.title = obj.entry.title;
|
||||||
|
this.pagination = obj.pagination || null;
|
||||||
|
|
||||||
if (obj.relations && obj.relations.containers) {
|
if (obj.relations && obj.relations.containers) {
|
||||||
obj.relations.containers.list.entries.forEach((content) => {
|
obj.relations.containers.list.entries.forEach((content) => {
|
||||||
|
@@ -37,8 +37,7 @@ export class SitesApiService {
|
|||||||
};
|
};
|
||||||
const queryOptions = Object.assign({}, defaultOptions, opts);
|
const queryOptions = Object.assign({}, defaultOptions, opts);
|
||||||
return Observable.fromPromise(this.apiService.getInstance().core.sitesApi.getSites(queryOptions))
|
return Observable.fromPromise(this.apiService.getInstance().core.sitesApi.getSites(queryOptions))
|
||||||
.map((res: any) => res.list.entries)
|
.map((res) => this.convertToModel(res))
|
||||||
.map((objList) => this.convertToModel(objList))
|
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,10 +67,14 @@ export class SitesApiService {
|
|||||||
return Observable.throw(error || 'Server error');
|
return Observable.throw(error || 'Server error');
|
||||||
}
|
}
|
||||||
|
|
||||||
private convertToModel(objList: any[]) {
|
private convertToModel(response: any) {
|
||||||
let convertedList: SiteModel[] = [];
|
let convertedList: SiteModel[] = [];
|
||||||
if (objList && objList.length > 0) {
|
if (response &&
|
||||||
objList.forEach((element: any) => {
|
response.list &&
|
||||||
|
response.list.entries &&
|
||||||
|
response.list.entries.length > 0) {
|
||||||
|
response.list.entries.forEach((element: any) => {
|
||||||
|
element.pagination = response.list.pagination;
|
||||||
convertedList.push(new SiteModel(element));
|
convertedList.push(new SiteModel(element));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user