X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FApp.vue;h=d97df0cc18d1f5ad5ff1af3ba5f8c8b1a059619c;hb=d1b29caaa62ef19e9dd68babf334ec25a966f945;hp=be16234d4d2b08c45dc89309d0f8b14799b8fd77;hpb=3bf0edcf136b6354274fe0a5870c38350d36e6b7;p=github%2Fbastienwirtz%2Fhomer.git diff --git a/src/App.vue b/src/App.vue index be16234..d97df0c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -26,7 +26,7 @@ @@ -40,16 +40,19 @@
- +
@@ -58,14 +61,14 @@
@@ -76,12 +79,12 @@ class="columns is-multiline layout-vertical" >

- + {{ group.name }}

{ + if (response.redirected) { + // This allows to work with authentication proxies. + window.location.href = response.url; return; } - return response.text().then(function (body) { - return jsyaml.load(body); - }); + if (!response.ok) { + throw Error(`${response.statusText}: ${response.body}`); + } + + const that = this; + return response + .text() + .then((body) => { + return jsyaml.load(body); + }) + .then(function (config) { + if (config.externalConfig) { + return that.getConfig(config.externalConfig); + } + return config; + }); }); }, matchesFilter: function (item) { @@ -209,6 +235,20 @@ export default { }, ]; }, + handleErrors: function (title, content) { + return { + message: { + title: title, + style: "is-danger", + content: content, + }, + }; + }, + createStylesheet: function (css) { + let style = document.createElement("style"); + style.appendChild(document.createTextNode(css)); + document.head.appendChild(style); + }, }, };