mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
feat: initial commit testing
This commit is contained in:
@@ -10,6 +10,9 @@ export { default as Shell } from './shell.svelte';
|
||||
export { default as Logs } from './logs.svelte';
|
||||
export { default as Wizard } from './wizard.svelte';
|
||||
export { default as WizardStep } from './wizardStep.svelte';
|
||||
export { default as WizardHeader } from './wizardHeader.svelte';
|
||||
export { default as WizardPage } from './wizardPage.svelte';
|
||||
export { default as WizardMainWrapper } from './wizardMainWrapper.svelte';
|
||||
export { default as Breadcrumbs } from './breadcrumbs.svelte';
|
||||
export { default as Unauthenticated } from './unauthenticated.svelte';
|
||||
export { default as Usage, type UsagePeriods } from './usage.svelte';
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
number,
|
||||
{
|
||||
label: string;
|
||||
component: typeof SvelteComponent<unknown>;
|
||||
component?: typeof SvelteComponent<unknown>;
|
||||
href?: string;
|
||||
optional?: boolean;
|
||||
disabled?: boolean;
|
||||
}
|
||||
@@ -19,6 +20,8 @@
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import { createEventDispatcher, type SvelteComponent } from 'svelte';
|
||||
import WizardExitModal from './wizardExitModal.svelte';
|
||||
import WizardHeader from './wizardHeader.svelte';
|
||||
import WizardMainWrapper from './wizardMainWrapper.svelte';
|
||||
|
||||
export let title: string;
|
||||
export let steps: WizardStepsType;
|
||||
@@ -132,24 +135,8 @@
|
||||
|
||||
<svelte:window on:keydown={handleKeydown} />
|
||||
|
||||
<section class="wizard">
|
||||
<div class="wizard-header-strip" />
|
||||
<div class="wizard-start-bg" />
|
||||
<div class="wizard-end-bg" />
|
||||
|
||||
<header class="wizard-header">
|
||||
<div class="body-text-1 u-bold">{title}</div>
|
||||
|
||||
<slot name="header" />
|
||||
<button
|
||||
class="button is-text is-only-icon u-margin-inline-start-auto"
|
||||
style="--button-size:1.5rem;"
|
||||
aria-label="close wizard"
|
||||
on:click={handleExit}>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<WizardMainWrapper>
|
||||
<WizardHeader {title} on:click={handleExit} />
|
||||
<aside class="wizard-side">
|
||||
<slot name="aside">
|
||||
<Steps
|
||||
@@ -195,7 +182,7 @@
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
</section>
|
||||
</WizardMainWrapper>
|
||||
|
||||
{#if showExitModal}
|
||||
<WizardExitModal
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<script lang="ts">
|
||||
export let title: string;
|
||||
export let header: string = '';
|
||||
export let href: string = null;
|
||||
</script>
|
||||
|
||||
<header class="wizard-header">
|
||||
<div class="body-text-1 u-bold">{title}</div>
|
||||
|
||||
{#if header}
|
||||
{header}
|
||||
{:else}
|
||||
<slot name="header" />
|
||||
{/if}
|
||||
|
||||
{#if href}
|
||||
<a
|
||||
class="button is-text is-only-icon u-margin-inline-start-auto"
|
||||
style="--button-size:1.5rem;"
|
||||
{href}
|
||||
aria-label="close wizard">
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</a>
|
||||
{:else}
|
||||
<button
|
||||
class="button is-text is-only-icon u-margin-inline-start-auto"
|
||||
style="--button-size:1.5rem;"
|
||||
aria-label="close wizard"
|
||||
on:click>
|
||||
<span class="icon-x" aria-hidden="true" />
|
||||
</button>
|
||||
{/if}
|
||||
</header>
|
||||
@@ -0,0 +1,6 @@
|
||||
<section class="wizard">
|
||||
<div class="wizard-header-strip" />
|
||||
<div class="wizard-start-bg" />
|
||||
<div class="wizard-end-bg" />
|
||||
<slot />
|
||||
</section>
|
||||
@@ -0,0 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { Form } from '$lib/elements/forms';
|
||||
|
||||
export let submit: (e: Event) => void | Promise<void>;
|
||||
</script>
|
||||
|
||||
<div class="wizard-main">
|
||||
<Form noStyle onSubmit={submit}>
|
||||
<slot />
|
||||
</Form>
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
export async function load() {
|
||||
return {
|
||||
wizardTitle: 'page 1'
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
test
|
||||
@@ -0,0 +1,5 @@
|
||||
<script>
|
||||
import WizardHeader from '$lib/layout/wizardHeader.svelte';
|
||||
</script>
|
||||
|
||||
<WizardHeader title="test" on:exit={handleExit} />
|
||||
@@ -0,0 +1,38 @@
|
||||
<script lang="ts">
|
||||
import { afterNavigate } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { WizardHeader, WizardMainWrapper } from '$lib/layout';
|
||||
|
||||
function handleExit() {
|
||||
console.log('test');
|
||||
}
|
||||
|
||||
let previousPage: string = base;
|
||||
afterNavigate(({ from }) => {
|
||||
previousPage = from?.url?.pathname || previousPage;
|
||||
});
|
||||
|
||||
$: console.log(previousPage);
|
||||
</script>
|
||||
|
||||
<WizardMainWrapper>
|
||||
<WizardHeader title={$page.data.wizardTitle} on:click={handleExit} />
|
||||
|
||||
<!-- <aside class="wizard-side">
|
||||
<slot name="aside">
|
||||
<Steps
|
||||
on:step={handleStepClick}
|
||||
steps={sortedSteps.map(([, { label, optional, disabled }]) => ({
|
||||
text: label,
|
||||
optional,
|
||||
disabled
|
||||
}))}
|
||||
currentStep={$wizard.step} />
|
||||
</slot>
|
||||
</aside> -->
|
||||
|
||||
<div class="wizard-main">
|
||||
<slot />
|
||||
</div>
|
||||
</WizardMainWrapper>
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
<script lang="ts">
|
||||
import { Alert, CustomId } from '$lib/components';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { Button, FormList, InputFile } from '$lib/elements/forms';
|
||||
import { humanFileSize, sizeToBytes } from '$lib/helpers/sizeConvertion';
|
||||
import WizardStep from '$lib/layout/wizardStep.svelte';
|
||||
import { getServiceLimit, tierToPlan } from '$lib/stores/billing';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import { isCloud } from '$lib/system';
|
||||
import ChangeOrganizationTierCloud from '$routes/console/changeOrganizationTierCloud.svelte';
|
||||
import { bucket } from '../../../store';
|
||||
import { createFile } from '../../store';
|
||||
|
||||
let showCustomId = false;
|
||||
const service = getServiceLimit('fileSize');
|
||||
</script>
|
||||
|
||||
<WizardStep>
|
||||
<svelte:fragment slot="title">Create file</svelte:fragment>
|
||||
<svelte:fragment slot="subtitle">Upload a file to add it to your bucket.</svelte:fragment>
|
||||
|
||||
{#if isCloud}
|
||||
{@const size = humanFileSize(sizeToBytes(service, 'MB', 1000))}
|
||||
{@const plan = tierToPlan($organization?.billingPlan)}
|
||||
<Alert type="info">
|
||||
<p class="text">
|
||||
The {plan.name} plan has a maximum upload file size limit of {Math.floor(
|
||||
parseInt(size.value)
|
||||
)}{size.unit}.
|
||||
{#if $organization?.billingPlan === BillingPlan.STARTER}
|
||||
Upgrade to allow files of a larger size.
|
||||
{/if}
|
||||
</p>
|
||||
<svelte:fragment slot="action">
|
||||
{#if $organization?.billingPlan === BillingPlan.STARTER}
|
||||
<div class="alert-buttons u-flex">
|
||||
<Button text on:click={() => wizard.start(ChangeOrganizationTierCloud)}>
|
||||
Upgrade plan
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</Alert>
|
||||
{/if}
|
||||
|
||||
<FormList class="u-margin-block-start-24">
|
||||
<div class="u-width-full-line u-overflow-hidden">
|
||||
<InputFile
|
||||
required
|
||||
bind:files={$createFile.files}
|
||||
allowedFileExtensions={$bucket.allowedFileExtensions}
|
||||
maxSize={$bucket.maximumFileSize} />
|
||||
</div>
|
||||
|
||||
{#if !showCustomId}
|
||||
<div>
|
||||
<Pill button on:click={() => (showCustomId = !showCustomId)}>
|
||||
<span class="icon-pencil" aria-hidden="true" /><span class="text">
|
||||
File ID
|
||||
</span>
|
||||
</Pill>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="custom-id-wrapper">
|
||||
<CustomId bind:show={showCustomId} name="File" bind:id={$createFile.id} />
|
||||
</div>
|
||||
{/if}
|
||||
</FormList>
|
||||
</WizardStep>
|
||||
|
||||
<style lang="scss">
|
||||
.custom-id-wrapper :global(.is-inner-modal) {
|
||||
inline-size: auto;
|
||||
}
|
||||
</style>
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<script lang="ts">
|
||||
import Alert from '$lib/components/alert.svelte';
|
||||
import Permissions from '$lib/components/permissions/permissions.svelte';
|
||||
import WizardStep from '$lib/layout/wizardStep.svelte';
|
||||
import { bucket } from '../../../store';
|
||||
import { createFile } from '../../store';
|
||||
</script>
|
||||
|
||||
<WizardStep>
|
||||
<svelte:fragment slot="title">Update Permissions</svelte:fragment>
|
||||
<svelte:fragment slot="subtitle">
|
||||
Choose who can access your buckets and files. For more information, check out the
|
||||
<a
|
||||
href="https://appwrite.io/docs/advanced/platform/permissions"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="link">
|
||||
Permissions Guide
|
||||
</a>.</svelte:fragment>
|
||||
|
||||
{#if $bucket.fileSecurity}
|
||||
<div class="common-section">
|
||||
<Alert type="info">
|
||||
<svelte:fragment slot="title">File security enabled</svelte:fragment>
|
||||
Users will be able to access this file if they have been granted
|
||||
<b>either File or Bucket permissions</b>.
|
||||
</Alert>
|
||||
</div>
|
||||
<div class="common-section">
|
||||
<Permissions bind:permissions={$createFile.permissions} />
|
||||
</div>
|
||||
{:else}
|
||||
<Alert type="info">
|
||||
<svelte:fragment slot="title">File security disabled</svelte:fragment>
|
||||
If you want to assign file permissions, navigate to Bucket settings and enable file security.
|
||||
Otherwise, only Bucket permissions will be used.
|
||||
</Alert>
|
||||
{/if}
|
||||
</WizardStep>
|
||||
@@ -0,0 +1,17 @@
|
||||
import { get } from 'svelte/store';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
export async function load({ params }) {
|
||||
const bucket = get(page)?.data?.bucket;
|
||||
|
||||
if (!bucket) {
|
||||
return {
|
||||
bucket: await sdk.forProject.storage.getBucket(params.bucket)
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
bucket
|
||||
};
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { WizardHeader, WizardMainWrapper } from '$lib/layout';
|
||||
</script>
|
||||
|
||||
<WizardMainWrapper>
|
||||
<WizardHeader
|
||||
title="Create File"
|
||||
href={`${base}/console/project-${$page.params.project}/storage/bucket-${$page.params.bucket}`} />
|
||||
|
||||
<!-- <aside class="wizard-side">
|
||||
<slot name="aside">
|
||||
<Steps
|
||||
on:step={handleStepClick}
|
||||
steps={sortedSteps.map(([, { label, optional, disabled }]) => ({
|
||||
text: label,
|
||||
optional,
|
||||
disabled
|
||||
}))}
|
||||
currentStep={$wizard.step} />
|
||||
</slot>
|
||||
</aside> -->
|
||||
|
||||
<div class="wizard-main">
|
||||
<slot />
|
||||
</div>
|
||||
</WizardMainWrapper>
|
||||
Reference in New Issue
Block a user