Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
Fixed limit on devices
Browse files Browse the repository at this point in the history
  • Loading branch information
CaribouJohn committed Mar 30, 2021
1 parent 253b755 commit ca35c76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"dist\\bundle-src\\custom-widget.js": "cumulocity-datapoints-charting-CustomWidget",
"dist/bundle-src/custom-widget.js": "cumulocity-datapoints-charting-CustomWidget"
},
"version": "1.0.0",
"version": "1.0.1",
"description": "Widget for displaying realtime measurement data in graphs (written by Software AG Global Pre-sales)",
"scripts": {
"build": "gulp",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,12 @@ export class CumulocityDataPointsChartingWidgetConfig implements OnInit {
//
// Helper methods
//
async getDeviceList(): Promise<IManagedObject[]> {
let dev: IManagedObject[] = [];
let page = 1;
let resp = await this.inventory.list({
pageSize: 2000,
async getDeviceList(): Promise<IResultList<IManagedObject>> {
let devs = this.inventory.list({
pageSize: 100,
fragmentType: "c8y_IsDevice",
});

if (resp.res.status == 200) {
dev = [...resp.data];
page = resp.paging.nextPage;
while (page != null) {
console.log(`requesting page ${page}`);
// Need to handle errors here and also could there be
// other status codes to handle?
resp = await resp.paging.next();
if (resp.res.status == 200) {
//add next range of stuff...
dev = [...dev, ...resp.data];
}

page = resp.paging.nextPage;
}
console.log(`total of ${resp.data.length} points`);
}
return dev;
return devs;
}

async getDeviceDetail(id: IdReference): Promise<IResult<IManagedObject>> {
Expand Down Expand Up @@ -97,7 +77,7 @@ export class CumulocityDataPointsChartingWidgetConfig implements OnInit {
//set the devices observable for the config form
let deviceList = await this.getDeviceList();
this.devices = of(
deviceList
deviceList.data
.map((item) => {
return { id: item.id, text: item.name };
})
Expand Down

0 comments on commit ca35c76

Please sign in to comment.