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
5a824c8a97
28 files changed
+373
-355
No files matched your search
+1
-1
@@ -23,7 +23,7 @@
|
||||
"@appwrite.io/pink-icons": "0.25.0",
|
||||
"@appwrite.io/pink-icons-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@011c2131",
|
||||
"@appwrite.io/pink-legacy": "^1.0.1",
|
||||
"@appwrite.io/pink-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@011c2131",
|
||||
"@appwrite.io/pink-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@e87d552",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@sentry/sveltekit": "^8.38.0",
|
||||
"@stripe/stripe-js": "^3.5.0",
|
||||
|
||||
Generated
+9
-9
@@ -21,8 +21,8 @@ importers:
|
||||
specifier: ^1.0.1
|
||||
version: 1.0.1
|
||||
'@appwrite.io/pink-svelte':
|
||||
specifier: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@011c2131
|
||||
version: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@011c2131(react-dom@18.3.1(react@18.3.1))(svelte@4.2.19)
|
||||
specifier: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@e87d552
|
||||
version: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@e87d552(react-dom@18.3.1(react@18.3.1))(svelte@4.2.19)
|
||||
'@popperjs/core':
|
||||
specifier: ^2.11.8
|
||||
version: 2.11.8
|
||||
@@ -221,8 +221,8 @@ packages:
|
||||
peerDependencies:
|
||||
svelte: ^4.0.0
|
||||
|
||||
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@011c21311ddfbacaa53563f02a1dcba32db8b595':
|
||||
resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@011c21311ddfbacaa53563f02a1dcba32db8b595}
|
||||
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@e87d5523b50e063bfe0d3b846d5db171a24b0792':
|
||||
resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@e87d5523b50e063bfe0d3b846d5db171a24b0792}
|
||||
version: 1.0.0-next.7
|
||||
peerDependencies:
|
||||
svelte: ^4.0.0
|
||||
@@ -236,8 +236,8 @@ packages:
|
||||
'@appwrite.io/pink-legacy@1.0.1':
|
||||
resolution: {integrity: sha512-e5IZx2drqSxgl2WXvmr0eLfg/WiOCzuqQE8oksD+9GoFBkcL9HWvXul5GjFni3RBAN9XFRL3nUExGk4T0H8sFw==}
|
||||
|
||||
'@appwrite.io/pink-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@011c2131':
|
||||
resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@011c2131}
|
||||
'@appwrite.io/pink-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@e87d552':
|
||||
resolution: {tarball: https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@e87d552}
|
||||
version: 1.0.0-next.85
|
||||
peerDependencies:
|
||||
react-dom: ^18.0.0
|
||||
@@ -4103,7 +4103,7 @@ snapshots:
|
||||
dependencies:
|
||||
svelte: 4.2.19
|
||||
|
||||
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@011c21311ddfbacaa53563f02a1dcba32db8b595(svelte@4.2.19)':
|
||||
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@e87d5523b50e063bfe0d3b846d5db171a24b0792(svelte@4.2.19)':
|
||||
dependencies:
|
||||
svelte: 4.2.19
|
||||
|
||||
@@ -4116,9 +4116,9 @@ snapshots:
|
||||
'@appwrite.io/pink-icons': 1.0.0
|
||||
the-new-css-reset: 1.11.3
|
||||
|
||||
'@appwrite.io/pink-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@011c2131(react-dom@18.3.1(react@18.3.1))(svelte@4.2.19)':
|
||||
'@appwrite.io/pink-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@e87d552(react-dom@18.3.1(react@18.3.1))(svelte@4.2.19)':
|
||||
dependencies:
|
||||
'@appwrite.io/pink-icons-svelte': https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@011c21311ddfbacaa53563f02a1dcba32db8b595(svelte@4.2.19)
|
||||
'@appwrite.io/pink-icons-svelte': https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@e87d5523b50e063bfe0d3b846d5db171a24b0792(svelte@4.2.19)
|
||||
'@floating-ui/dom': 1.6.13
|
||||
'@melt-ui/pp': 0.3.2(@melt-ui/svelte@0.86.3(svelte@4.2.19))(svelte@4.2.19)
|
||||
'@melt-ui/svelte': 0.86.3(svelte@4.2.19)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Button, Form } from '$lib/elements/forms';
|
||||
import { Button, Form, InputCheckbox } from '$lib/elements/forms';
|
||||
import { Alert, Dialog, Layout } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let open: boolean;
|
||||
@@ -8,9 +8,13 @@
|
||||
export let action: string = 'Delete';
|
||||
export let canDelete: boolean = true;
|
||||
export let disabled: boolean = false;
|
||||
export let confirmDeletion: boolean = false;
|
||||
export let onSubmit: (e: SubmitEvent) => Promise<void> | void = function () {
|
||||
return;
|
||||
};
|
||||
|
||||
let confirm = false;
|
||||
let checkboxId = `delete_${title.replaceAll(' ', '_').toLowerCase()}`;
|
||||
</script>
|
||||
|
||||
<Form isModal {onSubmit}>
|
||||
@@ -25,13 +29,30 @@
|
||||
{error}
|
||||
</Alert.Inline>
|
||||
{/if}
|
||||
<slot />
|
||||
|
||||
<Layout.Stack gap="l">
|
||||
<slot />
|
||||
|
||||
{#if confirmDeletion}
|
||||
<InputCheckbox
|
||||
size="s"
|
||||
required
|
||||
id={checkboxId}
|
||||
bind:checked={confirm}
|
||||
label="I understand and confirm" />
|
||||
{/if}
|
||||
</Layout.Stack>
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
<Layout.Stack direction="row" gap="s" justifyContent="flex-end">
|
||||
<slot name="footer">
|
||||
<Button text on:click={() => (open = false)}>Cancel</Button>
|
||||
{#if canDelete}
|
||||
<Button danger submit {disabled}>{action}</Button>
|
||||
<Button
|
||||
danger
|
||||
submit
|
||||
disabled={disabled || (confirmDeletion ? !confirm : false)}
|
||||
>{action}</Button>
|
||||
{/if}
|
||||
</slot>
|
||||
</Layout.Stack>
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
import { isTabletViewport } from '$lib/stores/viewport';
|
||||
import { isCloud } from '$lib/system.js';
|
||||
import { user } from '$lib/stores/user';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
let showSupport = false;
|
||||
|
||||
@@ -68,6 +69,10 @@
|
||||
: 'light'
|
||||
: theme;
|
||||
|
||||
trackEvent('select_theme', {
|
||||
value: theme === 'auto' ? 'system' : theme
|
||||
});
|
||||
|
||||
app.update(() => ({
|
||||
themeInUse: themeInUse,
|
||||
theme: theme
|
||||
@@ -115,7 +120,7 @@
|
||||
</a>
|
||||
<Breadcrumbs {organizations} />
|
||||
{#if selectedProject && selectedProject.pingCount === 0}
|
||||
<div class="only-desktop">
|
||||
<div class="only-desktop" style:margin-inline-start="-10px">
|
||||
<Button.Anchor
|
||||
href={`${base}/project-${selectedProject.$id}/get-started`}
|
||||
variant="secondary"
|
||||
@@ -130,12 +135,24 @@
|
||||
<Button.Anchor
|
||||
size="s"
|
||||
variant="primary"
|
||||
on:click={() => {
|
||||
trackEvent('click_organization_upgrade', {
|
||||
from: 'button',
|
||||
source: 'top_nav'
|
||||
});
|
||||
}}
|
||||
href={`${base}/organization-${currentOrg.$id}/change-plan`}
|
||||
>Upgrade</Button.Anchor>
|
||||
{/if}
|
||||
|
||||
<DropList show={$feedback.show} class="extended-width">
|
||||
<Button.Button type="button" variant="compact" on:click={() => toggleFeedback()}
|
||||
<Button.Button
|
||||
type="button"
|
||||
variant="compact"
|
||||
on:click={() => {
|
||||
toggleFeedback();
|
||||
trackEvent('click_menu_feedback', { source: 'top_nav' });
|
||||
}}
|
||||
>Feedback
|
||||
</Button.Button>
|
||||
<svelte:fragment slot="other">
|
||||
@@ -152,7 +169,10 @@
|
||||
<Button.Button
|
||||
variant="compact"
|
||||
type="button"
|
||||
on:click={() => (showSupport = !showSupport)}>
|
||||
on:click={() => {
|
||||
showSupport = !showSupport;
|
||||
trackEvent('click_menu_support', { source: 'top_nav' });
|
||||
}}>
|
||||
Support
|
||||
</Button.Button>
|
||||
|
||||
@@ -174,6 +194,9 @@
|
||||
<Link.Button
|
||||
on:click={() => {
|
||||
showAccountMenu = !showAccountMenu;
|
||||
if (showAccountMenu) {
|
||||
trackEvent('click_menu_dropdown');
|
||||
}
|
||||
}}>
|
||||
<div style:user-select="none">
|
||||
<Avatar size="s" src={avatar} />
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
import MobileFeedbackModal from '$routes/(console)/wizard/feedback/mobileFeedbackModal.svelte';
|
||||
import { getSidebarState, updateSidebarState } from '$lib/helpers/sidebar';
|
||||
import { isTabletViewport } from '$lib/stores/viewport';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
type $$Props = HTMLElement & {
|
||||
state?: 'closed' | 'open' | 'icons';
|
||||
@@ -66,6 +67,7 @@
|
||||
|
||||
$: state = $isTabletViewport ? 'closed' : getSidebarState();
|
||||
$: pathname = $page.url.pathname;
|
||||
$: isOnProjectSettings = /^\/console\/project-[a-zA-Z0-9-]+\/settings$/.test(pathname);
|
||||
|
||||
const projectOptions = [
|
||||
{ name: 'Auth', icon: IconUserGroup, slug: 'auth' },
|
||||
@@ -111,6 +113,7 @@
|
||||
class="progress-card"
|
||||
href={`/console/project-${project.$id}/get-started`}
|
||||
on:click={() => {
|
||||
trackEvent('click_menu_get_started');
|
||||
sideBarIsOpen = false;
|
||||
}}>
|
||||
<div class="progressCircle">
|
||||
@@ -138,6 +141,7 @@
|
||||
class="link"
|
||||
class:active={pathname.includes('overview')}
|
||||
on:click={() => {
|
||||
trackEvent('click_menu_overview');
|
||||
sideBarIsOpen = false;
|
||||
}}
|
||||
><span class="link-icon"
|
||||
@@ -165,6 +169,7 @@
|
||||
class="link"
|
||||
class:active={pathname.includes(projectOption.slug)}
|
||||
on:click={() => {
|
||||
trackEvent(`click_menu_${projectOption.slug}`);
|
||||
sideBarIsOpen = false;
|
||||
}}
|
||||
><span class="link-icon"
|
||||
@@ -182,7 +187,12 @@
|
||||
</div>
|
||||
<div class="only-mobile">
|
||||
<Tooltip inline={false} placement="right" disabled={state !== 'icons'}>
|
||||
<a href={`/console/project-${project.$id}/settings`} class="link"
|
||||
<a
|
||||
href={`/console/project-${project.$id}/settings`}
|
||||
on:click={() => {
|
||||
trackEvent('click_menu_settings');
|
||||
}}
|
||||
class="link"
|
||||
><span class="link-icon"><Icon icon={IconCog} size="s" /></span
|
||||
><span
|
||||
class:no-text={state === 'icons'}
|
||||
@@ -200,7 +210,10 @@
|
||||
<Button.Button
|
||||
variant="secondary"
|
||||
size="s"
|
||||
on:click={() => toggleFeedback()}
|
||||
on:click={() => {
|
||||
toggleFeedback();
|
||||
trackEvent('click_menu_feedback', { source: 'side_nav' });
|
||||
}}
|
||||
>Feedback
|
||||
</Button.Button>
|
||||
<svelte:fragment slot="other">
|
||||
@@ -212,7 +225,10 @@
|
||||
<Button.Button
|
||||
variant="secondary"
|
||||
size="s"
|
||||
on:click={() => ($showSupportModal = true)}>
|
||||
on:click={() => {
|
||||
$showSupportModal = true;
|
||||
trackEvent('click_menu_support', { source: 'side_nav' });
|
||||
}}>
|
||||
<span>Support</span>
|
||||
|
||||
<svelte:fragment slot="other">
|
||||
@@ -232,7 +248,10 @@
|
||||
<a
|
||||
href={`/console/project-${project.$id}/settings`}
|
||||
class="link"
|
||||
class:active={pathname.includes('settings')}
|
||||
on:click={() => {
|
||||
trackEvent('click_menu_settings');
|
||||
}}
|
||||
class:active={isOnProjectSettings}
|
||||
><span class="link-icon"><Icon icon={IconCog} size="s" /></span><span
|
||||
class:no-text={state === 'icons'}
|
||||
class:has-text={state === 'open'}
|
||||
@@ -251,7 +270,10 @@
|
||||
<Button.Button
|
||||
variant="secondary"
|
||||
size="s"
|
||||
on:click={() => toggleFeedback()}
|
||||
on:click={() => {
|
||||
toggleFeedback();
|
||||
trackEvent('click_menu_feedback', { source: 'side_nav' });
|
||||
}}
|
||||
><span>Feedback</span>
|
||||
</Button.Button>
|
||||
<svelte:fragment slot="other">
|
||||
@@ -263,7 +285,10 @@
|
||||
<Button.Button
|
||||
variant="secondary"
|
||||
size="s"
|
||||
on:click={() => ($showSupportModal = true)}>
|
||||
on:click={() => {
|
||||
$showSupportModal = true;
|
||||
trackEvent('click_menu_support', { source: 'side_nav' });
|
||||
}}>
|
||||
<span>Support</span>
|
||||
|
||||
<svelte:fragment slot="other">
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<Typography.Text size="s" truncate color="--color-fgcolor-neutral-primary"
|
||||
>{value}</Typography.Text>
|
||||
{:else}
|
||||
<Skeleton variant="line" width={100} height={20} />
|
||||
<Skeleton variant="line" width={100} height={19.5} />
|
||||
{/if}
|
||||
</slot>
|
||||
</Layout.Stack>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
element?: HTMLInputElement | undefined;
|
||||
indeterminate?: boolean;
|
||||
size?: 's' | 'm';
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export let id: string = '';
|
||||
@@ -20,6 +21,7 @@
|
||||
export let disabled = false;
|
||||
export let element: HTMLInputElement | undefined = undefined;
|
||||
export let size: $$Props['size'] = 's';
|
||||
export let description = '';
|
||||
let error: string;
|
||||
|
||||
const handleInvalid = (event: Event) => {
|
||||
@@ -47,6 +49,7 @@
|
||||
{size}
|
||||
{label}
|
||||
{required}
|
||||
{description}
|
||||
on:invalid={handleInvalid}
|
||||
on:click
|
||||
on:change />
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { Modal } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
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 { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import type { Dependencies } from '$lib/constants';
|
||||
import Confirm from '$lib/components/confirm.svelte';
|
||||
|
||||
@@ -15,6 +13,18 @@
|
||||
|
||||
let error: string;
|
||||
|
||||
function getCorrectMessage(): string {
|
||||
const resourceType = selectedDomain.resourceType;
|
||||
switch (resourceType) {
|
||||
case 'api':
|
||||
return `access ${resourceType}`;
|
||||
case 'function':
|
||||
return `execute your ${resourceType}`;
|
||||
case 'site':
|
||||
return `view your ${resourceType} `;
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteDomain() {
|
||||
try {
|
||||
await sdk.forProject.proxy.deleteRule(selectedDomain.$id);
|
||||
@@ -32,8 +42,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
a
|
||||
<Confirm onSubmit={deleteDomain} title="Delete domain" bind:open={showDelete} bind:error>
|
||||
Are you sure you want to delete <b>{selectedDomain?.domain}</b>? You will no longer be able to
|
||||
execute your function by visiting this domain.
|
||||
<p data-private>Are you sure you want to delete <b>{selectedDomain?.domain}</b>?</p>
|
||||
<p>You will no longer be able to {getCorrectMessage()} by visiting this domain.</p>
|
||||
</Confirm>
|
||||
@@ -55,10 +55,6 @@
|
||||
$templateConfig.repositoryBehaviour === 'manual'
|
||||
? undefined
|
||||
: $choices.rootDir || undefined,
|
||||
$template.providerRepositoryId || undefined,
|
||||
$template.providerOwner || undefined,
|
||||
runtimeDetail.providerRootDirectory || undefined,
|
||||
$template.providerVersion || undefined,
|
||||
$templateConfig.specification || undefined
|
||||
);
|
||||
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import Confirm from '$lib/components/confirm.svelte';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, Form } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { Dialog, Layout } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let showDelete = false;
|
||||
let error: string;
|
||||
|
||||
@@ -38,6 +38,6 @@
|
||||
title="Delete authentication method"
|
||||
bind:open={showDelete}
|
||||
bind:error>
|
||||
Are you sure you want to delete this authentication method? You will no longer be able to use
|
||||
this method to authenticate your account.
|
||||
<p>Are you sure you want to delete this authentication method?</p>
|
||||
<p>You will no longer be able to use this method to authenticate your account.</p>
|
||||
</Confirm>
|
||||
@@ -1,149 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Card, Heading } from '$lib/components';
|
||||
import { BillingPlan, Dependencies } from '$lib/constants';
|
||||
import { Button, Form, InputSelect, InputText } from '$lib/elements/forms';
|
||||
import FormList from '$lib/elements/forms/formList.svelte';
|
||||
import { Container } from '$lib/layout';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { ID } from '@appwrite.io/console';
|
||||
import { onMount } from 'svelte';
|
||||
import { tierToPlan, type Tier, plansInfo } from '$lib/stores/billing';
|
||||
import { formatCurrency } from '$lib/helpers/numbers';
|
||||
import { base } from '$app/paths';
|
||||
import { checkPricingRefAndRedirect } from '$lib/helpers/pricingRedirect';
|
||||
|
||||
let name: string;
|
||||
let plan: Tier;
|
||||
|
||||
const options = isCloud
|
||||
? [
|
||||
{
|
||||
value: BillingPlan.FREE,
|
||||
label: `${tierToPlan(BillingPlan.FREE).name} - ${formatCurrency($plansInfo.get(BillingPlan.FREE).price)} / month`
|
||||
},
|
||||
{
|
||||
value: BillingPlan.PRO,
|
||||
label: `${tierToPlan(BillingPlan.PRO).name} - ${formatCurrency($plansInfo.get(BillingPlan.PRO).price)} / month + add-ons`
|
||||
},
|
||||
{
|
||||
value: BillingPlan.SCALE,
|
||||
label: `${tierToPlan(BillingPlan.SCALE).name} - ${formatCurrency($plansInfo.get(BillingPlan.SCALE).price)}/month + usage`
|
||||
}
|
||||
]
|
||||
: [];
|
||||
|
||||
onMount(() => {
|
||||
if (isCloud) {
|
||||
checkPricingRefAndRedirect($page.url.searchParams);
|
||||
}
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
const orgName = name?.length ? name : 'Personal Projects';
|
||||
if (isCloud) {
|
||||
if (plan === BillingPlan.FREE) {
|
||||
try {
|
||||
const org = await sdk.forConsole.billing.createOrganization(
|
||||
ID.unique(),
|
||||
orgName,
|
||||
plan,
|
||||
null,
|
||||
null
|
||||
);
|
||||
trackEvent(Submit.OrganizationCreate, {
|
||||
plan: tierToPlan(plan)?.name
|
||||
});
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
await goto(`${base}/organization-${org.$id}`);
|
||||
addNotification({
|
||||
message: `${orgName} organization successfully created`,
|
||||
type: 'success'
|
||||
});
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.OrganizationCreate);
|
||||
}
|
||||
} else {
|
||||
goto(`${base}/create-organization?name=${orgName}&plan=${plan}`);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
const org = await sdk.forConsole.teams.create(ID.unique(), orgName);
|
||||
|
||||
await invalidate(Dependencies.ACCOUNT);
|
||||
await goto(`${base}/organization-${org.$id}`);
|
||||
|
||||
addNotification({
|
||||
message: `${orgName} organization successfully created`,
|
||||
type: 'success'
|
||||
});
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
message: error.message,
|
||||
type: 'error'
|
||||
});
|
||||
trackError(error, Submit.OrganizationCreate);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<Container overlapCover size="large">
|
||||
<Card>
|
||||
<Heading size="4" tag="h2">Create a new organization</Heading>
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<FormList gap={16}>
|
||||
<InputText
|
||||
id="name"
|
||||
label="Name"
|
||||
placeholder="Organization name"
|
||||
hideRequired
|
||||
bind:value={name} />
|
||||
{#if isCloud}
|
||||
<div class="u-margin-block-start-8">
|
||||
<h3><b>Plan</b></h3>
|
||||
<p>
|
||||
For more details on our plans, visit our <Button
|
||||
link
|
||||
external
|
||||
href="https://appwrite.io/pricing">pricing page</Button
|
||||
>.
|
||||
</p>
|
||||
<FormList class="u-margin-block-start-8">
|
||||
<InputSelect
|
||||
placeholder="Select a plan"
|
||||
label="Select plan"
|
||||
showLabel={false}
|
||||
id="plan"
|
||||
required
|
||||
hideRequired
|
||||
{options}
|
||||
bind:value={plan} />
|
||||
</FormList>
|
||||
</div>
|
||||
{/if}
|
||||
<Button
|
||||
fullWidth
|
||||
submit
|
||||
disabled={isCloud && !plan}
|
||||
event="create_organization"
|
||||
submissionLoader
|
||||
let:isSubmitting>
|
||||
{#if isSubmitting}
|
||||
Creating your first organization
|
||||
{:else}
|
||||
Get started
|
||||
{/if}
|
||||
</Button>
|
||||
</FormList>
|
||||
</Form>
|
||||
</Card>
|
||||
</Container>
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { Button, InputCheckbox } from '$lib/elements/forms';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { invalidate } from '$app/navigation';
|
||||
@@ -10,9 +9,21 @@
|
||||
|
||||
export let show = false;
|
||||
export let selectedDomain: Models.ProxyRule;
|
||||
let confirm = false;
|
||||
|
||||
let error = '';
|
||||
|
||||
function getCorrectMessage(): string {
|
||||
const resourceType = selectedDomain.resourceType;
|
||||
switch (resourceType) {
|
||||
case 'api':
|
||||
return `access ${resourceType}`;
|
||||
case 'function':
|
||||
return `execute your ${resourceType}`;
|
||||
case 'site':
|
||||
return `view your ${resourceType} `;
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteDomain() {
|
||||
try {
|
||||
await sdk.forProject.proxy.deleteRule(selectedDomain.$id);
|
||||
@@ -30,21 +41,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Confirm title="Delete domain" bind:open={show} onSubmit={deleteDomain} bind:error>
|
||||
{#if selectedDomain}
|
||||
<p data-private>
|
||||
Are you sure you want to delete <b>{selectedDomain.domain}</b>? You will no longer be
|
||||
able to execute your function by visiting this domain.
|
||||
</p>
|
||||
{/if}
|
||||
<InputCheckbox
|
||||
required
|
||||
bind:checked={confirm}
|
||||
id="confirm"
|
||||
label="I understand and confirm"
|
||||
size="s" />
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text on:click={() => (show = false)}>Cancel</Button>
|
||||
<Button secondary submit disabled={!confirm}>Delete</Button>
|
||||
</svelte:fragment>
|
||||
<Confirm onSubmit={deleteDomain} title="Delete domain" bind:open={show} bind:error>
|
||||
<p data-private>Are you sure you want to delete <b>{selectedDomain?.domain}</b>?</p>
|
||||
<p>You will no longer be able to {getCorrectMessage()} by visiting this domain.</p>
|
||||
</Confirm>
|
||||
+1
-7
@@ -30,11 +30,5 @@
|
||||
</script>
|
||||
|
||||
<Confirm title="Delete certificate" bind:open={show} onSubmit={deleteCertificate} bind:error>
|
||||
<Typography.Text>
|
||||
Are you sure you want to delete SSL certificate? This action is irreversible.
|
||||
</Typography.Text>
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text on:click={() => (show = false)}>Cancel</Button>
|
||||
<Button secondary submit danger>Delete</Button>
|
||||
</svelte:fragment>
|
||||
Are you sure you want to delete SSL certificate? This action is irreversible.
|
||||
</Confirm>
|
||||
@@ -14,6 +14,7 @@ export const templateConfig = writable<{
|
||||
repositoryId: string;
|
||||
execute?: boolean;
|
||||
scopes?: string[];
|
||||
specification?: string;
|
||||
}>();
|
||||
|
||||
export const choices = writable<{
|
||||
|
||||
+1
-4
@@ -49,10 +49,7 @@
|
||||
$templateConfig.repositoryBehaviour === 'manual'
|
||||
? undefined
|
||||
: $choices.rootDir || undefined,
|
||||
$template.providerRepositoryId || undefined,
|
||||
$template.providerOwner || undefined,
|
||||
runtimeDetail.providerRootDirectory || undefined,
|
||||
$template.providerVersion || undefined
|
||||
$templateConfig.specification
|
||||
);
|
||||
|
||||
if ($templateConfig.variables) {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
import { user } from '$lib/stores/user';
|
||||
import { isSmallViewport } from '$lib/stores/viewport';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
</script>
|
||||
|
||||
{#if !$page.url.pathname.includes('get-started')}
|
||||
@@ -45,6 +46,7 @@
|
||||
variant="secondary"
|
||||
size="s"
|
||||
on:click={async () => {
|
||||
trackEvent('onboarding_hub_platform_dismiss');
|
||||
await setHasOnboardingDismissed($project.$id);
|
||||
goto(`${base}/project-${$project.$id}/overview`);
|
||||
requestAnimationFrame(() => {
|
||||
|
||||
@@ -37,8 +37,15 @@
|
||||
import { AvatarGroup } from '$lib/components';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { getPlatformInfo } from '$lib/helpers/platform';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
function createKey() {
|
||||
trackEvent('onboarding_hub_platform', {
|
||||
platform: 'server',
|
||||
state: 'add'
|
||||
});
|
||||
wizard.start(Wizard);
|
||||
}
|
||||
|
||||
@@ -386,7 +393,12 @@
|
||||
<Layout.Stack
|
||||
gap="l"
|
||||
direction={$isSmallViewport ? 'column' : 'row'}>
|
||||
<Card.Button on:click={() => addPlatform(0)} padding="s"
|
||||
<Card.Button
|
||||
on:click={() => {
|
||||
trackEvent('onboarding_hub_setup_databases');
|
||||
goto(`${base}/project-${projectId}/databases`);
|
||||
}}
|
||||
padding="s"
|
||||
><Layout.Stack gap="xl"
|
||||
><div
|
||||
class="card-top-image database-card-image"
|
||||
@@ -419,20 +431,38 @@
|
||||
<Link.Anchor
|
||||
variant="quiet-muted"
|
||||
href="https://appwrite.io/docs/references"
|
||||
on:click={() => {
|
||||
trackEvent(
|
||||
'onboarding_hub_api_references'
|
||||
);
|
||||
}}
|
||||
target="_blank">API references</Link.Anchor>
|
||||
<Link.Anchor
|
||||
variant="quiet-muted"
|
||||
href="https://appwrite.io/docs/tutorials"
|
||||
on:click={() => {
|
||||
trackEvent('onboarding_hub_tutorials');
|
||||
}}
|
||||
target="_blank">Tutorials</Link.Anchor>
|
||||
<Link.Anchor
|
||||
variant="quiet-muted"
|
||||
href="https://appwrite.io/docs/products/storage/quick-start"
|
||||
on:click={() => {
|
||||
trackEvent(
|
||||
'onboarding_hub_storage_quick_start'
|
||||
);
|
||||
}}
|
||||
target="_blank"
|
||||
>Storage quick start
|
||||
</Link.Anchor>
|
||||
<Link.Anchor
|
||||
variant="quiet-muted"
|
||||
href="https://appwrite.io/docs/products/functions/quick-start"
|
||||
on:click={() => {
|
||||
trackEvent(
|
||||
'onboarding_hub_functions_quick_start'
|
||||
);
|
||||
}}
|
||||
target="_blank"
|
||||
>Functions quick start</Link.Anchor>
|
||||
</Layout.Stack>
|
||||
@@ -458,16 +488,29 @@
|
||||
<Link.Anchor
|
||||
variant="quiet-muted"
|
||||
href={`${base}/project-${projectId}/auth/settings`}
|
||||
on:click={() => {
|
||||
trackEvent(
|
||||
'onboarding_hub_auth_email_password'
|
||||
);
|
||||
}}
|
||||
>E-mail and password
|
||||
</Link.Anchor>
|
||||
<Link.Anchor
|
||||
variant="quiet-muted"
|
||||
href={`${base}/project-${projectId}/auth/settings`}
|
||||
>OAuth 2</Link.Anchor>
|
||||
on:click={() => {
|
||||
trackEvent(
|
||||
'onboarding_hub_auth_oauth2'
|
||||
);
|
||||
}}>OAuth 2</Link.Anchor>
|
||||
<Link.Anchor
|
||||
variant="quiet-muted"
|
||||
href={`${base}/project-${projectId}/auth/settings`}
|
||||
>View all methods</Link.Anchor>
|
||||
on:click={() => {
|
||||
trackEvent(
|
||||
'onboarding_hub_auth_all_methods'
|
||||
);
|
||||
}}>View all methods</Link.Anchor>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
<div
|
||||
@@ -481,7 +524,12 @@
|
||||
</div></Card.Base>
|
||||
</div>
|
||||
|
||||
<Card.Link href="https://appwrite.io/discord" padding="s">
|
||||
<Card.Link
|
||||
href="https://appwrite.io/discord"
|
||||
padding="s"
|
||||
on:click={() => {
|
||||
trackEvent('onboarding_hub_discord');
|
||||
}}>
|
||||
<div class="full-height-card">
|
||||
<Layout.Stack gap="xs" justifyContent="space-between">
|
||||
<Layout.Stack direction="column" gap="xxxs">
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<script lang="ts" context="module">
|
||||
import SearchDark from '$lib/images/search-dark.svg';
|
||||
import SearchLight from '$lib/images/search-light.svg';
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import CreateAndroid from './createAndroid.svelte';
|
||||
import CreateApple from './createApple.svelte';
|
||||
@@ -8,6 +6,7 @@
|
||||
import CreateReactNative from './createReactNative.svelte';
|
||||
import CreateWeb from './createWeb.svelte';
|
||||
import { createPlatform, versions } from './wizard/store';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
export enum Platform {
|
||||
Web,
|
||||
@@ -20,6 +19,10 @@
|
||||
export async function addPlatform(type: Platform) {
|
||||
await versions.load();
|
||||
createPlatform.reset();
|
||||
trackEvent('onboarding_hub_platform', {
|
||||
platform: platforms[type],
|
||||
state: 'add'
|
||||
});
|
||||
wizard.start(platforms[type]);
|
||||
}
|
||||
|
||||
@@ -35,6 +38,10 @@
|
||||
key: key,
|
||||
type: type
|
||||
});
|
||||
trackEvent('onboarding_hub_platform', {
|
||||
platform: platforms[platform],
|
||||
state: 'continue'
|
||||
});
|
||||
wizard.start(platforms[platform], null, 1, {
|
||||
isPlatformCreated: true,
|
||||
platform: type,
|
||||
|
||||
+14
-7
@@ -1,22 +1,29 @@
|
||||
<script lang="ts">
|
||||
import Link from '$lib/elements/link.svelte';
|
||||
import { timeFromNow } from '$lib/helpers/date';
|
||||
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';
|
||||
|
||||
export let deployment: Models.Deployment;
|
||||
</script>
|
||||
|
||||
<p>
|
||||
{#if deployment.providerCommitAuthor}
|
||||
<span title={deployment.$updatedAt}>
|
||||
{capitalize(timeFromNow(deployment.$updatedAt))}
|
||||
</span>
|
||||
<Tooltip>
|
||||
<span>
|
||||
{capitalize(timeFromNow(deployment.$updatedAt))}
|
||||
</span>
|
||||
<span slot="tooltip">{toLocaleDateTime(deployment.$updatedAt)}</span>
|
||||
</Tooltip>
|
||||
by <Link href={deployment.providerCommitAuthorUrl} external
|
||||
>{deployment.providerCommitAuthor}</Link>
|
||||
{:else}
|
||||
<span title={deployment.$updatedAt}>
|
||||
{capitalize(timeFromNow(deployment.$updatedAt))}
|
||||
</span>
|
||||
<Tooltip>
|
||||
<span>
|
||||
{capitalize(timeFromNow(deployment.$updatedAt))}
|
||||
</span>
|
||||
<span slot="tooltip">{toLocaleDateTime(deployment.$updatedAt)}</span>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
</p>
|
||||
@@ -28,7 +28,7 @@
|
||||
</Link>
|
||||
</Layout.Stack>
|
||||
<svelte:fragment slot="tooltip">
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Root noPadding>
|
||||
<ActionMenu.Item.Anchor
|
||||
href={deployment.providerRepositoryUrl}
|
||||
external
|
||||
@@ -42,7 +42,6 @@
|
||||
{deployment.providerBranch}
|
||||
</ActionMenu.Item.Anchor>
|
||||
{#if deployment?.providerCommitMessage && deployment?.providerCommitHash && deployment?.providerCommitUrl}
|
||||
<!-- TODO: either the Popover or this Anchor needs to correctly manage the width -->
|
||||
<ActionMenu.Item.Anchor
|
||||
href={deployment.providerCommitUrl}
|
||||
external
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import { formatTimeDetailed } from '$lib/helpers/timeConversion';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
@@ -102,7 +103,7 @@
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
{#key buildLogs}
|
||||
<Logs logs={buildLogs || 'No logs available'} />
|
||||
<Logs logs={buildLogs || 'No logs available'} bind:theme={$app.themeInUse} />
|
||||
{/key}
|
||||
{#if ['processing', 'building'].includes(status)}
|
||||
<Layout.Stack alignItems="flex-end">
|
||||
|
||||
@@ -7,23 +7,33 @@
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { protocol } from '$routes/(console)/store';
|
||||
import InstantRollbackDomain from './instantRollbackDomain.svelte';
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { app } from '$lib/stores/app';
|
||||
import EmptyDeploymentDark from './empty-deployment-dark.svg';
|
||||
import EmptyDeploymentLight from './empty-deployment-light.svg';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
export let data;
|
||||
let showRollback = false;
|
||||
|
||||
$: console.log(data.site);
|
||||
$: console.log(data.deployment);
|
||||
$: console.log(data.deploymentList);
|
||||
$: console.log(data.proxyRuleList);
|
||||
let unsubscribe: { (): void };
|
||||
|
||||
// TODO: dark mode empty state
|
||||
onMount(() => {
|
||||
unsubscribe = sdk.forConsole.client.subscribe('console', (response) => {
|
||||
if (response.events.includes(`sites.${$page.params.site}.deployments.*`)) {
|
||||
console.log('test');
|
||||
invalidate(Dependencies.SITE);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// $: console.log(data.site);
|
||||
$: console.log(data.deployment);
|
||||
// $: console.log(data.deploymentList);
|
||||
// $: console.log(data.proxyRuleList);
|
||||
</script>
|
||||
|
||||
<Container>
|
||||
@@ -37,7 +47,7 @@
|
||||
>Instant rollback</Button>
|
||||
</svelte:fragment>
|
||||
</SiteCard>
|
||||
{:else}
|
||||
{:else if data.deployment?.status === 'building'}
|
||||
<Card.Base padding="none">
|
||||
<Empty
|
||||
title="Deployment is still building"
|
||||
@@ -46,21 +56,17 @@
|
||||
Your build is running. When it completes, this page will automatically
|
||||
update with the latest deployment.
|
||||
</span>
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
gap="s"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
slot="actions">
|
||||
<!-- TODO: enable it after we have copy again-->
|
||||
<!-- <Button
|
||||
text
|
||||
href={`${base}/console/project-${$page.params.project}/sites/site-${data.site.$id}/deployments/deployment-${data.deployment.$id}`}>
|
||||
View logs
|
||||
</Button> -->
|
||||
<Button secondary on:click={() => invalidate(Dependencies.SITE)}
|
||||
>Reload</Button>
|
||||
</Layout.Stack>
|
||||
</Empty>
|
||||
</Card.Base>
|
||||
{:else}
|
||||
<Card.Base padding="none">
|
||||
<Empty
|
||||
title="No deployments found"
|
||||
src={$app.themeInUse === 'dark' ? EmptyDeploymentDark : EmptyDeploymentLight}>
|
||||
<span slot="description">
|
||||
You haven't deployed any sites yet. Get started by deploying your first
|
||||
site.
|
||||
</span>
|
||||
</Empty>
|
||||
</Card.Base>
|
||||
{/if}
|
||||
|
||||
@@ -94,11 +94,12 @@
|
||||
<Icon size="s" icon={IconPlus} />
|
||||
Create deployment
|
||||
</Button>
|
||||
<svelte:fragment slot="tooltip">
|
||||
<ActionMenu.Root>
|
||||
<svelte:fragment slot="tooltip" let:toggle>
|
||||
<ActionMenu.Root noPadding>
|
||||
<ActionMenu.Item.Button
|
||||
badge="Recommended"
|
||||
on:click={() => {
|
||||
on:click={(e) => {
|
||||
toggle(e);
|
||||
if (!hasInstallation) {
|
||||
showConnectRepo = true;
|
||||
} else {
|
||||
@@ -108,13 +109,15 @@
|
||||
Git
|
||||
</ActionMenu.Item.Button>
|
||||
<ActionMenu.Item.Button
|
||||
on:click={() => {
|
||||
on:click={(e) => {
|
||||
toggle(e);
|
||||
showConnectCLI = true;
|
||||
}}>
|
||||
CLI
|
||||
</ActionMenu.Item.Button>
|
||||
<ActionMenu.Item.Button
|
||||
on:click={() => {
|
||||
on:click={(e) => {
|
||||
toggle(e);
|
||||
showConnectManual = true;
|
||||
}}>
|
||||
Manual
|
||||
|
||||
+102
-76
@@ -4,80 +4,81 @@
|
||||
import { Repositories } from '$lib/components/git';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Link } from '$lib/elements';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import InputSelectSearch from '$lib/elements/forms/inputSelectSearch.svelte';
|
||||
import { Button, InputCheckbox, InputSelect } from '$lib/elements/forms';
|
||||
import { timeFromNow } from '$lib/helpers/date';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { installation, repository, sortBranches } from '$lib/stores/vcs';
|
||||
import type { BuildRuntime, Framework, Models } from '@appwrite.io/console';
|
||||
import { Type, type Models } from '@appwrite.io/console';
|
||||
import { IconGithub } from '@appwrite.io/pink-icons-svelte';
|
||||
import { Icon, InlineCode, Layout, Spinner, Typography } from '@appwrite.io/pink-svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { Icon, Layout, Skeleton, Typography } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let show = false;
|
||||
export let site: Models.Site;
|
||||
|
||||
let installations = { installations: [], total: 0 };
|
||||
let hasRepository = !!site?.providerRepositoryId;
|
||||
let selectedRepository: string = null;
|
||||
let selectedRepository: string = site.providerRepositoryId;
|
||||
let branch: string = null;
|
||||
let activate = true;
|
||||
let error = '';
|
||||
|
||||
onMount(async () => {
|
||||
installations = await sdk.forProject.vcs.listInstallations();
|
||||
if (!site?.installationId && installations.total > 0) {
|
||||
installation.set(installations.installations[0]);
|
||||
}
|
||||
if (!$repository?.id && hasRepository) {
|
||||
$repository = await sdk.forProject.vcs.getRepository(
|
||||
$installation.$id,
|
||||
site.providerRepositoryId
|
||||
async function loadInstallations() {
|
||||
try {
|
||||
installations = await sdk.forProject.vcs.listInstallations();
|
||||
if (!site?.installationId && installations.total > 0) {
|
||||
installation.set(installations.installations[0]);
|
||||
}
|
||||
$installation = installations.installations.find(
|
||||
(installation) => installation.$id === site.installationId
|
||||
);
|
||||
if (!$installation?.$id) {
|
||||
$installation = installations.installations[0];
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
console.log(installations);
|
||||
});
|
||||
}
|
||||
|
||||
async function loadBranches() {
|
||||
const { branches } = await sdk.forProject.vcs.listRepositoryBranches(
|
||||
$installation.$id,
|
||||
selectedRepository
|
||||
);
|
||||
const sorted = sortBranches(branches);
|
||||
branch = sorted[0]?.name ?? null;
|
||||
async function load() {
|
||||
try {
|
||||
await loadInstallations();
|
||||
if (!$repository?.id && hasRepository) {
|
||||
$repository = await sdk.forProject.vcs.getRepository(
|
||||
$installation.$id,
|
||||
site.providerRepositoryId
|
||||
);
|
||||
}
|
||||
const branchList = await sdk.forProject.vcs.listRepositoryBranches(
|
||||
$installation.$id,
|
||||
selectedRepository
|
||||
);
|
||||
|
||||
if (!branch) {
|
||||
branch = 'main';
|
||||
console.log(branchList);
|
||||
|
||||
const sorted = sortBranches(branchList.branches);
|
||||
branch = sorted[0]?.name ?? null;
|
||||
|
||||
if (!branch) {
|
||||
branch = 'main';
|
||||
}
|
||||
|
||||
return sorted;
|
||||
} catch (error) {
|
||||
console.log(installations);
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
return sorted;
|
||||
}
|
||||
|
||||
async function createDeployment() {
|
||||
try {
|
||||
if (!site.installationId || !site.providerRepositoryId || !branch) {
|
||||
await sdk.forProject.sites.update(
|
||||
site.$id,
|
||||
site.name,
|
||||
site?.framework as Framework,
|
||||
site.enabled || undefined,
|
||||
site.timeout || undefined,
|
||||
site.installCommand || undefined,
|
||||
site.buildCommand || undefined,
|
||||
site.outputDirectory || undefined,
|
||||
(site?.buildRuntime as BuildRuntime) || undefined,
|
||||
site.adapter || undefined,
|
||||
site.fallbackFile || undefined,
|
||||
site.installationId || $installation.$id || undefined,
|
||||
site.providerRepositoryId || $repository.id || undefined,
|
||||
branch,
|
||||
site.providerSilentMode || undefined,
|
||||
undefined //TODO: add dir?
|
||||
);
|
||||
}
|
||||
await sdk.forProject.sites.createVcsDeployment(site.$id, Type.Branch, branch, activate);
|
||||
show = false;
|
||||
invalidate(Dependencies.DEPLOYMENTS);
|
||||
addNotification({
|
||||
message: 'Deployment has been created successfully',
|
||||
message: activate
|
||||
? 'Deployment is in progress. It will be automatically activated after build step completes.'
|
||||
: 'Deployment is in progress. You can activate it after build step completes.',
|
||||
type: 'success'
|
||||
});
|
||||
} catch (e) {
|
||||
@@ -88,26 +89,26 @@
|
||||
|
||||
<Modal title="Create Git deployment" bind:show onSubmit={createDeployment} bind:error>
|
||||
<span slot="description">
|
||||
Enter a valid commit reference to create a new deployment from <InlineCode code="test" /> or
|
||||
use the CLI to deploy. <Link href="#">Learn more</Link>
|
||||
Enter a valid commit reference to create a new deployment. <Link href="#">Learn more</Link>
|
||||
</span>
|
||||
{#if installations && hasRepository}
|
||||
<Card isTile padding="s" radius="s">
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
gap="xs">
|
||||
<Layout.Stack direction="row" alignItems="center" gap="s">
|
||||
<Icon size="s" icon={IconGithub} />
|
||||
<Typography.Text variant="m-400" color="--color-fgcolor-neutral-primary">
|
||||
{$repository?.organization}/{$repository?.name}
|
||||
</Typography.Text>
|
||||
{#if hasRepository}
|
||||
{#await load()}
|
||||
<Card isTile padding="xs" radius="s" variant="secondary">
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
gap="xs">
|
||||
<Layout.Stack direction="row" alignItems="center" gap="s">
|
||||
<Icon size="s" icon={IconGithub} />
|
||||
<Skeleton variant="line" width={100} height={19.6} />
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Card>
|
||||
<Layout.Stack gap="s">
|
||||
<Skeleton variant="line" width={100} height={19.6} />
|
||||
<Skeleton variant="line" width={350} height={31} />
|
||||
</Layout.Stack>
|
||||
</Card>
|
||||
{#await loadBranches()}
|
||||
<Spinner size="s" />
|
||||
{:then branches}
|
||||
{@const options =
|
||||
branches
|
||||
@@ -120,24 +121,48 @@
|
||||
?.sort((a, b) => {
|
||||
return a.label > b.label ? 1 : -1;
|
||||
}) ?? []}
|
||||
|
||||
<InputSelectSearch
|
||||
<Card isTile padding="xs" radius="s" variant="secondary">
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
gap="xs">
|
||||
<Layout.Stack direction="row" alignItems="center" gap="s" inline>
|
||||
<Icon icon={IconGithub} />
|
||||
<Link
|
||||
external
|
||||
href={`https://github.com/${$repository?.organization}/${$repository?.name}`}>
|
||||
<Layout.Stack direction="row" alignItems="center" gap="s" inline>
|
||||
{$repository?.organization}/{$repository?.name}
|
||||
</Layout.Stack>
|
||||
</Link>
|
||||
</Layout.Stack>
|
||||
<Typography.Caption variant="400" color="--color-fgcolor-neutral-tertiary">
|
||||
Last updated {timeFromNow($repository?.pushedAt)}
|
||||
</Typography.Caption>
|
||||
</Layout.Stack>
|
||||
</Card>
|
||||
<InputSelect
|
||||
required={true}
|
||||
id="branch"
|
||||
label="Production branch"
|
||||
placeholder="Select branch"
|
||||
hideRequired
|
||||
bind:value={branch}
|
||||
bind:search={branch}
|
||||
isSearchable
|
||||
on:select={(event) => {
|
||||
branch = event.detail.value;
|
||||
}}
|
||||
interactiveOutput
|
||||
name="branch"
|
||||
{options} />
|
||||
{#if branch}
|
||||
<InputCheckbox
|
||||
label="Activate deployment after build"
|
||||
id="activate"
|
||||
description="This deployment will automatically activate after the build completes. If
|
||||
unchecked, it will remain inactive, and you can activate it manually later."
|
||||
bind:checked={activate} />
|
||||
{/if}
|
||||
{/await}
|
||||
{/if}
|
||||
{#if !hasRepository}
|
||||
{:else}
|
||||
<Repositories
|
||||
bind:selectedRepository
|
||||
installationList={installations}
|
||||
@@ -153,7 +178,8 @@
|
||||
{/if}
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text size="s" on:click={() => (show = false)}>Cancel</Button>
|
||||
<Button size="s" disabled={!$installation?.$id || !selectedRepository || !branch}
|
||||
>Create</Button>
|
||||
<Button submit size="s" disabled={!$installation?.$id || !selectedRepository || !branch}>
|
||||
Create
|
||||
</Button>
|
||||
</svelte:fragment>
|
||||
</Modal>
|
||||
+19
-15
@@ -55,21 +55,25 @@
|
||||
});
|
||||
|
||||
async function fetchUsage() {
|
||||
metrics.forEach((metric) => {
|
||||
metric.value = null;
|
||||
});
|
||||
metrics = metrics;
|
||||
try {
|
||||
const usage = await sdk.forProject.sites.getUsage($page.params.site, range);
|
||||
metrics = metrics.map((metric) => {
|
||||
metric.value = usage[metric.id] ?? '-';
|
||||
return metric;
|
||||
// Add timeout to make it look nicer
|
||||
setTimeout(async () => {
|
||||
metrics.forEach((metric) => {
|
||||
metric.value = null;
|
||||
});
|
||||
metrics = metrics;
|
||||
console.log(usage);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
try {
|
||||
const usage = await sdk.forProject.sites.getUsage($page.params.site, range);
|
||||
metrics = metrics.map((metric) => {
|
||||
metric.value = usage[metric.id] ?? '-';
|
||||
return metric;
|
||||
});
|
||||
metrics = metrics;
|
||||
console.log(usage);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}, 800);
|
||||
}
|
||||
|
||||
$: console.log(metrics);
|
||||
@@ -95,9 +99,9 @@
|
||||
on:change={fetchUsage} />
|
||||
</div>
|
||||
</Layout.Stack>
|
||||
<Layout.GridBox gap="m" itemSize="154px">
|
||||
<Layout.Stack gap="m" direction="row">
|
||||
{#each metrics as metric}
|
||||
<UsageCard description={metric.description} bind:value={metric.value} />
|
||||
{/each}
|
||||
</Layout.GridBox>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
+1
-1
@@ -193,7 +193,7 @@
|
||||
<span class:icon-cheveron-down={!showing} class:icon-cheveron-up={showing}> </span>
|
||||
</Tag>
|
||||
<svelte:fragment slot="tooltip" let:toggle>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Root noPadding>
|
||||
{#each filter.options as option (option.value + option.checked)}
|
||||
<SelectSearchCheckbox
|
||||
padding={8}
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@
|
||||
{#if selectedDomain}
|
||||
<p data-private>
|
||||
Are you sure you want to delete <b>{selectedDomain.domain}</b>? You will no longer be
|
||||
able to execute your function by visiting this domain.
|
||||
able to view your site by visiting this domain.
|
||||
</p>
|
||||
{/if}
|
||||
<InputCheckbox
|
||||
|
||||
Reference in new issue
Block a user