chore(lint): apply config update

pull/878/head
Bastien Wirtz 2025-02-22 19:52:51 +01:00
parent 1cc724c800
commit 474dc3ae8c
16 changed files with 113 additions and 81 deletions

View File

@ -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>

View File

@ -18,7 +18,7 @@ export default {
props: {
defaultValue: String,
},
emits: ['updated'],
emits: ["updated"],
data: function () {
return {
isDark: null,

View File

@ -73,7 +73,7 @@ export default {
return;
}
return response.json();
}
},
);
},

View File

@ -52,7 +52,7 @@ export default {
},
links: Array,
},
emits: ['navbar-toggle'],
emits: ["navbar-toggle"],
computed: {
showMenu: function () {
return this.open && this.isSmallScreen();

View File

@ -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";
@ -45,20 +52,29 @@ 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;
})
@ -66,7 +82,9 @@ export default {
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;
})
@ -78,7 +96,7 @@ export default {
},
};
</script>
<style scoped lang="scss">
.notifs {
position: absolute;
@ -104,4 +122,4 @@ export default {
}
}
}
</style>
</style>

View File

@ -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">
@ -92,5 +97,4 @@ a[href=""] {
pointer-events: all;
}
}
</style>

View File

@ -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>
@ -18,7 +19,6 @@
import service from "@/mixins/service.js";
import Generic from "./Generic.vue";
export default {
name: "Glances",
components: {
@ -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);

View File

@ -31,7 +31,7 @@ export default {
item: Object,
},
data: () => ({
health: {},
health: {},
messages: 0,
}),
computed: {
@ -45,7 +45,7 @@ export default {
}
return "green";
}
},
},
created() {
this.fetchStatus();
@ -55,7 +55,7 @@ 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 = {
@ -63,7 +63,7 @@ export default {
};
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));
},
},
};

View File

@ -46,7 +46,7 @@ export default {
return `Happily keeping ${this.stats.totalRecipes} recipes organized`;
}
return null;
}
},
},
created() {
this.fetchStatus();
@ -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));

View File

@ -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>

View File

@ -34,7 +34,7 @@
:value="completion"
max="100"
:title="`${state} - ${completion.toFixed()}%, ${formatTime(
printTimeLeft
printTimeLeft,
)} left`"
>
{{ completion }}%
@ -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`;
@ -136,7 +136,7 @@ export default {
} else {
return `${secs} seconds`;
}
}
},
},
};
</script>

View File

@ -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>
@ -42,7 +40,7 @@ export default {
case "OL":
return "online";
case "OB":
return "on battery"
return "on battery";
case "LB":
return "low battery";
default:
@ -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:
@ -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),

View File

@ -8,12 +8,12 @@
<template #content>
<p class="title is-4">{{ item.name }}</p>
<p class="subtitle is-6">
<template v-if="item.subtitle">
<template v-if="item.subtitle">
{{ item.subtitle }}
</template>
<template v-else>
{{ rttLabel }}
</template>
</template>
<template v-else>
{{ rttLabel }}
</template>
</p>
</template>
</Generic>
@ -38,11 +38,11 @@ export default {
}),
computed: {
rttLabel: function () {
if (this.status === 'online') {
if (this.status === "online") {
return `${this.rtt}ms`;
}
return "unavailable";
}
},
},
created() {
const updateInterval = parseInt(this.item.updateInterval, 10) || 0;
@ -66,10 +66,10 @@ export default {
const startTime = performance.now();
const timeout = parseInt(this.item.timeout, 10) || 2000;
const params = {
method,
cache: "no-cache",
signal: AbortSignal.timeout(timeout)
const params = {
method,
cache: "no-cache",
signal: AbortSignal.timeout(timeout),
};
this.fetch("/", params, false)
@ -117,4 +117,3 @@ export default {
}
}
</style>

View File

@ -106,14 +106,17 @@ export default {
})
.catch(handleError);
if (!this.item.legacyApi) {
this.fetch(`${this.apiPath}/wanted/missing?pageSize=1&apikey=${this.item.apikey}`)
this.fetch(
`${this.apiPath}/wanted/missing?pageSize=1&apikey=${this.item.apikey}`,
)
.then((overview) => {
this.fetch(`${this.apiPath}/wanted/missing?pageSize=${overview.totalRecords}&apikey=${this.item.apikey}`)
.then((movies) => {
this.missing = movies.records.filter(
(m) => m.monitored && m.isAvailable && !m.hasFile
).length;
})
this.fetch(
`${this.apiPath}/wanted/missing?pageSize=${overview.totalRecords}&apikey=${this.item.apikey}`,
).then((movies) => {
this.missing = movies.records.filter(
(m) => m.monitored && m.isAvailable && !m.hasFile,
).length;
});
})
.catch(handleError);
}

View File

@ -55,8 +55,15 @@ export default {
this.fetch(`/api/summary`)
.then((scrutinyData) => {
const devices = Object.values(scrutinyData.data.summary);
this.passed = devices.filter(device => device.device.device_status === 0)?.length || 0;
this.failed = devices.filter(device => device.device.device_status > 0 && device.device.device_status <= 3)?.length || 0;
this.passed =
devices.filter((device) => device.device.device_status === 0)
?.length || 0;
this.failed =
devices.filter(
(device) =>
device.device.device_status > 0 &&
device.device.device_status <= 3,
)?.length || 0;
this.unknown = devices.length - (this.passed + this.failed) || 0;
})
.catch((e) => {

View File

@ -53,7 +53,9 @@ export default {
}
if (!success) {
throw new Error(`Ping: target not available (${response.status} error)`);
throw new Error(
`Ping: target not available (${response.status} error)`,
);
}
return json ? response.json() : response.text();