mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix: realtime
This commit is contained in:
1 parent
e5837fec53
commit
af2d84e523
7 files changed
+78
-15
No files matched your search
@@ -25,6 +25,7 @@ export enum Dependencies {
|
||||
FUNCTIONS = 'functions',
|
||||
VARIABLES = 'variables',
|
||||
DEPLOYMENTS = 'deployments',
|
||||
EXECUTIONS = 'executions',
|
||||
PLATFORM = 'platform',
|
||||
PLATFORMS = 'platforms',
|
||||
KEY = 'key',
|
||||
|
||||
+23
@@ -1,5 +1,28 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import { collection } from './store';
|
||||
|
||||
let unsubscribe: { (): void; (): any };
|
||||
|
||||
onMount(() => {
|
||||
unsubscribe = sdkForConsole.client.subscribe('console', (response) => {
|
||||
if (
|
||||
response.events.includes('databases.*.collections.*.attributes.*') ||
|
||||
response.events.includes('databases.*.collections.*.indexes.*')
|
||||
) {
|
||||
invalidate(Dependencies.COLLECTION);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
if (unsubscribe) {
|
||||
unsubscribe();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
||||
+10
-1
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Empty, DropList, DropListItem } from '$lib/components';
|
||||
import { Empty, DropList, DropListItem, Heading } from '$lib/components';
|
||||
import { Pill } from '$lib/elements';
|
||||
import {
|
||||
Table,
|
||||
@@ -19,6 +19,7 @@
|
||||
import type { PageData } from './$types';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -34,6 +35,14 @@
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<div class="u-flex u-gap-12 common-section u-main-space-between">
|
||||
<Heading tag="h2" size="5">Indexes</Heading>
|
||||
|
||||
<Button on:click={() => (showCreateIndex = true)}>
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
<span class="text">Create index</span>
|
||||
</Button>
|
||||
</div>
|
||||
{#if data.indexes.total}
|
||||
<Table>
|
||||
<TableHeader>
|
||||
|
||||
+2
-10
@@ -2,7 +2,6 @@
|
||||
import { Modal } from '$lib/components';
|
||||
import { Button, InputText, FormList, InputSelect } from '$lib/elements/forms';
|
||||
import { collection } from '../store';
|
||||
import { onMount } from 'svelte';
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { page } from '$app/stores';
|
||||
@@ -11,7 +10,6 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
|
||||
export let showCreateIndex = false;
|
||||
export let externalAttribute: Attributes = null;
|
||||
|
||||
const databaseId = $page.params.database;
|
||||
|
||||
@@ -23,7 +21,7 @@
|
||||
];
|
||||
let newAttr = false;
|
||||
let selectedType = '';
|
||||
let attributeOptions = $collection.attributes.map((attribute: Attributes) => ({
|
||||
$: attributeOptions = $collection.attributes.map((attribute: Attributes) => ({
|
||||
value: attribute.key,
|
||||
label: attribute.key
|
||||
}));
|
||||
@@ -32,12 +30,6 @@
|
||||
let selectedAttribute = '';
|
||||
let selectedOrder = '';
|
||||
|
||||
onMount(() => {
|
||||
if (externalAttribute) {
|
||||
attributeList = [{ value: externalAttribute.key, order: 'ASC' }];
|
||||
}
|
||||
});
|
||||
|
||||
$: if (showCreateIndex) {
|
||||
attributeList = [];
|
||||
selectedType = selectedOrder = selectedAttribute = '';
|
||||
@@ -130,7 +122,7 @@
|
||||
<div class="form-item-part u-cross-child-end">
|
||||
<Button
|
||||
text
|
||||
disabled={externalAttribute && i === 0}
|
||||
disabled={i === 0}
|
||||
on:click={() => {
|
||||
if (i === 0) attributeList = [];
|
||||
attributeList = attributeList.splice(i, 1);
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
<script lang="ts">
|
||||
import { execute } from './store';
|
||||
import Execute from './execute.svelte';
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { invalidate } from '$app/navigation';
|
||||
|
||||
let unsubscribe: { (): void; (): any };
|
||||
|
||||
onMount(() => {
|
||||
unsubscribe = sdkForConsole.client.subscribe('console', (response) => {
|
||||
if (response.events.includes('functions.*.deployments.*')) {
|
||||
invalidate(Dependencies.DEPLOYMENTS);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
if (unsubscribe) {
|
||||
unsubscribe();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<slot />
|
||||
|
||||
+19
-2
@@ -17,12 +17,29 @@
|
||||
import { log } from '$lib/stores/logs';
|
||||
import { func } from '../../store';
|
||||
import type { PageData } from './$types';
|
||||
import { PAGE_LIMIT } from '$lib/constants';
|
||||
import { Dependencies, PAGE_LIMIT } from '$lib/constants';
|
||||
import { page } from '$app/stores';
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { invalidate } from '$app/navigation';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
//TODO: add optional hover state to rows
|
||||
let unsubscribe: { (): void; (): any };
|
||||
|
||||
onMount(() => {
|
||||
unsubscribe = sdkForConsole.client.subscribe('console', (response) => {
|
||||
if (response.events.includes('functions.*.executions.*')) {
|
||||
invalidate(Dependencies.EXECUTIONS);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
if (unsubscribe) {
|
||||
unsubscribe();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
|
||||
+3
-2
@@ -1,11 +1,12 @@
|
||||
import { Query } from '@aw-labs/appwrite-console';
|
||||
import { sdkForProject } from '$lib/stores/sdk';
|
||||
import { pageToOffset } from '$lib/helpers/load';
|
||||
import { PAGE_LIMIT } from '$lib/constants';
|
||||
import { Dependencies, PAGE_LIMIT } from '$lib/constants';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load: PageLoad = async ({ params, parent }) => {
|
||||
export const load: PageLoad = async ({ params, parent, depends }) => {
|
||||
await parent();
|
||||
depends(Dependencies.EXECUTIONS);
|
||||
const page = Number(params.page);
|
||||
const offset = pageToOffset(page, PAGE_LIMIT);
|
||||
|
||||
|
||||
Reference in new issue
Block a user