mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix:
This commit is contained in:
+1
-1
@@ -22,7 +22,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/svelte": "^1.1.24",
|
||||
"@appwrite.io/console": "https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@f76aff1",
|
||||
"@appwrite.io/console": "https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@7f8fe13",
|
||||
"@appwrite.io/pink": "0.25.0",
|
||||
"@appwrite.io/pink-icons": "0.25.0",
|
||||
"@appwrite.io/pink-icons-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bd21ff7f",
|
||||
|
||||
Generated
+5
-5
@@ -12,8 +12,8 @@ importers:
|
||||
specifier: ^1.1.24
|
||||
version: 1.1.24(svelte@5.25.3)(zod@3.24.3)
|
||||
'@appwrite.io/console':
|
||||
specifier: https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@f76aff1
|
||||
version: https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@f76aff1
|
||||
specifier: https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@7f8fe13
|
||||
version: https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@7f8fe13
|
||||
'@appwrite.io/pink':
|
||||
specifier: 0.25.0
|
||||
version: 0.25.0
|
||||
@@ -254,8 +254,8 @@ packages:
|
||||
'@analytics/type-utils@0.6.2':
|
||||
resolution: {integrity: sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg==}
|
||||
|
||||
'@appwrite.io/console@https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@f76aff1':
|
||||
resolution: {tarball: https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@f76aff1}
|
||||
'@appwrite.io/console@https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@7f8fe13':
|
||||
resolution: {tarball: https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@7f8fe13}
|
||||
version: 1.2.1
|
||||
|
||||
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bd21ff7f':
|
||||
@@ -3625,7 +3625,7 @@ snapshots:
|
||||
|
||||
'@analytics/type-utils@0.6.2': {}
|
||||
|
||||
'@appwrite.io/console@https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@f76aff1': {}
|
||||
'@appwrite.io/console@https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@7f8fe13': {}
|
||||
|
||||
'@appwrite.io/pink-icons-svelte@https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@bd21ff7f(svelte@5.25.3)':
|
||||
dependencies:
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
<InteractiveText
|
||||
isVisible
|
||||
variant="copy"
|
||||
text={toLocaleDateTime(time, 'UTC')}
|
||||
text={toLocaleDateTime(time, false, 'UTC')}
|
||||
value={toISOString(time)} />
|
||||
|
||||
<Badge variant="secondary" content="UTC" size="xs" />
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
<script lang="ts">
|
||||
import { InputDateTime, InputSelect } from '$lib/elements/forms';
|
||||
import { isSameDay, isValidDate, toLocaleDate } from '$lib/helpers/date';
|
||||
|
||||
function incrementToday(value: number, type: 'day' | 'month' | 'year'): string {
|
||||
const date = new Date();
|
||||
switch (type) {
|
||||
case 'day':
|
||||
date.setDate(date.getDate() + value);
|
||||
break;
|
||||
case 'month':
|
||||
date.setMonth(date.getMonth() + value);
|
||||
break;
|
||||
case 'year':
|
||||
date.setMonth(date.getMonth() + value * 12);
|
||||
break;
|
||||
}
|
||||
|
||||
return date.toISOString();
|
||||
}
|
||||
|
||||
const defaultOptions = [
|
||||
{
|
||||
label: 'Never',
|
||||
value: null
|
||||
},
|
||||
{
|
||||
label: '7 Days',
|
||||
value: incrementToday(7, 'day')
|
||||
},
|
||||
{
|
||||
label: '30 days',
|
||||
value: incrementToday(30, 'day')
|
||||
},
|
||||
{
|
||||
label: '90 days',
|
||||
value: incrementToday(90, 'day')
|
||||
},
|
||||
{
|
||||
label: '1 Year',
|
||||
value: incrementToday(1, 'year')
|
||||
},
|
||||
{
|
||||
label: 'Custom Date',
|
||||
value: 'custom'
|
||||
}
|
||||
];
|
||||
|
||||
const limitedOptions = [
|
||||
{
|
||||
label: '1 Day',
|
||||
value: incrementToday(1, 'day')
|
||||
},
|
||||
{
|
||||
label: '7 Days',
|
||||
value: incrementToday(7, 'day')
|
||||
},
|
||||
{
|
||||
label: '30 days',
|
||||
value: incrementToday(30, 'day')
|
||||
}
|
||||
];
|
||||
|
||||
export let value: string | null = null;
|
||||
export let keyType: 'api' | 'dev' = 'api';
|
||||
|
||||
const options = keyType === 'api' ? defaultOptions : limitedOptions;
|
||||
|
||||
function initExpirationSelect() {
|
||||
if (value === null || !isValidDate(value)) {
|
||||
return options[0]?.value ?? null;
|
||||
}
|
||||
|
||||
let result = 'custom';
|
||||
for (const option of options) {
|
||||
if (!isValidDate(option.value)) continue;
|
||||
|
||||
if (isSameDay(new Date(option.value), new Date(value))) {
|
||||
result = option.value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
let expirationSelect = initExpirationSelect();
|
||||
let expirationCustom: string | null = value ?? null;
|
||||
|
||||
$: {
|
||||
if (!isSameDay(new Date(expirationSelect), new Date(value))) {
|
||||
value = expirationSelect === 'custom' ? expirationCustom : expirationSelect;
|
||||
}
|
||||
}
|
||||
|
||||
$: helper =
|
||||
expirationSelect !== 'custom' && expirationSelect !== null
|
||||
? `Your key will expire in ${toLocaleDate(value)}`
|
||||
: undefined;
|
||||
</script>
|
||||
|
||||
<InputSelect
|
||||
required
|
||||
{helper}
|
||||
{options}
|
||||
id="preset"
|
||||
label="Expiration date"
|
||||
bind:value={expirationSelect} />
|
||||
|
||||
{#if expirationSelect === 'custom'}
|
||||
<InputDateTime required id="expire" label="" bind:value={expirationCustom} />
|
||||
{/if}
|
||||
|
||||
+13
-11
@@ -126,18 +126,20 @@
|
||||
</Layout.Stack>
|
||||
</Upload.Dropzone>
|
||||
{#if files[input.name]?.length}
|
||||
<Upload.List
|
||||
bind:files={files[input.name]}
|
||||
on:remove={(e) => (files[input.name] = removeFile(e.detail, files[input.name]))} />
|
||||
{#key files[input.name]}
|
||||
<Upload.List
|
||||
files={files[input.name]?.length
|
||||
? Array.from(files[input.name]).map((f) => {
|
||||
return {
|
||||
...f,
|
||||
extension: f.type,
|
||||
removable: true
|
||||
};
|
||||
})
|
||||
: []}
|
||||
on:remove={(e) => (files[input.name] = removeFile(e.detail, files[input.name]))} />
|
||||
{/key}
|
||||
{/if}
|
||||
<!-- <InputFile-->
|
||||
<!-- label={input.label}-->
|
||||
<!-- allowedFileExtensions={input.allowedFileExtensions}-->
|
||||
<!-- required={!input.optional}-->
|
||||
<!-- tooltip={input.tooltip}-->
|
||||
<!-- {popover}-->
|
||||
<!-- {popoverProps}-->
|
||||
<!-- bind:files={files[input.name]} />-->
|
||||
{:else if input.type === 'switch'}
|
||||
<InputSwitch label={input.label} id={input.name} bind:value={params[input.name]}>
|
||||
<svelte:fragment slot="description">
|
||||
|
||||
+1
-4
@@ -222,10 +222,7 @@
|
||||
<Empty
|
||||
single
|
||||
target="file"
|
||||
on:click={() => {
|
||||
goto(
|
||||
`${base}/project-${page.params.region}-${page.params.project}/storage/bucket-${page.params.bucket}/create`
|
||||
)} />
|
||||
href={`${base}/project-${page.params.region}-${page.params.project}/storage/bucket-${page.params.bucket}/create`} />
|
||||
{/if}
|
||||
</Container>
|
||||
|
||||
|
||||
+8
-8
@@ -241,7 +241,7 @@
|
||||
</CardGrid>
|
||||
|
||||
<div class="tokens-section">
|
||||
<CardGrid hideOverflow>
|
||||
<CardGrid>
|
||||
<svelte:fragment slot="title">File tokens</svelte:fragment>
|
||||
Use tokens to provide public access to the file.
|
||||
<svelte:fragment slot="aside">
|
||||
@@ -299,8 +299,8 @@
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Root noPadding>
|
||||
<ActionMenu.Item.Button
|
||||
on:click={(e) => {
|
||||
toggle(e);
|
||||
on:click={() => {
|
||||
toggle();
|
||||
showCopyUrlModal = true;
|
||||
selectedFileToken = token;
|
||||
}}
|
||||
@@ -310,8 +310,8 @@
|
||||
</ActionMenu.Root>
|
||||
<ActionMenu.Item.Button
|
||||
leadingIcon={IconPencil}
|
||||
on:click={(e) => {
|
||||
toggle(e);
|
||||
on:click={() => {
|
||||
toggle();
|
||||
showManageToken = true;
|
||||
selectedFileToken = token;
|
||||
}}>
|
||||
@@ -319,8 +319,8 @@
|
||||
</ActionMenu.Item.Button>
|
||||
<ActionMenu.Item.Button
|
||||
leadingIcon={IconKey}
|
||||
on:click={(e) => {
|
||||
toggle(e);
|
||||
on:click={() => {
|
||||
toggle();
|
||||
showManageToken = true;
|
||||
tokenPermissionsMode = true;
|
||||
selectedFileToken = token;
|
||||
@@ -331,7 +331,7 @@
|
||||
status="danger"
|
||||
leadingIcon={IconTrash}
|
||||
on:click={async (e) => {
|
||||
toggle(e);
|
||||
toggle();
|
||||
tokenDeleteMode = true;
|
||||
showManageToken = true;
|
||||
selectedFileToken = token;
|
||||
|
||||
Reference in New Issue
Block a user