This commit is contained in:
Fred Boniface 2023-07-30 21:56:10 +01:00
parent 1dd8f95607
commit 9d931d1835
8 changed files with 20 additions and 101 deletions

View File

@ -1,28 +1,23 @@
<script lang="ts">
import type { ServiceDetail } from "$lib/types/serviceDetail";
import IndicatorDot from "./indicatorDot.svelte";
import { detailMap } from "$lib/scripts/serviceMap";
import type { ServiceData } from "$lib/types/serviceData";
export let detail: ServiceDetail
export let detail: string
if (detail.boxContent.img === "auto") {
detail.boxContent.img = `/img/box/${detail.boxContent.name.toLowerCase()}.svg`
}
const service: ServiceData = detailMap.get(detail)
</script>
<a href="{detail.boxContent.link}">
<a href="{service.url}">
<div class="box">
<img class="logo" src="{detail.boxContent.img}" alt="">
<img class="logo" src="/img/box/{service.imgPath}" alt="">
<header>
{detail.boxContent.name.toUpperCase()}
<span class="status">
<IndicatorDot status={detail.statusMessage} />
</span>
{service.formattedName}
</header>
<div class="tooltip">
<p class="tooltipDesc">{detail.description}</p>
<p>Login with: {detail.loginMethod}</p>
<p>Current status: {detail.statusMessage || "Unknown"}</p>
<p class="tooltipDesc">{service.description}</p>
<p>Login with: {service.loginMethod}</p>
<!--<p>Current status: {detail.statusMessage || "Unknown"}</p>-->
</div>
</div>
</a>

View File

@ -1,38 +0,0 @@
import type { ServiceDetail } from "$lib/types/serviceDetail"
export const defaultVal: ServiceDetail = {description: "Unknown", loginMethod: "Unknown"}
export const detailMap = new Map <string, ServiceDetail>([
["nextcloud", {
description: "Personal Cloud, Organisation and workspace",
loginMethod: "FJLA.net Credentials"
}],
["gitea", {
description: "Git repositories & development tools",
loginMethod: "FJLA.net Credentials"
}],
["jellyfin", {
description: "Music, Film and TV Services",
loginMethod: "FJLA.net Credentials"
}],
["home assistant", {
description: "Smart & Connected Home",
loginMethod: "Home Assistant Credentials"
}],
["traccar", {
description: "Device and Person Tracking",
loginMethod: "Traccar Credentials"
}],
["owlboard", {
description: "Live train service data",
loginMethod: "No login required"
}],
["webmail", {
description: "Mail services for FJLA.net, FJLA.uk, OwlBoard.info & fb-infra.uk",
loginMethod: "Email Credentials"
}],
["account", {
description: "FJLA.net account settings",
loginMethod: "FJLA.net Credentials"
}]
])

View File

@ -5,13 +5,15 @@ export const detailMap = new Map <string, ServiceData>([
url: "https://cloud.fjla.uk",
checkString: "Login -",
description: "Personal cloud, organiser and workspace",
imgPath: "nextcloud.svg"
imgPath: "nextcloud.svg",
loginMethod: "FJLA.net Credentials"
}],
["gitea", {
formattedName: "Gitea",
url: "https://git.fjla.uk",
checkString: "--??--",
description: "Git Repository & Development tools",
imgPath: ""
imgPath: "",
loginMethod: "FJLA.net Credentials"
}]
])

View File

@ -1,5 +0,0 @@
export interface BoxContent {
name: string,
link: string,
img : string,
}

View File

@ -4,4 +4,5 @@ export interface ServiceData {
checkString: string,
imgPath: string,
description: string,
loginMethod: string
}

View File

@ -1,8 +0,0 @@
import type { BoxContent } from "./boxContent";
export interface ServiceDetail {
boxContent?: BoxContent,
description: string,
loginMethod: string,
statusMessage?: string,
}

View File

@ -1,26 +0,0 @@
import type { BoxContent } from "$lib/types/boxContent";
import type { ServiceDetail } from "$lib/types/serviceDetail";
import { check } from "$lib/scripts/statusChecks";
import { detailMap, defaultVal } from "$lib/scripts/serviceDetailMap";
const boxes: BoxContent[] = [
{name: "nextcloud", link: "https://cloud.fjla.uk", img: "auto"},
{name: "home assistant", link: "https://ha.fjla.uk", img: "auto"},
{name: "jellyfin", link: "https://jf.fjla.uk", img: "auto"},
{name: "traccar", link:"https://traccar.fjla.uk", img: "auto"},
{name: "owlboard", link:"https://owlboard.info", img:"auto"},
{name: "webmail", link:"https://mx0123.fb-infra.uk/mail", img: "auto"},
{name: "account", link:"https://ipa0922.fjla.net", img:"auto"}
]
export async function load() {
const data: ServiceDetail[] = []
for (const item of boxes) {
const svcDetail = detailMap.get(item.name.toLowerCase()) || defaultVal
svcDetail.statusMessage = await check(item.name.toLowerCase())
svcDetail.boxContent = item
data.push(svcDetail)
}
return {data: data}
}

View File

@ -1,18 +1,16 @@
<script lang="ts">
import ItemBox from "$lib/components/itemBox.svelte";
import type { ServiceDetail } from "$lib/types/serviceDetail";
interface dataObj {
data: ServiceDetail[]
}
export let data: dataObj
const homeLinks: string[] = [
"nextcloud",
"gitea"
]
</script>
<header>FJLA Gateway</header>
<div id="boxContainer">
{#each data.data as detail}
{#each homeLinks as detail}
<ItemBox {detail} />
{/each}
</div>