feat: add missing alerts

This commit is contained in:
Arman committed 2023-08-28 16:36:16 +02:00
1 parent a76c25322f
commit d456f9fd08
7 files changed
+92 -5

No files matched your search

+3 -1
View File
@@ -7,12 +7,14 @@
export let buttons: Buttons[] = [];
export let isAction = false;
export let isStandalone = false;
let classes = '';
export { classes as class };
const dispatch = createEventDispatcher();
</script>
<section
class="alert"
class="alert {classes}"
class:is-action={isAction}
class:is-standalone={isStandalone}
class:is-success={type === 'success'}
+27 -1
View File
@@ -1,13 +1,26 @@
<script lang="ts">
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { FormList, InputDomain } from '$lib/elements/forms';
import { Alert } from '$lib/components';
import { Button, FormList, InputDomain } from '$lib/elements/forms';
import { WizardStep } from '$lib/layout';
import { sdk } from '$lib/stores/sdk';
import { isSelfHosted } from '$lib/system';
import { func } from '$routes/console/project-[project]/functions/function-[function]/store';
import { onMount } from 'svelte';
import { ProxyTypes } from '../index.svelte';
import { domain, typeStore } from './store';
let error = null;
let isDomainsEnabled = false;
onMount(async () => {
if (!isSelfHosted) {
return;
}
const vars = await sdk.forConsole.console.variables();
isDomainsEnabled = vars?._APP_DOMAIN_ENABLED === true;
});
async function createDomain() {
try {
if ($domain.$id) {
@@ -56,4 +69,17 @@
</p>
</div>
{/if}
{#if isSelfHosted && !isDomainsEnabled}
<Alert class="common-section" type="info">
<svelte:fragment slot="title">
Adding a domain to a self-hosted instance
</svelte:fragment>
To add a domain to a locally hosted Appwrite project, you must first configure your server
domain.
<svelte:fragment slot="buttons">
<!-- TODO: add link to docs -->
<Button href="#/" external text>Learn more</Button>
</svelte:fragment>
</Alert>
{/if}
</WizardStep>
+8
View File
@@ -0,0 +1,8 @@
import { page } from '$app/stores';
import { derived } from 'svelte/store';
import type { Models } from '@appwrite.io/console';
export const consoleVariables = derived(
page,
($page) => $page.data.account as Models.ConsoleVariables
);
@@ -18,6 +18,7 @@ export const load: PageLoad = async ({ params, depends, url, route, parent }) =>
Query.limit(limit),
Query.offset(offset),
Query.orderDesc('')
])
]),
consoleVariables: sdk.forConsole.console.variables()
};
};
@@ -16,6 +16,8 @@
import { invalidate } from '$app/navigation';
import UpdateLogging from './updateLogging.svelte';
import UpdateConfiguration from './updateConfiguration.svelte';
import { Alert, Heading } from '$lib/components';
import { Button } from '$lib/elements/forms';
export let data;
@@ -39,6 +41,18 @@
</script>
<Container>
<Heading tag="h2" size="5">Settings</Heading>
{#if $func.version !== 'v3'}
<Alert type="warning" dismissible class="u-margin-block-start-24">
<svelte:fragment slot="title">Your function is outdated</svelte:fragment>
Update your function version to make use of new features including build commands and HTTP
data in your executions. To update, follow the steps outlined in our documentation.
<svelte:fragment slot="buttons">
<!-- TODO: Add link to docs -->
<Button href="#/" external text>Learn more</Button>
</svelte:fragment>
</Alert>
{/if}
<ExecuteFunction />
<UpdateName />
<UpdateRuntime />
@@ -15,6 +15,7 @@
import { page } from '$app/stores';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import {
Alert,
AvatarGroup,
Box,
CardGrid,
@@ -47,6 +48,8 @@
import ConnectExisting from '$lib/wizards/functions/connectExisting.svelte';
import InputSelectSearch from '$lib/elements/forms/inputSelectSearch.svelte';
import { installations } from '$lib/wizards/functions/store';
import { isSelfHosted } from '$lib/system';
import { consoleVariables } from '$lib/stores/variables';
const functionId = $page.params.function;
@@ -169,6 +172,8 @@
selectedBranch !== $func?.providerBranch ||
silentMode !== $func?.providerSilentMode ||
selectedDir !== $func?.providerRootDirectory;
$: isVcsEnabled = $consoleVariables?._APP_VCS_ENABLED === true;
</script>
<Form onSubmit={updateConfiguration}>
@@ -277,7 +282,21 @@
</div>
</Box>
{:else}
<article class="card-git card is-border-dashed is-no-shadow">
{#if isSelfHosted && !isVcsEnabled}
<Alert class="common-section" type="info">
<svelte:fragment slot="title">
Installing Git to a self-hosted instance
</svelte:fragment>
When installing Git in a locally hosted Appwrite project, you must
first configure your environment variables.
<svelte:fragment slot="buttons">
<!-- TODO: add link to docs -->
<Button href="#/" external text>Learn more</Button>
</svelte:fragment>
</Alert>
{/if}
<article
class="card-git card is-border-dashed is-no-shadow common-section">
<div class="u-flex u-cross-center u-flex-vertical u-gap-32">
<div class="u-flex u-cross-center u-gap-8">
<AvatarGroup
@@ -1,11 +1,15 @@
<script lang="ts">
import { base } from '$app/paths';
import { Card, Heading } from '$lib/components';
import { Alert, Card, Heading } from '$lib/components';
import { Pill } from '$lib/elements';
import { Button } from '$lib/elements/forms';
import { Container } from '$lib/layout';
import { consoleVariables } from '$lib/stores/variables';
import { isSelfHosted } from '$lib/system';
import { connectTemplate } from '$lib/wizards/functions/cover.svelte';
import { template } from './store';
$: isVcsEnabled = $consoleVariables?._APP_VCS_ENABLED === true;
</script>
<Container>
@@ -58,6 +62,19 @@
</span>
</Heading>
<p class="u-margin-block-start-24">{$template.tagline}</p>
{#if isSelfHosted && !isVcsEnabled}
<Alert class="u-margin-block-start-24" type="info">
<svelte:fragment slot="title">
Cloning templates to a self-hosted instance
</svelte:fragment>
In order to clone a template to a locally hosted Appwrite project, you must set
up a Git integration and configure your environment variables.
<svelte:fragment slot="buttons">
<!-- TODO: add link to docs -->
<Button href="#/" external text>Learn more</Button>
</svelte:fragment>
</Alert>
{/if}
<div class="u-flex u-gap-16 u-main-end u-margin-block-start-24">
<Button
text