mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix: database and search
This commit is contained in:
1 parent
053224da1b
commit
da0486bf91
9 files changed
+45
-31
No files matched your search
@@ -34,14 +34,18 @@
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(async () => {
|
||||
const url = new URL($page.url);
|
||||
url.search = value;
|
||||
|
||||
if (url.search === value) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Reset to first page if search changes.
|
||||
*/
|
||||
if ($page.data.page > 1) {
|
||||
url.pathname = url.pathname.replace(new RegExp(`/${$page.data.page}*$`), '/');
|
||||
}
|
||||
|
||||
url.search = value;
|
||||
|
||||
goto(url, { keepfocus: true });
|
||||
}, debounce);
|
||||
};
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
{:else if data.search}
|
||||
<EmptySearch>
|
||||
<div class="u-text-center">
|
||||
<b>Sorry, we couldn’t find ‘{data.search}’</b>
|
||||
<b>Sorry, we couldn't find '{data.search}'</b>
|
||||
<p>There are no users that match your search.</p>
|
||||
</div>
|
||||
<Button href={`/console/project-${projectId}/authentication`} secondary>
|
||||
|
||||
@@ -9,7 +9,7 @@ export const load: PageLoad = async ({ params, parent, url }) => {
|
||||
const page = Number(params.page);
|
||||
const offset = pageToOffset(page, PAGE_LIMIT);
|
||||
const search = url.search.slice(1) ?? undefined;
|
||||
|
||||
console.log(page);
|
||||
return {
|
||||
offset,
|
||||
search,
|
||||
|
||||
@@ -13,6 +13,7 @@ export const load: PageLoad = async ({ params, parent, url }) => {
|
||||
return {
|
||||
offset,
|
||||
search,
|
||||
page,
|
||||
teams: sdkForProject.teams.list(
|
||||
[Query.limit(PAGE_LIMIT), Query.offset(offset), Query.orderDesc('$createdAt')],
|
||||
search
|
||||
|
||||
+4
-1
@@ -11,6 +11,9 @@ export const load: PageLoad = async ({ params, parent }) => {
|
||||
|
||||
return {
|
||||
offset,
|
||||
logs: await sdkForProject.account.listLogs([Query.limit(PAGE_LIMIT), Query.offset(offset)])
|
||||
logs: await sdkForProject.users.listLogs(params.user, [
|
||||
Query.limit(PAGE_LIMIT),
|
||||
Query.offset(offset)
|
||||
])
|
||||
};
|
||||
};
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
import { page } from '$app/stores';
|
||||
import { Activity } from '$lib/layout';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
const path = `/console/project-${$page.params.project}/authentication/databases/database-${$page.params.team}/collection-${$page.params.collection}/document-${$page.params.document}/activity`;
|
||||
const path = `/console/project-${$page.params.project}/databases/database-${$page.params.database}/collection-${$page.params.collection}/activity`;
|
||||
</script>
|
||||
|
||||
<Activity {path} logs={data.logs} offset={data.offset} />
|
||||
+29
-20
@@ -9,28 +9,37 @@ import type { Attributes } from '../store';
|
||||
export const load: LayoutLoad = async ({ params, parent, depends }) => {
|
||||
depends(Dependencies.DOCUMENT);
|
||||
const { collection } = await parent();
|
||||
const document = await sdkForProject.databases.getDocument(
|
||||
params.database,
|
||||
params.collection,
|
||||
params.document
|
||||
);
|
||||
|
||||
/**
|
||||
* Sanitize DateTime to remove UTC Timezone section.
|
||||
*/
|
||||
collection.attributes.forEach((attribute) => {
|
||||
const { type, key, array } = attribute as unknown as Attributes;
|
||||
if (type === 'datetime') {
|
||||
if (array) {
|
||||
document[key] = document[key].map((n: string) => {
|
||||
return new Date(n).toISOString().slice(0, 23);
|
||||
});
|
||||
} else {
|
||||
document[key] = new Date(document[key]).toISOString().slice(0, 23);
|
||||
}
|
||||
}
|
||||
});
|
||||
try {
|
||||
const document = await sdkForProject.databases.getDocument(
|
||||
params.database,
|
||||
params.collection,
|
||||
params.document
|
||||
);
|
||||
|
||||
/**
|
||||
* Sanitize DateTime to remove UTC Timezone section.
|
||||
*/
|
||||
collection.attributes.forEach((attribute) => {
|
||||
const { type, key, array } = attribute as unknown as Attributes;
|
||||
if (type === 'datetime') {
|
||||
if (array) {
|
||||
document[key] = document[key].map((n: string) => {
|
||||
if (!n) {
|
||||
return '';
|
||||
}
|
||||
return new Date(n).toISOString().slice(0, 23);
|
||||
});
|
||||
} else {
|
||||
if (document[key]) {
|
||||
document[key] = new Date(document[key]).toISOString().slice(0, 23);
|
||||
} else {
|
||||
document[key] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
header: Header,
|
||||
breadcrumbs: Breadcrumbs,
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
import { Activity } from '$lib/layout';
|
||||
|
||||
export let data: PageData;
|
||||
const path = `/console/project-${$page.params.project}/authentication/databases/database-${$page.params.team}/collection-${$page.params.collection}/document-${$page.params.document}/activity`;
|
||||
const path = `/console/project-${$page.params.project}/databases/database-${$page.params.database}/collection-${$page.params.collection}/document-${$page.params.document}/activity`;
|
||||
</script>
|
||||
|
||||
<Activity {path} logs={data.logs} offset={data.offset} />
|
||||
-3
@@ -9,7 +9,6 @@
|
||||
export let id: string;
|
||||
export let label: string;
|
||||
export let value: string | number | boolean;
|
||||
export let index: number = null;
|
||||
export let attribute:
|
||||
| Models.AttributeBoolean
|
||||
| Models.AttributeEmail
|
||||
@@ -44,7 +43,6 @@
|
||||
{id}
|
||||
{label}
|
||||
{attribute}
|
||||
{index}
|
||||
bind:value />
|
||||
{:else}
|
||||
<svelte:component
|
||||
@@ -52,7 +50,6 @@
|
||||
{id}
|
||||
{label}
|
||||
{attribute}
|
||||
{index}
|
||||
bind:value />
|
||||
{/if}
|
||||
{/if}
|
||||
Reference in new issue
Block a user