mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge pull request #207 from appwrite/feat-compression-algorithm
feat: add compression algorithm setting
This commit is contained in:
+54
-12
@@ -36,8 +36,9 @@
|
||||
arePermsDisabled = true,
|
||||
encryption: boolean = null,
|
||||
antivirus: boolean = null,
|
||||
maxSize: number;
|
||||
let byteUnit = writable('KB');
|
||||
maxSize: number,
|
||||
compression: string = null;
|
||||
let byteUnit = writable('MB');
|
||||
let sizeInBytes: number = null;
|
||||
const options = [
|
||||
{ label: 'Bytes', value: 'Bytes' },
|
||||
@@ -45,6 +46,11 @@
|
||||
{ label: 'Megabytes', value: 'MB' },
|
||||
{ label: 'Gigabytes', value: 'GB' }
|
||||
];
|
||||
const compressionOptions = [
|
||||
{ label: 'None', value: 'none' },
|
||||
{ label: 'Gzip', value: 'gzip' },
|
||||
{ label: 'Zstd', value: 'zstd' }
|
||||
];
|
||||
let suggestedExtensions = ['jpg', 'png', 'svg', 'gif', 'html', 'pdf', 'mp4'];
|
||||
let extensions = $bucket.allowedFileExtensions;
|
||||
let isExtensionsDisabled = true;
|
||||
@@ -57,8 +63,10 @@
|
||||
bucketPermissions ??= $bucket.$permissions;
|
||||
encryption ??= $bucket.encryption;
|
||||
antivirus ??= $bucket.antivirus;
|
||||
maxSize = $bucket.maximumFileSize / 1024;
|
||||
maxSize = $bucket.maximumFileSize / 1024 / 1024;
|
||||
compression ??= $bucket.compression;
|
||||
});
|
||||
|
||||
$: if (bucketPermissions) {
|
||||
if (symmetricDifference(bucketPermissions, $bucket.$permissions).length) {
|
||||
arePermsDisabled = false;
|
||||
@@ -192,6 +200,17 @@
|
||||
);
|
||||
}
|
||||
|
||||
function updateCompression() {
|
||||
updateBucket(
|
||||
{
|
||||
compression
|
||||
},
|
||||
{
|
||||
trackEventName: 'submit_bucket_update_size'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function updateAllowedExtensions() {
|
||||
updateBucket(
|
||||
{
|
||||
@@ -234,8 +253,8 @@
|
||||
id="toggle"
|
||||
bind:value={enabled} />
|
||||
</FormList>
|
||||
<p>Created: {toLocaleDateTime($bucket.$createdAt)}</p>
|
||||
<p>Last Updated: {toLocaleDateTime($bucket.$updatedAt)}</p>
|
||||
<p class="text">Created: {toLocaleDateTime($bucket.$createdAt)}</p>
|
||||
<p class="text">Last Updated: {toLocaleDateTime($bucket.$updatedAt)}</p>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
|
||||
@@ -320,7 +339,7 @@
|
||||
<Form on:submit={updateSecurity}>
|
||||
<CardGrid>
|
||||
<Heading tag="h2" size="7">Update Security Settings</Heading>
|
||||
<p>
|
||||
<p class="text">
|
||||
Enable or disable security services for the bucket including <b>Ecryption</b>
|
||||
and <b>Antivirus scanning.</b>
|
||||
</p>
|
||||
@@ -381,17 +400,40 @@
|
||||
<Button
|
||||
disabled={encryption === $bucket.encryption &&
|
||||
antivirus === $bucket.antivirus}
|
||||
submit
|
||||
>Update
|
||||
submit>
|
||||
Update
|
||||
</Button>
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
</Form>
|
||||
|
||||
<Form on:submit={updateCompression}>
|
||||
<CardGrid>
|
||||
<Heading tag="h2" size="6">Update Compression Algorithm</Heading>
|
||||
<p class="text">
|
||||
Choose an algorithm for compression. For files larger than 20MB, compression
|
||||
will be skipped even if it's enabled.
|
||||
</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<FormList>
|
||||
<InputSelect
|
||||
id="compression"
|
||||
label="Compression algorithm"
|
||||
options={compressionOptions}
|
||||
bind:value={compression} />
|
||||
</FormList>
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
<Button disabled={compression === $bucket.compression} submit>Update</Button>
|
||||
</svelte:fragment>
|
||||
</CardGrid>
|
||||
</Form>
|
||||
|
||||
<Form on:submit={updateMaxSize}>
|
||||
<CardGrid>
|
||||
<Heading tag="h2" size="6">Update Maximum File Size</Heading>
|
||||
<p>Set the maximum file size allowed in the bucket.</p>
|
||||
<p class="text">Set the maximum file size allowed in the bucket.</p>
|
||||
<svelte:fragment slot="aside">
|
||||
<ul class="u-flex u-gap-12">
|
||||
<InputNumber
|
||||
@@ -414,7 +456,7 @@
|
||||
<Form on:submit={updateAllowedExtensions}>
|
||||
<CardGrid>
|
||||
<Heading tag="h6" size="7">Update Allowed File Extensions</Heading>
|
||||
<p>
|
||||
<p class="text">
|
||||
A maximum of 100 file extensions can be added. Leave blank to allow all file
|
||||
types.
|
||||
</p>
|
||||
@@ -453,7 +495,7 @@
|
||||
|
||||
<CardGrid danger>
|
||||
<Heading tag="h6" size="7">Delete Bucket</Heading>
|
||||
<p>
|
||||
<p class="text">
|
||||
The bucket will be permanently deleted, including all the files within it. This
|
||||
action is irreversible.
|
||||
</p>
|
||||
@@ -462,7 +504,7 @@
|
||||
<svelte:fragment slot="title">
|
||||
<h6 class="u-bold u-trim-1">{$bucket.name}</h6>
|
||||
</svelte:fragment>
|
||||
<p>Last Updated: {toLocaleDateTime($bucket.$updatedAt)}</p>
|
||||
<p class="text">Last Updated: {toLocaleDateTime($bucket.$updatedAt)}</p>
|
||||
</Box>
|
||||
</svelte:fragment>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user