]> git.immae.eu Git - github/bastienwirtz/homer.git/blobdiff - src/App.vue
Handling empty groups in search function
[github/bastienwirtz/homer.git] / src / App.vue
index f2089ee0290d92b2061c4d297c3c15859bba0503..a329775d789f7c9266834fb1f45ffcbef5bb3d7c 100644 (file)
@@ -50,7 +50,7 @@
         <SearchInput
           class="navbar-item is-inline-block-mobile"
           :hotkey="searchHotkey()"
-          @input="filterServices($event.target?.value)"
+          @input="filterServices($event)"
           @search-focus="showMenu = true"
           @search-open="navigateToFirstService($event?.target?.value)"
           @search-cancel="filterServices()"
 </template>
 
 <script>
-import jsyaml from "js-yaml";
+import { parse } from "yaml";
 import merge from "lodash.merge";
 
 import Navbar from "./components/Navbar.vue";
@@ -200,7 +200,7 @@ export default {
       }
     },
     buildDashboard: async function () {
-      const defaults = jsyaml.load(defaultConfig);
+      const defaults = parse(defaultConfig);
       let config;
       try {
         config = await this.getConfig();
@@ -245,7 +245,7 @@ export default {
         return response
           .text()
           .then((body) => {
-            return jsyaml.load(body);
+            return parse(body, {merge: true});
           })
           .then(function (config) {
             if (config.externalConfig) {
@@ -283,9 +283,11 @@ export default {
 
       const searchResultItems = [];
       for (const group of this.config.services) {
-        for (const item of group.items) {
-          if (this.matchesFilter(item)) {
-            searchResultItems.push(item);
+        if (group.items !== null) {
+          for (const item of group.items) {
+            if (this.matchesFilter(item)) {
+              searchResultItems.push(item);
+            }
           }
         }
       }