mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: create deployment dropdown
This commit is contained in:
@@ -5,7 +5,7 @@ import { get } from 'svelte/store';
|
||||
import type { Searcher } from '../commands';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { page } from '$app/stores';
|
||||
import { showCreateDeployment } from '$routes/console/project-[project]/functions/function-[function]/+page.svelte';
|
||||
import { showCreateDeployment } from '$routes/console/project-[project]/functions/function-[function]/store';
|
||||
|
||||
const getFunctionCommand = (fn: Models.Function, projectId: string) => {
|
||||
return {
|
||||
@@ -37,7 +37,7 @@ export const functionsSearcher = (async (query: string) => {
|
||||
if (!$page.url.pathname.endsWith(func.$id)) {
|
||||
await goto(`/console/project-${projectId}/functions/function-${func.$id}`);
|
||||
}
|
||||
showCreateDeployment();
|
||||
showCreateDeployment.set(true);
|
||||
},
|
||||
group: 'functions',
|
||||
icon: 'plus'
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { execute, func } from './store';
|
||||
import { execute, func, showCreateDeployment } from './store';
|
||||
import Execute from './execute.svelte';
|
||||
import { registerCommands } from '$lib/commandCenter';
|
||||
import { goto } from '$app/navigation';
|
||||
import { project } from '../../store';
|
||||
import { page } from '$app/stores';
|
||||
import { showCreateDeployment } from './+page.svelte';
|
||||
|
||||
$: $registerCommands([
|
||||
{
|
||||
@@ -14,7 +13,7 @@
|
||||
if (!$page.url.pathname.endsWith($func.$id)) {
|
||||
await goto(`/console/project-${$project.$id}/functions/function-${$func.$id}`);
|
||||
}
|
||||
showCreateDeployment();
|
||||
showCreateDeployment.set(true);
|
||||
},
|
||||
keys: $page.url.pathname.endsWith($func.$id) ? ['c'] : ['c', 'd'],
|
||||
group: 'functions',
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
<script lang="ts" context="module">
|
||||
let showCreate = writable(false);
|
||||
export const showCreateDeployment = () => {
|
||||
showCreate.set(true);
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
@@ -49,7 +42,6 @@
|
||||
import RedeployModal from './redeployModal.svelte';
|
||||
import DeploymentSource from './deploymentSource.svelte';
|
||||
import DeploymentCreatedBy from './deploymentCreatedBy.svelte';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -82,7 +74,7 @@
|
||||
<Container>
|
||||
<div class="u-flex u-gap-12 common-section u-main-space-between">
|
||||
<Heading tag="h2" size="5">Deployments</Heading>
|
||||
<Create bind:showCreate={$showCreate} />
|
||||
<Create main />
|
||||
</div>
|
||||
{#if data.deployments.total}
|
||||
<div class="common-section">
|
||||
@@ -180,7 +172,7 @@
|
||||
single
|
||||
href="https://appwrite.io/docs/functions#createFunction"
|
||||
target="deployment"
|
||||
on:click={() => showCreate.set(true)} />
|
||||
on:click />
|
||||
{/if}
|
||||
|
||||
<div class="common-section">
|
||||
@@ -297,7 +289,7 @@
|
||||
</TableBody>
|
||||
</TableScroll>
|
||||
{:else}
|
||||
<Empty single target="deployment" on:click={() => showCreate.set(true)}>
|
||||
<Empty single target="deployment" on:click>
|
||||
<div class="u-text-center">
|
||||
<Heading size="7" tag="h2"
|
||||
>You have no deployments. Create one to see it here.</Heading>
|
||||
@@ -312,18 +304,29 @@
|
||||
text
|
||||
event="empty_documentation"
|
||||
ariaLabel={`create {target}`}>Documentation</Button>
|
||||
<Button secondary on:click={() => showCreate.set(true)}>
|
||||
Create deployment
|
||||
</Button>
|
||||
<Button secondary on:click>Create deployment</Button>
|
||||
<Create />
|
||||
</div>
|
||||
</Empty>
|
||||
{/if}
|
||||
{:else}
|
||||
<Empty
|
||||
single
|
||||
target="deployment"
|
||||
href="https://appwrite.io/docs/functions#createFunction"
|
||||
on:click={() => showCreate.set(true)} />
|
||||
<Empty single target="deployment" on:click>
|
||||
<div class="u-text-center">
|
||||
<Heading size="7" tag="h2">Create your first deployment to get started.</Heading>
|
||||
<p class="body-text-2 u-bold u-margin-block-start-4">
|
||||
Learn more about deployments in our Documentation.
|
||||
</p>
|
||||
</div>
|
||||
<div class="u-flex u-gap-16 u-main-center">
|
||||
<Button
|
||||
external
|
||||
href="https://appwrite.io/docs/functions#createFunction"
|
||||
text
|
||||
event="empty_documentation"
|
||||
ariaLabel={`create {target}`}>Documentation</Button>
|
||||
<Create secondary />
|
||||
</div>
|
||||
</Empty>
|
||||
{/if}
|
||||
{@const sum = data.deployments.total ? data.deployments.total - 1 : 0}
|
||||
|
||||
|
||||
@@ -4,33 +4,43 @@
|
||||
import CreateCli from './createCli.svelte';
|
||||
import CreateGit from './createGit.svelte';
|
||||
import CreateManual from './createManual.svelte';
|
||||
import { showCreateDeployment } from './store';
|
||||
|
||||
export let showCreate = false;
|
||||
export let secondary = false;
|
||||
// This allows us to know which one to open when the user uses the shortcut in the command center
|
||||
export let main = false;
|
||||
let show = false;
|
||||
let showCreateCli = false;
|
||||
let showCreateGit = false;
|
||||
let showCreateManual = false;
|
||||
|
||||
$: if ($showCreateDeployment && main) {
|
||||
show = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<DropList bind:show={showCreate} placement="bottom-end">
|
||||
<Button on:click={() => (showCreate = true)} event="create_deployment">
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
<DropList bind:show placement="bottom-end">
|
||||
<Button {secondary} on:click={() => (show = !show)} event="create_deployment">
|
||||
{#if !secondary}
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
{/if}
|
||||
<span class="text">Create deployment</span>
|
||||
</Button>
|
||||
<svelte:fragment slot="list">
|
||||
<DropListItem
|
||||
on:click={() => {
|
||||
showCreateGit = true;
|
||||
showCreate = false;
|
||||
show = false;
|
||||
}}>Git</DropListItem>
|
||||
<DropListItem
|
||||
on:click={() => {
|
||||
showCreateCli = true;
|
||||
showCreate = false;
|
||||
show = false;
|
||||
}}>CLI</DropListItem>
|
||||
<DropListItem
|
||||
on:click={() => {
|
||||
showCreateManual = true;
|
||||
showCreate = false;
|
||||
show = false;
|
||||
}}>Manual</DropListItem>
|
||||
</svelte:fragment>
|
||||
</DropList>
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@
|
||||
</script>
|
||||
|
||||
<Modal {error} size="big" bind:show onSubmit={create}>
|
||||
<svelte:fragment slot="header">Create Deployment</svelte:fragment>
|
||||
<svelte:fragment slot="header">Create deployment</svelte:fragment>
|
||||
<FormList>
|
||||
<InputFile
|
||||
label="Gzipped code (tar.gz)"
|
||||
|
||||
@@ -13,3 +13,5 @@ export const repositories: Writable<{
|
||||
installationId: '',
|
||||
repositories: []
|
||||
});
|
||||
|
||||
export const showCreateDeployment: Writable<boolean> = writable(false);
|
||||
|
||||
Reference in New Issue
Block a user