mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-03 22:20:56 +00:00
refactor(web): improve resource page layout
This commit is contained in:
1 parent
d97f11ac7b
commit
3c199c2217
2 files changed
+56
-48
No files matched your search
@@ -3,7 +3,7 @@
|
|||||||
import { createTable, Render, Subscribe } from 'svelte-headless-table';
|
import { createTable, Render, Subscribe } from 'svelte-headless-table';
|
||||||
import { addSortBy } from 'svelte-headless-table/plugins';
|
import { addSortBy } from 'svelte-headless-table/plugins';
|
||||||
import { readable } from 'svelte/store';
|
import { readable } from 'svelte/store';
|
||||||
|
|
||||||
const data = readable([
|
const data = readable([
|
||||||
{
|
{
|
||||||
query: 'SELECT * FROM users WHERE ID = 1',
|
query: 'SELECT * FROM users WHERE ID = 1',
|
||||||
@@ -44,47 +44,49 @@
|
|||||||
const { headerRows, rows, tableAttrs, tableBodyAttrs } = table.createViewModel(columns);
|
const { headerRows, rows, tableAttrs, tableBodyAttrs } = table.createViewModel(columns);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<table {...$tableAttrs} class="w-full">
|
<div class="px-4">
|
||||||
<thead class="bg-dark-600">
|
<table {...$tableAttrs} class="w-full">
|
||||||
{#each $headerRows as headerRow (headerRow.id)}
|
<thead class="bg-dark-600">
|
||||||
<Subscribe rowAttrs={headerRow.attrs()} let:rowAttrs>
|
{#each $headerRows as headerRow (headerRow.id)}
|
||||||
<tr {...rowAttrs}>
|
<Subscribe rowAttrs={headerRow.attrs()} let:rowAttrs>
|
||||||
{#each headerRow.cells as cell (cell.id)}
|
<tr {...rowAttrs}>
|
||||||
<Subscribe attrs={cell.attrs()} let:attrs props={cell.props()} let:props>
|
{#each headerRow.cells as cell (cell.id)}
|
||||||
<th {...attrs} on:click={props.sort.toggle} class="p-1 border-b-[1px] border-dark-400">
|
<Subscribe attrs={cell.attrs()} let:attrs props={cell.props()} let:props>
|
||||||
<div class="flex justify-center items-center gap-2 select-none cursor-pointer">
|
<th {...attrs} on:click={props.sort.toggle} class="p-1 border-b-[1px] border-dark-400">
|
||||||
|
<div class="flex justify-center items-center gap-2 select-none cursor-pointer">
|
||||||
|
<Render of={cell.render()} />
|
||||||
|
{#if props.sort.order === 'asc'}
|
||||||
|
<IconChevronDown />
|
||||||
|
{:else if props.sort.order === 'desc'}
|
||||||
|
<IconChevronUp />
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
|
</Subscribe>
|
||||||
|
{/each}
|
||||||
|
</tr>
|
||||||
|
</Subscribe>
|
||||||
|
{/each}
|
||||||
|
</thead>
|
||||||
|
<tbody {...$tableBodyAttrs}>
|
||||||
|
{#each $rows as row (row.id)}
|
||||||
|
<Subscribe rowAttrs={row.attrs()} let:rowAttrs>
|
||||||
|
<tr {...rowAttrs}>
|
||||||
|
{#each row.cells as cell (cell.id)}
|
||||||
|
<Subscribe attrs={cell.attrs()} let:attrs>
|
||||||
|
<td
|
||||||
|
{...attrs}
|
||||||
|
class={`${
|
||||||
|
cell.id === 'time' && 'text-center'
|
||||||
|
} p-2 bg-dark-700 border-b-[0px] border-dark-400 truncate max-w-[200px]`}
|
||||||
|
>
|
||||||
<Render of={cell.render()} />
|
<Render of={cell.render()} />
|
||||||
{#if props.sort.order === 'asc'}
|
</td>
|
||||||
<IconChevronDown />
|
</Subscribe>
|
||||||
{:else if props.sort.order === 'desc'}
|
{/each}
|
||||||
<IconChevronUp />
|
</tr>
|
||||||
{/if}
|
</Subscribe>
|
||||||
</div>
|
{/each}
|
||||||
</th>
|
</tbody>
|
||||||
</Subscribe>
|
</table>
|
||||||
{/each}
|
</div>
|
||||||
</tr>
|
|
||||||
</Subscribe>
|
|
||||||
{/each}
|
|
||||||
</thead>
|
|
||||||
<tbody {...$tableBodyAttrs}>
|
|
||||||
{#each $rows as row (row.id)}
|
|
||||||
<Subscribe rowAttrs={row.attrs()} let:rowAttrs>
|
|
||||||
<tr {...rowAttrs}>
|
|
||||||
{#each row.cells as cell (cell.id)}
|
|
||||||
<Subscribe attrs={cell.attrs()} let:attrs>
|
|
||||||
<td
|
|
||||||
{...attrs}
|
|
||||||
class={`${
|
|
||||||
cell.id === 'time' && 'text-center'
|
|
||||||
} p-2 bg-dark-700 border-b-[1px] border-dark-400 truncate max-w-[200px]`}
|
|
||||||
>
|
|
||||||
<Render of={cell.render()} />
|
|
||||||
</td>
|
|
||||||
</Subscribe>
|
|
||||||
{/each}
|
|
||||||
</tr>
|
|
||||||
</Subscribe>
|
|
||||||
{/each}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
@@ -1,15 +1,21 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { IconChevronLeft } from '@tabler/icons-svelte';
|
import { IconChevronLeft } from '@tabler/icons-svelte';
|
||||||
|
import { meta, router } from 'tinro';
|
||||||
|
|
||||||
import { router } from 'tinro';
|
const data = meta();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="p-4 flex items-center">
|
<div class="p-4 grid grid-flow-col grid-cols-3 items-center ">
|
||||||
<button
|
<button
|
||||||
on:click={() => router.goto('/')}
|
on:click={() => router.goto('/')}
|
||||||
class="flex p-2 bg-dark-600 text-dark-100 hover:text-white rounded-md justify-center items-center hover:bg-dark-500 outline-none border-[1px] border-transparent focus-visible:border-cyan-600"
|
class="flex p-2 w-12 bg-dark-600 text-dark-100 hover:text-white rounded-md justify-center items-center hover:bg-dark-500 outline-none border-[1px] border-transparent focus-visible:border-cyan-600"
|
||||||
>
|
>
|
||||||
<IconChevronLeft />
|
<IconChevronLeft />
|
||||||
Resources
|
|
||||||
</button>
|
</button>
|
||||||
|
<p class="text-center text-lg">{data.params.resource}</p>
|
||||||
|
<div class="text-end text-dark-100 flex flex-col text-xs">
|
||||||
|
<p>Queries: 530</p>
|
||||||
|
<p>Time: 3014 ms</p>
|
||||||
|
<p class="text-yellow-500">Slow queries: 3</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
Reference in new issue
Block a user