mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge pull request #3109 from appwrite/remove-activity-screens
Remove Activity screens from the console
This commit is contained in:
34 files changed
-578
No files matched your search
@@ -33,17 +33,6 @@ export const teamSearcher = (async (query: string) => {
|
||||
},
|
||||
group: 'teams',
|
||||
nested: true
|
||||
},
|
||||
|
||||
{
|
||||
label: 'Go to activity',
|
||||
callback: () => {
|
||||
goto(
|
||||
`${base}/project-${page.params.region}-${page.params.project}/auth/teams/team-${teams[0].$id}/activity`
|
||||
);
|
||||
},
|
||||
group: 'teams',
|
||||
nested: true
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@@ -34,16 +34,6 @@ export const userSearcher = (async (query: string) => {
|
||||
nested: true,
|
||||
icon: IconTrash
|
||||
},
|
||||
{
|
||||
label: 'Go to activity',
|
||||
callback: () => {
|
||||
goto(
|
||||
`${base}/project-${page.params.region}-${page.params.project}/auth/user-${users[0].$id}/activity`
|
||||
);
|
||||
},
|
||||
group: 'users',
|
||||
nested: true
|
||||
},
|
||||
{
|
||||
label: 'Go to sessions',
|
||||
callback: () => {
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { AvatarInitials, PaginationWithLimit, Trim } from '$lib/components';
|
||||
import { Container } from '$lib/layout';
|
||||
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';
|
||||
import type { PinkColumn } from '$lib/helpers/types';
|
||||
|
||||
export let limit = 0;
|
||||
export let offset = 0;
|
||||
export let logs: Models.LogList;
|
||||
export let insideSideSheet = false;
|
||||
export let databasesScreen = false;
|
||||
export let useCreateLinkForPagination = true;
|
||||
|
||||
function getColumnWidth(columnId: string): Pick<PinkColumn, 'width'> {
|
||||
const widthConfig: Record<
|
||||
string,
|
||||
{ insideSheet: number | { min: number }; default: number | { min: number } }
|
||||
> = {
|
||||
user: { insideSheet: 140, default: { min: 100 } },
|
||||
event: { insideSheet: 125, default: { min: 160 } },
|
||||
location: { insideSheet: 100, default: { min: 120 } },
|
||||
ip: { insideSheet: { min: 150 }, default: { min: 250 } },
|
||||
date: { insideSheet: { min: 200 }, default: { min: 180 } }
|
||||
};
|
||||
|
||||
const config = widthConfig[columnId];
|
||||
if (!config) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return { width: insideSideSheet ? config.insideSheet : config.default };
|
||||
}
|
||||
|
||||
const columns: PinkColumn[] = [
|
||||
{ id: 'user', ...getColumnWidth('user') },
|
||||
{ id: 'event', ...getColumnWidth('event') },
|
||||
{ id: 'location', ...getColumnWidth('location') },
|
||||
{ id: 'ip', ...getColumnWidth('ip') },
|
||||
{ id: 'date', ...getColumnWidth('date') }
|
||||
];
|
||||
</script>
|
||||
|
||||
<Container
|
||||
{databasesScreen}
|
||||
{insideSideSheet}
|
||||
expanded={databasesScreen && !insideSideSheet}
|
||||
slotSpacing={databasesScreen && !insideSideSheet}>
|
||||
{#if logs.total}
|
||||
<Table.Root class="responsive-table" {columns} let:root>
|
||||
<svelte:fragment slot="header" let:root>
|
||||
<Table.Header.Cell column="user" {root}>User</Table.Header.Cell>
|
||||
<Table.Header.Cell column="event" {root}>Event</Table.Header.Cell>
|
||||
<Table.Header.Cell column="location" {root}>Location</Table.Header.Cell>
|
||||
<Table.Header.Cell column="ip" {root}>IP</Table.Header.Cell>
|
||||
<Table.Header.Cell column="date" {root}>Date</Table.Header.Cell>
|
||||
</svelte:fragment>
|
||||
{#each logs.logs as log}
|
||||
<Table.Row.Base {root}>
|
||||
<Table.Cell column="user" {root}>
|
||||
<Layout.Stack direction="row" alignItems="center">
|
||||
{#if log.userEmail}
|
||||
{#if log.userName}
|
||||
<AvatarInitials size="xs" name={log.userName} />
|
||||
<Trim>{log.userName}</Trim>
|
||||
{:else}
|
||||
<AvatarInitials size="xs" name={log.userEmail} />
|
||||
<Trim>{log.userEmail}</Trim>
|
||||
{/if}
|
||||
{:else}
|
||||
<div class="avatar is-size-small">
|
||||
<span class="icon-anonymous" aria-hidden="true"></span>
|
||||
</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}>
|
||||
<DualTimeView time={log.time} showDatetime />
|
||||
</Table.Cell>
|
||||
</Table.Row.Base>
|
||||
{/each}
|
||||
</Table.Root>
|
||||
|
||||
<PaginationWithLimit
|
||||
{limit}
|
||||
{offset}
|
||||
on:page
|
||||
name="Logs"
|
||||
total={logs.total}
|
||||
useCreateLink={useCreateLinkForPagination} />
|
||||
{:else}
|
||||
<Card.Base padding="none">
|
||||
<Empty
|
||||
title="No activities available"
|
||||
description="Need a hand? Learn more in our documentation."
|
||||
type="secondary">
|
||||
<svelte:fragment slot="actions">
|
||||
<Button
|
||||
external
|
||||
secondary
|
||||
href="https://appwrite.io/docs/advanced/security/audit-logs">
|
||||
Documentation
|
||||
</Button>
|
||||
</svelte:fragment>
|
||||
</Empty>
|
||||
</Card.Base>
|
||||
{/if}
|
||||
</Container>
|
||||
@@ -12,7 +12,6 @@ export { default as Breadcrumbs } from './breadcrumbs.svelte';
|
||||
export { default as Unauthenticated } from './unauthenticated.svelte';
|
||||
export { default as Usage, type UsagePeriods } from './usage.svelte';
|
||||
export { default as UsageMultiple } from './usageMultiple.svelte';
|
||||
export { default as Activity } from './activity.svelte';
|
||||
export { default as Progress } from './progress.svelte';
|
||||
export { default as GridHeader } from './gridHeader.svelte';
|
||||
export { default as ContainerHeader } from './containerHeader.svelte';
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { Activity } from '$lib/layout';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
</script>
|
||||
|
||||
<Activity {...data} />
|
||||
@@ -1,19 +0,0 @@
|
||||
import { Query } from '@appwrite.io/console';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
|
||||
import { PAGE_LIMIT } from '$lib/constants';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ url, route }) => {
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
offset,
|
||||
limit,
|
||||
logs: await sdk.forConsole.account.listLogs({
|
||||
queries: [Query.offset(offset), Query.limit(limit)]
|
||||
})
|
||||
};
|
||||
};
|
||||
@@ -27,12 +27,6 @@
|
||||
title: 'Applications',
|
||||
event: 'applications'
|
||||
},
|
||||
{
|
||||
href: `${path}/activity`,
|
||||
title: 'Activity',
|
||||
event: 'activity',
|
||||
hasChildren: true
|
||||
},
|
||||
{
|
||||
href: `${path}/organizations`,
|
||||
title: 'Organizations',
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
import { Activity } from '$lib/layout';
|
||||
|
||||
export let data: PageData;
|
||||
</script>
|
||||
|
||||
<Activity {...data} />
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
import { Query } from '@appwrite.io/console';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
|
||||
import { PAGE_LIMIT } from '$lib/constants';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ params, url, route }) => {
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
offset,
|
||||
limit,
|
||||
logs: await sdk.forProject(params.region, params.project).teams.listLogs({
|
||||
teamId: params.team,
|
||||
queries: [Query.limit(limit), Query.offset(offset)]
|
||||
})
|
||||
};
|
||||
};
|
||||
@@ -18,12 +18,6 @@
|
||||
title: 'Members',
|
||||
event: 'members',
|
||||
hasChildren: true
|
||||
},
|
||||
{
|
||||
href: `${path}/activity`,
|
||||
title: 'Activity',
|
||||
event: 'activity',
|
||||
hasChildren: true
|
||||
}
|
||||
];
|
||||
</script>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
import { Activity } from '$lib/layout';
|
||||
|
||||
export let data: PageData;
|
||||
</script>
|
||||
|
||||
<Activity logs={data.logs} offset={data.offset} limit={data.limit} />
|
||||
@@ -1,19 +0,0 @@
|
||||
import { Query } from '@appwrite.io/console';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
|
||||
import { PAGE_LIMIT } from '$lib/constants';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ params, url, route }) => {
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
return {
|
||||
offset,
|
||||
limit,
|
||||
logs: await sdk.forProject(params.region, params.project).users.listLogs({
|
||||
userId: params.user,
|
||||
queries: [Query.limit(limit), Query.offset(offset)]
|
||||
})
|
||||
};
|
||||
};
|
||||
@@ -32,12 +32,6 @@
|
||||
href: `${path}/sessions`,
|
||||
title: 'Sessions',
|
||||
event: 'sessions'
|
||||
},
|
||||
{
|
||||
href: `${path}/activity`,
|
||||
title: 'Activity',
|
||||
event: 'activity',
|
||||
hasChildren: true
|
||||
}
|
||||
];
|
||||
</script>
|
||||
|
||||
-74
@@ -1,74 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/state';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { Activity } from '$lib/layout';
|
||||
import { pageToOffset } from '$lib/helpers/load';
|
||||
import { Skeleton } from '@appwrite.io/pink-svelte';
|
||||
import { type Models, Query } from '@appwrite.io/console';
|
||||
import { type Record, toSupportiveRecord } from '$database/(entity)';
|
||||
|
||||
const {
|
||||
record
|
||||
}: {
|
||||
record: Record;
|
||||
} = $props();
|
||||
|
||||
let limit = 25; /* default */
|
||||
let offset = $state(0);
|
||||
let loading = $state(true);
|
||||
let recordActivityLogs = $state<Models.LogList | null>(null);
|
||||
|
||||
onMount(loadRecordLogs);
|
||||
|
||||
async function loadRecordLogs(event?: CustomEvent<number>) {
|
||||
loading = true;
|
||||
|
||||
if (event) {
|
||||
offset = pageToOffset(event.detail, limit);
|
||||
}
|
||||
|
||||
const { $databaseId: databaseId, entityId, $id: recordId } = toSupportiveRecord(record);
|
||||
|
||||
recordActivityLogs = await sdk
|
||||
.forProject(page.params.region, page.params.project)
|
||||
.tablesDB.listRowLogs({
|
||||
databaseId: databaseId,
|
||||
tableId: entityId,
|
||||
rowId: recordId,
|
||||
queries: [Query.limit(limit), Query.offset(offset)]
|
||||
});
|
||||
|
||||
loading = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if loading}
|
||||
<div style:margin-block="" style:margin-inline-end="2.25rem">
|
||||
<!--<Skeleton variant="line" height={25} width="25%" />-->
|
||||
<Skeleton variant="line" height={40} width="auto" />
|
||||
</div>
|
||||
{:else if recordActivityLogs}
|
||||
<div class="record-activity-wrapper">
|
||||
<Activity
|
||||
{limit}
|
||||
{offset}
|
||||
insideSideSheet
|
||||
on:page={loadRecordLogs}
|
||||
logs={recordActivityLogs}
|
||||
useCreateLinkForPagination={false} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style lang="scss">
|
||||
.record-activity-wrapper {
|
||||
& :global(.console-container) {
|
||||
margin-inline: unset;
|
||||
padding-inline-end: unset;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
margin-block: 0.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
-1
@@ -1,3 +1,2 @@
|
||||
export { default as RecordActivity } from './activity.svelte';
|
||||
export { default as CsvDisabled } from './csvDisabled.svelte';
|
||||
export { default as EditRecordPermissions } from './editPermissions.svelte';
|
||||
-3
@@ -13,7 +13,6 @@
|
||||
| 'update'
|
||||
| 'duplicate-row'
|
||||
| 'permissions'
|
||||
| 'activity'
|
||||
| 'copy-url'
|
||||
| 'copy-json'
|
||||
// | 'copy-snippet'
|
||||
@@ -26,7 +25,6 @@
|
||||
import {
|
||||
IconArrowLeft,
|
||||
IconArrowRight,
|
||||
IconChartBar,
|
||||
IconClipboardCopy,
|
||||
IconDuplicate,
|
||||
IconKey,
|
||||
@@ -68,7 +66,6 @@
|
||||
{ label: 'Duplicate', icon: IconDuplicate, action: 'duplicate-row' },
|
||||
{ divider: true },
|
||||
{ label: 'Manage permissions', icon: IconKey, action: 'permissions' },
|
||||
{ label: 'View activity', icon: IconChartBar, action: 'activity' },
|
||||
{ divider: true },
|
||||
{ label: 'Copy URL', icon: IconLink, action: 'copy-url' },
|
||||
{ label: 'Copy as JSON', icon: IconClipboardCopy, action: 'copy-json' },
|
||||
|
||||
-15
@@ -42,7 +42,6 @@
|
||||
import { sleep } from '$lib/helpers/promises';
|
||||
import { hash } from '$lib/helpers/string';
|
||||
import {
|
||||
documentActivitySheet,
|
||||
documentPermissionSheet,
|
||||
noSqlDocument,
|
||||
showCreateIndexSheet
|
||||
@@ -50,7 +49,6 @@
|
||||
import {
|
||||
SideSheet,
|
||||
EditRecordPermissions,
|
||||
RecordActivity,
|
||||
useDatabaseSdk,
|
||||
DEFAULT_VECTOR_DIMENSION,
|
||||
type Field,
|
||||
@@ -139,15 +137,6 @@
|
||||
disabled: page.url.pathname.endsWith('indexes'),
|
||||
group: 'collections'
|
||||
},
|
||||
{
|
||||
label: 'Go to activity',
|
||||
keys: ['g', 'c'],
|
||||
callback() {
|
||||
goto(withPath(basePath, '/activity'));
|
||||
},
|
||||
disabled: page.url.pathname.endsWith('activity'),
|
||||
group: 'collections'
|
||||
},
|
||||
{
|
||||
label: 'Go to usage',
|
||||
keys: ['g', 'u'],
|
||||
@@ -352,10 +341,6 @@
|
||||
bind:record={$documentPermissionSheet.document} />
|
||||
</SideSheet>
|
||||
|
||||
<SideSheet title="Document activity" bind:show={$documentActivitySheet.show} closeOnBlur>
|
||||
<RecordActivity record={$documentActivitySheet.document} />
|
||||
</SideSheet>
|
||||
|
||||
<SideSheet
|
||||
closeOnBlur
|
||||
title="Create index"
|
||||
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { Activity } from '$lib/layout';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
const {
|
||||
data
|
||||
}: {
|
||||
data: PageData;
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
<div class="wide-screen-wrapper databases-spreadsheet">
|
||||
<Activity {...data} databasesScreen />
|
||||
</div>
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import type { PageLoad } from './$types';
|
||||
import { PAGE_LIMIT } from '$lib/constants';
|
||||
import { Query } from '@appwrite.io/console';
|
||||
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
|
||||
|
||||
export const load: PageLoad = async ({ params, url, route }) => {
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
offset,
|
||||
limit,
|
||||
logs: await sdk.forProject(params.region, params.project).tablesDB.listTableLogs({
|
||||
databaseId: params.database,
|
||||
tableId: params.collection,
|
||||
queries: [Query.limit(limit), Query.offset(offset)]
|
||||
})
|
||||
};
|
||||
};
|
||||
-6
@@ -27,12 +27,6 @@
|
||||
title: 'Indexes',
|
||||
event: 'indexes'
|
||||
},
|
||||
{
|
||||
href: `${path}/activity`,
|
||||
title: 'Activity',
|
||||
event: 'activity',
|
||||
hasChildren: true
|
||||
},
|
||||
{
|
||||
href: `${path}/usage`,
|
||||
title: 'Usage',
|
||||
|
||||
-6
@@ -42,7 +42,6 @@
|
||||
import { mockSuggestions } from '$database/(suggestions)';
|
||||
import {
|
||||
collectionColumns,
|
||||
documentActivitySheet,
|
||||
documentPermissionSheet,
|
||||
noSqlDocument,
|
||||
paginatedDocuments,
|
||||
@@ -431,11 +430,6 @@
|
||||
selectedDocumentForDelete = document.$id;
|
||||
showDelete = true;
|
||||
}
|
||||
|
||||
if (action === 'activity') {
|
||||
$documentActivitySheet.show = true;
|
||||
$documentActivitySheet.document = document;
|
||||
}
|
||||
}
|
||||
|
||||
// possibly for auto-save!
|
||||
|
||||
-5
@@ -95,11 +95,6 @@ export const documentPermissionSheet = writable({
|
||||
document: null as Models.Document
|
||||
});
|
||||
|
||||
export const documentActivitySheet = writable({
|
||||
show: false,
|
||||
document: null as Models.Document
|
||||
});
|
||||
|
||||
export const showCreateIndexSheet = writable<{
|
||||
show: boolean;
|
||||
column?: string;
|
||||
|
||||
-15
@@ -29,7 +29,6 @@
|
||||
databaseRowSheetOptions,
|
||||
showCreateColumnSheet,
|
||||
showCreateIndexSheet,
|
||||
rowActivitySheet,
|
||||
databaseRelatedRowSheetOptions,
|
||||
rowPermissionSheet,
|
||||
showRowCreateSheet
|
||||
@@ -50,7 +49,6 @@
|
||||
import {
|
||||
CreateIndex,
|
||||
EditRecordPermissions,
|
||||
RecordActivity,
|
||||
SideSheet,
|
||||
type Field,
|
||||
useTerminology
|
||||
@@ -206,15 +204,6 @@
|
||||
disabled: page.url.pathname.endsWith('indexes'),
|
||||
group: 'tables'
|
||||
},
|
||||
{
|
||||
label: 'Go to activity',
|
||||
keys: ['g', 'c'],
|
||||
callback() {
|
||||
goto(withPath(basePath, '/activity'));
|
||||
},
|
||||
disabled: page.url.pathname.endsWith('activity'),
|
||||
group: 'tables'
|
||||
},
|
||||
{
|
||||
label: 'Go to usage',
|
||||
keys: ['g', 'u'],
|
||||
@@ -593,10 +582,6 @@
|
||||
bind:arePermsDisabled={editRowPermissionsDisabled} />
|
||||
</SideSheet>
|
||||
|
||||
<SideSheet title="Row activity" bind:show={$rowActivitySheet.show} closeOnBlur>
|
||||
<RecordActivity record={$rowActivitySheet.row} />
|
||||
</SideSheet>
|
||||
|
||||
<Dialog title="Generate sample data" bind:open={$randomDataModalState.show}>
|
||||
<Layout.Stack style="gap: 28px;">
|
||||
<Typography.Text>
|
||||
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { Activity } from '$lib/layout';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
const {
|
||||
data
|
||||
}: {
|
||||
data: PageData;
|
||||
} = $props();
|
||||
</script>
|
||||
|
||||
<div class="wide-screen-wrapper databases-spreadsheet">
|
||||
<Activity {...data} databasesScreen />
|
||||
</div>
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
import { Query } from '@appwrite.io/console';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
|
||||
import { PAGE_LIMIT } from '$lib/constants';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ params, url, route }) => {
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
offset,
|
||||
limit,
|
||||
logs: await sdk.forProject(params.region, params.project).tablesDB.listTableLogs({
|
||||
databaseId: params.database,
|
||||
tableId: params.table,
|
||||
queries: [Query.limit(limit), Query.offset(offset)]
|
||||
})
|
||||
};
|
||||
};
|
||||
-6
@@ -32,12 +32,6 @@
|
||||
title: 'Indexes',
|
||||
event: 'indexes'
|
||||
},
|
||||
{
|
||||
href: `${path}/activity`,
|
||||
title: 'Activity',
|
||||
event: 'activity',
|
||||
hasChildren: true
|
||||
},
|
||||
{
|
||||
href: `${path}/usage`,
|
||||
title: 'Usage',
|
||||
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/state';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { Activity } from '$lib/layout';
|
||||
import { rowActivitySheet } from '../store';
|
||||
import { pageToOffset } from '$lib/helpers/load';
|
||||
import { type Models, Query } from '@appwrite.io/console';
|
||||
import { Skeleton } from '@appwrite.io/pink-svelte';
|
||||
|
||||
let limit = 25; /* default */
|
||||
let offset = $state(0);
|
||||
let loading = $state(true);
|
||||
let rowActivityLogs = $state<Models.LogList | null>(null);
|
||||
|
||||
onMount(loadRowLogs);
|
||||
|
||||
async function loadRowLogs(event?: CustomEvent<number>) {
|
||||
loading = true;
|
||||
|
||||
if (event) {
|
||||
offset = pageToOffset(event.detail, limit);
|
||||
}
|
||||
|
||||
const row = $rowActivitySheet.row;
|
||||
|
||||
rowActivityLogs = await sdk
|
||||
.forProject(page.params.region, page.params.project)
|
||||
.tablesDB.listRowLogs({
|
||||
databaseId: row.$databaseId,
|
||||
tableId: row.$tableId,
|
||||
rowId: row.$id,
|
||||
queries: [Query.limit(limit), Query.offset(offset)]
|
||||
});
|
||||
|
||||
loading = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if loading}
|
||||
<div style:margin-block="" style:margin-inline-end="2.25rem">
|
||||
<!--<Skeleton variant="line" height={25} width="25%" />-->
|
||||
<Skeleton variant="line" height={40} width="auto" />
|
||||
</div>
|
||||
{:else if rowActivityLogs}
|
||||
<div class="row-activity-wrapper">
|
||||
<Activity
|
||||
{limit}
|
||||
{offset}
|
||||
insideSideSheet
|
||||
on:page={loadRowLogs}
|
||||
logs={rowActivityLogs}
|
||||
useCreateLinkForPagination={false} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style lang="scss">
|
||||
.row-activity-wrapper {
|
||||
& :global(.console-container) {
|
||||
margin-inline: unset;
|
||||
padding-inline-end: unset;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
margin-block: 0.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
-3
@@ -13,7 +13,6 @@
|
||||
| 'update'
|
||||
| 'duplicate-row'
|
||||
| 'permissions'
|
||||
| 'activity'
|
||||
| 'copy-url'
|
||||
| 'copy-json'
|
||||
// | 'copy-snippet'
|
||||
@@ -26,7 +25,6 @@
|
||||
import {
|
||||
IconArrowLeft,
|
||||
IconArrowRight,
|
||||
IconChartBar,
|
||||
IconClipboardCopy,
|
||||
IconDuplicate,
|
||||
IconKey,
|
||||
@@ -69,7 +67,6 @@
|
||||
{ label: 'Duplicate', icon: IconDuplicate, action: 'duplicate-row' },
|
||||
{ divider: true },
|
||||
{ label: 'Manage permissions', icon: IconKey, action: 'permissions' },
|
||||
{ label: 'View activity', icon: IconChartBar, action: 'activity' },
|
||||
{ divider: true },
|
||||
{ label: 'Copy URL', icon: IconLink, action: 'copy-url' },
|
||||
{ label: 'Copy as JSON', icon: IconClipboardCopy, action: 'copy-json' },
|
||||
|
||||
-6
@@ -31,7 +31,6 @@
|
||||
columnsWidth,
|
||||
showCreateIndexSheet,
|
||||
Deletion,
|
||||
rowActivitySheet,
|
||||
paginatedRows,
|
||||
paginatedRowsLoading,
|
||||
databaseRelatedRowSheetOptions,
|
||||
@@ -678,11 +677,6 @@
|
||||
showDelete = true;
|
||||
selectedRowForDelete = row.$id;
|
||||
}
|
||||
|
||||
if (action === 'activity') {
|
||||
$rowActivitySheet.row = row;
|
||||
$rowActivitySheet.show = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-5
@@ -143,11 +143,6 @@ export enum Deletion {
|
||||
restrict = 'Row can not be deleted'
|
||||
}
|
||||
|
||||
export const rowActivitySheet = writable({
|
||||
show: false,
|
||||
row: null as Models.Row
|
||||
});
|
||||
|
||||
export const rowPermissionSheet = writable({
|
||||
show: false,
|
||||
row: null as Models.Row
|
||||
|
||||
-12
@@ -20,18 +20,6 @@
|
||||
group: 'topics',
|
||||
rank: 1
|
||||
},
|
||||
{
|
||||
label: 'Go to Activity',
|
||||
callback() {
|
||||
goto(
|
||||
`${base}/project-${$project.region}-${$project.$id}/messaging/topics/topic-${topicId}/activity`
|
||||
);
|
||||
},
|
||||
keys: ['g', 'a'],
|
||||
disabled: page.url.pathname.endsWith('activity'),
|
||||
group: 'topics',
|
||||
rank: 1
|
||||
},
|
||||
{
|
||||
label: 'Go to Overview',
|
||||
callback() {
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
import { Activity } from '$lib/layout';
|
||||
|
||||
export let data: PageData;
|
||||
</script>
|
||||
|
||||
<Activity {...data} />
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
import { Query } from '@appwrite.io/console';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { getLimit, getPage, pageToOffset } from '$lib/helpers/load';
|
||||
import { PAGE_LIMIT } from '$lib/constants';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ params, url, route }) => {
|
||||
const page = getPage(url);
|
||||
const limit = getLimit(url, route, PAGE_LIMIT);
|
||||
const offset = pageToOffset(page, limit);
|
||||
|
||||
return {
|
||||
offset,
|
||||
limit,
|
||||
logs: await sdk.forProject(params.region, params.project).messaging.listTopicLogs({
|
||||
topicId: params.topic,
|
||||
queries: [Query.limit(limit), Query.offset(offset)]
|
||||
})
|
||||
};
|
||||
};
|
||||
-5
@@ -16,11 +16,6 @@
|
||||
title: 'Subscribers',
|
||||
event: 'subscribers'
|
||||
},
|
||||
{
|
||||
href: `${path}/activity`,
|
||||
title: 'Activity',
|
||||
event: 'activity'
|
||||
},
|
||||
{
|
||||
href: `${path}/settings`,
|
||||
title: 'Settings',
|
||||
|
||||
Reference in new issue
Block a user