diff --git a/src/routes/(console)/project-[region]-[project]/functions/create-function/manual/+page.svelte b/src/routes/(console)/project-[region]-[project]/functions/create-function/manual/+page.svelte index 54167235a8..5c1622d82a 100644 --- a/src/routes/(console)/project-[region]-[project]/functions/create-function/manual/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/functions/create-function/manual/+page.svelte @@ -8,7 +8,7 @@ import { addNotification } from '$lib/stores/notifications'; import { sdk } from '$lib/stores/sdk'; import { Icon, Layout, Tooltip, Typography, Upload } from '@appwrite.io/pink-svelte'; - import { writable } from 'svelte/store'; + import { get, writable } from 'svelte/store'; import { ID, Runtime } from '@appwrite.io/console'; import type { Models } from '@appwrite.io/console'; import { consoleVariables } from '$routes/(console)/store'; @@ -20,15 +20,22 @@ import Configuration from './configuration.svelte'; import { getIconFromRuntime } from '$lib/stores/runtimes'; import { InvalidFileType, removeFile } from '$lib/helpers/files'; + import { isCloud } from '$lib/system'; + import { humanFileSize } from '$lib/helpers/sizeConvertion'; + import { currentPlan } from '$lib/stores/organization'; export let data; + const iconFor = get(iconPath); + const runtimeOptions = data.runtimesList.runtimes.map((runtime) => { - return { - value: runtime.$id, - label: `${runtime.name} - ${runtime.version}`, - leadingHtml: `` - }; + const { $id: value, name, version, key } = runtime; + const label = `${name} - ${version}`; + const iconName = getIconFromRuntime(key); + const iconSrc = iconFor(iconName, 'color'); + const leadingHtml = `${iconName}`; + + return { value, label, leadingHtml }; }); const specificationOptions = data.specificationsList.specifications.map((size) => ({ @@ -153,6 +160,13 @@ }; }) : []; + + $: maxSize = + isCloud && $currentPlan + ? $currentPlan.deploymentSize * 1000000 + : $consoleVariables._APP_COMPUTE_SIZE_LIMIT; // already in MB + + $: readableMaxSize = humanFileSize(maxSize); @@ -176,7 +190,7 @@ bind:files title="Upload function" extensions={['gz', 'tar']} - maxSize={10000000} + {maxSize} required on:invalid={handleInvalid}> @@ -201,12 +215,12 @@ Max file size 10MB + >Max file size: {readableMaxSize.value + + readableMaxSize.unit} {#if files?.length} - (files = removeFile(e.detail, files))} /> diff --git a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/(modals)/createManual.svelte b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/(modals)/createManual.svelte index 5c8056398f..4d6ae6e708 100644 --- a/src/routes/(console)/project-[region]-[project]/functions/function-[function]/(modals)/createManual.svelte +++ b/src/routes/(console)/project-[region]-[project]/functions/function-[function]/(modals)/createManual.svelte @@ -14,6 +14,7 @@ import { consoleVariables } from '$routes/(console)/store'; import { currentPlan } from '$lib/stores/organization'; import { isCloud } from '$lib/system'; + import { humanFileSize } from '$lib/helpers/sizeConvertion'; export let show = false; @@ -22,11 +23,11 @@ $: maxSize = isCloud && $currentPlan - ? $currentPlan?.deploymentSize === 0 - ? 0 - : $currentPlan?.deploymentSize * 1000000 + ? $currentPlan.deploymentSize * 1000000 : $consoleVariables._APP_COMPUTE_SIZE_LIMIT; // already in MB + $: readableMaxSize = humanFileSize(maxSize); + async function create() { try { await sdk @@ -100,7 +101,9 @@ >Only .tar.gz files allowed - Max file size 10MB + Max file size: {readableMaxSize.value + + readableMaxSize.unit} diff --git a/src/routes/(console)/project-[region]-[project]/messaging/providers/settingsFormInput.svelte b/src/routes/(console)/project-[region]-[project]/messaging/providers/settingsFormInput.svelte index 4227724d27..35ba274bac 100644 --- a/src/routes/(console)/project-[region]-[project]/messaging/providers/settingsFormInput.svelte +++ b/src/routes/(console)/project-[region]-[project]/messaging/providers/settingsFormInput.svelte @@ -124,6 +124,7 @@ on:invalid={handleInvalid} extensions={['json']} bind:files={files[input.name]} + maxSize={10000000} required={!input.optional}> diff --git a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/deployments/createManualDeploymentModal.svelte b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/deployments/createManualDeploymentModal.svelte index cd4c9f4347..3930d56c7c 100644 --- a/src/routes/(console)/project-[region]-[project]/sites/site-[site]/deployments/createManualDeploymentModal.svelte +++ b/src/routes/(console)/project-[region]-[project]/sites/site-[site]/deployments/createManualDeploymentModal.svelte @@ -12,6 +12,7 @@ import { isCloud } from '$lib/system'; import { currentPlan } from '$lib/stores/organization'; import { consoleVariables } from '$routes/(console)/store'; + import { humanFileSize } from '$lib/helpers/sizeConvertion'; export let show = false; export let site: Models.Site; @@ -21,11 +22,11 @@ $: maxSize = isCloud && $currentPlan - ? $currentPlan?.deploymentSize === 0 - ? 0 - : $currentPlan?.deploymentSize * 1000000 + ? $currentPlan.deploymentSize * 1000000 : $consoleVariables._APP_COMPUTE_SIZE_LIMIT; // already in MB + $: readableMaxSize = humanFileSize(maxSize); + async function createDeployment() { try { uploader.uploadSiteDeployment(site.$id, files[0]); @@ -94,7 +95,9 @@ >Only .tar.gz files allowed - Max file size 10MB + Max file size: {readableMaxSize.value + + readableMaxSize.unit}