in angular/src/app/stage/item-list/item-list.component.ts [99:146]
searchEntities() {
let lastToken = this.search.lastTokenStack[this.search.lastTokenStack.length - 1];
if (this.search.queryResource || this.search.queryMetadata) {
let query : any = {};
if(this.search.queryResource) {
query.Resource = JSON.parse(this.search.queryResource);
}
if(this.search.queryMetadata) {
query.Metadata = JSON.parse(this.search.queryMetadata);
}
this.resourceService.find(this.stageEndpoint, this.namespaceCode, lastToken, this.search.pageSize, query)
.subscribe(
(res: any) => {
this.search.pageCount = res.pageCount;
if(res.LastEvaluatedKey) {
this.search.lastTokenStack.push(res.LastEvaluatedKey);
}
this.entities = res.Items;
this.processItems(this.entities);
},
(err: any) => {
console.log(err);
this.formHelperService.showError('Errors.GenericError', null);
}
);
} else {
this.resourceService.list(this.stageEndpoint, this.namespaceCode, lastToken, this.search.pageSize)
.subscribe(
(res: any) => {
this.search.pageCount = res.pageCount;
if(res.LastEvaluatedKey) {
this.search.lastTokenStack.push(res.LastEvaluatedKey.id);
}
this.entities = res.Items;
this.processItems(this.entities);
},
(err: any) => {
console.log(err);
this.formHelperService.showError('Errors.GenericError', null);
}
);
}
}