mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge pull request #2360 from appwrite/fix-dat-744
This commit is contained in:
+4
-4
@@ -12,7 +12,7 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import CreateTable from './createTable.svelte';
|
||||
import { showCreate } from './store';
|
||||
import { showCreateTable } from './store';
|
||||
import { TablesPanel } from '$lib/commandCenter/panels';
|
||||
import { canWriteTables, canWriteDatabases } from '$lib/stores/roles';
|
||||
import { showCreateBackup, showCreatePolicy } from './backups/store';
|
||||
@@ -25,7 +25,7 @@
|
||||
const databaseId = page.params.database;
|
||||
|
||||
async function handleCreate(event: CustomEvent<Models.Table>) {
|
||||
$showCreate = false;
|
||||
$showCreateTable = false;
|
||||
await invalidate(Dependencies.DATABASE);
|
||||
await goto(
|
||||
`${base}/project-${page.params.region}-${project}/databases/database-${databaseId}/table-${event.detail.$id}`
|
||||
@@ -36,7 +36,7 @@
|
||||
{
|
||||
label: 'Create table',
|
||||
callback() {
|
||||
$showCreate = true;
|
||||
$showCreateTable = true;
|
||||
if (!page.url.pathname.endsWith(databaseId)) {
|
||||
goto(
|
||||
`${base}/project-${page.params.region}-${project}/databases/database-${databaseId}`
|
||||
@@ -152,4 +152,4 @@
|
||||
|
||||
<slot />
|
||||
|
||||
<CreateTable bind:showCreate={$showCreate} on:created={handleCreate} />
|
||||
<CreateTable bind:showCreate={$showCreateTable} on:created={handleCreate} />
|
||||
|
||||
+5
-5
@@ -2,7 +2,7 @@
|
||||
import { EmptySearch, PaginationWithLimit, SearchQuery, ViewSelector } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { Container } from '$lib/layout';
|
||||
import { showCreate, tableViewColumns } from './store';
|
||||
import { showCreateTable, tableViewColumns } from './store';
|
||||
import Table from './table.svelte';
|
||||
import Grid from './grid.svelte';
|
||||
import type { PageData } from './$types';
|
||||
@@ -33,7 +33,7 @@
|
||||
hideView={!data.tables.total} />
|
||||
|
||||
{#if $canWriteTables}
|
||||
<Button event="create_table" on:click={() => ($showCreate = true)}>
|
||||
<Button event="create_table" on:click={() => ($showCreateTable = true)}>
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Create table
|
||||
</Button>
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
{#if data.tables.total}
|
||||
{#if data.view === 'grid'}
|
||||
<Grid {data} bind:showCreate={$showCreate} />
|
||||
<Grid {data} bind:showCreate={$showCreateTable} />
|
||||
{:else}
|
||||
<Table {data} />
|
||||
{/if}
|
||||
@@ -77,13 +77,13 @@
|
||||
href="https://appwrite.io/docs/products/databases/databases"
|
||||
text
|
||||
event="empty_documentation"
|
||||
ariaLabel={`create table`}>Documentation</Button>
|
||||
ariaLabel="create table">Documentation</Button>
|
||||
|
||||
{#if $canWriteTables}
|
||||
<Button
|
||||
secondary
|
||||
on:click={() => {
|
||||
$showCreate = true;
|
||||
$showCreateTable = true;
|
||||
}}>
|
||||
Create table
|
||||
</Button>
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import { derived, writable } from 'svelte/store';
|
||||
import { IconChartBar, IconCloudUpload, IconCog } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export const database = derived(page, ($page) => $page.data.database as Models.Database);
|
||||
export const showCreate = writable(false);
|
||||
export const showCreateTable = writable(false);
|
||||
|
||||
export const tableViewColumns = writable<Column[]>([
|
||||
{ id: '$id', title: 'Table ID', type: 'string', width: 200 },
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/state';
|
||||
import { showCreate, databaseSubNavigationItems } from './store';
|
||||
import { showCreateTable, databaseSubNavigationItems } from './store';
|
||||
import type { PageData } from './$types';
|
||||
import { showSubNavigation } from '$lib/stores/layout';
|
||||
import {
|
||||
@@ -137,7 +137,7 @@
|
||||
<Button
|
||||
compact
|
||||
on:click={() => {
|
||||
$showCreate = true;
|
||||
$showCreateTable = true;
|
||||
$showSubNavigation = false;
|
||||
}}>
|
||||
Create table
|
||||
|
||||
+2
-6
@@ -40,7 +40,7 @@
|
||||
import { addSubPanel, registerCommands, updateCommandGroupRanks } from '$lib/commandCenter';
|
||||
import CreateColumn from './createColumn.svelte';
|
||||
import { CreateColumnPanel } from '$lib/commandCenter/panels';
|
||||
import { database } from '../store';
|
||||
import { database, showCreateTable } from '../store';
|
||||
import { project } from '../../../store';
|
||||
import { page } from '$app/state';
|
||||
import { base } from '$app/paths';
|
||||
@@ -100,11 +100,7 @@
|
||||
{
|
||||
label: 'Create row',
|
||||
keys: page.url.pathname.endsWith($table.$id) ? ['t'] : ['t', 'd'],
|
||||
callback() {
|
||||
goto(
|
||||
`${base}/project-${page.params.region}-${page.params.project}/databases/database-${$database?.$id}/table-${$table?.$id}/create`
|
||||
);
|
||||
},
|
||||
callback: () => ($showCreateTable = true),
|
||||
icon: IconPlus,
|
||||
group: 'rows'
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user