Skip to content

Instantly share code, notes, and snippets.

@nathggns
Created July 6, 2015 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathggns/914e919a6a11109dcf7e to your computer and use it in GitHub Desktop.
Save nathggns/914e919a6a11109dcf7e to your computer and use it in GitHub Desktop.
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;
}
async activate(params) {
const fabric_response = await this.http.get(this.url_base + '/fabrics');
return await Promise.all(fabric_response.content.map(async fabric => {
const cluster_response = await this.http.get(`${this.url_base}/fabrics/${fabric.name}/clusters`);
if (fabric.clusters_exist) {
this.fabrics.push({ name : fabric.name, clusters : cluster_response.content });
}
return cluster_response;
}));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment