Add bus and ferry to staffLDB

This commit is contained in:
Fred Boniface
2023-07-08 21:54:33 +01:00
parent b6dca2df78
commit 13d3bc4dbe
13 changed files with 404 additions and 128 deletions

View File

@@ -4,6 +4,8 @@
import InputIsland from '$lib/islands/input-island-form.svelte';
import QuickLinkIsland from '$lib/islands/quick-link-island.svelte';
import Welcome from '$lib/overlays/welcome.svelte';
import { welcome } from '$lib/stores/welcome';
import { version, showWelcome } from '$lib/stores/version';
const title = 'OwlBoard';
const inputIslands = [
@@ -20,11 +22,9 @@
queryName: 'headcode'
}
];
const isWelcomed = 'false'; // Usually a bool - <Welcome /> is incomplete so should be hidden for now.
</script>
{#if !isWelcomed}
{#if showWelcome && ($welcome === 'null' || !$welcome || parseInt($welcome.replace(/\./g, '')) < parseInt(version.replace(/\./g, '')))}
<Welcome />
{/if}
<Header {title} />

View File

@@ -9,13 +9,13 @@
<Header {title} />
<LargeLogo />
<p class="neg">&copy; 2022-2023 Frederick Boniface</p>
<p>OwlBoard was created by train-crew for train-crew</p>
<p>I created OwlBoard in 2022 to freely give fast and easy access to the information that we need every day.</p>
<p>Data sourced from: National Rail Enquiries, OwlBoard Project and Network Rail.</p>
<p>OwlBoard was created by train crew for train crew.</p>
<p>I developed OwlBoard in 2022 with the aim of providing fast and easy access to the information we need on a daily basis.</p>
<p>Data is sourced from National Rail Enquiries, the OwlBoard Project, and Network Rail.</p>
<p>
OwlBoard components are available under various Open Source licenses, see the
OwlBoard components are available under various Open Source licenses. Please refer to the
<a href="https://git.fjla.uk/OwlBoard" target="_blank">code repository</a>
for more information.
for more detailed information.
</p>
<Nav />

View File

@@ -59,7 +59,7 @@
<ul>
<li>Non-Passenger movements</li>
<li>Hidden platform numbers</li>
<li>Display up to 40 services</li>
<li>Display up to 25 services</li>
</ul>
</ul>
<p>To register, you will need to enter a work email address to receive a confirmation email</p>

View File

@@ -140,8 +140,8 @@
font-size: 16px;
border: none;
width: 50%;
max-width: 250px;
min-width: 100px;
max-width: 450px;
min-width: 250px;
}
input {
text-align: center;

View File

@@ -3,22 +3,13 @@
import Header from '$lib/navigation/header.svelte';
import Loading from '$lib/navigation/loading.svelte';
import Nav from '$lib/navigation/nav.svelte';
import { onMount } from 'svelte';
const title = 'Statistics';
let isLoading = true;
let data, error;
onMount(async () => {
async function getData() {
const url = 'https://owlboard.info/misc/server/stats';
const res = await fetch(url);
if (res.status == 200) {
data = await res.json();
} else {
error = true;
}
isLoading = false;
});
return await res.json();
}
function U2L(input) {
try {
@@ -33,15 +24,9 @@
<Header {title} />
{#if error}
<Island>
<p>Unable to connect to server</p>
</Island>
{/if}
{#if isLoading}
{#await getData()}
<Loading />
{:else if !isLoading && !error}
{:then data}
<p>API Server:<br /><span>{data?.hostname}</span></p>
<p>Runtime Mode: <span>{data?.runtimeMode}</span></p>
<p>Stats Reset: <span>{U2L(data?.reset) || 'Unknown'}</span></p>
@@ -68,7 +53,11 @@
<p>PIS: <span>{data?.dbLengths?.pis}</span></p>
<p>Timetable: <span>{data?.dbLengths?.timetable}</span></p>
<p>Reason Codes: <span>{data?.dbLengths?.reasonCodes}</span></p>
{/if}
{:catch}
<Island>
<p style="font-weight:600">Unable to connect to server</p>
</Island>
{/await}
<Nav />

View File

@@ -4,40 +4,39 @@
import Loading from '$lib/navigation/loading.svelte';
import Nav from '$lib/navigation/nav.svelte';
import LargeLogo from '$lib/images/large-logo.svelte';
import { onMount } from 'svelte';
import { version, versionTag } from '$lib/stores/version.js';
const title = 'Versions';
const variable = { title: '' };
let data,
isLoading = true;
async function getData() {
const url = 'https://owlboard.info/misc/server/versions';
const res = await fetch(url);
data = await res.json();
isLoading = false;
return await res.json();
}
onMount(() => {
getData();
});
</script>
<Header {title} />
<LargeLogo />
{#if isLoading}
{#await getData()}
<Loading />
{:else}
{:then data}
<Island>
<p>
Web-app Version<br /><span class="data">{'2023.7.1-Svelte-Dev'}</span>
Web-app Version<br /><span class="data">{version}-{versionTag}</span>
</p>
<p>API Server Version<br /><span class="data">{data.backend}</span></p>
<p>DBManager Version<br /><span class="data">{data['db-manager']}</span></p>
</Island>
{/if}
{:catch}
<Island>
<p>
Web-app Version<br /><span class="data">{version}-{versionTag}</span>
</p>
<p>Unable to fetch server versions</p>
</Island>
{/await}
<Nav />
<style>

View File

@@ -51,7 +51,12 @@
}
};
const url = `https://owlboard.info/api/v2/timetable/train/${date}/${searchType}/${id}`;
const res = await fetch(url, options);
try {
const res = await fetch(url, options);
} catch (err) {
error = true;
errMsg = 'Connection error, try again later';
}
isLoading = false;
if (res.status == 200) {
return await res.json();
@@ -72,7 +77,7 @@
{#if error}
<Island>
<p class="error">{errMsg}</p>
<p style="font-weight:600">{errMsg}</p>
</Island>
{/if}