1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-04-19 08:51:03 +00:00

65 lines
1.3 KiB
Svelte
Raw Normal View History

2023-06-07 21:52:43 +02:00
<script>
import BlankState from '$components/blankstate.svelte';
import TabBar from '$components/tabbar.svelte';
import { EventsOn } from '$wails/runtime/runtime';
import Status from './status.svelte';
import SystemInfo from './systeminfo.svelte';
export let host;
export let hostKey;
2023-06-26 21:05:05 +02:00
export let tab = 'status';
2023-06-07 21:52:43 +02:00
$: if (host) {
host.hostKey = hostKey;
}
2023-06-11 09:34:00 +02:00
$: if (hostKey) {
2023-06-07 21:52:43 +02:00
tab = 'status';
}
EventsOn('OpenStatusTab', name => (tab = name || tab));
</script>
<div class="view" class:empty={!host}>
{#if host}
{#key host}
<TabBar tabs={[
{ key: 'status', icon: 'chart', title: 'Host status' },
2023-06-11 09:34:00 +02:00
{ key: 'systemInfo', icon: 'server', title: 'System info' },
]}
bind:selectedKey={tab} />
2023-06-07 21:52:43 +02:00
<div class="container">
{#if tab === 'status'} <Status {host} />
{:else if tab === 'systemInfo'} <SystemInfo {host} />
{/if}
</div>
{/key}
{:else}
<BlankState label="Select a host to continue" />
{/if}
</div>
<style>
.view {
height: 100%;
display: grid;
grid-template: auto 1fr / 1fr;
}
.view.empty {
grid-template: 1fr / 1fr;
}
.container {
padding: 0.5rem;
display: flex;
align-items: stretch;
overflow: auto;
min-height: 0;
min-width: 0;
}
.container > :global(*) {
width: 100%;
}
</style>