Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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: `<img src='${$iconPath(getIconFromRuntime(runtime.key), 'color')}' style='inline-size: var(--icon-size-m)' />`
};
const { $id: value, name, version, key } = runtime;
const label = `${name} - ${version}`;
const iconName = getIconFromRuntime(key);
const iconSrc = iconFor(iconName, 'color');
const leadingHtml = `<img src='${iconSrc}' alt='${iconName}' style='inline-size: var(--icon-size-m)' />`;

return { value, label, leadingHtml };
});

const specificationOptions = data.specificationsList.specifications.map((size) => ({
Expand Down Expand Up @@ -153,6 +160,13 @@
};
})
: [];

$: maxSize =
isCloud && $currentPlan
? $currentPlan.deploymentSize * 1000000
: $consoleVariables._APP_COMPUTE_SIZE_LIMIT; // already in MB

$: readableMaxSize = humanFileSize(maxSize);
</script>

<svelte:head>
Expand All @@ -176,7 +190,7 @@
bind:files
title="Upload function"
extensions={['gz', 'tar']}
maxSize={10000000}
{maxSize}
required
on:invalid={handleInvalid}>
<Layout.Stack alignItems="center" gap="s">
Expand All @@ -201,12 +215,12 @@
</Tooltip>
</Layout.Stack>
<Typography.Caption variant="400"
>Max file size 10MB</Typography.Caption>
>Max file size: {readableMaxSize.value +
readableMaxSize.unit}</Typography.Caption>
</Layout.Stack>
</Layout.Stack>
</Upload.Dropzone>
{#if files?.length}
<!-- TODO: torsten, the types issue with FileList-->
<Upload.List
bind:files={filesList}
on:remove={(e) => (files = removeFile(e.detail, files))} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down Expand Up @@ -100,7 +101,9 @@
>Only .tar.gz files allowed</svelte:fragment>
</Tooltip>
</Layout.Stack>
<Typography.Caption variant="400">Max file size 10MB</Typography.Caption>
<Typography.Caption variant="400"
>Max file size: {readableMaxSize.value +
readableMaxSize.unit}</Typography.Caption>
</Layout.Stack>
</Layout.Stack>
</Upload.Dropzone>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
on:invalid={handleInvalid}
extensions={['json']}
bind:files={files[input.name]}
maxSize={10000000}
required={!input.optional}>
<Layout.Stack alignItems="center" gap="s">
<Layout.Stack alignItems="center" gap="s">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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]);
Expand Down Expand Up @@ -94,7 +95,9 @@
>Only .tar.gz files allowed</svelte:fragment>
</Tooltip>
</Layout.Stack>
<Typography.Caption variant="400">Max file size 10MB</Typography.Caption>
<Typography.Caption variant="400"
>Max file size: {readableMaxSize.value +
readableMaxSize.unit}</Typography.Caption>
</Layout.Stack>
</Layout.Stack>
</Upload.Dropzone>
Expand Down
Loading