Merge branch 'main' into fix-sessions-and-activity-table-layout

This commit is contained in:
Harsh Mahajan
2026-01-02 14:17:53 +05:30
committed by GitHub
12 changed files with 93 additions and 59 deletions
+27 -22
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import { AvatarInitials, PaginationWithLimit, Trim } from '$lib/components';
import { Container } from '$lib/layout';
import { toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import type { Models } from '@appwrite.io/console';
import { Layout, Table, Card, Empty, InteractiveText } from '@appwrite.io/pink-svelte';
import Button from '$lib/elements/forms/button.svelte';
@@ -75,27 +75,32 @@
</div>
<span class="text u-trim">{log.userName ?? 'Anonymous'}</span>
{/if}
</Layout.Stack>
</Table.Cell>
<Table.Cell column="event" {root}>
{log.event}
</Table.Cell>
<Table.Cell column="location" {root}>
{#if log.countryCode !== '--'}
{log.countryName}
{:else}
Unknown
{/if}
</Table.Cell>
<Table.Cell column="ip" {root}>
<InteractiveText variant="copy" text={log.ip} isVisible />
</Table.Cell>
<Table.Cell column="date" {root}>
{toLocaleDateTime(log.time)}
</Table.Cell>
</Table.Row.Base>
{/each}
</Table.Root>
</Layout.Stack>
</Table.Cell>
<Table.Cell column="event" {root}>
{log.event}
</Table.Cell>
<Table.Cell column="location" {root}>
{#if log.countryCode !== '--'}
{log.countryName}
{:else}
Unknown
{/if}
</Table.Cell>
<Table.Cell column="ip" {root}>
<InteractiveText variant="copy" text={log.ip} isVisible />
</Table.Cell>
<Table.Cell column="date" {root}>
<DualTimeView time={log.time} showDatetime />
</Table.Cell>
</Table.Row.Base>
{/each}
</Table.Root>
</div>
<PaginationWithLimit
{limit}
@@ -5,7 +5,6 @@
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { identities } from './store';
import { toLocaleDateTime } from '$lib/helpers/date';
import { invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
import { oAuthProviders } from '$lib/stores/oauth-providers';
@@ -82,7 +81,13 @@
<DualTimeView time={identity.$createdAt} />
</Table.Cell>
<Table.Cell column="expiryDate" {root}>
{toLocaleDateTime(identity.providerAccessTokenExpiry)}
{#if identity.providerAccessTokenExpiry}
<DualTimeView
time={identity.providerAccessTokenExpiry}
showDatetime />
{:else}
-
{/if}
</Table.Cell>
<Table.Cell column="actions" {root}>
<Button text on:click={() => deleteIdentity(identity.$id)}>
@@ -86,7 +86,7 @@
label="Min"
placeholder="Enter size"
bind:value={data.min}
step={0.1}
step="any"
{disabled}
required={editing} />
@@ -95,7 +95,7 @@
label="Max"
placeholder="Enter size"
bind:value={data.max}
step={0.1}
step="any"
{disabled}
required={editing} />
</Layout.Stack>
@@ -109,7 +109,7 @@
bind:value={data.default}
disabled={data.required || data.array || disabled}
nullable={!data.required && !data.array}
step={0.1} />
step="any" />
<RequiredArrayCheckboxes
{editing}
@@ -31,5 +31,5 @@
min={column.min}
max={column.max}
required={column.required}
step={column.type === 'double' ? 0.1 : 1}
step={column.type === 'double' ? 'any' : 1}
leadingIcon={!limited ? IconHashtag : undefined} />
@@ -630,7 +630,6 @@
permissions: row.$permissions
});
invalidate(Dependencies.ROW);
trackEvent(Submit.RowUpdate);
addNotification({
message: 'Row has been updated',
@@ -1105,7 +1104,14 @@
<EditRowCell
{row}
column={rowColumn}
onRowStructureUpdate={updateRowContents}
onRowStructureUpdate={async (row) => {
const success = await updateRowContents(row);
if (success) {
// database update succeeded!
paginatedRows.update(index, row);
}
return success;
}}
noInlineEdit={isRelatedToMany && hasItems}
onChange={(row) => paginatedRows.update(index, row)}
onRevert={(row) => paginatedRows.update(index, row)}
@@ -193,7 +193,9 @@ export const expandTabs = writable(null);
export const spreadsheetRenderKey = writable('initial');
export const paginatedRowsLoading = writable(false);
export const paginatedRows = createSparsePagedDataStore<Models.DefaultRow>(SPREADSHEET_PAGE_LIMIT);
export const paginatedRows = createSparsePagedDataStore<Models.DefaultRow | Models.Row>(
SPREADSHEET_PAGE_LIMIT
);
export const PROHIBITED_ROW_KEYS = [
'$id',
@@ -2,7 +2,7 @@
import { base } from '$app/paths';
import { page } from '$app/state';
import { Id } from '$lib/components';
import { toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import { columns } from './store';
import { IconExclamation } from '@appwrite.io/pink-icons-svelte';
import { Layout, Tooltip, Table, Icon } from '@appwrite.io/pink-svelte';
@@ -72,8 +72,10 @@
{`Last backup: ${lastBackup}`}
</span>
</Tooltip>
{:else if column.type === 'datetime'}
<DualTimeView time={database[column.id]} showDatetime />
{:else}
{toLocaleDateTime(database[column.id])}
{database[column.id]}
{/if}
</Table.Cell>
{/each}
@@ -2,7 +2,7 @@
import { base } from '$app/paths';
import { page } from '$app/state';
import { Empty, Id } from '$lib/components';
import { toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import { Container } from '$lib/layout';
import { Button } from '$lib/elements/forms';
import type { PageData } from './$types';
@@ -58,7 +58,11 @@
{:else if column.id === 'events'}
{webhook.events.length}
{:else if column.type === 'datetime'}
{webhook[column.id] ? toLocaleDateTime(webhook[column.id]) : '-'}
{#if webhook[column.id]}
<DualTimeView time={webhook[column.id]} showDatetime />
{:else}
-
{/if}
{:else if column.id === 'enabled'}
<Layout.Stack direction="row" gap="s" alignItems="normal">
<Status
@@ -1,7 +1,7 @@
<script lang="ts">
import { base } from '$app/paths';
import { page } from '$app/state';
import { timeFromNow, toLocaleDateTime } from '$lib/helpers/date';
import { timeFromNow } from '$lib/helpers/date';
import { Avatar, Icon, Layout, Popover, Table, Typography } from '@appwrite.io/pink-svelte';
import { columns } from './store';
import type { Models } from '@appwrite.io/console';
@@ -80,7 +80,7 @@
time={site?.latestDeploymentCreatedAt ?? site.$createdAt} />
{/if}
{:else if column.id === '$createdAt'}
{toLocaleDateTime(site[column.id])}
<DualTimeView time={site[column.id]} showDatetime />
{/if}
</Table.Cell>
{/each}
@@ -2,7 +2,7 @@
import { base } from '$app/paths';
import { page } from '$app/state';
import { Id } from '$lib/components';
import { toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import type { PageData } from './$types';
import { columns } from './store';
import { Table } from '@appwrite.io/pink-svelte';
@@ -30,8 +30,10 @@
{/key}
{:else if column.id === 'name'}
{bucket.name}
{:else if column.type === 'datetime'}
<DualTimeView time={bucket[column.id]} showDatetime />
{:else}
{toLocaleDateTime(bucket[column.id])}
{bucket[column.id]}
{/if}
</Table.Cell>
{/each}
@@ -94,6 +94,15 @@
<svelte:fragment>
<Form onSubmit={login}>
<Layout.Stack>
{#if isCloud}
<div style:margin-bottom="var(--gap-s, 8px)">
<Button secondary fullWidth on:click={onGithubLogin} {disabled}>
<span class="icon-github" aria-hidden="true"></span>
<span class="text">Sign in with GitHub</span>
</Button>
</div>
<span class="with-separators eyebrow-heading-3">or</span>
{/if}
<InputEmail
id="email"
label="Email"
@@ -108,13 +117,6 @@
required={true}
bind:value={pass} />
<Button fullWidth submit {disabled}>Sign in</Button>
{#if isCloud}
<span class="with-separators eyebrow-heading-3">or</span>
<Button secondary fullWidth on:click={onGithubLogin} {disabled}>
<span class="icon-github" aria-hidden="true"></span>
<span class="text">Sign in with GitHub</span>
</Button>
{/if}
</Layout.Stack>
</Form>
</svelte:fragment>
@@ -106,9 +106,17 @@
}
function onGithubLogin() {
let successUrl = window.location.origin;
if (page.url.searchParams.has('code')) {
successUrl += `?code=${page.url.searchParams.get('code')}`;
} else if (page.url.searchParams.has('campaign')) {
successUrl += `?campaign=${page.url.searchParams.get('campaign')}`;
}
sdk.forConsole.account.createOAuth2Session({
provider: OAuthProvider.Github,
success: window.location.origin,
success: successUrl,
failure: window.location.origin,
scopes: ['read:user', 'user:email']
});
@@ -124,6 +132,16 @@
<svelte:fragment>
<Form onSubmit={register}>
<Layout.Stack>
{#if isCloud}
<div style:margin-bottom="var(--gap-s, 8px)">
<Button secondary fullWidth on:click={onGithubLogin} {disabled}>
<span class="icon-github" aria-hidden="true"></span>
<span class="text">Sign up with GitHub</span>
</Button>
</div>
<span class="with-separators eyebrow-heading-3">or</span>
{/if}
<InputText
id="name"
label="Name"
@@ -159,18 +177,6 @@
>.</InputChoice>
<Button fullWidth submit disabled={disabled || !terms}>Sign up</Button>
{#if isCloud}
<span class="with-separators eyebrow-heading-3">or</span>
<Button
secondary
fullWidth
on:click={onGithubLogin}
disabled={disabled || !terms}>
<span class="icon-github" aria-hidden="true"></span>
<span class="text">Sign up with GitHub</span>
</Button>
{/if}
</Layout.Stack>
</Form>
</svelte:fragment>