mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge branch 'feat-pink-v2' of https://github.com/appwrite/console into feat-pink-v2
This commit is contained in:
commit
9c2796a3dc
58 files changed
+1076
-663
No files matched your search
+1
-1
@@ -8,7 +8,7 @@
|
||||
"build": "node build.js",
|
||||
"preview": "vite preview",
|
||||
"sync": "svelte-kit sync",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings --threshold warning --workspace",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings --threshold warning",
|
||||
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"lint": "prettier --check . && eslint .",
|
||||
"format": "prettier --write .",
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<script lang="ts">
|
||||
import { getUTCOffset, timeFromNow, toLocaleDateTime } from '$lib/helpers/date';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import { Badge, InteractiveText, Layout, Popover, Typography } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let time: string = '';
|
||||
export let placement: any | string = 'bottom-end';
|
||||
|
||||
function timeDifference(dateString: string): string {
|
||||
const SECONDS_IN_MINUTE = 60;
|
||||
const SECONDS_IN_HOUR = SECONDS_IN_MINUTE * 60;
|
||||
const SECONDS_IN_DAY = SECONDS_IN_HOUR * 24;
|
||||
const SECONDS_IN_MONTH = SECONDS_IN_DAY * 30;
|
||||
|
||||
const now = new Date();
|
||||
const pastDate = new Date(dateString);
|
||||
|
||||
if (isNaN(pastDate.getTime())) return 'Invalid time';
|
||||
|
||||
const diffInSeconds = Math.floor((now.getTime() - pastDate.getTime()) / 1000);
|
||||
|
||||
const timeParts = [
|
||||
{ label: 'month', value: Math.floor(diffInSeconds / SECONDS_IN_MONTH) },
|
||||
{ label: 'day', value: Math.floor(diffInSeconds / SECONDS_IN_DAY) % 30 },
|
||||
{ label: 'hour', value: Math.floor(diffInSeconds / SECONDS_IN_HOUR) % 24 },
|
||||
{ label: 'minute', value: Math.floor(diffInSeconds / SECONDS_IN_MINUTE) % 60 }
|
||||
];
|
||||
|
||||
const formattedTime = timeParts
|
||||
.filter((unit) => unit.value > 0)
|
||||
.slice(0, 3)
|
||||
.map((unit) => `${unit.value} ${unit.label}${unit.value > 1 ? 's' : ''}`)
|
||||
.join(', ');
|
||||
|
||||
return formattedTime ? `${formattedTime} ago` : 'Just now';
|
||||
}
|
||||
|
||||
$: timeToString = time ? timeDifference(time) : 'Invalid time';
|
||||
</script>
|
||||
|
||||
<Popover let:toggle {placement} portal>
|
||||
<button on:mouseenter={(e) => toggle(e)}>
|
||||
<slot>{capitalize(timeFromNow(time))}</slot>
|
||||
</button>
|
||||
|
||||
<Layout.Stack gap="m" alignContent="flex-start" slot="tooltip">
|
||||
<Typography.Text color="--fgcolor-neutral-tertiary" variant="m-400"
|
||||
>{timeToString}</Typography.Text>
|
||||
|
||||
<Layout.Stack gap="xxs">
|
||||
<Layout.Stack direction="row" justifyContent="space-between">
|
||||
<Typography.Text variant="m-400">
|
||||
<InteractiveText
|
||||
variant="copy"
|
||||
text={toLocaleDateTime(time, 'UTC')}
|
||||
isVisible />
|
||||
</Typography.Text>
|
||||
<Badge variant="secondary" content="UTC" size="xs" />
|
||||
</Layout.Stack>
|
||||
|
||||
<Layout.Stack direction="row" justifyContent="space-between">
|
||||
<Typography.Text variant="m-400">
|
||||
<InteractiveText variant="copy" text={toLocaleDateTime(time)} isVisible />
|
||||
</Typography.Text>
|
||||
|
||||
<Badge variant="secondary" content="UTC{getUTCOffset()}" size="xs" />
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Popover>
|
||||
@@ -5,12 +5,12 @@
|
||||
import { ID, Query, Permission, Role } from '@appwrite.io/console';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { calculateSize } from '$lib/helpers/sizeConvertion';
|
||||
import { toLocaleDate } from '$lib/helpers/date';
|
||||
import InputSearch from '$lib/elements/forms/inputSearch.svelte';
|
||||
import { writable } from 'svelte/store';
|
||||
import { onMount } from 'svelte';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import DualTimeView from './dualTimeView.svelte';
|
||||
import {
|
||||
Layout,
|
||||
Typography,
|
||||
@@ -318,7 +318,7 @@
|
||||
{calculateSize(file.sizeOriginal)}
|
||||
</Table.Cell>
|
||||
<Table.Cell column="created" {root}>
|
||||
{toLocaleDate(file.$createdAt)}
|
||||
<DualTimeView time={file.$createdAt} />
|
||||
</Table.Cell>
|
||||
</Table.Row.Button>
|
||||
{/each}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<script lang="ts">
|
||||
import Link from '$lib/elements/link.svelte';
|
||||
import { timeFromNow, toLocaleDateTime } from '$lib/helpers/date';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { Tooltip } from '@appwrite.io/pink-svelte';
|
||||
import { timeFromNow, toLocaleDateTime } from '$lib/helpers/date';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
|
||||
export let deployment: Models.Deployment;
|
||||
</script>
|
||||
@@ -19,11 +20,6 @@
|
||||
by <Link href={deployment.providerCommitAuthorUrl} external
|
||||
>{deployment.providerCommitAuthor}</Link>
|
||||
{:else}
|
||||
<Tooltip>
|
||||
<span>
|
||||
{capitalize(timeFromNow(deployment.$updatedAt))}
|
||||
</span>
|
||||
<span slot="tooltip">{toLocaleDateTime(deployment.$updatedAt)}</span>
|
||||
</Tooltip>
|
||||
<DualTimeView time={deployment.$updatedAt} />
|
||||
{/if}
|
||||
</p>
|
||||
@@ -3,7 +3,6 @@
|
||||
import { disableCommands } from '$lib/commandCenter';
|
||||
import { beforeNavigate } from '$app/navigation';
|
||||
import { Alert, Layout, Modal } from '@appwrite.io/pink-svelte';
|
||||
import { Click, trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
export let show = false;
|
||||
export let error: string = null;
|
||||
@@ -13,7 +12,6 @@
|
||||
};
|
||||
export let title = '';
|
||||
export let hideFooter = false;
|
||||
export let submitOnEnter = true;
|
||||
|
||||
let alert: HTMLElement;
|
||||
let formComponent: Form;
|
||||
@@ -22,16 +20,6 @@
|
||||
show = false;
|
||||
});
|
||||
|
||||
function handleKeydown(event: KeyboardEvent) {
|
||||
if (show && event.key === 'Enter' && submitOnEnter) {
|
||||
event.preventDefault();
|
||||
if (show) {
|
||||
formComponent.triggerSubmit();
|
||||
trackEvent(Click.SubmitFormClick, { from: 'enter' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$: $disableCommands(show);
|
||||
|
||||
$: if (error) {
|
||||
@@ -39,8 +27,6 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:window on:keydown={handleKeydown} />
|
||||
|
||||
<Form isModal {onSubmit} bind:this={formComponent}>
|
||||
<Modal {title} bind:open={show} {hideFooter} {dismissible}>
|
||||
<slot slot="description" name="description" />
|
||||
|
||||
+13
-1
@@ -31,7 +31,10 @@ export const toLocaleDate = (datetime: string) => {
|
||||
return date.toLocaleDateString('en', options);
|
||||
};
|
||||
|
||||
export const toLocaleDateTime = (datetime: string | number) => {
|
||||
export const toLocaleDateTime = (
|
||||
datetime: string | number,
|
||||
timeZone: string | undefined = undefined
|
||||
) => {
|
||||
const date = new Date(datetime);
|
||||
|
||||
if (isNaN(date.getTime())) {
|
||||
@@ -39,6 +42,7 @@ export const toLocaleDateTime = (datetime: string | number) => {
|
||||
}
|
||||
|
||||
const options: Intl.DateTimeFormatOptions = {
|
||||
timeZone,
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
@@ -181,3 +185,11 @@ export function getTomorrow(date: Date) {
|
||||
|
||||
return tomorrow;
|
||||
}
|
||||
|
||||
export function getUTCOffset(): string {
|
||||
const offsetMinutes = -new Date().getTimezoneOffset();
|
||||
const hours = Math.floor(offsetMinutes / 60);
|
||||
const minutes = Math.abs(offsetMinutes % 60);
|
||||
|
||||
return `${hours >= 0 ? '+' : ''}${hours}${minutes ? `:${minutes.toString().padStart(2, '0')}` : ''}`;
|
||||
}
|
||||
+40
-43
@@ -58,7 +58,6 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { Container } from '$lib/layout';
|
||||
import { BarChart } from '$lib/charts';
|
||||
import { formatNumberWithCommas } from '$lib/helpers/numbers';
|
||||
import { Card } from '$lib/components';
|
||||
@@ -81,52 +80,50 @@
|
||||
export let hidePeriodSelect = false;
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
<Layout.Stack gap="s">
|
||||
{#if !hidePeriodSelect}
|
||||
<div
|
||||
style:max-width="250px"
|
||||
style:--input-background-color="var(--bgcolor-neutral-primary)">
|
||||
<InputSelect
|
||||
on:change={(e) => goto(`${path}/${e.detail}`)}
|
||||
id="period"
|
||||
options={[
|
||||
<Layout.Stack gap="s">
|
||||
{#if !hidePeriodSelect}
|
||||
<div
|
||||
style:max-width="250px"
|
||||
style:--input-background-color="var(--bgcolor-neutral-primary)">
|
||||
<InputSelect
|
||||
on:change={(e) => goto(`${path}/${e.detail}`)}
|
||||
id="period"
|
||||
options={[
|
||||
{
|
||||
label: '24 hours',
|
||||
value: '24h'
|
||||
},
|
||||
{
|
||||
label: '30 days',
|
||||
value: '30d'
|
||||
},
|
||||
{
|
||||
label: '90 days',
|
||||
value: '90d'
|
||||
}
|
||||
]}
|
||||
value={$page.params.period ?? '30d'} />
|
||||
</div>
|
||||
{/if}
|
||||
<Card>
|
||||
{#if count}
|
||||
<Layout.Stack gap="xs">
|
||||
<Typography.Title>{formatNumberWithCommas(total)}</Typography.Title>
|
||||
<Typography.Text>{countMetadata.title}</Typography.Text>
|
||||
</Layout.Stack>
|
||||
<div class="chart-container">
|
||||
<BarChart
|
||||
formatted={$page.params.period === '24h' ? 'hours' : 'days'}
|
||||
series={[
|
||||
{
|
||||
label: '24 hours',
|
||||
value: '24h'
|
||||
},
|
||||
{
|
||||
label: '30 days',
|
||||
value: '30d'
|
||||
},
|
||||
{
|
||||
label: '90 days',
|
||||
value: '90d'
|
||||
name: countMetadata.legend,
|
||||
data: accumulateFromEndingTotal(count, total)
|
||||
}
|
||||
]}
|
||||
value={$page.params.period ?? '30d'} />
|
||||
]} />
|
||||
</div>
|
||||
{/if}
|
||||
<Card>
|
||||
{#if count}
|
||||
<Layout.Stack gap="xs">
|
||||
<Typography.Title>{formatNumberWithCommas(total)}</Typography.Title>
|
||||
<Typography.Text>{countMetadata.title}</Typography.Text>
|
||||
</Layout.Stack>
|
||||
<div class="chart-container">
|
||||
<BarChart
|
||||
formatted={$page.params.period === '24h' ? 'hours' : 'days'}
|
||||
series={[
|
||||
{
|
||||
name: countMetadata.legend,
|
||||
data: accumulateFromEndingTotal(count, total)
|
||||
}
|
||||
]} />
|
||||
</div>
|
||||
{/if}
|
||||
</Card>
|
||||
</Layout.Stack>
|
||||
</Container>
|
||||
</Card>
|
||||
</Layout.Stack>
|
||||
|
||||
<style lang="scss">
|
||||
.chart-container {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { Container } from '$lib/layout';
|
||||
import { BarChart, Legend, type LegendData } from '$lib/charts';
|
||||
import { accumulateFromEndingTotal } from '$lib/layout/usage.svelte';
|
||||
import { Card, SecondaryTabs, SecondaryTabsItem } from '$lib/components';
|
||||
@@ -14,10 +13,9 @@
|
||||
export let count: Models.Metric[][];
|
||||
export let legendData: LegendData[];
|
||||
export let showHeader: boolean = true;
|
||||
export let overlapContainerCover = false;
|
||||
</script>
|
||||
|
||||
<Container overlapCover={overlapContainerCover}>
|
||||
<div>
|
||||
{#if showHeader}
|
||||
<div class="u-flex u-main-space-between common-section">
|
||||
<Typography.Title>{title}</Typography.Title>
|
||||
@@ -66,7 +64,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
</Card>
|
||||
</Container>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.multiple-chart-container {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
hideFooter?: boolean;
|
||||
column?: boolean;
|
||||
columnSize?: 's' | 'm' | 'l';
|
||||
stickySide?: boolean;
|
||||
onExit?: () => void;
|
||||
}
|
||||
| {
|
||||
@@ -26,6 +27,7 @@
|
||||
hideFooter?: boolean;
|
||||
column?: boolean;
|
||||
columnSize?: 's' | 'm' | 'l';
|
||||
stickySide?: boolean;
|
||||
onExit?: () => void;
|
||||
};
|
||||
|
||||
@@ -37,6 +39,7 @@
|
||||
export let hideFooter = false;
|
||||
export let column: $$Props['column'] = false;
|
||||
export let columnSize: $$Props['columnSize'] = 'm';
|
||||
export let stickySide: $$Props['stickySide'] = false;
|
||||
export let onExit: $$Props['onExit'] = undefined;
|
||||
|
||||
function handleKeydown(event: KeyboardEvent) {
|
||||
@@ -57,32 +60,32 @@
|
||||
|
||||
<svelte:window on:keydown={handleKeydown} />
|
||||
|
||||
<div class="wizard-position">
|
||||
<Layout.Wizard
|
||||
{title}
|
||||
{invertColumns}
|
||||
{column}
|
||||
{columnSize}
|
||||
{hideFooter}
|
||||
href={confirmExit ? null : href}
|
||||
buttonMethod={() => {
|
||||
if (confirmExit) {
|
||||
showExitModal = true;
|
||||
} else {
|
||||
trackEvent('wizard_exit', {
|
||||
from: 'button'
|
||||
});
|
||||
}
|
||||
}}>
|
||||
<slot />
|
||||
<svelte:fragment slot="aside">
|
||||
<slot name="aside" />
|
||||
</svelte:fragment>
|
||||
<svelte:fragment slot="footer">
|
||||
<slot name="footer" />
|
||||
</svelte:fragment>
|
||||
</Layout.Wizard>
|
||||
</div>
|
||||
<Layout.Wizard
|
||||
{title}
|
||||
{invertColumns}
|
||||
{column}
|
||||
{columnSize}
|
||||
{stickySide}
|
||||
{hideFooter}
|
||||
href={confirmExit ? null : href}
|
||||
buttonMethod={() => {
|
||||
if (confirmExit) {
|
||||
showExitModal = true;
|
||||
} else {
|
||||
goto(href);
|
||||
trackEvent('wizard_exit', {
|
||||
from: 'button'
|
||||
});
|
||||
}
|
||||
}}>
|
||||
<slot />
|
||||
<svelte:fragment slot="aside">
|
||||
<slot name="aside" />
|
||||
</svelte:fragment>
|
||||
<svelte:fragment slot="footer">
|
||||
<slot name="footer" />
|
||||
</svelte:fragment>
|
||||
</Layout.Wizard>
|
||||
|
||||
{#if showExitModal}
|
||||
<WizardExitModal
|
||||
@@ -107,22 +110,3 @@
|
||||
</slot>
|
||||
</WizardExitModal>
|
||||
{/if}
|
||||
|
||||
<style lang="scss">
|
||||
.wizard-position {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 50;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-height: 100dvh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
// :global(html) {
|
||||
// overflow-y: hidden;
|
||||
// }
|
||||
</style>
|
||||
@@ -11,6 +11,7 @@
|
||||
import { oAuthProviders } from '$lib/stores/oauth-providers';
|
||||
import { Card, Empty, Icon, Layout, Table } from '@appwrite.io/pink-svelte';
|
||||
import { IconTrash } from '@appwrite.io/pink-icons-svelte';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
|
||||
async function deleteIdentity(id: string) {
|
||||
try {
|
||||
@@ -78,7 +79,7 @@
|
||||
{identity.providerEmail}
|
||||
</Table.Cell>
|
||||
<Table.Cell column="createdAt" {root}>
|
||||
{toLocaleDateTime(identity.$createdAt)}
|
||||
<DualTimeView time={identity.$createdAt} />
|
||||
</Table.Cell>
|
||||
<Table.Cell column="expiryDate" {root}>
|
||||
{toLocaleDateTime(identity.providerAccessTokenExpiry)}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { Click, Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { CardGrid } from '$lib/components';
|
||||
import { BillingPlan, Dependencies } from '$lib/constants';
|
||||
import { Button, Form, FormList, InputNumber, InputSwitch } from '$lib/elements/forms';
|
||||
import { Button, Form, InputNumber, InputSwitch } from '$lib/elements/forms';
|
||||
import { showUsageRatesModal, upgradeURL } from '$lib/stores/billing';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { organization, currentPlan } from '$lib/stores/organization';
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
<svelte:fragment slot="tooltip" let:toggle>
|
||||
<ActionMenu.Root>
|
||||
<!-- {#if domain.status !== 'verified'}
|
||||
{#if domain.nameservers !== 'Appwrite'}
|
||||
<ActionMenu.Item.Button
|
||||
leadingIcon={IconRefresh}
|
||||
on:click={(e) => {
|
||||
@@ -117,13 +117,16 @@
|
||||
selectedDomain = domain;
|
||||
showRetry = true;
|
||||
toggle(e);
|
||||
trackEvent(Click.DomainRetryDomainVerificationClick, {
|
||||
source: 'organization_domain_overview'
|
||||
});
|
||||
trackEvent(
|
||||
Click.DomainRetryDomainVerificationClick,
|
||||
{
|
||||
source: 'organization_domain_overview'
|
||||
}
|
||||
);
|
||||
}}>
|
||||
Retry
|
||||
</ActionMenu.Item.Button>
|
||||
{/if} -->
|
||||
{/if}
|
||||
<ActionMenu.Item.Button
|
||||
status="danger"
|
||||
leadingIcon={IconTrash}
|
||||
@@ -201,6 +204,6 @@
|
||||
<DeleteDomainModal bind:show={showDelete} {selectedDomain} />
|
||||
{/if}
|
||||
|
||||
<!-- {#if showRetry}
|
||||
{#if showRetry}
|
||||
<RetryDomainModal show={showRetry} {selectedDomain} />
|
||||
{/if} -->
|
||||
{/if}
|
||||
@@ -12,7 +12,7 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import type { Domain } from '$lib/sdk/domains';
|
||||
|
||||
const backPage = `${base}/project-${$page.params.organization}/domains`;
|
||||
const backPage = `${base}/organization-${$page.params.organization}/domains`;
|
||||
|
||||
let domainName = '';
|
||||
let domain: Domain;
|
||||
@@ -31,7 +31,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Wizard title="Add domain" href={backPage} column columnSize="s" hideFooter={!domain}>
|
||||
<Wizard title="Add domain" href={backPage} column columnSize="s" hideFooter>
|
||||
{#if domain}
|
||||
<RecordsCard {domain} />
|
||||
{:else}
|
||||
@@ -54,11 +54,4 @@
|
||||
</Form>
|
||||
</Fieldset>
|
||||
{/if}
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text href={backPage}>Cancel</Button>
|
||||
{#if domain}
|
||||
<Button secondary href={backPage}>Skip to console</Button>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</Wizard>
|
||||
+2
-4
@@ -18,7 +18,7 @@
|
||||
import { IconDownload, IconPlus, IconUpload } from '@appwrite.io/pink-icons-svelte';
|
||||
import { ViewSelector } from '$lib/components';
|
||||
import { View } from '$lib/helpers/load';
|
||||
import { columns } from './store';
|
||||
import { columns, presets } from './store';
|
||||
import CreateRecordModal from './createRecordModal.svelte';
|
||||
import Table from './table.svelte';
|
||||
import AddPresetModal from './addPresetModal.svelte';
|
||||
@@ -30,8 +30,6 @@
|
||||
let showPresetModal = false;
|
||||
let showImportModal = false;
|
||||
let selectedPreset = '';
|
||||
|
||||
const presets = ['Zoho', 'Mailgun', 'Outlook', 'Proton Mail', 'iCloud', 'Google Workspace'];
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
@@ -54,7 +52,7 @@
|
||||
</Tooltip>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack direction="row" gap="s" inline>
|
||||
<ViewSelector view={View.Table} {columns} hideView allowNoColumns />
|
||||
<ViewSelector view={View.Table} {columns} hideView />
|
||||
<Popover let:toggle padding="none">
|
||||
<Button secondary on:click={toggle}>Add preset</Button>
|
||||
<svelte:fragment slot="tooltip" let:toggle>
|
||||
|
||||
+39
-6
@@ -7,23 +7,57 @@
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { page } from '$app/stores';
|
||||
import type { DnsRecordsList } from '$lib/sdk/domains';
|
||||
import { presets } from './store';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
|
||||
export let show = false;
|
||||
export let selectedPreset;
|
||||
export let selectedPreset: (typeof presets)[number];
|
||||
let records: DnsRecordsList;
|
||||
let error = '';
|
||||
|
||||
async function fetchPreset() {
|
||||
switch (selectedPreset.toLowerCase()) {
|
||||
//TODO: finish switch statement
|
||||
case 'zoho':
|
||||
return await sdk.forConsole.domains.getPresetZoho($page.params.domain);
|
||||
records = await sdk.forConsole.domains.getPresetZoho($page.params.domain);
|
||||
return records;
|
||||
case 'google workspace':
|
||||
records = await sdk.forConsole.domains.getPresetGoogleWorkspace(
|
||||
$page.params.domain
|
||||
);
|
||||
return records;
|
||||
case 'outlook':
|
||||
records = await sdk.forConsole.domains.getPresetOutlook($page.params.domain);
|
||||
return records;
|
||||
case 'proton mail':
|
||||
records = await sdk.forConsole.domains.getPresetProtonMail($page.params.domain);
|
||||
return records;
|
||||
case 'mailgun':
|
||||
records = await sdk.forConsole.domains.getPresetMailgun($page.params.domain);
|
||||
return records;
|
||||
case 'icloud':
|
||||
records = await sdk.forConsole.domains.getPresetICloud($page.params.domain);
|
||||
return records;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
//TODO: create DNS records
|
||||
|
||||
if (records.total) {
|
||||
const promises = records.dnsRecords.map((record) =>
|
||||
sdk.forConsole.domains.createRecordMX(
|
||||
$page.params.domain,
|
||||
record.name,
|
||||
record.value,
|
||||
record.ttl,
|
||||
record.priority
|
||||
)
|
||||
);
|
||||
await Promise.all(promises);
|
||||
}
|
||||
invalidate(Dependencies.DOMAIN);
|
||||
show = false;
|
||||
addNotification({
|
||||
type: 'success',
|
||||
@@ -69,8 +103,7 @@
|
||||
</Table.Row.Base>
|
||||
{/each}
|
||||
{:then presetData}
|
||||
{JSON.stringify(presetData)}
|
||||
{#each presetData as record}
|
||||
{#each presetData.dnsRecords as record}
|
||||
<Table.Row.Base {root}>
|
||||
<Table.Cell {root}>{record.type}</Table.Cell>
|
||||
<Table.Cell {root}>{record.name}</Table.Cell>
|
||||
|
||||
+8
-8
@@ -59,7 +59,7 @@
|
||||
name,
|
||||
value,
|
||||
ttl,
|
||||
comment
|
||||
comment || undefined
|
||||
);
|
||||
|
||||
break;
|
||||
@@ -69,7 +69,7 @@
|
||||
name,
|
||||
value,
|
||||
ttl,
|
||||
comment
|
||||
comment || undefined
|
||||
);
|
||||
|
||||
break;
|
||||
@@ -80,7 +80,7 @@
|
||||
value,
|
||||
ttl,
|
||||
priority,
|
||||
comment
|
||||
comment || undefined
|
||||
);
|
||||
|
||||
break;
|
||||
@@ -90,7 +90,7 @@
|
||||
name,
|
||||
value,
|
||||
ttl,
|
||||
comment
|
||||
comment || undefined
|
||||
);
|
||||
|
||||
break;
|
||||
@@ -100,7 +100,7 @@
|
||||
name,
|
||||
value,
|
||||
ttl,
|
||||
comment
|
||||
comment || undefined
|
||||
);
|
||||
|
||||
break;
|
||||
@@ -111,7 +111,7 @@
|
||||
name,
|
||||
value,
|
||||
ttl,
|
||||
comment
|
||||
comment || undefined
|
||||
);
|
||||
|
||||
break;
|
||||
@@ -121,7 +121,7 @@
|
||||
name,
|
||||
value,
|
||||
ttl,
|
||||
comment
|
||||
comment || undefined
|
||||
);
|
||||
|
||||
break;
|
||||
@@ -131,7 +131,7 @@
|
||||
name,
|
||||
value,
|
||||
ttl,
|
||||
comment
|
||||
comment || undefined
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
+270
-17
@@ -5,19 +5,247 @@
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { Icon, Layout, Tooltip, Typography, Upload } from '@appwrite.io/pink-svelte';
|
||||
import { IconInfo } from '@appwrite.io/pink-icons-svelte';
|
||||
import { removeFile } from '$lib/helpers/files';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import type { DnsRecord } from '$lib/sdk/domains';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
export let show = false;
|
||||
let files: FileList;
|
||||
let error = '';
|
||||
|
||||
type ParsedRecords = {
|
||||
A: Partial<DnsRecord>[];
|
||||
AAAA: Partial<DnsRecord>[];
|
||||
CNAME: Partial<DnsRecord>[];
|
||||
MX: Partial<DnsRecord>[];
|
||||
TXT: Partial<DnsRecord>[];
|
||||
NS: Partial<DnsRecord>[];
|
||||
SRV: Partial<DnsRecord>[];
|
||||
CAA: Partial<DnsRecord>[];
|
||||
PTR: Partial<DnsRecord>[];
|
||||
HTTPS: Partial<DnsRecord>[];
|
||||
ALIAS: Partial<DnsRecord>[];
|
||||
[key: string]: Partial<DnsRecord>[];
|
||||
};
|
||||
|
||||
function parseZoneFile(content: string): ParsedRecords {
|
||||
const records: ParsedRecords = {
|
||||
A: [],
|
||||
AAAA: [],
|
||||
CNAME: [],
|
||||
MX: [],
|
||||
TXT: [],
|
||||
NS: [],
|
||||
SRV: [],
|
||||
CAA: [],
|
||||
PTR: [],
|
||||
HTTPS: [],
|
||||
ALIAS: []
|
||||
};
|
||||
|
||||
// Split the content into lines and process each line
|
||||
const lines = content.split('\n');
|
||||
|
||||
for (let line of lines) {
|
||||
// Remove comments, but save them for record comment field
|
||||
let comment = '';
|
||||
const commentIndex = line.indexOf(';');
|
||||
if (commentIndex !== -1) {
|
||||
comment = line.substring(commentIndex + 1).trim();
|
||||
line = line.substring(0, commentIndex).trim();
|
||||
}
|
||||
|
||||
// Skip empty lines or pure comment lines
|
||||
if (!line.trim()) continue;
|
||||
|
||||
// Split line into parts (whitespace separated)
|
||||
const parts = line.trim().split(/\s+/);
|
||||
|
||||
// Need at least a name, TTL/class/type, and value
|
||||
if (parts.length < 3) continue;
|
||||
|
||||
let recordType = '';
|
||||
let name = '';
|
||||
let value = '';
|
||||
let ttl = 3600;
|
||||
let priority: number | undefined;
|
||||
let weight: number | undefined;
|
||||
let port: number | undefined;
|
||||
|
||||
// Try to determine the record type from the parts
|
||||
for (let i = 0; i < parts.length; i++) {
|
||||
const part = parts[i].toUpperCase();
|
||||
if (['A', 'AAAA', 'CNAME', 'MX', 'TXT', 'NS', 'SRV', 'CAA'].includes(part)) {
|
||||
recordType = part;
|
||||
name = parts[0] === '@' ? '' : parts[0]; // @ represents the domain itself
|
||||
|
||||
// Handle TTL if it appears to be a number
|
||||
const possibleTtl = parseInt(parts[i - 1]);
|
||||
if (!isNaN(possibleTtl) && i > 0) {
|
||||
ttl = possibleTtl;
|
||||
}
|
||||
|
||||
if (recordType === 'MX' && i + 2 < parts.length) {
|
||||
priority = parseInt(parts[i + 1]);
|
||||
value = parts[i + 2];
|
||||
} else if (recordType === 'SRV' && i + 4 < parts.length) {
|
||||
priority = parseInt(parts[i + 1]);
|
||||
weight = parseInt(parts[i + 2]);
|
||||
port = parseInt(parts[i + 3]);
|
||||
value = parts[i + 4];
|
||||
} else if (i + 1 < parts.length) {
|
||||
value = parts.slice(i + 1).join(' ');
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (recordType && value) {
|
||||
if (recordType === 'TXT' && value.startsWith('"') && value.endsWith('"')) {
|
||||
value = value.slice(1, -1);
|
||||
}
|
||||
|
||||
const record: Partial<DnsRecord> = {
|
||||
name,
|
||||
value,
|
||||
ttl,
|
||||
comment: comment || undefined
|
||||
};
|
||||
|
||||
if (priority !== undefined) {
|
||||
record.priority = priority;
|
||||
}
|
||||
|
||||
if (!records[recordType]) {
|
||||
records[recordType] = [];
|
||||
}
|
||||
|
||||
records[recordType].push(record);
|
||||
}
|
||||
}
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
//TODO: create DNS records
|
||||
if (!files?.length) return;
|
||||
|
||||
const file = files[0];
|
||||
const content = await file.text();
|
||||
const parsedRecords = parseZoneFile(content);
|
||||
|
||||
let recordCount = 0;
|
||||
|
||||
for (const [type, records] of Object.entries(parsedRecords)) {
|
||||
recordCount += records.length;
|
||||
|
||||
for (const record of records) {
|
||||
switch (type) {
|
||||
case 'A':
|
||||
await sdk.forConsole.domains.createRecordA(
|
||||
$page.params.domain,
|
||||
record.name,
|
||||
record.value,
|
||||
record.ttl,
|
||||
record.comment
|
||||
);
|
||||
break;
|
||||
case 'AAAA':
|
||||
await sdk.forConsole.domains.createRecordAAAA(
|
||||
$page.params.domain,
|
||||
record.name,
|
||||
record.value,
|
||||
record.ttl,
|
||||
record.comment
|
||||
);
|
||||
break;
|
||||
case 'CNAME':
|
||||
await sdk.forConsole.domains.createRecordCNAME(
|
||||
$page.params.domain,
|
||||
record.name,
|
||||
record.value,
|
||||
record.ttl,
|
||||
record.comment
|
||||
);
|
||||
break;
|
||||
case 'MX':
|
||||
await sdk.forConsole.domains.createRecordMX(
|
||||
$page.params.domain,
|
||||
record.name,
|
||||
record.value,
|
||||
record.priority || 10,
|
||||
record.ttl,
|
||||
record.comment
|
||||
);
|
||||
break;
|
||||
case 'TXT':
|
||||
await sdk.forConsole.domains.createRecordTXT(
|
||||
$page.params.domain,
|
||||
record.name,
|
||||
record.value,
|
||||
record.ttl,
|
||||
record.comment
|
||||
);
|
||||
break;
|
||||
case 'NS':
|
||||
await sdk.forConsole.domains.createRecordNS(
|
||||
$page.params.domain,
|
||||
record.name,
|
||||
record.value,
|
||||
record.ttl,
|
||||
record.comment
|
||||
);
|
||||
break;
|
||||
case 'SRV':
|
||||
await sdk.forConsole.domains.createRecordSRV(
|
||||
$page.params.domain,
|
||||
record.name,
|
||||
record.value,
|
||||
record.ttl,
|
||||
record.priority,
|
||||
record.weight,
|
||||
record.port,
|
||||
record.comment
|
||||
);
|
||||
break;
|
||||
case 'CAA':
|
||||
await sdk.forConsole.domains.createRecordCAA(
|
||||
$page.params.domain,
|
||||
record.name,
|
||||
record.value,
|
||||
record.ttl,
|
||||
record.comment
|
||||
);
|
||||
break;
|
||||
case 'PTR':
|
||||
await sdk.forConsole.domains.createRecordHTTPS(
|
||||
$page.params.domain,
|
||||
record.name,
|
||||
record.value,
|
||||
record.ttl,
|
||||
record.comment
|
||||
);
|
||||
break;
|
||||
case 'ALIAS':
|
||||
await sdk.forConsole.domains.createRecordAlias(
|
||||
$page.params.domain,
|
||||
record.name,
|
||||
record.value,
|
||||
record.ttl,
|
||||
record.comment
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
show = false;
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: `Presets have been added`
|
||||
message: `${recordCount} DNS records have been imported successfully`
|
||||
});
|
||||
trackEvent(Submit.RecordCreate);
|
||||
} catch (e) {
|
||||
@@ -25,6 +253,14 @@
|
||||
trackError(e, Submit.RecordCreate);
|
||||
}
|
||||
}
|
||||
|
||||
$: filesList = files?.length
|
||||
? Array.from(files).map((file) => {
|
||||
let f = file as Partial<File> & { removable: boolean };
|
||||
f.removable = true;
|
||||
return f;
|
||||
})
|
||||
: [];
|
||||
</script>
|
||||
|
||||
<Modal title="Import zone file" bind:show bind:error onSubmit={handleSubmit}>
|
||||
@@ -34,24 +270,41 @@
|
||||
>.
|
||||
</span>
|
||||
|
||||
<Upload.Dropzone bind:files>
|
||||
<Layout.Stack alignItems="center" gap="s">
|
||||
<Layout.Stack alignItems="center" gap="s">
|
||||
<Layout.Stack alignItems="center" justifyContent="center" direction="row" gap="s">
|
||||
<Typography.Text variant="l-500">
|
||||
Drag and drop file here or click to upload
|
||||
</Typography.Text>
|
||||
<Tooltip>
|
||||
<Layout.Stack alignItems="center" justifyContent="center" inline>
|
||||
<Icon icon={IconInfo} size="s" />
|
||||
<Layout.Stack gap="xl">
|
||||
<Layout.Stack gap="s">
|
||||
<Typography.Text color="--fgcolor-neutral-primary">
|
||||
Upload a .txt file with your DNS records
|
||||
</Typography.Text>
|
||||
<Upload.Dropzone bind:files extensions={['txt']}>
|
||||
<Layout.Stack alignItems="center" gap="s">
|
||||
<Layout.Stack alignItems="center" gap="s">
|
||||
<Layout.Stack
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
direction="row"
|
||||
gap="s">
|
||||
<Typography.Text variant="l-500">
|
||||
Drag and drop file here or click to upload
|
||||
</Typography.Text>
|
||||
<Tooltip>
|
||||
<Layout.Stack alignItems="center" justifyContent="center" inline>
|
||||
<Icon icon={IconInfo} size="s" />
|
||||
</Layout.Stack>
|
||||
<svelte:fragment slot="tooltip"
|
||||
>Only .txt files allowed</svelte:fragment>
|
||||
</Tooltip>
|
||||
</Layout.Stack>
|
||||
<svelte:fragment slot="tooltip">Only .txt files allowed</svelte:fragment>
|
||||
</Tooltip>
|
||||
<Typography.Caption variant="400">Max file size 10MB</Typography.Caption>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
<Typography.Caption variant="400">Max file size 10MB</Typography.Caption>
|
||||
</Layout.Stack>
|
||||
</Upload.Dropzone>
|
||||
</Layout.Stack>
|
||||
</Upload.Dropzone>
|
||||
{#if files?.length}
|
||||
<Upload.List
|
||||
bind:files={filesList}
|
||||
on:remove={(e) => (files = removeFile(e.detail, files))} />
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text on:click={() => (show = false)}>Cancel</Button>
|
||||
<Button size="s" submit disabled={!files?.length}>Import</Button>
|
||||
|
||||
@@ -66,3 +66,5 @@ export const recordTypes = [
|
||||
helper: 'ALIAS records are similar to CNAMEs but can be used for the root domain, allowing you to point your domain to another domain or server.'
|
||||
}
|
||||
];
|
||||
|
||||
export const presets = ['Zoho', 'Mailgun', 'Outlook', 'Proton Mail', 'iCloud', 'Google Workspace'];
|
||||
+2
-5
@@ -12,11 +12,10 @@
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
import { IconDotsHorizontal, IconPencil, IconTrash } from '@appwrite.io/pink-icons-svelte';
|
||||
import { columns } from './store';
|
||||
import { timeFromNow } from '$lib/helpers/date';
|
||||
import DeleteRecordModal from './deleteRecordModal.svelte';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import EditRecordModal from './updateRecordModal.svelte';
|
||||
import type { DnsRecord } from '$lib/sdk/domains';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
|
||||
export let data;
|
||||
|
||||
@@ -63,9 +62,7 @@
|
||||
{record?.comment ?? '-'}
|
||||
</Typography.Text>
|
||||
{:else if column.id === '$createdAt'}
|
||||
<Typography.Text>
|
||||
{capitalize(timeFromNow(record.$createdAt))}
|
||||
</Typography.Text>
|
||||
<DualTimeView time={record.$createdAt} />
|
||||
{/if}
|
||||
</Table.Cell>
|
||||
{/each}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<script lang="ts">
|
||||
import { Copy } from '$lib/components';
|
||||
import { Link } from '$lib/elements';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import type { Domain } from '$lib/sdk/domains';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { consoleVariables } from '$routes/(console)/store';
|
||||
import { IconDuplicate, IconInfo } from '@appwrite.io/pink-icons-svelte';
|
||||
import {
|
||||
Badge,
|
||||
Layout,
|
||||
Typography,
|
||||
Table,
|
||||
Fieldset,
|
||||
Icon,
|
||||
Divider
|
||||
Divider,
|
||||
Tabs,
|
||||
Input,
|
||||
InteractiveText
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let domain: Domain;
|
||||
@@ -30,7 +30,7 @@
|
||||
async function verifyStatus() {
|
||||
try {
|
||||
domain = await sdk.forConsole.domains.updateNameservers(domain.$id);
|
||||
verified = domain.nameservers === nameservers;
|
||||
verified = domain.nameservers === 'Appwrite';
|
||||
console.log(domain);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
@@ -40,75 +40,73 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function back() {
|
||||
try {
|
||||
await sdk.forConsole.domains.delete(domain.$id);
|
||||
domain = undefined;
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$: console.log($consoleVariables._APP_DOMAINS_NAMESERVERS);
|
||||
</script>
|
||||
|
||||
<Fieldset legend="Verification">
|
||||
<Layout.Stack gap="xl">
|
||||
<Layout.Stack gap="xl">
|
||||
<Layout.Stack gap="s">
|
||||
<Layout.Stack gap="s" direction="row" alignItems="center">
|
||||
<Typography.Text variant="l-500">{domain.domain}</Typography.Text>
|
||||
|
||||
{#if verified === false}
|
||||
<Badge variant="secondary" type="error" content="Verification failed" />
|
||||
{/if}
|
||||
<Badge variant="secondary" type="warning" content="Pending verification" />
|
||||
</Layout.Stack>
|
||||
<Typography.Text variant="m-400">
|
||||
Add the following nameservers on your DNS provider. Note that DNS changes may
|
||||
take time to propagate fully.
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
|
||||
<Table.Root
|
||||
columns={[{ id: 'type' }, { id: 'value' }, { id: 'actions', width: 40 }]}
|
||||
let:root>
|
||||
<svelte:fragment slot="header" let:root>
|
||||
<Table.Header.Cell column="type" {root}>Type</Table.Header.Cell>
|
||||
<Table.Header.Cell column="value" {root}>Value</Table.Header.Cell>
|
||||
<Table.Header.Cell column="actions" {root} />
|
||||
</svelte:fragment>
|
||||
{#each nameservers as nameserver}
|
||||
<Table.Row.Base {root}>
|
||||
<Table.Cell column="type" {root}>NS</Table.Cell>
|
||||
<Table.Cell column="value" {root}>{nameserver}</Table.Cell>
|
||||
<Table.Cell column="actions" {root}>
|
||||
<Layout.Stack alignItems="flex-end">
|
||||
<Copy value={nameserver}>
|
||||
<Icon icon={IconDuplicate} />
|
||||
</Copy>
|
||||
</Layout.Stack>
|
||||
</Table.Cell>
|
||||
</Table.Row.Base>
|
||||
{/each}
|
||||
</Table.Root>
|
||||
<div>
|
||||
<Tabs.Root variant="secondary" let:root>
|
||||
<Tabs.Item.Button {root} active>Nameservers</Tabs.Item.Button>
|
||||
</Tabs.Root>
|
||||
<Divider />
|
||||
</div>
|
||||
<Layout.Stack gap="s">
|
||||
<Layout.Stack gap="s" direction="row" alignItems="center">
|
||||
<Icon icon={IconInfo} size="s" color="--fgcolor-neutral-secondary" />
|
||||
<Typography.Text variant="m-400" color="--fgcolor-neutral-secondary">
|
||||
A list of all domain providers and their DNS setting is available <Link
|
||||
variant="muted"
|
||||
href="#">here</Link
|
||||
>.
|
||||
</Typography.Text>
|
||||
<Typography.Text variant="l-500" color="--fgcolor-neutral-primary"
|
||||
>{domain.domain}</Typography.Text>
|
||||
|
||||
{#if verified === false}
|
||||
<Badge
|
||||
variant="secondary"
|
||||
type="error"
|
||||
size="xs"
|
||||
content="Verification failed" />
|
||||
{:else}
|
||||
<Badge
|
||||
variant="secondary"
|
||||
type="warning"
|
||||
size="xs"
|
||||
content="Pending verification" />
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
<Typography.Text variant="m-400">
|
||||
Add the following nameservers on your DNS provider. Note that DNS changes may take
|
||||
time to propagate fully.
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
|
||||
<Table.Root
|
||||
columns={[{ id: 'type' }, { id: 'value' }, { id: 'actions', width: 40 }]}
|
||||
let:root>
|
||||
<svelte:fragment slot="header" let:root>
|
||||
<Table.Header.Cell column="type" {root}>Type</Table.Header.Cell>
|
||||
<Table.Header.Cell column="value" {root}>Value</Table.Header.Cell>
|
||||
<Table.Header.Cell column="actions" {root} />
|
||||
</svelte:fragment>
|
||||
{#each nameservers as nameserver}
|
||||
<Table.Row.Base {root}>
|
||||
<Table.Cell column="type" {root}>NS</Table.Cell>
|
||||
<Table.Cell column="value" {root}>{nameserver}</Table.Cell>
|
||||
<Table.Cell column="actions" {root}>
|
||||
<Layout.Stack alignItems="flex-end">
|
||||
<InteractiveText variant="copy" isVisible text={nameserver}>
|
||||
{nameserver}</InteractiveText>
|
||||
</Layout.Stack>
|
||||
</Table.Cell>
|
||||
</Table.Row.Base>
|
||||
{/each}
|
||||
</Table.Root>
|
||||
<Input.Helper state="default">
|
||||
A list of all domain providers and their DNS setting is available <Link
|
||||
variant="muted"
|
||||
external
|
||||
href="https://appwrite.io/docs/advanced/platform/custom-domains">here</Link
|
||||
>.
|
||||
</Input.Helper>
|
||||
<Divider />
|
||||
<Layout.Stack direction="row" justifyContent="flex-end">
|
||||
<Button text on:click={back}>Back</Button>
|
||||
<Button secondary on:click={verifyStatus}>Verify</Button>
|
||||
<Button on:click={verifyStatus}>Verify</Button>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Fieldset>
|
||||
@@ -4,28 +4,41 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import RecordsCard from './recordsCard.svelte';
|
||||
import { Input, InteractiveText, Layout, Table, Typography } from '@appwrite.io/pink-svelte';
|
||||
import { Link } from '$lib/elements';
|
||||
import { consoleVariables } from '$routes/(console)/store';
|
||||
import type { Domain } from '$lib/sdk/domains';
|
||||
|
||||
export let show = false;
|
||||
export let selectedDomain: Models.ProxyRule;
|
||||
export let selectedDomain: Domain;
|
||||
let nameservers = $consoleVariables?._APP_DOMAINS_NAMESERVERS.split(',') ?? [
|
||||
'ns1.appwrite.io',
|
||||
'ns2.appwrite.io'
|
||||
];
|
||||
|
||||
let error = null;
|
||||
async function retryDomain() {
|
||||
try {
|
||||
await sdk.forProject.proxy.updateRuleVerification(selectedDomain.$id);
|
||||
await invalidate(Dependencies.SITES_DOMAINS);
|
||||
const domain = await sdk.forConsole.domains.updateNameservers(selectedDomain.$id);
|
||||
show = false;
|
||||
addNotification({
|
||||
type: 'success',
|
||||
message: `${selectedDomain.domain} has been deleted`
|
||||
});
|
||||
trackEvent(Submit.DomainDelete);
|
||||
if (domain.nameservers === 'Appwrite') {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: `${selectedDomain.domain} has been verified`
|
||||
});
|
||||
} else {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: `Domain verification failed. Please check your domain settings or try again later`
|
||||
});
|
||||
}
|
||||
await invalidate(Dependencies.DOMAINS);
|
||||
trackEvent(Submit.DomainUpdateVerification);
|
||||
} catch (e) {
|
||||
error = e;
|
||||
trackError(e, Submit.DomainDelete);
|
||||
trackError(e, Submit.DomainUpdateVerification);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +48,41 @@
|
||||
</script>
|
||||
|
||||
<Modal title="Retry verification" bind:show onSubmit={retryDomain} bind:error>
|
||||
{#if selectedDomain}
|
||||
<RecordsCard domain={selectedDomain} />
|
||||
{/if}
|
||||
<Layout.Stack gap="s">
|
||||
<Layout.Stack gap="s" direction="row" alignItems="center">
|
||||
<Typography.Text variant="l-500" color="--fgcolor-neutral-primary"
|
||||
>{selectedDomain.domain}</Typography.Text>
|
||||
\
|
||||
</Layout.Stack>
|
||||
<Typography.Text variant="m-400">
|
||||
Add the following nameservers on your DNS provider. Note that DNS changes may take time
|
||||
to propagate fully.
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
|
||||
<Table.Root>
|
||||
<svelte:fragment slot="header">
|
||||
<Table.Header.Cell>Type</Table.Header.Cell>
|
||||
<Table.Header.Cell>Value</Table.Header.Cell>
|
||||
<Table.Header.Cell />
|
||||
</svelte:fragment>
|
||||
{#each nameservers as nameserver}
|
||||
<Table.Row>
|
||||
<Table.Cell>NS</Table.Cell>
|
||||
<Table.Cell>
|
||||
<InteractiveText variant="copy" isVisible text={nameserver}>
|
||||
{nameserver}</InteractiveText>
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
{/each}
|
||||
</Table.Root>
|
||||
<Input.Helper state="default">
|
||||
A list of all domain providers and their DNS setting is available <Link
|
||||
variant="muted"
|
||||
external
|
||||
href="https://appwrite.io/docs/advanced/platform/custom-domains">here</Link
|
||||
>.
|
||||
</Input.Helper>
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text on:click={() => (show = false)}>Cancel</Button>
|
||||
<Button submit>Retry</Button>
|
||||
|
||||
+2
-4
@@ -3,13 +3,13 @@
|
||||
import { EmptyCardCloud } from '$lib/components/billing';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { toLocaleDate } from '$lib/helpers/date';
|
||||
import { formatCurrency } from '$lib/helpers/numbers';
|
||||
import { plansInfo, tierToPlan } from '$lib/stores/billing';
|
||||
import { newMemberModal, organization } from '$lib/stores/organization';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { IconInfo, IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
import { Icon, Layout, Table, Tooltip, Typography } from '@appwrite.io/pink-svelte';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
|
||||
export let members: Models.MembershipList;
|
||||
|
||||
@@ -78,9 +78,7 @@
|
||||
</Layout.Stack>
|
||||
</Table.Cell>
|
||||
<Table.Cell {root}>
|
||||
{member.joined
|
||||
? toLocaleDate(member.joined)
|
||||
: toLocaleDate(member.$createdAt)}
|
||||
<DualTimeView time={member.joined ?? member.$createdAt} />
|
||||
</Table.Cell>
|
||||
</Table.Row.Base>
|
||||
{/each}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
} from '$lib/components';
|
||||
import Create from '../createTeam.svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import { Container } from '$lib/layout';
|
||||
import { base } from '$app/paths';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
@@ -23,6 +22,7 @@
|
||||
import { canWriteTeams } from '$lib/stores/roles';
|
||||
import { Icon, Layout, Table } from '@appwrite.io/pink-svelte';
|
||||
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
{team.total} members
|
||||
</Table.Cell>
|
||||
<Table.Cell {root}>
|
||||
{toLocaleDateTime(team.$createdAt)}
|
||||
<DualTimeView time={team.$createdAt} />
|
||||
</Table.Cell>
|
||||
</Table.Row.Link>
|
||||
{/each}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage } from '$lib/layout';
|
||||
import { Container, Usage } from '$lib/layout';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
@@ -9,12 +9,14 @@
|
||||
$: count = data.users;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Users"
|
||||
path={`${base}/project-${$page.params.project}/auth/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Users',
|
||||
title: 'Registered users'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
<Container>
|
||||
<Usage
|
||||
title="Users"
|
||||
path={`${base}/project-${$page.params.project}/auth/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Users',
|
||||
title: 'Registered users'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
</Container>
|
||||
+4
-6
@@ -27,6 +27,7 @@
|
||||
import { LabelCard } from '$lib/components/index.js';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Tooltip } from '@appwrite.io/pink-svelte';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -155,12 +156,9 @@
|
||||
<TableRow>
|
||||
<TableCellCheck id={backup.$id} bind:selectedIds={selectedBackups} />
|
||||
<TableCell title={backup.$createdAt}>
|
||||
<Tooltip>
|
||||
<span>
|
||||
{cleanBackupName(backup)}
|
||||
</span>
|
||||
<span slot="tooltip">{timeFromNow(backup.$createdAt)}</span>
|
||||
</Tooltip>
|
||||
<DualTimeView time={backup.$createdAt}>
|
||||
{cleanBackupName(backup)}
|
||||
</DualTimeView>
|
||||
</TableCell>
|
||||
<TableCell title="Backup Size">
|
||||
{#if backup.status === 'completed'}
|
||||
|
||||
+9
-3
@@ -18,6 +18,8 @@
|
||||
import type { ColumnType } from '$lib/helpers/types';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import { Tooltip, Table, Button, Link } from '@appwrite.io/pink-svelte';
|
||||
import { Tooltip, Table, Selector, Button, Link } from '@appwrite.io/pink-svelte';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -233,10 +235,10 @@
|
||||
</Table.Cell>
|
||||
{/each}
|
||||
<Table.Cell column="$created" {root}>
|
||||
{toLocaleDateTime(document.$createdAt)}
|
||||
<DualTimeView time={document.$createdAt} />
|
||||
</Table.Cell>
|
||||
<Table.Cell column="$updated" {root}>
|
||||
{toLocaleDateTime(document.$updatedAt)}
|
||||
<DualTimeView time={document.$updatedAt} />
|
||||
</Table.Cell>
|
||||
</Table.Row.Link>
|
||||
{/each}
|
||||
@@ -265,7 +267,11 @@
|
||||
</div>
|
||||
</FloatingActionBar>
|
||||
|
||||
<Modal title="Delete Documents" bind:show={showDelete} onSubmit={handleDelete} closable={!deleting}>
|
||||
<Modal
|
||||
title="Delete Documents"
|
||||
bind:show={showDelete}
|
||||
onSubmit={handleDelete}
|
||||
dismissible={!deleting}>
|
||||
<div>
|
||||
<p class="text" data-private>
|
||||
Are you sure you want to delete <b>{selectedRows.length}</b>
|
||||
|
||||
+12
-9
@@ -2,6 +2,7 @@
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage } from '$lib/layout';
|
||||
import Container from '$lib/layout/container.svelte';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
@@ -9,12 +10,14 @@
|
||||
$: count = data.documents;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Databases"
|
||||
path={`${base}/project-${$page.params.project}/databases/database-${$page.params.database}/collection-${$page.params.collection}/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Documents',
|
||||
title: 'Total documents'
|
||||
}} />
|
||||
<Container>
|
||||
<Usage
|
||||
title="Databases"
|
||||
path={`${base}/project-${$page.params.project}/databases/database-${$page.params.database}/collection-${$page.params.collection}/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Documents',
|
||||
title: 'Total documents'
|
||||
}} />
|
||||
</Container>
|
||||
+24
-20
@@ -1,7 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage, UsageMultiple } from '$lib/layout';
|
||||
import { Container, Usage, UsageMultiple } from '$lib/layout';
|
||||
import { Layout } from '@appwrite.io/pink-svelte';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
@@ -16,23 +17,26 @@
|
||||
$: writesTotal = data.databaseWritesTotal;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Usage"
|
||||
path={`${base}/project-${$page.params.project}/databases/database-${$page.params.database}/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Collections',
|
||||
title: 'Total collections'
|
||||
}} />
|
||||
<Container>
|
||||
<Layout.Stack gap="l">
|
||||
<Usage
|
||||
title="Usage"
|
||||
path={`${base}/project-${$page.params.project}/databases/database-${$page.params.database}/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Collections',
|
||||
title: 'Total collections'
|
||||
}} />
|
||||
|
||||
<UsageMultiple
|
||||
title="Reads and writes"
|
||||
showHeader={false}
|
||||
overlapContainerCover
|
||||
total={[readsTotal, writesTotal]}
|
||||
count={[reads, writes]}
|
||||
legendData={[
|
||||
{ name: 'Reads', value: readsTotal },
|
||||
{ name: 'Writes', value: writesTotal }
|
||||
]} />
|
||||
<UsageMultiple
|
||||
title="Reads and writes"
|
||||
showHeader={false}
|
||||
total={[readsTotal, writesTotal]}
|
||||
count={[reads, writes]}
|
||||
legendData={[
|
||||
{ name: 'Reads', value: readsTotal },
|
||||
{ name: 'Writes', value: writesTotal }
|
||||
]} />
|
||||
</Layout.Stack>
|
||||
</Container>
|
||||
@@ -1,7 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage, UsageMultiple } from '$lib/layout';
|
||||
import { Container, Usage, UsageMultiple } from '$lib/layout';
|
||||
import { Layout } from '@appwrite.io/pink-svelte';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
@@ -15,23 +16,26 @@
|
||||
$: writesTotal = data.databasesWritesTotal;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Usage"
|
||||
path={`${base}/project-${$page.params.project}/databases/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Databases',
|
||||
title: 'Total databases'
|
||||
}} />
|
||||
<Container>
|
||||
<Layout.Stack gap="l">
|
||||
<Usage
|
||||
title="Usage"
|
||||
path={`${base}/project-${$page.params.project}/databases/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Databases',
|
||||
title: 'Total databases'
|
||||
}} />
|
||||
|
||||
<UsageMultiple
|
||||
title="Reads and writes"
|
||||
showHeader={false}
|
||||
overlapContainerCover
|
||||
total={[readsTotal, writesTotal]}
|
||||
count={[reads, writes]}
|
||||
legendData={[
|
||||
{ name: 'Reads', value: readsTotal },
|
||||
{ name: 'Writes', value: writesTotal }
|
||||
]} />
|
||||
<UsageMultiple
|
||||
title="Reads and writes"
|
||||
showHeader={false}
|
||||
total={[readsTotal, writesTotal]}
|
||||
count={[reads, writes]}
|
||||
legendData={[
|
||||
{ name: 'Reads', value: readsTotal },
|
||||
{ name: 'Writes', value: writesTotal }
|
||||
]} />
|
||||
</Layout.Stack>
|
||||
</Container>
|
||||
@@ -66,7 +66,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Wizard title="Create function" href={previousPage} column columnSize="l">
|
||||
<Wizard title="Create function" href={previousPage} column columnSize="l" hideFooter>
|
||||
<Layout.Stack gap="l">
|
||||
<Layout.GridFraction start={4} end={6} gap="l" rowSize="auto">
|
||||
<Card.Base>
|
||||
|
||||
+3
-2
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Id } from '$lib/components';
|
||||
import { timeFromNow, toLocaleDateTime } from '$lib/helpers/date';
|
||||
import { toLocaleDateTime } from '$lib/helpers/date';
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { Badge, Layout, Status, Table, Tooltip, Typography } from '@appwrite.io/pink-svelte';
|
||||
@@ -8,6 +8,7 @@
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import { formatTimeDetailed } from '$lib/helpers/timeConversion';
|
||||
import { logStatusConverter } from './store';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
|
||||
export let columns: Column[];
|
||||
export let logs: Models.ExecutionList;
|
||||
@@ -36,7 +37,7 @@
|
||||
<Id value={log.$id}>{log.$id}</Id>
|
||||
{/key}
|
||||
{:else if column.id === '$createdAt'}
|
||||
{capitalize(timeFromNow(log.$createdAt))}
|
||||
<DualTimeView time={log.$createdAt} />
|
||||
{:else if column.id === 'requestPath'}
|
||||
<Layout.Stack direction="row" alignItems="center" gap="s">
|
||||
<Badge
|
||||
|
||||
+28
-26
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Usage } from '$lib/layout';
|
||||
import { Container, Usage } from '$lib/layout';
|
||||
import { page } from '$app/stores';
|
||||
import type { PageData } from './$types';
|
||||
import { base } from '$app/paths';
|
||||
@@ -12,29 +12,31 @@
|
||||
$: mbSecondsCount = data.executionsMbSeconds;
|
||||
</script>
|
||||
|
||||
<Layout.Stack gap="l">
|
||||
{#if count}
|
||||
<Usage
|
||||
title="Executions"
|
||||
path={`${base}/project-${$page.params.project}/functions/function-${$page.params.function}/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Executions',
|
||||
title: 'Total executions'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
{/if}
|
||||
<Container>
|
||||
<Layout.Stack gap="l">
|
||||
{#if count}
|
||||
<Usage
|
||||
title="Executions"
|
||||
path={`${base}/project-${$page.params.project}/functions/function-${$page.params.function}/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Executions',
|
||||
title: 'Total executions'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
{/if}
|
||||
|
||||
{#if mbSecondsCount}
|
||||
<Usage
|
||||
hidePeriodSelect
|
||||
title="GB hours"
|
||||
path={`${base}/project-${$page.params.project}/functions/function-${$page.params.function}/usage`}
|
||||
countMetadata={{
|
||||
legend: 'GB hours',
|
||||
title: 'Total GB hours'
|
||||
}}
|
||||
total={gbHoursTotal}
|
||||
count={mbSecondsCount} />
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
{#if mbSecondsCount}
|
||||
<Usage
|
||||
hidePeriodSelect
|
||||
title="GB hours"
|
||||
path={`${base}/project-${$page.params.project}/functions/function-${$page.params.function}/usage`}
|
||||
countMetadata={{
|
||||
legend: 'GB hours',
|
||||
title: 'Total GB hours'
|
||||
}}
|
||||
total={gbHoursTotal}
|
||||
count={mbSecondsCount} />
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Container>
|
||||
@@ -1,19 +1,21 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage } from '$lib/layout';
|
||||
import { Container, Usage } from '$lib/layout';
|
||||
|
||||
export let data;
|
||||
$: total = data.deploymentsTotal;
|
||||
$: count = data.deployments;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Functions"
|
||||
path={`${base}/project-${$page.params.project}/functions/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Functions',
|
||||
title: 'Total functions'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
<Container>
|
||||
<Usage
|
||||
title="Functions"
|
||||
path={`${base}/project-${$page.params.project}/functions/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Functions',
|
||||
title: 'Total functions'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
</Container>
|
||||
@@ -62,7 +62,6 @@
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { toLocaleDate } from '$lib/helpers/date';
|
||||
import type { PageData } from './$types';
|
||||
import { canWritePlatforms } from '$lib/stores/roles';
|
||||
import { setOverviewAction } from '../context';
|
||||
@@ -84,6 +83,7 @@
|
||||
IconReact
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import type { ComponentType } from 'svelte';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -141,7 +141,11 @@
|
||||
</Layout.Stack>
|
||||
</Table.Cell>
|
||||
<Table.Cell {root}>
|
||||
{platform.$updatedAt ? toLocaleDate(platform.$updatedAt) : 'never'}
|
||||
{#if platform.$updatedAt}
|
||||
<DualTimeView time={platform.$updatedAt} />
|
||||
{:else}
|
||||
never
|
||||
{/if}
|
||||
</Table.Cell>
|
||||
</Table.Row.Link>
|
||||
{/each}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<script>
|
||||
import { SvgIcon } from '$lib/components';
|
||||
</script>
|
||||
|
||||
<SvgIcon name="js" type="color" iconSize="" />
|
||||
@@ -0,0 +1,9 @@
|
||||
export { default as AngularFrameworkIcon } from './AngularFrameworkIcon.svelte';
|
||||
export { default as ConnectionLine } from './ConnectionLine.svelte';
|
||||
export { default as JavascriptFrameworkIcon } from './JavascriptFrameworkIcon.svelte';
|
||||
export { default as NextjsFrameworkIcon } from './NextjsFrameworkIcon.svelte';
|
||||
export { default as NoFrameworkIcon } from './NoFrameworkIcon.svelte';
|
||||
export { default as NuxtFrameworkIcon } from './NuxtFrameworkIcon.svelte';
|
||||
export { default as ReactFrameworkIcon } from './ReactFrameworkIcon.svelte';
|
||||
export { default as SvelteFrameworkIcon } from './SvelteFrameworkIcon.svelte';
|
||||
export { default as VueFrameworkIcon } from './AngularFrameworkIcon.svelte';
|
||||
@@ -22,7 +22,8 @@
|
||||
IconNuxt,
|
||||
IconInfo,
|
||||
IconExternalLink,
|
||||
IconAngular
|
||||
IconAngular,
|
||||
IconJs
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { type ComponentType, onMount } from 'svelte';
|
||||
@@ -33,13 +34,16 @@
|
||||
import ConnectionLine from './components/ConnectionLine.svelte';
|
||||
import OnboardingPlatformCard from './components/OnboardingPlatformCard.svelte';
|
||||
import { PlatformType } from '@appwrite.io/console';
|
||||
import ReactFrameworkIcon from './components/ReactFrameworkIcon.svelte';
|
||||
import SvelteFrameworkIcon from '$routes/(console)/project-[project]/overview/platforms/components/SvelteFrameworkIcon.svelte';
|
||||
import NuxtFrameworkIcon from '$routes/(console)/project-[project]/overview/platforms/components/NuxtFrameworkIcon.svelte';
|
||||
import NextjsFrameworkIcon from '$routes/(console)/project-[project]/overview/platforms/components/NextjsFrameworkIcon.svelte';
|
||||
import VueFrameworkIcon from '$routes/(console)/project-[project]/overview/platforms/components/VueFrameworkIcon.svelte';
|
||||
import NoFrameworkIcon from './components/NoFrameworkIcon.svelte';
|
||||
import AngularFrameworkIcon from '$routes/(console)/project-[project]/overview/platforms/components/AngularFrameworkIcon.svelte';
|
||||
import {
|
||||
ReactFrameworkIcon,
|
||||
SvelteFrameworkIcon,
|
||||
NuxtFrameworkIcon,
|
||||
NextjsFrameworkIcon,
|
||||
VueFrameworkIcon,
|
||||
NoFrameworkIcon,
|
||||
AngularFrameworkIcon,
|
||||
JavascriptFrameworkIcon
|
||||
} from './components/index';
|
||||
|
||||
export let key;
|
||||
|
||||
@@ -51,8 +55,8 @@
|
||||
|
||||
const projectId = $page.params.project;
|
||||
|
||||
const updateConfigCode = `APPWRITE_PROJECT_ID = "${projectId}"
|
||||
APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}"
|
||||
const updateConfigCode = (prefix = '') => `${prefix}APPWRITE_PROJECT_ID = "${projectId}"
|
||||
${prefix}APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}"
|
||||
`;
|
||||
type FrameworkType = {
|
||||
key: string;
|
||||
@@ -60,6 +64,8 @@ APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}"
|
||||
icon: ComponentType;
|
||||
smallIcon: ComponentType;
|
||||
portNumber: number;
|
||||
runCommand: string;
|
||||
updateConfigCode: string;
|
||||
};
|
||||
export let platform: PlatformType = PlatformType.Flutterandroid;
|
||||
export let selectedFrameworkKey: string | undefined = key ? key : undefined;
|
||||
@@ -70,42 +76,63 @@ APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}"
|
||||
label: 'Svelte',
|
||||
icon: SvelteFrameworkIcon,
|
||||
smallIcon: IconSvelte,
|
||||
portNumber: 5173
|
||||
portNumber: 5173,
|
||||
runCommand: 'npm run dev',
|
||||
updateConfigCode: updateConfigCode('PUBLIC_')
|
||||
},
|
||||
{
|
||||
key: 'react',
|
||||
label: 'React',
|
||||
icon: ReactFrameworkIcon,
|
||||
smallIcon: IconReact,
|
||||
portNumber: 5173
|
||||
portNumber: 5173,
|
||||
runCommand: 'npm run dev',
|
||||
updateConfigCode: updateConfigCode('VITE_')
|
||||
},
|
||||
{
|
||||
key: 'nuxt',
|
||||
label: 'Nuxt',
|
||||
icon: NuxtFrameworkIcon,
|
||||
smallIcon: IconNuxt,
|
||||
portNumber: 3000
|
||||
portNumber: 3000,
|
||||
runCommand: 'npm run dev',
|
||||
updateConfigCode: updateConfigCode('NUXT_')
|
||||
},
|
||||
{
|
||||
key: 'nextjs',
|
||||
label: 'Next.js',
|
||||
icon: NextjsFrameworkIcon,
|
||||
smallIcon: NextjsFrameworkIcon,
|
||||
portNumber: 3000
|
||||
portNumber: 3000,
|
||||
runCommand: 'npm run dev',
|
||||
updateConfigCode: updateConfigCode('NEXT_PUBLIC_')
|
||||
},
|
||||
{
|
||||
key: 'vue',
|
||||
label: 'Vue',
|
||||
icon: VueFrameworkIcon,
|
||||
smallIcon: IconVue,
|
||||
portNumber: 5173
|
||||
portNumber: 5173,
|
||||
runCommand: 'npm run dev',
|
||||
updateConfigCode: updateConfigCode('VITE_')
|
||||
},
|
||||
{
|
||||
key: 'angular',
|
||||
label: 'Angular',
|
||||
icon: AngularFrameworkIcon,
|
||||
smallIcon: IconAngular,
|
||||
portNumber: 4200
|
||||
portNumber: 4200,
|
||||
runCommand: 'npm run start',
|
||||
updateConfigCode: `appwriteEndpoint: '${sdk.forProject.client.config.endpoint}',\nappwriteProjectId:'${projectId}'`
|
||||
},
|
||||
{
|
||||
key: 'js',
|
||||
label: 'Javascript',
|
||||
icon: JavascriptFrameworkIcon,
|
||||
smallIcon: IconJs,
|
||||
portNumber: 5173,
|
||||
runCommand: 'npm run dev',
|
||||
updateConfigCode: updateConfigCode('VITE_')
|
||||
}
|
||||
];
|
||||
|
||||
@@ -165,7 +192,7 @@ APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}"
|
||||
});
|
||||
</script>
|
||||
|
||||
<Wizard title="Add web platform" bind:showExitModal confirmExit>
|
||||
<Wizard title="Add web platform" bind:showExitModal>
|
||||
<Form onSubmit={createWebPlatform}>
|
||||
<Layout.Stack gap="xxl">
|
||||
<!-- Step One -->
|
||||
@@ -249,7 +276,10 @@ APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}"
|
||||
|
||||
<!-- Temporary fix: Remove this div once Code splitting issue with stack spacing is resolved -->
|
||||
<div class="pink2-code-margin-fix">
|
||||
<Code lang="bash" lineNumbers code={updateConfigCode} />
|
||||
<Code
|
||||
lang="bash"
|
||||
lineNumbers
|
||||
code={selectedFramework.updateConfigCode} />
|
||||
</div>
|
||||
|
||||
<Typography.Text variant="m-500"
|
||||
@@ -261,9 +291,13 @@ APPWRITE_PUBLIC_ENDPOINT = "${sdk.forProject.client.config.endpoint}"
|
||||
</div>
|
||||
|
||||
<Typography.Text variant="m-500"
|
||||
>3. Run the app, then click the <InlineCode
|
||||
>4. Run the app, then click the <InlineCode
|
||||
size="s"
|
||||
code="Send a ping" /> button to verify the setup.</Typography.Text>
|
||||
<!-- Temporary fix: Remove this div once Code splitting issue with stack spacing is resolved -->
|
||||
<div class="pink2-code-margin-fix">
|
||||
<Code lang="bash" lineNumbers code={selectedFramework.runCommand} />
|
||||
</div>
|
||||
</Layout.Stack>
|
||||
</Fieldset>
|
||||
<Card.Base padding="s"
|
||||
|
||||
@@ -127,27 +127,11 @@
|
||||
window.URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
function handleKeydown(event: KeyboardEvent) {
|
||||
if (event.key === 'Enter') {
|
||||
if (tab === 'env') {
|
||||
envCode += '\n';
|
||||
} else {
|
||||
jsonCode += '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
$: isButtonDisabled =
|
||||
(tab === 'env' && baseEnvCode === envCode) || (tab === 'json' && baseJsonCode === jsonCode);
|
||||
</script>
|
||||
|
||||
<svelte:window on:keydown={handleKeydown} />
|
||||
|
||||
<Modal
|
||||
title="Editor"
|
||||
bind:show={showEditor}
|
||||
onSubmit={handleSubmit}
|
||||
bind:error
|
||||
submitOnEnter={false}>
|
||||
<Modal title="Editor" bind:show={showEditor} onSubmit={handleSubmit} bind:error>
|
||||
<p slot="description">
|
||||
Edit {isGlobal ? 'global' : 'environment'} variables below or download as a
|
||||
<InlineCode size="s" code={`.${tab}`} /> file.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { Arrow, Avatar, AvatarGroup, CardGrid } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { isSameDay, toLocaleDate } from '$lib/helpers/date';
|
||||
import { isSameDay } from '$lib/helpers/date';
|
||||
import { Container } from '$lib/layout';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { GRACE_PERIOD_OVERRIDE, isSelfHosted } from '$lib/system';
|
||||
@@ -28,6 +28,7 @@
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import { Icon, Layout, Link, Status, Table } from '@appwrite.io/pink-svelte';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
import { Click, trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
export let data;
|
||||
@@ -163,9 +164,11 @@
|
||||
<Table.Row.Base {root}>
|
||||
{@const status = getStatus(entry.status)}
|
||||
<Table.Cell {root}>
|
||||
{isSameDay(new Date(), new Date(entry.$createdAt))
|
||||
? 'Today'
|
||||
: toLocaleDate(entry.$createdAt)}
|
||||
{#if isSameDay(new Date(), new Date(entry.$createdAt))}
|
||||
Today
|
||||
{:else}
|
||||
<DualTimeView time={entry.$createdAt} />
|
||||
{/if}
|
||||
</Table.Cell>
|
||||
<Table.Cell {root}>{entry.source}</Table.Cell>
|
||||
<Table.Cell {root}>
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import GitDisconnectModal from './GitDisconnectModal.svelte';
|
||||
import dayjs from 'dayjs';
|
||||
import { isSelfHosted } from '$lib/system';
|
||||
import { consoleVariables } from '$routes/(console)/store';
|
||||
import {
|
||||
@@ -25,6 +24,7 @@
|
||||
IconPlus,
|
||||
IconXCircle
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
import { Click, trackEvent } from '$lib/actions/analytics';
|
||||
import type { ComponentType } from 'svelte';
|
||||
import { Link } from '$lib/elements';
|
||||
@@ -117,7 +117,7 @@
|
||||
</Layout.Stack>
|
||||
</Table.Cell>
|
||||
<Table.Cell column="updated" {root}>
|
||||
{dayjs().to(installation.$updatedAt)}
|
||||
<DualTimeView time={installation.$updatedAt} />
|
||||
</Table.Cell>
|
||||
<Table.Cell column="actions" {root}>
|
||||
<Popover let:toggle padding="none" placement="bottom-end">
|
||||
|
||||
+4
-1
@@ -6,6 +6,7 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { DeploymentDownloadType, type Models } from '@appwrite.io/console';
|
||||
import {
|
||||
IconChevronRight,
|
||||
IconDotsHorizontal,
|
||||
IconDownload,
|
||||
IconLightningBolt,
|
||||
@@ -77,7 +78,9 @@
|
||||
{#if deployment?.status === 'ready' || deployment?.status === 'failed'}
|
||||
<SubMenu>
|
||||
<ActionMenu.Root noPadding>
|
||||
<ActionMenu.Item.Button leadingIcon={IconDownload}>
|
||||
<ActionMenu.Item.Button
|
||||
leadingIcon={IconDownload}
|
||||
trailingIcon={IconChevronRight}>
|
||||
Download
|
||||
</ActionMenu.Item.Button>
|
||||
</ActionMenu.Root>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
<Wizard column href={`${base}/project-${$page.params.project}/sites/site-${data.site.$id}`}>
|
||||
<!-- Creating a new stack -->
|
||||
<div style:position="relative" style="z-index: 1;">
|
||||
<div style:position="relative" style="z-index: 6;">
|
||||
<Layout.Stack gap="xxxl">
|
||||
<Layout.Stack gap="xxxl">
|
||||
<Layout.Stack gap="l" direction="column" alignItems="center">
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { EmptySearch, PaginationWithLimit } from '$lib/components';
|
||||
import { EmptySearch, PaginationWithLimit, SvgIcon } from '$lib/components';
|
||||
import { Button, InputSearch } from '$lib/elements/forms';
|
||||
import { page } from '$app/stores';
|
||||
import Wizard from '$lib/layout/wizard.svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { debounce } from '$lib/helpers/debounce.js';
|
||||
import { Card, Layout, Accordion, Selector } from '@appwrite.io/pink-svelte';
|
||||
import { Card, Layout, Accordion, Selector, Tooltip } from '@appwrite.io/pink-svelte';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import { app } from '$lib/stores/app.js';
|
||||
import { getFrameworkIcon } from '../../store.js';
|
||||
|
||||
export let data;
|
||||
|
||||
@@ -69,6 +70,7 @@
|
||||
href={`${base}/project-${$page.params.project}/sites/`}
|
||||
title="Create site"
|
||||
invertColumns
|
||||
stickySide
|
||||
hideFooter>
|
||||
<svelte:fragment slot="aside">
|
||||
<Layout.Stack gap="xl">
|
||||
@@ -95,7 +97,7 @@
|
||||
{/each}
|
||||
</Layout.Stack>
|
||||
</Accordion>
|
||||
<Accordion title="Framework">
|
||||
<Accordion title="Framework" open>
|
||||
<Layout.Stack>
|
||||
{#each [...data.frameworks] as framework}
|
||||
<Layout.Stack direction="row" gap="s">
|
||||
@@ -126,13 +128,23 @@
|
||||
padding="xxs">
|
||||
<Card.Media
|
||||
title={template.name}
|
||||
description={templateFrameworks.join(', ')}
|
||||
src={$app.themeInUse === 'dark'
|
||||
? template?.screenshotDark ||
|
||||
`${base}/images/sites/screenshot-placeholder-dark.svg`
|
||||
: template?.screenshotDark ||
|
||||
: template?.screenshotLight ||
|
||||
`${base}/images/sites/screenshot-placeholder-light.svg`}
|
||||
alt={template.name}>
|
||||
alt={template.name}
|
||||
avatar>
|
||||
<svelte:fragment slot="avatar">
|
||||
<Tooltip>
|
||||
<SvgIcon
|
||||
name={getFrameworkIcon(templateFrameworks[0])}
|
||||
iconSize="small" />
|
||||
<svelte:fragment slot="tooltip">
|
||||
{capitalize(templateFrameworks[0])}
|
||||
</svelte:fragment>
|
||||
</Tooltip>
|
||||
</svelte:fragment>
|
||||
</Card.Media>
|
||||
</Card.Link>
|
||||
{/each}
|
||||
|
||||
@@ -17,7 +17,7 @@ export const load = async ({ url, route }) => {
|
||||
|
||||
console.log(siteTemplatesList);
|
||||
|
||||
const [frameworks, useCases] = siteTemplatesList.templates.reduce(
|
||||
const [frameworksSet, useCasesSet] = siteTemplatesList.templates.reduce(
|
||||
([fr, uc], next) => {
|
||||
next.useCases.forEach((useCase) => uc.add(useCase));
|
||||
next.frameworks.forEach((framework) => fr.add(framework.name));
|
||||
@@ -26,6 +26,9 @@ export const load = async ({ url, route }) => {
|
||||
[new Set<string>(), new Set<string>()]
|
||||
);
|
||||
|
||||
const frameworks = Array.from(frameworksSet).sort((a, b) => a.localeCompare(b));
|
||||
const useCases = Array.from(useCasesSet).sort((a, b) => a.localeCompare(b));
|
||||
|
||||
const templates = siteTemplatesList.templates.filter((template) => {
|
||||
if (
|
||||
filter.frameworks.length > 0 &&
|
||||
|
||||
+4
-20
@@ -30,11 +30,12 @@
|
||||
null,
|
||||
2
|
||||
);
|
||||
const baseEnvCode = envCode;
|
||||
const baseJsonCode = jsonCode;
|
||||
let baseEnvCode = envCode;
|
||||
let baseJsonCode = jsonCode;
|
||||
|
||||
if (jsonCode === '{}') {
|
||||
jsonCode = '';
|
||||
baseJsonCode = '';
|
||||
}
|
||||
|
||||
let tab: 'env' | 'json' = 'env';
|
||||
@@ -108,30 +109,13 @@
|
||||
window.URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
function handleKeydown(event: KeyboardEvent) {
|
||||
if (event.key === 'Enter') {
|
||||
if (tab === 'env') {
|
||||
envCode += '\n';
|
||||
} else {
|
||||
jsonCode += '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$: isButtonDisabled =
|
||||
(tab === 'env' && baseEnvCode === envCode) || (tab === 'json' && baseJsonCode === jsonCode);
|
||||
|
||||
// TODO: merge this component with the rawVariableEditor?
|
||||
</script>
|
||||
|
||||
<svelte:window on:keydown={handleKeydown} />
|
||||
|
||||
<Modal
|
||||
title="Editor"
|
||||
bind:show={showEditor}
|
||||
onSubmit={handleSubmit}
|
||||
bind:error
|
||||
submitOnEnter={false}>
|
||||
<Modal title="Editor" bind:show={showEditor} onSubmit={handleSubmit} bind:error>
|
||||
<p slot="description">Add, edit, or delete environment variables using a raw editor.</p>
|
||||
|
||||
<Layout.Stack gap="l">
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
variant="secondary"
|
||||
padding="xs"
|
||||
radius="s"
|
||||
href={`${base}/project-${$page.params.project}/sites/create-site/templates`}>
|
||||
href={`${base}/project-${$page.params.project}/sites/create-site/templates?framework=React&framework=Vue.js&framework=Next.js&framework=SvelteKit&framework=Nuxt`}>
|
||||
<Image
|
||||
alt="repositories"
|
||||
radius="xxs"
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
import { page } from '$app/stores';
|
||||
import { timeFromNow } from '$lib/helpers/date';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { Card, Layout } from '@appwrite.io/pink-svelte';
|
||||
import { Card, Layout, Tooltip } from '@appwrite.io/pink-svelte';
|
||||
import { getFrameworkIcon } from './store';
|
||||
import { SvgIcon } from '$lib/components';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { getApiEndpoint } from '$lib/stores/sdk';
|
||||
import AddCollaboratorModal from './(components)/addCollaboratorModal.svelte';
|
||||
import SitesActionMenu from './sitesActionMenu.svelte';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
|
||||
export let siteList: Models.SiteList;
|
||||
export let deployments: Models.Deployment[];
|
||||
@@ -51,7 +52,12 @@
|
||||
alt={site.name}
|
||||
avatar>
|
||||
<svelte:fragment slot="avatar">
|
||||
<SvgIcon name={getFrameworkIcon(site.framework)} iconSize="small" />
|
||||
<Tooltip>
|
||||
<SvgIcon name={getFrameworkIcon(site.framework)} iconSize="small" />
|
||||
<svelte:fragment slot="tooltip">
|
||||
{capitalize(site.framework)}
|
||||
</svelte:fragment>
|
||||
</Tooltip>
|
||||
</svelte:fragment>
|
||||
<SitesActionMenu {site} bind:showAddCollaborator bind:selectedSite />
|
||||
</Card.Media>
|
||||
|
||||
@@ -20,8 +20,7 @@ export const load = async ({ params, depends, parent }) => {
|
||||
Query.equal('type', RuleType.DEPLOYMENT),
|
||||
Query.equal('deploymentResourceType', DeploymentResourceType.SITE),
|
||||
Query.equal('deploymentResourceId', site.$id),
|
||||
Query.equal('deploymentId', site.deploymentId),
|
||||
Query.equal('trigger', 'manual')
|
||||
Query.equal('deploymentId', site.deploymentId)
|
||||
])
|
||||
]);
|
||||
|
||||
|
||||
@@ -43,29 +43,16 @@
|
||||
<Container>
|
||||
<Layout.Stack direction="row" justifyContent="space-between">
|
||||
<SearchQuery search={data.search} placeholder="Search domain" />
|
||||
<Popover padding="none" let:toggle placement="bottom-end">
|
||||
<Button
|
||||
on:click={(event) => {
|
||||
toggle(event);
|
||||
trackEvent(Click.DomainCreateClick, {
|
||||
source: 'sites_domain_overview'
|
||||
});
|
||||
}}>
|
||||
<Icon icon={IconPlus} size="s" />
|
||||
Add domain
|
||||
</Button>
|
||||
<svelte:fragment slot="tooltip">
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Anchor
|
||||
href={`${base}/project-${$page.params.project}/sites/site-${$page.params.site}/domains/add-domain`}>
|
||||
Custom domain
|
||||
</ActionMenu.Item.Anchor>
|
||||
<ActionMenu.Item.Button on:click={() => (showPreviewDomainModal = true)}>
|
||||
Preview domain
|
||||
</ActionMenu.Item.Button>
|
||||
</ActionMenu.Root>
|
||||
</svelte:fragment>
|
||||
</Popover>
|
||||
<Button
|
||||
href={`${base}/project-${$page.params.project}/sites/site-${$page.params.site}/domains/add-domain`}
|
||||
on:click={() => {
|
||||
trackEvent(Click.DomainCreateClick, {
|
||||
source: 'sites_domain_overview'
|
||||
});
|
||||
}}>
|
||||
<Icon icon={IconPlus} size="s" />
|
||||
Add domain
|
||||
</Button>
|
||||
</Layout.Stack>
|
||||
|
||||
{#if data.domains.total}
|
||||
|
||||
+126
-125
@@ -5,14 +5,25 @@
|
||||
import { Wizard } from '$lib/layout';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { Fieldset, Layout, Tooltip, Icon, Alert, Input } from '@appwrite.io/pink-svelte';
|
||||
import {
|
||||
Fieldset,
|
||||
Layout,
|
||||
Tooltip,
|
||||
Icon,
|
||||
Alert,
|
||||
Input,
|
||||
Divider,
|
||||
Typography,
|
||||
Badge,
|
||||
Card
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { sortBranches } from '$lib/stores/vcs';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { consoleVariables } from '$routes/(console)/store';
|
||||
import InputDomain from '$lib/elements/forms/inputDomain.svelte';
|
||||
import { IconInfo } from '@appwrite.io/pink-icons-svelte';
|
||||
import { IconGlobeAlt, IconInfo } from '@appwrite.io/pink-icons-svelte';
|
||||
import { LabelCard } from '$lib/components';
|
||||
import { writable } from 'svelte/store';
|
||||
import ConnectRepoModal from '../../../(components)/connectRepoModal.svelte';
|
||||
@@ -28,7 +39,8 @@
|
||||
let isSubmitting = writable(false);
|
||||
|
||||
let showConnectRepo = false;
|
||||
let behaviour: 'REDIRECT' | 'CREATE' = 'CREATE';
|
||||
let behaviour: 'REDIRECT' | 'BRANCH' | 'ACTIVE' = 'ACTIVE';
|
||||
let step: 'add' | 'verify' = 'add';
|
||||
let domain = '';
|
||||
let redirect: string = null;
|
||||
let statusCode: number = null;
|
||||
@@ -146,11 +158,36 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Wizard title="Add custom domain" href={backPage} column columnSize="s">
|
||||
<Wizard title="Add custom domain" href={backPage} column columnSize="s" hideFooter={step === 'add'}>
|
||||
<Form bind:this={formComponent} onSubmit={addDomain} bind:isSubmitting>
|
||||
<Layout.Stack gap="xxl">
|
||||
<Fieldset legend="Details">
|
||||
<!-- <Input.ComboBox
|
||||
{#if step === 'add'}
|
||||
<Layout.Stack gap="xxl">
|
||||
<Layout.Grid columns={3} columnsXS={1}>
|
||||
<LabelCard value="ACTIVE" bind:group={behaviour} title="Active deployment">
|
||||
Point this domain to the latest deployed version.
|
||||
</LabelCard>
|
||||
<Tooltip disabled={!!data.site?.providerRepositoryId}>
|
||||
<div>
|
||||
<LabelCard
|
||||
value="BRANCH"
|
||||
bind:group={behaviour}
|
||||
title="Branch"
|
||||
disabled={!data.site?.providerRepositoryId}>
|
||||
Point this domain to a specific branch in your repository.
|
||||
</LabelCard>
|
||||
</div>
|
||||
<svelte:fragment slot="tooltip">
|
||||
No repository connected to your site.
|
||||
</svelte:fragment>
|
||||
</Tooltip>
|
||||
<LabelCard value="REDIRECT" bind:group={behaviour} title="Redirect">
|
||||
Forward all traffic from this domain to another URL.
|
||||
</LabelCard>
|
||||
</Layout.Grid>
|
||||
|
||||
<Fieldset legend="Settings">
|
||||
<Layout.Stack gap="xl">
|
||||
<!-- <Input.ComboBox
|
||||
label="Domain"
|
||||
id="domain"
|
||||
name="domain"
|
||||
@@ -161,131 +198,95 @@
|
||||
}))}
|
||||
required
|
||||
placeholder="appwrite.example.com" /> -->
|
||||
<InputDomain
|
||||
label="Domain"
|
||||
id="domain"
|
||||
bind:value={domain}
|
||||
required
|
||||
placeholder="appwrite.example.com" />
|
||||
</Fieldset>
|
||||
|
||||
<Layout.Grid columns={2} columnsXS={1}>
|
||||
<LabelCard
|
||||
value="CREATE"
|
||||
bind:group={behaviour}
|
||||
title="Connect to active deployment">
|
||||
Connect this domain to your active deployment and configure the linked Git
|
||||
branch as needed.
|
||||
</LabelCard>
|
||||
<LabelCard
|
||||
value="REDIRECT"
|
||||
bind:group={behaviour}
|
||||
title="Redirect to another domain">
|
||||
Automatically forward traffic from this domain to another URL of your choice.
|
||||
</LabelCard>
|
||||
</Layout.Grid>
|
||||
|
||||
{#if behaviour === 'CREATE'}
|
||||
<Fieldset legend="Configuration">
|
||||
<Layout.Stack gap="xl">
|
||||
{#if data.site?.providerRepositoryId}
|
||||
{@const sortedBranches = sortBranches(data.branches.branches)}
|
||||
{@const options = sortedBranches.map((branch) => ({
|
||||
label: branch.name,
|
||||
value: branch.name
|
||||
}))}
|
||||
<Layout.Stack gap="s">
|
||||
<InputSelect
|
||||
{options}
|
||||
label="Production branch"
|
||||
id="branch"
|
||||
required
|
||||
bind:value={branch}
|
||||
placeholder="Select branch" />
|
||||
{#if !data.branches?.total}
|
||||
<Input.Helper state="default">
|
||||
No branches found in the selected repository. Create a
|
||||
branch to see it here.
|
||||
</Input.Helper>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
{:else}
|
||||
<InputSelect
|
||||
disabled
|
||||
options={[{ label: 'main', value: 'main' }]}
|
||||
label="Production branch"
|
||||
id="branch"
|
||||
required
|
||||
value="main"
|
||||
placeholder="Select branch" />
|
||||
<Alert.Inline title=" There is no repository connected to your site">
|
||||
<Layout.Stack>
|
||||
<p>
|
||||
The domain will be connected to your active deployment.
|
||||
Connect your Git repository to link a production branch.
|
||||
</p>
|
||||
<div>
|
||||
<Button compact on:click={() => (showConnectRepo = true)}>
|
||||
Connect repository
|
||||
</Button>
|
||||
</div>
|
||||
</Layout.Stack>
|
||||
</Alert.Inline>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Fieldset>
|
||||
|
||||
<!-- {:else if data.site.installationId || data.installations?.total}
|
||||
<PinkCard.Base padding="none" border="dashed">
|
||||
<Empty
|
||||
type="secondary"
|
||||
title="Connect Git repository"
|
||||
description="Link a repository to associate your domain with an active deployment.">
|
||||
<svelte:fragment slot="actions">
|
||||
<Button secondary on:click={() => (showConnectRepo = true)}>
|
||||
<Icon icon={IconGithub} size="s" slot="start" />
|
||||
Connect Git repository
|
||||
</Button>
|
||||
</svelte:fragment>
|
||||
</Empty>
|
||||
</PinkCard.Base>
|
||||
{:else}
|
||||
<ConnectGit callbackState={{ newInstallation: 'true' }} />
|
||||
{/if} -->
|
||||
{:else if behaviour === 'REDIRECT'}
|
||||
<Fieldset legend="Configuration">
|
||||
<Layout.Stack gap="xl">
|
||||
<InputSelect
|
||||
label="Redirect to"
|
||||
id="redirect"
|
||||
placeholder="Select domain"
|
||||
options={redirectOptions}
|
||||
bind:value={redirect}
|
||||
required>
|
||||
<Tooltip slot="info">
|
||||
<Icon icon={IconInfo} size="s" />
|
||||
<span slot="tooltip">
|
||||
Redirect this domain. Domains added to your project will be
|
||||
listed here.
|
||||
</span>
|
||||
</Tooltip>
|
||||
</InputSelect>
|
||||
<InputSelect
|
||||
options={statusCodeOptions}
|
||||
label="Status code"
|
||||
id="code"
|
||||
<InputDomain
|
||||
label="Domain"
|
||||
id="domain"
|
||||
bind:value={domain}
|
||||
required
|
||||
bind:value={statusCode}
|
||||
placeholder="Select status code" />
|
||||
placeholder="appwrite.example.com" />
|
||||
|
||||
{#if behaviour === 'BRANCH'}
|
||||
{#if data.site?.providerRepositoryId}
|
||||
{@const sortedBranches = sortBranches(data.branches.branches)}
|
||||
{@const options = sortedBranches.map((branch) => ({
|
||||
label: branch.name,
|
||||
value: branch.name
|
||||
}))}
|
||||
<Layout.Stack gap="s">
|
||||
<InputSelect
|
||||
{options}
|
||||
label="Production branch"
|
||||
id="branch"
|
||||
required
|
||||
bind:value={branch}
|
||||
placeholder="Select branch" />
|
||||
{#if !data.branches?.total}
|
||||
<Input.Helper state="default">
|
||||
No branches found in the selected repository. Create a
|
||||
branch to see it here.
|
||||
</Input.Helper>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
{/if}
|
||||
{:else if behaviour === 'REDIRECT'}
|
||||
<InputSelect
|
||||
label="Redirect to"
|
||||
id="redirect"
|
||||
placeholder="Select domain"
|
||||
options={redirectOptions}
|
||||
bind:value={redirect}
|
||||
required>
|
||||
<Tooltip slot="info">
|
||||
<Icon icon={IconInfo} size="s" />
|
||||
<span slot="tooltip">
|
||||
Redirect this domain. Domains added to your project will be
|
||||
listed here.
|
||||
</span>
|
||||
</Tooltip>
|
||||
</InputSelect>
|
||||
<InputSelect
|
||||
options={statusCodeOptions}
|
||||
label="Status code"
|
||||
id="code"
|
||||
required
|
||||
bind:value={statusCode}
|
||||
placeholder="Select status code" />
|
||||
{/if}
|
||||
<Divider />
|
||||
<Layout.Stack direction="row" justifyContent="flex-end">
|
||||
<Button on:click={() => (step = 'verify')}>Add</Button>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Fieldset>
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
{:else if step === 'verify'}
|
||||
<Card.Base radius="s" padding="s">
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
gap="xs">
|
||||
<Layout.Stack direction="row" alignItems="center" gap="xs">
|
||||
<Icon icon={IconGlobeAlt} color="--fgcolor-neutral-primary" />
|
||||
|
||||
<Typography.Text variation="m-500" color="--fgcolor-neutral-primary">
|
||||
{domain}
|
||||
</Typography.Text>
|
||||
</Layout.Stack>
|
||||
<Button
|
||||
secondary
|
||||
href={`${base}/project-${$page.params.project}/sites/create-site/repositories`}>
|
||||
Change
|
||||
</Button>
|
||||
</Layout.Stack>
|
||||
</Card.Base>
|
||||
{/if}
|
||||
</Form>
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
<Button secondary href={backPage}>Cancel</Button>
|
||||
<Button on:click={() => formComponent.triggerSubmit()} bind:disabled={$isSubmitting}>
|
||||
Add
|
||||
Verify
|
||||
</Button>
|
||||
</svelte:fragment>
|
||||
</Wizard>
|
||||
|
||||
@@ -17,11 +17,7 @@
|
||||
let showDomainQR = false;
|
||||
let selectedDomainURL: string;
|
||||
|
||||
// $: hasCustomDomain = proxyRuleList?.total
|
||||
// ? proxyRuleList.rules.some((rule) =>
|
||||
// rule.domain.includes($consoleVariables._APP_DOMAIN_TARGET)
|
||||
// )
|
||||
// : false;
|
||||
$: rules = proxyRuleList?.rules?.filter((rule) => rule.trigger === 'manual') ?? [];
|
||||
</script>
|
||||
|
||||
<Layout.Stack>
|
||||
@@ -40,7 +36,7 @@
|
||||
</Layout.Stack>
|
||||
<Card padding="xs" radius="s" isTile>
|
||||
<Layout.Stack>
|
||||
{#if proxyRuleList?.rules?.length <= 1}
|
||||
{#if rules.length <= 1}
|
||||
<Layout.Stack gap="l">
|
||||
<Layout.Stack gap="xxs">
|
||||
<Typography.Text variant="m-500">
|
||||
@@ -65,11 +61,11 @@
|
||||
</Button>
|
||||
</div>
|
||||
</Layout.Stack>
|
||||
{#if proxyRuleList?.rules?.length}
|
||||
{#if rules?.length}
|
||||
<Divider />
|
||||
{/if}
|
||||
{/if}
|
||||
{#each proxyRuleList?.rules?.slice(0, 3) as rule, i}
|
||||
{#each rules?.slice(0, 3) as rule, i}
|
||||
<Layout.Stack
|
||||
alignItems="center"
|
||||
justifyContent="space-between"
|
||||
@@ -104,7 +100,7 @@
|
||||
<Icon icon={IconQrcode} />
|
||||
</Button>
|
||||
</Layout.Stack>
|
||||
{#if i < 2 && i < proxyRuleList.rules.length - 1}
|
||||
{#if i < 2 && i < rules.length - 1}
|
||||
<Divider />
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { Id } from '$lib/components';
|
||||
import { timeFromNow } from '$lib/helpers/date';
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { Badge, Layout, Table, Typography } from '@appwrite.io/pink-svelte';
|
||||
import Sheet from './sheet.svelte';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
|
||||
export let columns: Column[];
|
||||
export let logs: Models.ExecutionList;
|
||||
@@ -34,7 +33,7 @@
|
||||
<Id value={log.$id}>{log.$id}</Id>
|
||||
{/key}
|
||||
{:else if column.id === '$createdAt'}
|
||||
{capitalize(timeFromNow(log.$createdAt))}
|
||||
<DualTimeView time={log.$createdAt} />
|
||||
{:else if column.id === 'responseStatusCode'}
|
||||
{log.responseStatusCode}
|
||||
{:else if column.id === 'requestPath'}
|
||||
|
||||
+16
-14
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage } from '$lib/layout';
|
||||
import { Container, Usage } from '$lib/layout';
|
||||
|
||||
export let data;
|
||||
$: total = data.deploymentsTotal;
|
||||
@@ -13,22 +13,24 @@
|
||||
$: console.log(data);
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Deployments"
|
||||
path={`${base}/project-${$page.params.project}/sites/site-${$page.params.site}/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Deployments',
|
||||
title: 'Total deployments'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
<Container>
|
||||
<Usage
|
||||
title="Deployments"
|
||||
path={`${base}/project-${$page.params.project}/sites/site-${$page.params.site}/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Deployments',
|
||||
title: 'Total deployments'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
|
||||
<!-- <Usage
|
||||
<!-- <Usage
|
||||
title="Builds"
|
||||
path={`${base}/project-${$page.params.project}/sites/site-${$page.params.site}/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Builds',
|
||||
title: 'Total builds'
|
||||
}}
|
||||
total={totalBuilds}
|
||||
count={countBuilds} /> -->
|
||||
}}
|
||||
total={totalBuilds}
|
||||
count={countBuilds} /> -->
|
||||
</Container>
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage } from '$lib/layout';
|
||||
import { Container, Usage } from '$lib/layout';
|
||||
|
||||
export let data;
|
||||
$: total = data.deploymentsTotal;
|
||||
@@ -10,12 +10,14 @@
|
||||
$: console.log(data);
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Sites"
|
||||
path={`${base}/project-${$page.params.project}/sites/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Sites',
|
||||
title: 'Total sites'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
<Container>
|
||||
<Usage
|
||||
title="Sites"
|
||||
path={`${base}/project-${$page.params.project}/sites/usage`}
|
||||
countMetadata={{
|
||||
legend: 'Sites',
|
||||
title: 'Total sites'
|
||||
}}
|
||||
{total}
|
||||
{count} />
|
||||
</Container>
|
||||
@@ -10,7 +10,6 @@
|
||||
import { fileSearcher } from '$lib/commandCenter/searchers';
|
||||
import { canWriteBuckets } from '$lib/stores/roles';
|
||||
import { project } from '../../store';
|
||||
import { showCreateFile } from './+page.svelte';
|
||||
import { bucket } from './store';
|
||||
import { IconKey, IconLockClosed, IconPlus, IconPuzzle } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
<script lang="ts" context="module">
|
||||
export const showCreateFile = () => {
|
||||
wizard.start(Create);
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
@@ -13,17 +7,16 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { toLocaleDate } from '$lib/helpers/date';
|
||||
import { calculateSize } from '$lib/helpers/sizeConvertion';
|
||||
import { Container } from '$lib/layout';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { uploader } from '$lib/stores/uploader';
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import { sdk } from '$lib/stores/sdk.js';
|
||||
import DeleteFile from './deleteFile.svelte';
|
||||
import { Layout, Table, Icon, Popover, ActionMenu } from '@appwrite.io/pink-svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import DualTimeView from '$lib/components/dualTimeView.svelte';
|
||||
import {
|
||||
IconDotsHorizontal,
|
||||
IconPencil,
|
||||
@@ -34,7 +27,6 @@
|
||||
export let data;
|
||||
|
||||
let showDelete = false;
|
||||
let showDropdown = [];
|
||||
let selectedFile: Models.File = null;
|
||||
|
||||
const projectId = $page.params.project;
|
||||
@@ -84,7 +76,8 @@
|
||||
onMount(() => {
|
||||
return uploader.subscribe(() => {
|
||||
isUploading = $uploader.files.some(
|
||||
(file) => !file.completed && file.progress < 100 && !file.failed
|
||||
(file) =>
|
||||
file.status !== 'success' && file.progress < 100 && file.status !== 'failed'
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -142,7 +135,7 @@
|
||||
{calculateSize(file.sizeOriginal)}
|
||||
</Table.Cell>
|
||||
<Table.Cell column="created" {root}>
|
||||
{toLocaleDate(file.$createdAt)}
|
||||
<DualTimeView time={file.$createdAt} />
|
||||
</Table.Cell>
|
||||
<Table.Cell column="actions" {root}>
|
||||
<div class="u-flex u-main-center">
|
||||
@@ -169,7 +162,7 @@
|
||||
{calculateSize(file.sizeOriginal)}
|
||||
</Table.Cell>
|
||||
<Table.Cell column="created" {root}>
|
||||
{toLocaleDate(file.$createdAt)}
|
||||
<DualTimeView time={file.$createdAt} />
|
||||
</Table.Cell>
|
||||
<Table.Cell column="actions" {root}>
|
||||
<Popover let:toggle placement="bottom-start" padding="none">
|
||||
|
||||
+12
-10
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage } from '$lib/layout';
|
||||
import { Container, Usage } from '$lib/layout';
|
||||
import type { PageData } from './$types';
|
||||
|
||||
export let data: PageData;
|
||||
@@ -9,12 +9,14 @@
|
||||
$: count = data.files;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Files"
|
||||
path={`${base}/project-${$page.params.project}/storage/bucket-${$page.params.bucket}/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Files',
|
||||
title: 'Total files'
|
||||
}} />
|
||||
<Container>
|
||||
<Usage
|
||||
title="Files"
|
||||
path={`${base}/project-${$page.params.project}/storage/bucket-${$page.params.bucket}/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Files',
|
||||
title: 'Total files'
|
||||
}} />
|
||||
</Container>
|
||||
@@ -1,20 +1,21 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { Usage } from '$lib/layout';
|
||||
import type { PageData } from './$types';
|
||||
import { Container, Usage } from '$lib/layout';
|
||||
|
||||
export let data: PageData;
|
||||
export let data;
|
||||
$: total = data.bucketsTotal;
|
||||
$: count = data.buckets;
|
||||
</script>
|
||||
|
||||
<Usage
|
||||
title="Buckets"
|
||||
path={`${base}/project-${$page.params.project}/storage/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Buckets',
|
||||
title: 'Total buckets'
|
||||
}} />
|
||||
<Container>
|
||||
<Usage
|
||||
title="Buckets"
|
||||
path={`${base}/project-${$page.params.project}/storage/usage`}
|
||||
{total}
|
||||
{count}
|
||||
countMetadata={{
|
||||
legend: 'Buckets',
|
||||
title: 'Total buckets'
|
||||
}} />
|
||||
</Container>
|
||||
Reference in new issue
Block a user