Skip to content

Commit

Permalink
chore(lint): apply config update
Browse files Browse the repository at this point in the history
  • Loading branch information
bastienwirtz committed Feb 23, 2025
1 parent 1cc724c commit 474dc3a
Show file tree
Hide file tree
Showing 16 changed files with 113 additions and 81 deletions.
7 changes: 5 additions & 2 deletions src/components/ConnectivityChecker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
<div v-if="offline" class="offline-message mb-4">
<i class="fa-solid fa-triangle-exclamation"></i>
<h1>
Network unreachable
Network unreachable
<span @click="checkOffline"> <i class="fas fa-redo-alt"></i></span>
</h1>
<p>
<a href="https://github.com/bastienwirtz/homer/blob/main/docs/configuration.md#connectivity-checks">More information →</a>
<a
href="https://github.com/bastienwirtz/homer/blob/main/docs/configuration.md#connectivity-checks"
>More information →</a
>
</p>
</div>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/components/DarkMode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
props: {
defaultValue: String,
},
emits: ['updated'],
emits: ["updated"],
data: function () {
return {
isDark: null,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default {
return;
}
return response.json();
}
},
);
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default {
},
links: Array,
},
emits: ['navbar-toggle'],
emits: ["navbar-toggle"],
computed: {
showMenu: function () {
return this.open && this.isSmallScreen();
Expand Down
48 changes: 33 additions & 15 deletions src/components/services/FreshRSS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,27 @@
<Generic :item="item">
<template #indicator>
<div class="notifs">
<strong v-if="subscriptions > 0" class="notif subscriptions" title="Subscriptions">
<strong
v-if="subscriptions > 0"
class="notif subscriptions"
title="Subscriptions"
>
{{ subscriptions }}
</strong>
<strong v-if="unread > 0" class="notif unread" title="Unread">
{{ unread }}
</strong>
<strong
v-if="serverError" class="notif errors"
title="Connection error to the FreshRSS API, check url username and password in config.yml">?</strong>
v-if="serverError"
class="notif errors"
title="Connection error to the FreshRSS API, check url username and password in config.yml"
>?</strong
>
</div>
</template>
</Generic>
</template>

<script>
import service from "@/mixins/service.js";
import Generic from "./Generic.vue";
Expand Down Expand Up @@ -45,28 +52,39 @@ export default {
},
methods: {
fetchConfig: async function () {
if (!this.auth) {
const match = await this.fetch(`/api/greader.php/accounts/ClientLogin?Email=${this.item.username}&Passwd=${this.item.password}`, { method: 'GET', cache: "no-cache" }, false)
.then(response => { return response.text(); })
.then(body => { return body.match(/Auth=(([([a-z0-9]+)\/([([a-z0-9]+))/i); });
if (match !== null)
this.auth = match[1];
const match = await this.fetch(
`/api/greader.php/accounts/ClientLogin?Email=${this.item.username}&Passwd=${this.item.password}`,
{ method: "GET", cache: "no-cache" },
false,
)
.then((response) => {
return response.text();
})
.then((body) => {
return body.match(/Auth=(([([a-z0-9]+)\/([([a-z0-9]+))/i);
});
if (match !== null) this.auth = match[1];
}
const headers = {
"Authorization": `GoogleLogin auth=${this.auth}`,
Authorization: `GoogleLogin auth=${this.auth}`,
};
this.fetch(`/api/greader.php/reader/api/0/subscription/list?output=json`, { headers })
this.fetch(
`/api/greader.php/reader/api/0/subscription/list?output=json`,
{ headers },
)
.then((subscription) => {
this.subscriptions = subscription.subscriptions.length;
})
.catch((e) => {
console.error(e);
this.serverError = true;
});
this.fetch(`/api/greader.php/reader/api/0/unread-count?output=json`, { headers })
this.fetch(`/api/greader.php/reader/api/0/unread-count?output=json`, {
headers,
})
.then((unreadcount) => {
this.unread = unreadcount.max;
})
Expand All @@ -78,7 +96,7 @@ export default {
},
};
</script>

<style scoped lang="scss">
.notifs {
position: absolute;
Expand All @@ -104,4 +122,4 @@ export default {
}
}
}
</style>
</style>
24 changes: 14 additions & 10 deletions src/components/services/Generic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,21 @@
<slot name="content">
<p class="title">{{ item.name }}</p>
<p v-if="item.quick" class="quicklinks">
<a
v-for="(link, linkIndex) in item.quick"
:key="linkIndex"
:style="`background-color:${link.color};`"
:href="link.url"
:target="link.target"
<a
v-for="(link, linkIndex) in item.quick"
:key="linkIndex"
:style="`background-color:${link.color};`"
:href="link.url"
:target="link.target"
rel="noreferrer"
>
<span v-if="item.icon"><i style="font-size: 12px" :class="['fa-fw', link.icon]"></i></span>
{{ link.name }}
>
<span v-if="item.icon"
><i
style="font-size: 12px"
:class="['fa-fw', link.icon]"
></i
></span>
{{ link.name }}
</a>
</p>
<p v-if="item.subtitle" class="subtitle">
Expand Down Expand Up @@ -92,5 +97,4 @@ a[href=""] {
pointer-events: all;
}
}
</style>
14 changes: 7 additions & 7 deletions src/components/services/Glances.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
<p class="subtitle is-6">
<template v-for="(statItem, index) in item.stats" :key="statItem">
<span v-if="stats[statItem]" :title="stats[statItem].label">
<i :class="stats[statItem].icon"></i> {{ stats[statItem].value }} {{ stats[statItem].unit }}
<span v-if="index != item.stats.length-1"> / </span>
<i :class="stats[statItem].icon"></i> {{ stats[statItem].value }}
{{ stats[statItem].unit }}
<span v-if="index != item.stats.length - 1"> / </span>
</span>
</template>
</p>
Expand All @@ -18,7 +19,6 @@
import service from "@/mixins/service.js";
import Generic from "./Generic.vue";
export default {
name: "Glances",
components: {
Expand Down Expand Up @@ -48,25 +48,25 @@ export default {
label: "System load",
icon: "fa-solid fa-bolt",
unit: "%",
}
};
this.stats["cpu"] = {
value: response.cpu,
label: `CPU usage (${response.cpu_name})`,
icon: "fa-solid fa-microchip",
unit: "%",
}
};
this.stats["mem"] = {
value: response.mem,
label: `RAM usage`,
icon: "fa-solid fa-memory",
unit: "%",
}
};
this.stats["swap"] = {
value: response.swap,
label: `Swap usage`,
icon: "fa-solid fa-file-arrow-down",
unit: "%",
}
};
})
.catch((e) => {
console.log(e);
Expand Down
8 changes: 4 additions & 4 deletions src/components/services/Gotify.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
item: Object,
},
data: () => ({
health: {},
health: {},
messages: 0,
}),
computed: {
Expand All @@ -45,7 +45,7 @@ export default {
}
return "green";
}
},
},
created() {
this.fetchStatus();
Expand All @@ -55,15 +55,15 @@ export default {
fetchStatus: async function () {
await this.fetch(`/health`)
.catch((e) => console.log(e))
.then((resp) => this.health = resp);
.then((resp) => (this.health = resp));
},
fetchMessages: async function () {
const headers = {
"X-Gotify-Key": this.item.apikey,
};
await this.fetch(`/message?limit=100`, { headers })
.catch((e) => console.log(e))
.then((resp) => this.messages = resp.messages.length);
.then((resp) => (this.messages = resp.messages.length));
},
},
};
Expand Down
8 changes: 4 additions & 4 deletions src/components/services/Mealie.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default {
return `Happily keeping ${this.stats.totalRecipes} recipes organized`;
}
return null;
}
},
},
created() {
this.fetchStatus();
Expand All @@ -60,9 +60,9 @@ export default {
if (this.item.subtitle != null) return;
this.meal = await this.fetch("/api/groups/mealplans/today", { headers }).catch(
(e) => console.log(e),
);
this.meal = await this.fetch("/api/groups/mealplans/today", {
headers,
}).catch((e) => console.log(e));
this.stats = await this.fetch("/api/admin/about/statistics", {
headers,
}).catch((e) => console.log(e));
Expand Down
4 changes: 1 addition & 3 deletions src/components/services/Nextcloud.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
<template #content>
<p class="title is-4">{{ item.name }}</p>
<p class="subtitle is-6">
<template v-if="versionstring">
Version {{ versionstring }}
</template>
<template v-if="versionstring"> Version {{ versionstring }} </template>
</p>
</template>
<template #indicator>
Expand Down
10 changes: 5 additions & 5 deletions src/components/services/OctoPrint.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
:value="completion"
max="100"
:title="`${state} - ${completion.toFixed()}%, ${formatTime(
printTimeLeft
printTimeLeft,
)} left`"
>
{{ completion }}%
Expand Down Expand Up @@ -123,9 +123,9 @@ export default {
const minutes = Math.floor(remainingSeconds / 60);
const secs = remainingSeconds % 60;
const formattedHrs = hours.toString().padStart(2, '0')
const formattedMins = minutes.toString().padStart(2, '0')
const formattedSecs = secs.toString().padStart(2, '0')
const formattedHrs = hours.toString().padStart(2, "0");
const formattedMins = minutes.toString().padStart(2, "0");
const formattedSecs = secs.toString().padStart(2, "0");
if (days > 0) {
return `${days}d ${formattedHrs}h ${formattedMins}m`;
Expand All @@ -136,7 +136,7 @@ export default {
} else {
return `${secs} seconds`;
}
}
},
},
};
</script>
Expand Down
10 changes: 4 additions & 6 deletions src/components/services/PeaNUT.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
<template v-if="item.subtitle">
{{ item.subtitle }}
</template>
<template v-else-if="load">
{{ load }}&percnt; UPS Load
</template>
<template v-else-if="load"> {{ load }}&percnt; UPS Load </template>
</p>
</template>
<template #indicator>
Expand Down Expand Up @@ -42,7 +40,7 @@ export default {
case "OL":
return "online";
case "OB":
return "on battery"
return "on battery";
case "LB":
return "low battery";
default:
Expand All @@ -54,7 +52,7 @@ export default {
case "OL":
return "online";
case "OB": // On battery
return "pending"
return "pending";
case "LB": // Low battery
return "offline";
default:
Expand All @@ -73,7 +71,7 @@ export default {
},
methods: {
fetchStatus: async function () {
const device = this.item.device || '';
const device = this.item.device || "";
const result = await this.fetch(`/api/v1/devices/${device}`).catch((e) =>
console.log(e),
Expand Down
Loading

0 comments on commit 474dc3a

Please sign in to comment.