From 077167abd0686c2b6ae52e19f6effcc78e0e99b6 Mon Sep 17 00:00:00 2001 From: Arman Date: Fri, 14 Mar 2025 11:54:35 +0100 Subject: [PATCH] feat: add donwload to functions --- .../downloadActionMenuItem.svelte | 55 +++++++++++++++++++ .../function-[function]/+page.svelte | 27 ++++----- .../function-[function]/table.svelte | 55 +++++++------------ 3 files changed, 88 insertions(+), 49 deletions(-) create mode 100644 src/routes/(console)/project-[project]/functions/function-[function]/(components)/downloadActionMenuItem.svelte diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/(components)/downloadActionMenuItem.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/(components)/downloadActionMenuItem.svelte new file mode 100644 index 000000000..0a2b6850a --- /dev/null +++ b/src/routes/(console)/project-[project]/functions/function-[function]/(components)/downloadActionMenuItem.svelte @@ -0,0 +1,55 @@ + + +{#if deployment?.status === 'ready' || deployment?.status === 'failed'} + + + Download + + + + + Download source + + + + Download output + + + + +{/if} diff --git a/src/routes/(console)/project-[project]/functions/function-[function]/+page.svelte b/src/routes/(console)/project-[project]/functions/function-[function]/+page.svelte index 3213a86ee..5f8b2862c 100644 --- a/src/routes/(console)/project-[project]/functions/function-[function]/+page.svelte +++ b/src/routes/(console)/project-[project]/functions/function-[function]/+page.svelte @@ -13,15 +13,7 @@ import DeploymentCard from './(components)/deploymentCard.svelte'; import RedeployModal from './(modals)/redeployModal.svelte'; import { canWriteFunctions } from '$lib/stores/roles'; - import { - ActionMenu, - Alert, - Card, - Empty, - Icon, - Layout, - Popover - } from '@appwrite.io/pink-svelte'; + import { ActionMenu, Alert, Card, Empty, Icon, Layout } from '@appwrite.io/pink-svelte'; import { Click, trackEvent } from '$lib/actions/analytics'; import { IconDotsHorizontal, @@ -32,6 +24,8 @@ import { app } from '$lib/stores/app'; import CreateActionMenu from './(components)/createActionMenu.svelte'; import { ParsedTagList, QuickFilters } from '$lib/components/filters'; + import { Menu } from '$lib/components/menu'; + import DownloadActionMenuItem from './(components)/downloadActionMenuItem.svelte'; export let data; @@ -82,24 +76,27 @@ activeDeployment> - - - + {#if $canWriteFunctions} { + on:click={() => { selectedDeployment = activeDeployment; showRedeploy = true; trackEvent(Click.FunctionsRedeployClick); - toggle(e); + toggle(); }}> Redeploy {/if} + @@ -107,7 +104,7 @@ - + - + + { + on:click={() => { selectedDeployment = deployment; showRedeploy = true; - toggle(e); + toggle(); trackEvent(Click.FunctionsRedeployClick); }}> Redeploy @@ -145,27 +136,23 @@ {#if deployment.status === 'ready' && deployment.$id !== $func.deploymentId} { + on:click={() => { selectedDeployment = deployment; showActivate = true; - toggle(e); + toggle(); }}> Activate {/if} - (showDropdown[index] = false)}> - Download - + + {#if deployment.status === 'processing' || deployment.status === 'building' || deployment.status === 'waiting'} { + on:click={() => { selectedDeployment = deployment; - toggle(e); + toggle(); showCancel = true; trackEvent(Click.FunctionsDeploymentCancelClick); @@ -177,9 +164,9 @@ { + on:click={() => { selectedDeployment = deployment; - toggle(e); + toggle(); showDelete = true; trackEvent(Click.FunctionsDeploymentDeleteClick); @@ -189,7 +176,7 @@ {/if} - +