fix: tables

This commit is contained in:
Arman
2025-03-25 16:19:09 +01:00
parent 70b73a5c98
commit fad656d461
11 changed files with 20 additions and 25 deletions
+1 -1
View File
@@ -63,7 +63,7 @@
</Typography.Text>
{/if}
<Table.Root
columns={[{ id: 'resource' }, { id: 'limit' }, { id: 'rate', hide: isFree }]}
columns={[{ id: 'resource' }, { id: 'limit' }, { id: 'rate', show: !isFree }]}
let:root>
<svelte:fragment slot="header" let:root>
<Table.Header.Cell column="resource" {root}>Resource</Table.Header.Cell>
@@ -128,7 +128,7 @@
const columns: Column[] = [
{ id: 'role', width: { min: 100 } },
{ id: 'create', width: { min: 100 }, hide: !withCreate },
{ id: 'create', width: { min: 100 }, show: withCreate },
{ id: 'read', width: { min: 100 } },
{ id: 'update', width: { min: 100 } },
{ id: 'delete', width: { min: 100 } },
+10 -8
View File
@@ -29,7 +29,7 @@
const prefs = preferences.getCustomCollectionColumns($page.params.collection);
columns.set(
$columns.map((column) => {
column.show = prefs?.includes(column.id) ?? false;
column.show = prefs?.includes(column.id) ?? true;
return column;
})
);
@@ -40,7 +40,7 @@
if (prefs?.columns) {
columns.set(
$columns.map((column) => {
column.show = prefs.columns?.includes(column.id) ?? false;
column.show = prefs.columns?.includes(column.id) ?? true;
return column;
})
);
@@ -75,11 +75,13 @@
});
}
$: selectedColumnsNumber = $columns.reduce((acc, column) => {
if (column.show === true) return acc;
$: selectedColumnsNumber = $columns
.filter((c) => !c?.exclude)
.reduce((acc, column) => {
if (column.show === true) return acc;
return ++acc;
}, 0);
return ++acc;
}, 0);
</script>
{#if !hideColumns && view === View.Table}
@@ -95,13 +97,13 @@
<svelte:fragment slot="tooltip">
<ActionMenu.Root>
<Layout.Stack>
{#each $columns as column}
{#each $columns.filter((c) => !c?.exclude) as column}
{#if !column?.exclude}
<InputCheckbox
id={column.id}
label={column.title}
on:change={() => (column.show = !column.show)}
checked={!column.show}
checked={column.show}
disabled={allowNoColumns
? false
: selectedColumnsNumber <= 1 && column.show !== true} />
+1 -1
View File
@@ -78,7 +78,7 @@
{ id: 'name' },
{ id: 'verification' },
{ id: 'certificate' },
{ id: 'action', width: 20, hide: !$canWriteRules }
{ id: 'action', width: 20, show: $canWriteRules }
]}>
<svelte:fragment slot="header" let:root>
<Table.Header.Cell column="name" {root}>Name</Table.Header.Cell>
@@ -83,7 +83,7 @@
{ id: 'email' },
{ id: 'roles' },
{ id: 'mfa' },
{ id: 'actions', hide: !$isOwner, width: 40 }
{ id: 'actions', show: $isOwner, width: 40 }
]}>
<svelte:fragment slot="header" let:root>
<Table.Header.Cell column="name" {root}>Name</Table.Header.Cell>
@@ -107,9 +107,9 @@
<Table.Root
columns={[
{ id: 'project' },
{ id: 'reads', hide: !databaseOperationMetric },
{ id: 'writes', hide: !databaseOperationMetric },
{ id: 'metric', hide: !!databaseOperationMetric },
{ id: 'reads', show: !!databaseOperationMetric },
{ id: 'writes', show: !!databaseOperationMetric },
{ id: 'metric', show: !databaseOperationMetric },
{ id: 'costs' }
]}
let:root>
@@ -82,7 +82,7 @@ export const columns = writable<Column[]>([
id: 'buildSize',
title: 'Build size',
type: 'integer',
hide: true,
show: false,
filter: false,
width: 80
},
@@ -163,7 +163,7 @@
let:root
columns={[
{ id: 'target' },
{ id: 'identifier', hide: !recipientsAvailable },
{ id: 'identifier', show: recipientsAvailable },
{ id: 'actions', width: 40 }
]}>
<svelte:fragment slot="header" let:root>
@@ -22,7 +22,6 @@
import { Badge, Layout, Logs, Typography } from '@appwrite.io/pink-svelte';
import LogsTimer from './logsTimer.svelte';
export let site: Models.Site;
export let deployment: Models.Deployment;
export let hideTitle = false;
export let hideScrollButtons = false;
@@ -59,7 +59,6 @@
<Fieldset legend="Deploy">
<Logs
bind:deployment={data.deployment}
bind:site={data.site}
hideScrollButtons
height="calc(100dvh - 430px)"
emptyCopy="No logs available yet..." />
@@ -74,12 +74,7 @@
open
badgeType={badgeTypeDeployment(data.deployment.status)}
hideDivider>
<Logs
site={data.site}
deployment={data.deployment}
hideTitle
hideScrollButtons
fullHeight />
<Logs deployment={data.deployment} hideTitle hideScrollButtons fullHeight />
<svelte:fragment slot="end">
<LogsTimer status={data.deployment.status} deployment={data.deployment} />
</svelte:fragment>