Merge branch 'bastienwirtz:main' into apikey

This commit is contained in:
Robin Schneider 2021-10-25 14:06:41 +02:00 committed by GitHub
commit f2c901a1ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 5 deletions

View File

@ -19,6 +19,9 @@ logo: "assets/logo.png"
# icon: "fas fa-skull-crossbones"
header: true # Set to false to hide the header
# Optional: Different hotkey for search, defaults to "/"
# hotkey:
# search: "Shift"
footer: '<p>Created with <span class="has-text-danger">❤️</span> with <a href="https://bulma.io/">bulma</a>, <a href="https://vuejs.org/">vuejs</a> & <a href="https://fontawesome.com/">font awesome</a> // Fork me on <a href="https://github.com/bastienwirtz/homer"><i class="fab fa-github-alt"></i></a></p>' # set false if you want to hide it.
columns: "3" # "auto" or number (must be a factor of 12: 1, 2, 3, 4, 6, 12)

View File

@ -97,8 +97,9 @@ For Ping you need to set the type to Ping and provide a url.
- name: "Awesome app"
type: Ping
logo: "assets/tools/sample.png"
subtitle: "Bookmark example" tag: "app"
url: "https://www.reddit.com/r/selfhosted/"
subtitle: "Bookmark example"
tag: "app"
url: "https://www.reddit.com/r/selfhosted/"
```
## Prometheus

View File

@ -41,6 +41,7 @@
<SearchInput
class="navbar-item is-inline-block-mobile"
:hotkey=searchHotkey()
@input="filterServices"
@search-focus="showMenu = true"
@search-open="navigateToFirstService"
@ -167,6 +168,11 @@ export default {
window.onhashchange = this.buildDashboard;
},
methods: {
searchHotkey() {
if (this.config.hotkey && this.config.hotkey.search) {
return this.config.hotkey.search;
}
},
buildDashboard: async function () {
const defaults = jsyaml.load(defaultConfig);
let config;

View File

@ -15,10 +15,16 @@
<script>
export default {
name: "SearchInput",
props: ["value"],
props: {
value: String,
hotkey: {
type: String,
default: "/"
}
},
mounted() {
this._keyListener = function (event) {
if (event.key === "/") {
if (event.key === this.hotkey) {
event.preventDefault();
this.focus();
}
@ -28,7 +34,7 @@ export default {
};
document.addEventListener("keydown", this._keyListener.bind(this));
// fill seach from get parameter.
// fill search from get parameter.
const search = new URLSearchParams(window.location.search).get("search");
if (search) {
this.$refs.search.value = search;