import {inject} from 'aurelia-framework'; import {HttpClient} from 'aurelia-http-client'; @inject(HttpClient) export class ClusterList { heading = 'Clusters'; url_base = "https://foobar:443/v1" fabrics = []; constructor(http){ this.http = http; } activate(params) { return this.http.get(this.url_base + "/fabrics").then(fabric_response => { return Promise.all(fabric_response.content.map(fabric => { return this.http.get(`${this.url_base}/fabrics/${fabric.name}/clusters`).then(cluster_response => { if(fabric.clusters_exist) { this.fabrics.push({"name": fabric.name, "clusters": cluster_response.content}); } }); })); }); } }