2023-06-07 21:30:22 +02:00
|
|
|
<script>
|
|
|
|
import BlankState from '$components/blankstate.svelte';
|
|
|
|
import TabBar from '$components/tabbar.svelte';
|
|
|
|
import { EventsOn } from '$wails/runtime/runtime';
|
2023-07-01 21:34:32 +02:00
|
|
|
|
|
|
|
import Shell from '../shell.svelte';
|
2023-06-07 21:30:22 +02:00
|
|
|
import Stats from './stats.svelte';
|
|
|
|
|
|
|
|
export let database;
|
|
|
|
export let hostKey;
|
|
|
|
export let dbKey;
|
2023-06-26 21:05:05 +02:00
|
|
|
export let tab = 'stats';
|
2023-06-07 21:30:22 +02:00
|
|
|
|
|
|
|
$: if (database) {
|
|
|
|
database.hostKey = hostKey;
|
|
|
|
database.dbKey = dbKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
$: if (hostKey || dbKey) {
|
|
|
|
tab = 'stats';
|
|
|
|
}
|
|
|
|
|
|
|
|
EventsOn('OpenStatsTab', name => (tab = name || tab));
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="view" class:empty={!database}>
|
|
|
|
{#if database}
|
|
|
|
{#key database}
|
2023-07-01 21:34:32 +02:00
|
|
|
<TabBar
|
|
|
|
tabs={[
|
|
|
|
{ key: 'stats', icon: 'chart', title: 'Database stats' },
|
|
|
|
{ key: 'shell', icon: 'shell', title: 'Shell' },
|
|
|
|
]}
|
|
|
|
bind:selectedKey={tab} />
|
2023-06-07 21:30:22 +02:00
|
|
|
<div class="container">
|
|
|
|
{#if tab === 'stats'} <Stats {database} />
|
2023-07-01 21:34:32 +02:00
|
|
|
{:else if tab === 'shell'} <Shell {database} />
|
2023-06-07 21:30:22 +02:00
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
{/key}
|
|
|
|
{:else}
|
|
|
|
<BlankState label="Select a database 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>
|