Enhancement: use duration for audiobookshelf tottal, refactor uptime (#4229)

This commit is contained in:
shamoon 2024-10-31 22:09:23 -07:00 committed by GitHub
parent 3736c1fcab
commit e6cf86ed4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 20 additions and 23 deletions

View file

@ -25,7 +25,7 @@ export default function Uptime({ refresh = 1500 }) {
return (
<Resource
icon={FaRegClock}
value={t("common.uptime", { value: data.uptime })}
value={t("common.duration", { value: data.uptime })}
label={t("resources.uptime")}
percentage={percent}
/>

View file

@ -39,11 +39,8 @@ export default function Component({ service }) {
<Block label="audiobookshelf.podcasts" value={t("common.number", { value: totalPodcasts })} />
<Block
label="audiobookshelf.podcastsDuration"
value={t("common.number", {
value: totalPodcastsDuration / 60,
maximumFractionDigits: 0,
style: "unit",
unit: "minute",
value={t("common.duration", {
value: totalPodcastsDuration,
})}
/>
<Block label="audiobookshelf.books" value={t("common.number", { value: totalBooks })} />

View file

@ -40,7 +40,7 @@ export default function Component({ service }) {
/>
<Block
label="frigate.uptime"
value={t("common.uptime", {
value={t("common.duration", {
value: data.uptime,
})}
/>

View file

@ -44,7 +44,7 @@ export default function Component({ service }) {
return (
<Container service={service}>
<Block label="fritzbox.connectionStatus" value={t(`fritzbox.connectionStatus${fritzboxData.connectionStatus}`)} />
<Block label="fritzbox.uptime" value={t("common.uptime", { value: fritzboxData.uptime })} />
<Block label="fritzbox.uptime" value={t("common.duration", { value: fritzboxData.uptime })} />
<Block label="fritzbox.maxDown" value={t("common.byterate", { value: fritzboxData.maxDown / 8, decimals: 1 })} />
<Block label="fritzbox.maxUp" value={t("common.byterate", { value: fritzboxData.maxUp / 8, decimals: 1 })} />
<Block label="fritzbox.down" value={t("common.byterate", { value: fritzboxData.down, decimals: 1 })} />

View file

@ -20,7 +20,7 @@ export default function Component({ service }) {
return (
<Container service={service}>
<Block label="openwrt.uptime" value={t("common.uptime", { value: uptime })} />
<Block label="openwrt.uptime" value={t("common.duration", { value: uptime })} />
<Block label="openwrt.cpuLoad" value={cpuLoad} />
</Container>
);

View file

@ -46,12 +46,12 @@ export default function Component({ service }) {
<Block label="stash.scenes" value={t("common.number", { value: stats.scene_count })} />
<Block label="stash.scenesPlayed" value={t("common.number", { value: stats.scenes_played })} />
<Block label="stash.playCount" value={t("common.number", { value: stats.total_play_count })} />
<Block label="stash.playDuration" value={t("common.uptime", { value: stats.total_play_duration })} />
<Block label="stash.playDuration" value={t("common.duration", { value: stats.total_play_duration })} />
<Block
label="stash.sceneSize"
value={t("common.bbytes", { value: stats.scenes_size, maximumFractionDigits: 1 })}
/>
<Block label="stash.sceneDuration" value={t("common.uptime", { value: stats.scenes_duration })} />
<Block label="stash.sceneDuration" value={t("common.duration", { value: stats.scenes_duration })} />
<Block label="stash.images" value={t("common.number", { value: stats.image_count })} />
<Block

View file

@ -35,7 +35,7 @@ export default function Component({ service }) {
<>
<Container service={service}>
<Block label="truenas.load" value={t("common.number", { value: statusData.loadavg[0] })} />
<Block label="truenas.uptime" value={t("common.uptime", { value: statusData.uptime_seconds })} />
<Block label="truenas.uptime" value={t("common.duration", { value: statusData.uptime_seconds })} />
<Block label="truenas.alerts" value={t("common.number", { value: alertData.pending })} />
</Container>
{enablePools &&

View file

@ -58,7 +58,7 @@ export default function Component({ service }) {
break;
case 2:
status = t("uptimerobot.up");
uptime = t("common.uptime", { value: monitor.logs[0].duration });
uptime = t("common.duration", { value: monitor.logs[0].duration });
logIndex = 1;
break;
case 8:
@ -73,7 +73,7 @@ export default function Component({ service }) {
}
const lastDown = new Date(monitor.logs[logIndex].datetime * 1000).toLocaleString();
const downDuration = t("common.uptime", { value: monitor.logs[logIndex].duration });
const downDuration = t("common.duration", { value: monitor.logs[logIndex].duration });
const hideDown = logIndex === 1 && monitor.logs[logIndex].type !== 1;
return (