diff --git a/tfweb/src/lib/i18n/locales/en.json b/tfweb/src/lib/i18n/locales/en.json index 15ec33c..949fabb 100644 --- a/tfweb/src/lib/i18n/locales/en.json +++ b/tfweb/src/lib/i18n/locales/en.json @@ -83,6 +83,13 @@ "api": "Unable to contact the server. Try again later." } }, + "hosts": { + "name": "Name", + "role": "Role", + "lastseen": "Last Seen", + "actions": "Actions", + "ipaddr": "IP Address" + }, "roles": { "create": "Add", "explain": "Roles control how hosts, lighthouses, and relays communicate through firewall rules.", diff --git a/tfweb/src/routes/hosts/+page.svelte b/tfweb/src/routes/hosts/+page.svelte index 60c2949..5192584 100644 --- a/tfweb/src/routes/hosts/+page.svelte +++ b/tfweb/src/routes/hosts/+page.svelte @@ -6,7 +6,8 @@ import {Logger, logSetup} from "$lib/logger"; import type {APIError} from "$lib/auth.ts"; import {PUBLIC_BASE_URL} from "$env/static/public"; - import {Configuration, NetworksApi} from "$lib/api"; + import {Configuration, HostsApi, NetworksApi, RolesApi} from "$lib/api"; + import type {Host} from "$lib/api/models/Host.ts"; import AdminLayout from "$components/AdminLayout.svelte"; let loading = true; @@ -14,6 +15,8 @@ let error = ''; $: currentlyLoading = $isLoading || loading; + let hosts: Host[] = []; + logSetup(); let logger = new Logger("hosts/+page.svelte"); @@ -63,6 +66,14 @@ return; } + const hostsApi = new HostsApi(configuration); + hosts = (await hostsApi.hostsList({ + filterIsLighthouse: false, + filterIsRelay: false + })).data!; + + console.log(hosts); + loading = false; }) @@ -74,5 +85,32 @@

{$t("common.page.hosts")}

+ + + + + + + + + + + + + {#each hosts as host} + {#if !(host.isLighthouse || host.isRelay)} + + + + + + + + {/if} + {/each} + +
{$t("hosts.name")}{$t("hosts.lastseen")}{$t("hosts.ipaddr")}{$t("hosts.role")}{$t("hosts.actions")}
{host.name}{host.metadata?.lastSeenAt}{host.ipAddress}{host.roleID} + +