]>
git.immae.eu Git - github/bastienwirtz/homer.git/blob - app.js
9 return getConfig().then(function (config
) {
10 // Splice services list into groups of 3 for flex column display
12 config
.services
.forEach(function(service
) {
14 items
= service
.items
;
15 while (items
.length
) {
16 service
.rows
.push(items
.splice(0, size
));
19 if (service
.rows
.length
) {
20 var last
= service
.rows
.length
-1;
21 service
.rows
[last
] = service
.rows
[last
].concat(Array(size
- service
.rows
[last
].length
));
30 function getConfig() {
31 return new Promise(function (resolve
, reject
) {
32 var xhr
= new XMLHttpRequest();
33 xhr
.open('GET', 'config.yml');
34 xhr
.onload = function () {
35 if (this.status
>= 200 && this.status
< 300) {
37 var data
= jsyaml
.load(xhr
.response
);
40 console
.error('fail to parse config file');
46 statusText: xhr
.statusText
50 xhr
.onerror = function () {
53 statusText: xhr
.statusText