mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
refactor: use exhisting components where possible
This commit is contained in:
1 parent
3ccce7293a
commit
1b74f4af19
10 files changed
+140
-149
No files matched your search
@@ -1,5 +1,6 @@
|
||||
export { default as Table } from './table.svelte';
|
||||
export { default as TableScroll } from './tableScroll.svelte';
|
||||
export { default as TableList } from './tableList.svelte';
|
||||
export { default as TableBody } from './body.svelte';
|
||||
export { default as TableHeader } from './header.svelte';
|
||||
export { default as TableFooter } from './footer.svelte';
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
<div class="table is-vertical u-margin-block-start-32" role="table">
|
||||
<script lang="ts">
|
||||
export let noOuterStyles = false;
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="table is-vertical u-margin-block-start-32"
|
||||
class:is-remove-outer-styles={noOuterStyles}
|
||||
role="table">
|
||||
<slot />
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!-- TODO: is 100% height needed? -->
|
||||
<div class="table-with-scroll u-height-100-percents">
|
||||
<div class="table-wrapper">
|
||||
<div class="table is-remove-outer-styles">
|
||||
<ul class="table-thead">
|
||||
<slot />
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -5,6 +5,7 @@
|
||||
import { createFunction } from './store';
|
||||
import SelectUsers from '../selectUsers.svelte';
|
||||
import SelectTeams from '../selectTeams.svelte';
|
||||
import { TableList, TableCellText, TableCell } from '$lib/elements/table';
|
||||
|
||||
let showDropdown = false;
|
||||
let showUsers = false;
|
||||
@@ -30,38 +31,28 @@
|
||||
|
||||
ROLE
|
||||
{#if $createFunction?.execute?.length}
|
||||
<div class="table-with-scroll">
|
||||
<div class="table-wrapper">
|
||||
<div class="table is-remove-outer-styles">
|
||||
<ul class="table-thead">
|
||||
{#each $createFunction.execute as id}
|
||||
<li class="table-row">
|
||||
<div class="table-col" data-title="id">
|
||||
<span class="text">{id}</span>
|
||||
</div>
|
||||
<div
|
||||
class="table-col u-overflow-visible"
|
||||
data-title="options"
|
||||
style="--p-col-width:40">
|
||||
<button
|
||||
class="button is-text is-only-icon"
|
||||
aria-label="delete id"
|
||||
on:click|preventDefault={() => {
|
||||
$createFunction.execute =
|
||||
$createFunction.execute.filter(
|
||||
(item) => item !== id
|
||||
);
|
||||
$createFunction = $createFunction;
|
||||
}}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<TableList>
|
||||
{#each $createFunction.execute as id}
|
||||
<li class="table-row">
|
||||
<TableCellText title="id">
|
||||
{id}
|
||||
</TableCellText>
|
||||
<TableCell showOverflow title="options" width={40}>
|
||||
<button
|
||||
class="button is-text is-only-icon"
|
||||
aria-label="delete role"
|
||||
on:click|preventDefault={() => {
|
||||
$createFunction.execute = $createFunction.execute.filter(
|
||||
(item) => item !== id
|
||||
);
|
||||
$createFunction = $createFunction;
|
||||
}}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</button>
|
||||
</TableCell>
|
||||
</li>
|
||||
{/each}
|
||||
</TableList>
|
||||
{:else}
|
||||
<Empty isButton single on:click={() => (showDropdown = !showDropdown)}>
|
||||
Add a role to get started
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { Empty } from '$lib/components';
|
||||
import { createFunction } from './store';
|
||||
import { EventModal } from '$lib/components';
|
||||
import { TableList, TableCellText, TableCell } from '$lib/elements/table';
|
||||
|
||||
let showCreate = false;
|
||||
|
||||
@@ -20,37 +21,28 @@
|
||||
|
||||
EVENT
|
||||
{#if $createFunction?.events?.length}
|
||||
<div class="table-with-scroll u-height-100-percents">
|
||||
<div class="table-wrapper">
|
||||
<div class="table is-remove-outer-styles">
|
||||
<ul class="table-thead">
|
||||
{#each $createFunction.events as id}
|
||||
<li class="table-row">
|
||||
<div class="table-col" data-title="id">
|
||||
<span class="text">{id}</span>
|
||||
</div>
|
||||
<div
|
||||
class="table-col u-overflow-visible"
|
||||
data-title="options"
|
||||
style="--p-col-width:40">
|
||||
<button
|
||||
class="button is-text is-only-icon"
|
||||
aria-label="delete id"
|
||||
on:click|preventDefault={() => {
|
||||
$createFunction.events = $createFunction.events.filter(
|
||||
(item) => item !== id
|
||||
);
|
||||
$createFunction = $createFunction;
|
||||
}}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<TableList>
|
||||
{#each $createFunction.events as id}
|
||||
<li class="table-row">
|
||||
<TableCellText title="id">
|
||||
{id}
|
||||
</TableCellText>
|
||||
<TableCell showOverflow title="options" width={30}>
|
||||
<button
|
||||
class="button is-text is-only-icon"
|
||||
aria-label="delete id"
|
||||
on:click|preventDefault={() => {
|
||||
$createFunction.events = $createFunction.events.filter(
|
||||
(item) => item !== id
|
||||
);
|
||||
$createFunction = $createFunction;
|
||||
}}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</button>
|
||||
</TableCell>
|
||||
</li>
|
||||
{/each}
|
||||
</TableList>
|
||||
{:else}
|
||||
<Empty isButton single on:click={() => (showCreate = !showCreate)}
|
||||
>Add a event to get started</Empty>
|
||||
|
||||
@@ -4,6 +4,15 @@
|
||||
import Create from '../createVariable.svelte';
|
||||
import { DropList, DropListItem, Copy } from '$lib/components';
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableCellHead,
|
||||
TableCellText,
|
||||
TableHeader,
|
||||
TableRow
|
||||
} from '$lib/elements/table';
|
||||
|
||||
let showCreate = false;
|
||||
|
||||
@@ -33,26 +42,21 @@
|
||||
Create a variable (or secret key) that will be passed to your function at runtime.
|
||||
</svelte:fragment>
|
||||
|
||||
<table class="table is-remove-outer-styles">
|
||||
<thead class="table-thead">
|
||||
<tr class="table-row">
|
||||
<th class="table-thead-col">
|
||||
<span class="eyebrow-heading-3">Key</span>
|
||||
</th>
|
||||
<th class="table-thead-col">
|
||||
<span class="eyebrow-heading-3">Value</span>
|
||||
</th>
|
||||
<th class="table-thead-col" style="--p-col-width:40" />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-tbody">
|
||||
<Table noOuterStyles>
|
||||
<TableHeader>
|
||||
<TableCellHead>Key</TableCellHead>
|
||||
<TableCellHead>Value</TableCellHead>
|
||||
<TableCellHead width={30} />
|
||||
</TableHeader>
|
||||
|
||||
<TableBody>
|
||||
{#if $createFunction.vars}
|
||||
{#each $createFunction.vars as variable, i}
|
||||
<tr class="table-row">
|
||||
<td class="table-col" data-title="Key">
|
||||
<span class="text">{variable.key}</span>
|
||||
</td>
|
||||
<td class="table-col u-overflow-visible" data-title="value">
|
||||
<TableRow>
|
||||
<TableCellText title="key">
|
||||
{variable.key}
|
||||
</TableCellText>
|
||||
<TableCell showOverflow title="value">
|
||||
<div class="interactive-text-output">
|
||||
{#if showValue[i]}
|
||||
<span class="text">{variable.value}</span>
|
||||
@@ -80,8 +84,8 @@
|
||||
</Copy>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-col u-overflow-visible" data-title="options">
|
||||
</TableCell>
|
||||
<TableCell showOverflow title="options">
|
||||
<DropList
|
||||
bind:show={showDropdown[i]}
|
||||
position="bottom"
|
||||
@@ -115,12 +119,12 @@
|
||||
</DropListItem>
|
||||
</svelte:fragment>
|
||||
</DropList>
|
||||
</td>
|
||||
</tr>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
{/each}
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</TableBody>
|
||||
</Table>
|
||||
<div class="u-flex u-margin-block-start-16">
|
||||
<button
|
||||
class="button is-text u-padding-inline-0"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
import { createWebhook } from './wizard/store';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { page } from '$app/stores';
|
||||
import { webhookList } from './store';
|
||||
|
||||
const projectId = $page.params.project;
|
||||
const create = async () => {
|
||||
@@ -23,6 +24,7 @@
|
||||
$createWebhook.httpUser,
|
||||
$createWebhook.httpPass
|
||||
);
|
||||
await webhookList.load(projectId);
|
||||
addNotification({
|
||||
message: 'Webhook has been created',
|
||||
type: 'success'
|
||||
|
||||
+20
-30
@@ -9,6 +9,7 @@
|
||||
InputChoice,
|
||||
InputPassword
|
||||
} from '$lib/elements/forms';
|
||||
import { TableList, TableCellText, TableCell } from '$lib/elements/table';
|
||||
import { Container } from '$lib/layout';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
@@ -204,36 +205,25 @@
|
||||
</p>
|
||||
<svelte:fragment slot="aside">
|
||||
{#if events?.length}
|
||||
<div class="table-with-scroll u-height-100-percents">
|
||||
<div class="table-wrapper">
|
||||
<div class="table is-remove-outer-styles">
|
||||
<ul class="table-thead">
|
||||
{#each events as id}
|
||||
<li class="table-row">
|
||||
<div class="table-col" data-title="id">
|
||||
<span class="text">{id}</span>
|
||||
</div>
|
||||
<div
|
||||
class="table-col u-overflow-visible"
|
||||
data-title="options"
|
||||
style="--p-col-width:40">
|
||||
<button
|
||||
class="button is-text is-only-icon"
|
||||
aria-label="delete id"
|
||||
on:click|preventDefault={() => {
|
||||
events = events.filter(
|
||||
(item) => item !== id
|
||||
);
|
||||
}}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<TableList>
|
||||
{#each events as id}
|
||||
<li class="table-row">
|
||||
<TableCellText title="id">
|
||||
{id}
|
||||
</TableCellText>
|
||||
<TableCell showOverflow title="options" width={30}>
|
||||
<button
|
||||
class="button is-text is-only-icon"
|
||||
aria-label="delete id"
|
||||
on:click|preventDefault={() => {
|
||||
events = events.filter((item) => item !== id);
|
||||
}}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</button>
|
||||
</TableCell>
|
||||
</li>
|
||||
{/each}
|
||||
</TableList>
|
||||
{:else}
|
||||
<Empty isButton single on:click={() => (showCreateEvent = !showCreateEvent)}
|
||||
>Add a event to get started</Empty>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { project } from '../../../../store';
|
||||
import { webhookList } from '../../store';
|
||||
import { webhook } from './store';
|
||||
|
||||
export let showDelete = false;
|
||||
@@ -13,6 +14,7 @@
|
||||
async function handleDelete() {
|
||||
try {
|
||||
await sdkForConsole.projects.deleteWebhook($project.$id, $webhook.$id);
|
||||
await webhookList.load($project.$id);
|
||||
showDelete = false;
|
||||
addNotification({
|
||||
type: 'success',
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { Empty } from '$lib/components';
|
||||
import { createWebhook } from './store';
|
||||
import { EventModal } from '$lib/components';
|
||||
import { TableList, TableCellText, TableCell } from '$lib/elements/table';
|
||||
|
||||
let showCreate = false;
|
||||
|
||||
@@ -21,37 +22,28 @@
|
||||
|
||||
EVENT
|
||||
{#if $createWebhook?.events?.length}
|
||||
<div class="table-with-scroll u-height-100-percents">
|
||||
<div class="table-wrapper">
|
||||
<div class="table is-remove-outer-styles">
|
||||
<ul class="table-thead">
|
||||
{#each $createWebhook.events as id}
|
||||
<li class="table-row">
|
||||
<div class="table-col" data-title="id">
|
||||
<span class="text">{id}</span>
|
||||
</div>
|
||||
<div
|
||||
class="table-col u-overflow-visible"
|
||||
data-title="options"
|
||||
style="--p-col-width:40">
|
||||
<button
|
||||
class="button is-text is-only-icon"
|
||||
aria-label="delete id"
|
||||
on:click|preventDefault={() => {
|
||||
$createWebhook.events = $createWebhook.events.filter(
|
||||
(item) => item !== id
|
||||
);
|
||||
$createWebhook = $createWebhook;
|
||||
}}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<TableList>
|
||||
{#each $createWebhook.events as id}
|
||||
<li class="table-row">
|
||||
<TableCellText title="id">
|
||||
{id}
|
||||
</TableCellText>
|
||||
<TableCell showOverflow title="options" width={30}>
|
||||
<button
|
||||
class="button is-text is-only-icon"
|
||||
aria-label="delete id"
|
||||
on:click|preventDefault={() => {
|
||||
$createWebhook.events = $createWebhook.events.filter(
|
||||
(item) => item !== id
|
||||
);
|
||||
$createWebhook = $createWebhook;
|
||||
}}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</button>
|
||||
</TableCell>
|
||||
</li>
|
||||
{/each}
|
||||
</TableList>
|
||||
{:else}
|
||||
<Empty isButton single on:click={() => (showCreate = !showCreate)}
|
||||
>Add a event to get started</Empty>
|
||||
|
||||
Reference in new issue
Block a user