Created
July 6, 2015 18:50
-
-
Save nathggns/914e919a6a11109dcf7e to your computer and use it in GitHub Desktop.
ES7 version of http://pastebin.com/raw.php?i=yEB4mrty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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