Added href check to services page since href is now optional

This commit is contained in:
Neshura 2023-03-16 22:19:33 +01:00
parent 691a0ed881
commit f6258df5a2
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C

View file

@ -4,7 +4,7 @@ import { ReactElement } from 'react'
import useSWR from 'swr'; import useSWR from 'swr';
import ServiceList from '../public/data/pages.json'; import ServiceList from '../public/data/pages.json';
import { DockerInfo } from '../interfaces/DockerStatus'; import { DockerInfo } from '../interfaces/DockerStatus';
import { CardContentService, PageContentBox, PageDescription, PageTitle } from '../components/styles/content'; import { PageContentBox, PageDescription, PageTitle } from '../components/styles/content';
import useWindowSize from '../components/windowsize'; import useWindowSize from '../components/windowsize';
import { ServiceCardMobile } from '../components/styles/cards/mobile'; import { ServiceCardMobile } from '../components/styles/cards/mobile';
import { ServiceCardDesktop } from '../components/styles/cards/desktop'; import { ServiceCardDesktop } from '../components/styles/cards/desktop';
@ -85,7 +85,7 @@ async function getStatus(entry: Service, containers: DockerInfo[]) {
// Others to follow but low prio as this is currently the only location used // Others to follow but low prio as this is currently the only location used
// Type APP // Type APP
if (entry.type === ServiceType.app) { if (entry.type === ServiceType.app && entry.href) {
await fetch(entry.href) await fetch(entry.href)
.then((response) => { .then((response) => {
if (response.ok) { if (response.ok) {
@ -126,10 +126,10 @@ async function getStatus(entry: Service, containers: DockerInfo[]) {
default: default:
console.log("Container Status " + container.status + " has no case implemented"); console.log("Container Status " + container.status + " has no case implemented");
entry.status = Status.offline; entry.status = Status.offline;
} }
found = true; found = true;
// cancel the for // cancel the for
break; break;
} }
} }
// If container name is not missing the container is set to offline // If container name is not missing the container is set to offline