mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
design review: settings page, invites page, refactor cardGrid
This commit is contained in:
1 parent
6ff6bf5e89
commit
4f7fce859f
9 files changed
+205
-213
No files matched your search
@@ -5,10 +5,10 @@ import { Submit, trackEvent } from '$lib/actions/analytics';
|
||||
import { base } from '$app/paths';
|
||||
import { uploader } from '$lib/stores/uploader';
|
||||
|
||||
export async function logout() {
|
||||
export async function logout(redirect: boolean = true) {
|
||||
await sdk.forConsole.account.deleteSession('current');
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
uploader.reset();
|
||||
trackEvent(Submit.AccountLogout);
|
||||
await goto(`${base}/login`);
|
||||
if (redirect) await goto(`${base}/login`);
|
||||
}
|
||||
@@ -65,7 +65,8 @@
|
||||
|
||||
<Container>
|
||||
<Layout.Stack direction="row" justifyContent="space-between">
|
||||
<SearchQuery search={data.search} placeholder="Search by ID"></SearchQuery>
|
||||
<SearchQuery search={data.search} placeholder="Search by ID" disabled={!data.logs.total}
|
||||
></SearchQuery>
|
||||
{#if data.logs.total}
|
||||
<ViewSelector view={View.Table} {columns} hideView />
|
||||
{/if}
|
||||
@@ -93,6 +94,7 @@
|
||||
{:else}
|
||||
<Card.Base padding="none">
|
||||
<Empty
|
||||
type="secondary"
|
||||
title="There are no logs to display at the moment"
|
||||
description="Logs are automatically generated based on your site's activity.">
|
||||
<svelte:fragment slot="actions">
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
import UpdateRepository from './updateRepository.svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { showConnectRepo } from './store';
|
||||
import UpdateSpa from './updateSPA.svelte';
|
||||
|
||||
export let data;
|
||||
|
||||
@@ -67,7 +66,6 @@
|
||||
globalVariableList={data.globalVariables}
|
||||
variableList={data.variables}
|
||||
product="site" />
|
||||
<UpdateSpa site={data.site} />
|
||||
<UpdateRuntimeSettings site={data.site} frameworks={data.frameworks.frameworks} />
|
||||
<UpdateTimeout site={data.site} />
|
||||
<DangerZone site={data.site} />
|
||||
|
||||
+91
-34
@@ -8,10 +8,11 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { onMount } from 'svelte';
|
||||
import { Adapter, BuildRuntime, Framework, type Models } from '@appwrite.io/console';
|
||||
import { Card, Fieldset, InlineCode, Layout } from '@appwrite.io/pink-svelte';
|
||||
import { Card, Fieldset, Icon, InlineCode, Layout, Tooltip } from '@appwrite.io/pink-svelte';
|
||||
import { iconPath } from '$lib/stores/app';
|
||||
import { getFrameworkIcon } from '../../store';
|
||||
import { Link } from '$lib/elements';
|
||||
import { IconInfo } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export let site: Models.Site;
|
||||
export let frameworks: Models.Framework[];
|
||||
@@ -20,8 +21,10 @@
|
||||
let buildCommand = undefined;
|
||||
let outputDirectory = undefined;
|
||||
let frameworkKey = site.framework;
|
||||
let adapter: Adapter = site.adapter as Adapter;
|
||||
let fallback = site.fallbackFile;
|
||||
let isButtonDisabled = true;
|
||||
let adapter: Adapter;
|
||||
let showFallback = site.adapter === Adapter.Static;
|
||||
|
||||
onMount(async () => {
|
||||
selectedFramework ??= frameworks.find((framework) => framework.key === site.framework);
|
||||
@@ -47,8 +50,8 @@
|
||||
buildCommand || undefined,
|
||||
outputDirectory || undefined,
|
||||
(site?.buildRuntime as BuildRuntime) || undefined,
|
||||
site.adapter,
|
||||
site.fallbackFile || undefined,
|
||||
adapter || undefined,
|
||||
fallback || undefined,
|
||||
site.installationId || undefined,
|
||||
site.providerRepositoryId || undefined,
|
||||
site.providerBranch || undefined,
|
||||
@@ -75,12 +78,23 @@
|
||||
installCommand === site?.installCommand &&
|
||||
buildCommand === site?.buildCommand &&
|
||||
outputDirectory === site?.outputDirectory &&
|
||||
selectedFramework?.key === site?.framework
|
||||
selectedFramework?.key === site?.framework &&
|
||||
fallback === site?.fallbackFile
|
||||
) {
|
||||
isButtonDisabled = true;
|
||||
} else {
|
||||
isButtonDisabled = false;
|
||||
}
|
||||
|
||||
$: if (adapter === Adapter.Static) {
|
||||
showFallback = true;
|
||||
} else {
|
||||
showFallback = false;
|
||||
}
|
||||
|
||||
$: if (fallback === '') {
|
||||
fallback = null;
|
||||
}
|
||||
</script>
|
||||
|
||||
<Form onSubmit={updateName}>
|
||||
@@ -129,35 +143,78 @@
|
||||
</Card.Selector>
|
||||
</Layout.Grid>
|
||||
<Fieldset legend="Settings">
|
||||
<Layout.Stack gap="s" direction="row" alignItems="flex-end">
|
||||
<InputText
|
||||
id="installCommand"
|
||||
label="Install command"
|
||||
bind:value={installCommand}
|
||||
placeholder={frameworkData.adapters[site.adapter]
|
||||
.defaultInstallCommand} />
|
||||
<Button secondary size="s" on:click={() => (installCommand = '')}
|
||||
>Reset</Button>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack gap="s" direction="row" alignItems="flex-end">
|
||||
<InputText
|
||||
id="buildCommand"
|
||||
label="Build command"
|
||||
bind:value={buildCommand}
|
||||
placeholder={frameworkData.adapters[site.adapter]
|
||||
.defaultBuildCommand} />
|
||||
<Button secondary size="s" on:click={() => (buildCommand = '')}
|
||||
>Reset</Button>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack gap="s" direction="row" alignItems="flex-end">
|
||||
<InputText
|
||||
id="outputDirectory"
|
||||
label="Output directory"
|
||||
bind:value={outputDirectory}
|
||||
placeholder={frameworkData.adapters[site.adapter]
|
||||
.defaultOutputDirectory} />
|
||||
<Button secondary size="s" on:click={() => (outputDirectory = '')}
|
||||
>Reset</Button>
|
||||
<Layout.Stack gap="xl">
|
||||
<Layout.Stack gap="s" direction="row" alignItems="flex-end">
|
||||
<InputText
|
||||
id="installCommand"
|
||||
label="Install command"
|
||||
bind:value={installCommand}
|
||||
placeholder={frameworkData.adapters[site.adapter]
|
||||
.defaultInstallCommand} />
|
||||
|
||||
<Button
|
||||
secondary
|
||||
size="s"
|
||||
on:click={() =>
|
||||
(installCommand =
|
||||
site?.installCommand ??
|
||||
selectedFramework.adapters[site.adapter]
|
||||
.defaultInstallCommand)}>
|
||||
Reset
|
||||
</Button>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack gap="s" direction="row" alignItems="flex-end">
|
||||
<InputText
|
||||
id="buildCommand"
|
||||
label="Build command"
|
||||
bind:value={buildCommand}
|
||||
placeholder={frameworkData.adapters[site.adapter]
|
||||
.defaultBuildCommand} />
|
||||
<Button
|
||||
secondary
|
||||
size="s"
|
||||
on:click={() =>
|
||||
(buildCommand =
|
||||
site?.buildCommand ??
|
||||
selectedFramework.adapters[site.adapter]
|
||||
.defaultbuildCommand)}>
|
||||
Reset
|
||||
</Button>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack gap="s" direction="row" alignItems="flex-end">
|
||||
<InputText
|
||||
id="outputDirectory"
|
||||
label="Output directory"
|
||||
bind:value={outputDirectory}
|
||||
placeholder={frameworkData.adapters[site.adapter]
|
||||
.defaultOutputDirectory} />
|
||||
<Button
|
||||
secondary
|
||||
size="s"
|
||||
on:click={() =>
|
||||
(outputDirectory =
|
||||
site?.outputDirectory ??
|
||||
selectedFramework.adapters[site.adapter]
|
||||
.defaultoutputDirectory)}>
|
||||
Reset
|
||||
</Button>
|
||||
</Layout.Stack>
|
||||
{#if showFallback}
|
||||
<InputText
|
||||
id="fallback"
|
||||
label="Fallback file"
|
||||
required
|
||||
placeholder="index.html"
|
||||
bind:value={fallback}>
|
||||
<Tooltip slot="info">
|
||||
<Icon icon={IconInfo} size="s" />
|
||||
<span slot="tooltip">
|
||||
Provide a fallback file for advanced routing and proper page
|
||||
handling in SPA mode.
|
||||
</span>
|
||||
</Tooltip>
|
||||
</InputText>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Fieldset>
|
||||
</Layout.Stack>
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { CardGrid } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, Form, InputText } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { onMount } from 'svelte';
|
||||
import { BuildRuntime, Framework, type Models } from '@appwrite.io/console';
|
||||
import { Selector } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let site: Models.Site;
|
||||
let fallback: null | string;
|
||||
|
||||
onMount(async () => {
|
||||
fallback = site.fallbackFile;
|
||||
});
|
||||
|
||||
async function updateSPA() {
|
||||
try {
|
||||
await sdk.forProject.sites.update(
|
||||
site.$id,
|
||||
site.name,
|
||||
site?.framework as Framework,
|
||||
site.enabled || undefined,
|
||||
site.timeout || undefined,
|
||||
site.installCommand || undefined,
|
||||
site.buildCommand || undefined,
|
||||
site.outputDirectory || undefined,
|
||||
(site?.buildRuntime as BuildRuntime) || undefined,
|
||||
site.adapter || undefined,
|
||||
fallback,
|
||||
site.installationId || undefined,
|
||||
site.providerRepositoryId || undefined,
|
||||
site.providerBranch || undefined,
|
||||
site.providerSilentMode || undefined,
|
||||
site.providerRootDirectory || undefined
|
||||
);
|
||||
await invalidate(Dependencies.SITE);
|
||||
addNotification({
|
||||
message: 'Settings have been updated',
|
||||
type: 'success'
|
||||
});
|
||||
trackEvent(Submit.SiteUpdateSinglePageApplication);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.SiteUpdateSinglePageApplication);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<Form onSubmit={updateSPA}>
|
||||
<CardGrid>
|
||||
<svelte:fragment slot="title">Single page application</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="aside">
|
||||
<Selector.Switch
|
||||
label="Single page application (SPA)"
|
||||
description="Provide a fallback file for advanced routing and proper page handling in SPA mode."
|
||||
checked={site.fallbackFile !== null}
|
||||
on:change={(value) => {
|
||||
if (value.detail) {
|
||||
fallback = '';
|
||||
} else {
|
||||
fallback = null;
|
||||
}
|
||||
}} />
|
||||
|
||||
{#if fallback !== null}
|
||||
<InputText
|
||||
id="fallback"
|
||||
label="Fallback file"
|
||||
required
|
||||
placeholder="index.html"
|
||||
bind:value={fallback} />
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
<Button disabled={fallback === site.fallbackFile} submit>Update</Button>
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
</Form>
|
||||
@@ -259,7 +259,7 @@
|
||||
{/if}
|
||||
<Table.Root>
|
||||
<svelte:fragment slot="header">
|
||||
<Table.Header.Cell width="180px">Key</Table.Header.Cell>
|
||||
<Table.Header.Cell width="300px">Key</Table.Header.Cell>
|
||||
<Table.Header.Cell>Value</Table.Header.Cell>
|
||||
<Table.Header.Cell width="30px" />
|
||||
</svelte:fragment>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script>
|
||||
import { Container } from '$lib/layout';
|
||||
<script lang="ts">
|
||||
import { app } from '$lib/stores/app';
|
||||
import { loading } from '$routes/store';
|
||||
import { Typography } from '@appwrite.io/pink-svelte';
|
||||
@@ -8,14 +7,13 @@
|
||||
</script>
|
||||
|
||||
<div class="auth-bg">
|
||||
<div>
|
||||
<Container size="xxl">
|
||||
<section>
|
||||
<div class="console-container">
|
||||
<slot />
|
||||
</Container>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<footer>
|
||||
<!-- TODO: change text style to eyebrow -->
|
||||
<Typography.Text size="s" color="--fgcolor-neutral-secondary">POWERED BY</Typography.Text>
|
||||
<Typography.Eyebrow color="--fgcolor-neutral-secondary">POWERED BY</Typography.Eyebrow>
|
||||
{#if $app.themeInUse === 'dark'}
|
||||
<img
|
||||
src="/console/images/appwrite-logo-dark.svg"
|
||||
@@ -46,7 +44,7 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
justify-content: space-between;
|
||||
div {
|
||||
section {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -57,6 +55,7 @@
|
||||
gap: 0.5rem;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -28,10 +28,12 @@
|
||||
<title>Preview - Appwrite</title>
|
||||
</svelte:head>
|
||||
|
||||
<Layout.Stack alignItems="center" justifyContent="center">
|
||||
<Layout.Stack direction="row" alignItems="center" justifyContent="center">
|
||||
<Spinner size="l" />
|
||||
<Layout.Stack alignItems="center" justifyContent="center" style="max-width: 400px">
|
||||
<Layout.Stack direction="row" alignItems="center" justifyContent="center" gap="s">
|
||||
<Spinner size="s" />
|
||||
<Typography.Text>Authenticating...</Typography.Text>
|
||||
</Layout.Stack>
|
||||
<Typography.Title>Please wait while we authenticate you</Typography.Title>
|
||||
<Typography.Title size="xl" align="center">
|
||||
Please wait while we verify your access
|
||||
</Typography.Title>
|
||||
</Layout.Stack>
|
||||
@@ -19,7 +19,7 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { ID, OAuthProvider } from '@appwrite.io/console';
|
||||
import { Layout } from '@appwrite.io/pink-svelte';
|
||||
import { Layout, Typography } from '@appwrite.io/pink-svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import BGDark from './bg_dark.jpg';
|
||||
import BGLight from './bg_light.jpg';
|
||||
@@ -126,90 +126,111 @@
|
||||
show
|
||||
hideFooter={state !== 'authenticated'}
|
||||
{error}>
|
||||
<span slot="description">
|
||||
{#if state === 'authenticated'}
|
||||
Request access to view this preview. You'll gain access once your request is approved.
|
||||
{/if}
|
||||
</span>
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<Layout.Stack gap="l">
|
||||
<Layout.Stack gap="xxl">
|
||||
{#if state === 'login'}
|
||||
<InputEmail
|
||||
id="email"
|
||||
label="Email"
|
||||
placeholder="Email"
|
||||
autofocus
|
||||
required
|
||||
bind:value={mail} />
|
||||
<InputPassword
|
||||
id="password"
|
||||
label="Password"
|
||||
placeholder="Password"
|
||||
required
|
||||
bind:value={pass} />
|
||||
<Button size="m" fullWidth submit>Sign in</Button>
|
||||
{#if isCloud}
|
||||
<Layout.Stack gap="l">
|
||||
<InputEmail
|
||||
id="email"
|
||||
label="Email"
|
||||
placeholder="Enter email"
|
||||
autofocus
|
||||
required
|
||||
bind:value={mail} />
|
||||
<InputPassword
|
||||
id="password"
|
||||
label="Password"
|
||||
placeholder="Enter password"
|
||||
required
|
||||
bind:value={pass} />
|
||||
</Layout.Stack>
|
||||
|
||||
<Layout.Stack gap="l">
|
||||
<Button size="m" fullWidth submit>Sign in</Button>
|
||||
<span class="with-separators eyebrow-heading-3">or</span>
|
||||
<Button size="m" secondary fullWidth on:click={onGithubAuth}>
|
||||
<span class="icon-github" aria-hidden="true" />
|
||||
<span class="text">Sign in with GitHub</span>
|
||||
{#if isCloud}
|
||||
<Button size="m" secondary fullWidth on:click={onGithubAuth}>
|
||||
<span class="icon-github" aria-hidden="true" />
|
||||
<span class="text">Sign in with GitHub</span>
|
||||
</Button>
|
||||
{/if}
|
||||
<Button size="m" text fullWidth on:click={() => (state = 'register')}>
|
||||
Sign up instead
|
||||
</Button>
|
||||
{/if}
|
||||
<Button size="m" text fullWidth on:click={() => (state = 'register')}>
|
||||
Sign up instead
|
||||
</Button>
|
||||
</Layout.Stack>
|
||||
{:else if state === 'register'}
|
||||
<InputText
|
||||
id="name"
|
||||
label="Name"
|
||||
placeholder="Your name"
|
||||
autofocus
|
||||
required
|
||||
bind:value={name} />
|
||||
<InputEmail
|
||||
id="email"
|
||||
label="Email"
|
||||
placeholder="Email"
|
||||
required
|
||||
bind:value={mail} />
|
||||
<InputPassword
|
||||
id="password"
|
||||
label="Password"
|
||||
placeholder="Password"
|
||||
required
|
||||
bind:value={pass} />
|
||||
<InputChoice required value={terms} id="terms" label="terms" showLabel={false}>
|
||||
By registering, you agree that you have read, understand, and acknowledge our <a
|
||||
class="link"
|
||||
href="https://appwrite.io/privacy"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
Privacy Policy</a>
|
||||
and accept our
|
||||
<a
|
||||
class="link"
|
||||
href="https://appwrite.io/terms"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">General Terms of Use</a
|
||||
>.</InputChoice>
|
||||
<Button size="m" fullWidth submit>Sign up</Button>
|
||||
{#if isCloud}
|
||||
<Layout.Stack gap="l">
|
||||
<InputText
|
||||
id="name"
|
||||
label="Name"
|
||||
placeholder="Enter name"
|
||||
autofocus
|
||||
required
|
||||
bind:value={name} />
|
||||
<InputEmail
|
||||
id="email"
|
||||
label="Email"
|
||||
placeholder="Enter email"
|
||||
required
|
||||
bind:value={mail} />
|
||||
<InputPassword
|
||||
id="password"
|
||||
label="Password"
|
||||
placeholder="Enter password"
|
||||
required
|
||||
bind:value={pass} />
|
||||
|
||||
<InputChoice required value={terms} id="terms" label="terms" showLabel={false}>
|
||||
By registering, you agree that you have read, understand, and acknowledge
|
||||
our <a
|
||||
class="link"
|
||||
href="https://appwrite.io/privacy"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
Privacy Policy</a>
|
||||
and accept our
|
||||
<a
|
||||
class="link"
|
||||
href="https://appwrite.io/terms"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">General Terms of Use</a
|
||||
>.</InputChoice>
|
||||
</Layout.Stack>
|
||||
|
||||
<Layout.Stack gap="l">
|
||||
<Button size="m" fullWidth submit>Sign up</Button>
|
||||
<span class="with-separators eyebrow-heading-3">or</span>
|
||||
<Button size="m" secondary fullWidth on:click={onGithubAuth}>
|
||||
<span class="icon-github" aria-hidden="true" />
|
||||
<span class="text">Continue with GitHub</span>
|
||||
{#if isCloud}
|
||||
<Button size="m" secondary fullWidth on:click={onGithubAuth}>
|
||||
<span class="icon-github" aria-hidden="true" />
|
||||
<span class="text">Continue with GitHub</span>
|
||||
</Button>
|
||||
{/if}
|
||||
<Button size="m" text fullWidth on:click={() => (state = 'login')}>
|
||||
Sign in instead
|
||||
</Button>
|
||||
{/if}
|
||||
<Button size="m" text fullWidth on:click={() => (state = 'login')}>
|
||||
Sign in instead
|
||||
</Button>
|
||||
</Layout.Stack>
|
||||
{:else if state === 'authenticated'}
|
||||
<Card isTile>
|
||||
<Card isTile variant="secondary" radius="s" padding="s">
|
||||
<Layout.Stack gap="xxs">
|
||||
<p>
|
||||
You're signed in as <b>{data.account.email}</b>
|
||||
</p>
|
||||
<Layout.Stack direction="row" gap="xxs">
|
||||
<Typography.Text variant="m-400">You're signed in as</Typography.Text>
|
||||
|
||||
<Typography.Text variant="m-500">
|
||||
{data.account.email}
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
<Link
|
||||
size="s"
|
||||
variant="muted"
|
||||
on:click={() => {
|
||||
logout();
|
||||
logout(false);
|
||||
state = 'login';
|
||||
}}>Swith account</Link>
|
||||
}}>Switch account</Link>
|
||||
</Layout.Stack>
|
||||
</Card>
|
||||
{/if}
|
||||
|
||||
Reference in new issue
Block a user